001package org.hl7.fhir.r5.formats;
002
003/*
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Oct 17, 2019 19:56+1100 for FHIR v4.1.0
053
054import org.hl7.fhir.r5.model.*;
055import org.hl7.fhir.utilities.Utilities;
056import org.hl7.fhir.utilities.xhtml.XhtmlNode;
057import org.hl7.fhir.exceptions.FHIRFormatError;
058import org.hl7.fhir.exceptions.FHIRException;
059import org.hl7.fhir.utilities.json.JsonTrackingParser.PresentedBigDecimal;
060import com.google.gson.JsonObject;
061import com.google.gson.JsonArray;
062import com.google.gson.JsonElement;
063import java.io.IOException;
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    if (json.has("height"))
422      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
423    if (json.has("_height"))
424      parseElementProperties(json.getAsJsonObject("_height"), res.getHeightElement());
425    if (json.has("width"))
426      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
427    if (json.has("_width"))
428      parseElementProperties(json.getAsJsonObject("_width"), res.getWidthElement());
429    if (json.has("frames"))
430      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
431    if (json.has("_frames"))
432      parseElementProperties(json.getAsJsonObject("_frames"), res.getFramesElement());
433    if (json.has("duration"))
434      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
435    if (json.has("_duration"))
436      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
437    if (json.has("pages"))
438      res.setPagesElement(parsePositiveInt(json.get("pages").getAsString()));
439    if (json.has("_pages"))
440      parseElementProperties(json.getAsJsonObject("_pages"), res.getPagesElement());
441  }
442
443  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
444    Count res = new Count();
445    parseCountProperties(json, res);
446    return res;
447  }
448
449  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
450    parseQuantityProperties(json, res);
451  }
452
453  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
454    DataRequirement res = new DataRequirement();
455    parseDataRequirementProperties(json, res);
456    return res;
457  }
458
459  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res) throws IOException, FHIRFormatError {
460    parseTypeProperties(json, res);
461    if (json.has("type"))
462      res.setTypeElement(parseCode(json.get("type").getAsString()));
463    if (json.has("_type"))
464      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
465    if (json.has("profile")) {
466      JsonArray array = json.getAsJsonArray("profile");
467      for (int i = 0; i < array.size(); i++) {
468        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
469      }
470    };
471    if (json.has("_profile")) {
472      JsonArray array = json.getAsJsonArray("_profile");
473      for (int i = 0; i < array.size(); i++) {
474        if (i == res.getProfile().size())
475          res.getProfile().add(parseCanonical(null));
476        if (array.get(i) instanceof JsonObject) 
477          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
478      }
479    };
480    Type subject = parseType("subject", json);
481    if (subject != null)
482      res.setSubject(subject);
483    if (json.has("mustSupport")) {
484      JsonArray array = json.getAsJsonArray("mustSupport");
485      for (int i = 0; i < array.size(); i++) {
486        res.getMustSupport().add(parseString(array.get(i).getAsString()));
487      }
488    };
489    if (json.has("_mustSupport")) {
490      JsonArray array = json.getAsJsonArray("_mustSupport");
491      for (int i = 0; i < array.size(); i++) {
492        if (i == res.getMustSupport().size())
493          res.getMustSupport().add(parseString(null));
494        if (array.get(i) instanceof JsonObject) 
495          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
496      }
497    };
498    if (json.has("codeFilter")) {
499      JsonArray array = json.getAsJsonArray("codeFilter");
500      for (int i = 0; i < array.size(); i++) {
501        res.getCodeFilter().add(parseDataRequirementDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject(), res));
502      }
503    };
504    if (json.has("dateFilter")) {
505      JsonArray array = json.getAsJsonArray("dateFilter");
506      for (int i = 0; i < array.size(); i++) {
507        res.getDateFilter().add(parseDataRequirementDataRequirementDateFilterComponent(array.get(i).getAsJsonObject(), res));
508      }
509    };
510    if (json.has("limit"))
511      res.setLimitElement(parsePositiveInt(json.get("limit").getAsString()));
512    if (json.has("_limit"))
513      parseElementProperties(json.getAsJsonObject("_limit"), res.getLimitElement());
514    if (json.has("sort")) {
515      JsonArray array = json.getAsJsonArray("sort");
516      for (int i = 0; i < array.size(); i++) {
517        res.getSort().add(parseDataRequirementDataRequirementSortComponent(array.get(i).getAsJsonObject(), res));
518      }
519    };
520  }
521
522  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementDataRequirementCodeFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
523    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
524    parseDataRequirementDataRequirementCodeFilterComponentProperties(json, owner, res);
525    return res;
526  }
527
528  protected void parseDataRequirementDataRequirementCodeFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementCodeFilterComponent res) throws IOException, FHIRFormatError {
529    parseTypeProperties(json, res);
530    if (json.has("path"))
531      res.setPathElement(parseString(json.get("path").getAsString()));
532    if (json.has("_path"))
533      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
534    if (json.has("searchParam"))
535      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
536    if (json.has("_searchParam"))
537      parseElementProperties(json.getAsJsonObject("_searchParam"), res.getSearchParamElement());
538    if (json.has("valueSet"))
539      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
540    if (json.has("_valueSet"))
541      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
542    if (json.has("code")) {
543      JsonArray array = json.getAsJsonArray("code");
544      for (int i = 0; i < array.size(); i++) {
545        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
546      }
547    };
548  }
549
550  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDataRequirementDateFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
551    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
552    parseDataRequirementDataRequirementDateFilterComponentProperties(json, owner, res);
553    return res;
554  }
555
556  protected void parseDataRequirementDataRequirementDateFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementDateFilterComponent res) throws IOException, FHIRFormatError {
557    parseTypeProperties(json, res);
558    if (json.has("path"))
559      res.setPathElement(parseString(json.get("path").getAsString()));
560    if (json.has("_path"))
561      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
562    if (json.has("searchParam"))
563      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
564    if (json.has("_searchParam"))
565      parseElementProperties(json.getAsJsonObject("_searchParam"), res.getSearchParamElement());
566    Type value = parseType("value", json);
567    if (value != null)
568      res.setValue(value);
569  }
570
571  protected DataRequirement.DataRequirementSortComponent parseDataRequirementDataRequirementSortComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
572    DataRequirement.DataRequirementSortComponent res = new DataRequirement.DataRequirementSortComponent();
573    parseDataRequirementDataRequirementSortComponentProperties(json, owner, res);
574    return res;
575  }
576
577  protected void parseDataRequirementDataRequirementSortComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementSortComponent res) throws IOException, FHIRFormatError {
578    parseTypeProperties(json, res);
579    if (json.has("path"))
580      res.setPathElement(parseString(json.get("path").getAsString()));
581    if (json.has("_path"))
582      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
583    if (json.has("direction"))
584      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), DataRequirement.SortDirection.NULL, new DataRequirement.SortDirectionEnumFactory()));
585    if (json.has("_direction"))
586      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
587  }
588
589  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
590    Dosage res = new Dosage();
591    parseDosageProperties(json, res);
592    return res;
593  }
594
595  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
596    parseBackboneElementProperties(json, res);
597    if (json.has("sequence"))
598      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
599    if (json.has("_sequence"))
600      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
601    if (json.has("text"))
602      res.setTextElement(parseString(json.get("text").getAsString()));
603    if (json.has("_text"))
604      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
605    if (json.has("additionalInstruction")) {
606      JsonArray array = json.getAsJsonArray("additionalInstruction");
607      for (int i = 0; i < array.size(); i++) {
608        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
609      }
610    };
611    if (json.has("patientInstruction"))
612      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
613    if (json.has("_patientInstruction"))
614      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
615    if (json.has("timing"))
616      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
617    Type asNeeded = parseType("asNeeded", json);
618    if (asNeeded != null)
619      res.setAsNeeded(asNeeded);
620    if (json.has("site"))
621      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
622    if (json.has("route"))
623      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
624    if (json.has("method"))
625      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
626    if (json.has("doseAndRate")) {
627      JsonArray array = json.getAsJsonArray("doseAndRate");
628      for (int i = 0; i < array.size(); i++) {
629        res.getDoseAndRate().add(parseDosageDosageDoseAndRateComponent(array.get(i).getAsJsonObject(), res));
630      }
631    };
632    if (json.has("maxDosePerPeriod"))
633      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
634    if (json.has("maxDosePerAdministration"))
635      res.setMaxDosePerAdministration(parseQuantity(json.getAsJsonObject("maxDosePerAdministration")));
636    if (json.has("maxDosePerLifetime"))
637      res.setMaxDosePerLifetime(parseQuantity(json.getAsJsonObject("maxDosePerLifetime")));
638  }
639
640  protected Dosage.DosageDoseAndRateComponent parseDosageDosageDoseAndRateComponent(JsonObject json, Dosage owner) throws IOException, FHIRFormatError {
641    Dosage.DosageDoseAndRateComponent res = new Dosage.DosageDoseAndRateComponent();
642    parseDosageDosageDoseAndRateComponentProperties(json, owner, res);
643    return res;
644  }
645
646  protected void parseDosageDosageDoseAndRateComponentProperties(JsonObject json, Dosage owner, Dosage.DosageDoseAndRateComponent res) throws IOException, FHIRFormatError {
647    parseTypeProperties(json, res);
648    if (json.has("type"))
649      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
650    Type dose = parseType("dose", json);
651    if (dose != null)
652      res.setDose(dose);
653    Type rate = parseType("rate", json);
654    if (rate != null)
655      res.setRate(rate);
656  }
657
658  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
659    Money res = new Money();
660    parseMoneyProperties(json, res);
661    return res;
662  }
663
664  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
665    parseTypeProperties(json, res);
666    if (json.has("value"))
667      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
668    if (json.has("_value"))
669      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
670    if (json.has("currency"))
671      res.setCurrencyElement(parseCode(json.get("currency").getAsString()));
672    if (json.has("_currency"))
673      parseElementProperties(json.getAsJsonObject("_currency"), res.getCurrencyElement());
674  }
675
676  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
677    HumanName res = new HumanName();
678    parseHumanNameProperties(json, res);
679    return res;
680  }
681
682  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
683    parseTypeProperties(json, res);
684    if (json.has("use"))
685      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
686    if (json.has("_use"))
687      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
688    if (json.has("text"))
689      res.setTextElement(parseString(json.get("text").getAsString()));
690    if (json.has("_text"))
691      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
692    if (json.has("family"))
693      res.setFamilyElement(parseString(json.get("family").getAsString()));
694    if (json.has("_family"))
695      parseElementProperties(json.getAsJsonObject("_family"), res.getFamilyElement());
696    if (json.has("given")) {
697      JsonArray array = json.getAsJsonArray("given");
698      for (int i = 0; i < array.size(); i++) {
699        res.getGiven().add(parseString(array.get(i).getAsString()));
700      }
701    };
702    if (json.has("_given")) {
703      JsonArray array = json.getAsJsonArray("_given");
704      for (int i = 0; i < array.size(); i++) {
705        if (i == res.getGiven().size())
706          res.getGiven().add(parseString(null));
707        if (array.get(i) instanceof JsonObject) 
708          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
709      }
710    };
711    if (json.has("prefix")) {
712      JsonArray array = json.getAsJsonArray("prefix");
713      for (int i = 0; i < array.size(); i++) {
714        res.getPrefix().add(parseString(array.get(i).getAsString()));
715      }
716    };
717    if (json.has("_prefix")) {
718      JsonArray array = json.getAsJsonArray("_prefix");
719      for (int i = 0; i < array.size(); i++) {
720        if (i == res.getPrefix().size())
721          res.getPrefix().add(parseString(null));
722        if (array.get(i) instanceof JsonObject) 
723          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
724      }
725    };
726    if (json.has("suffix")) {
727      JsonArray array = json.getAsJsonArray("suffix");
728      for (int i = 0; i < array.size(); i++) {
729        res.getSuffix().add(parseString(array.get(i).getAsString()));
730      }
731    };
732    if (json.has("_suffix")) {
733      JsonArray array = json.getAsJsonArray("_suffix");
734      for (int i = 0; i < array.size(); i++) {
735        if (i == res.getSuffix().size())
736          res.getSuffix().add(parseString(null));
737        if (array.get(i) instanceof JsonObject) 
738          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
739      }
740    };
741    if (json.has("period"))
742      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
743  }
744
745  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
746    ContactPoint res = new ContactPoint();
747    parseContactPointProperties(json, res);
748    return res;
749  }
750
751  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
752    parseTypeProperties(json, res);
753    if (json.has("system"))
754      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
755    if (json.has("_system"))
756      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
757    if (json.has("value"))
758      res.setValueElement(parseString(json.get("value").getAsString()));
759    if (json.has("_value"))
760      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
761    if (json.has("use"))
762      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
763    if (json.has("_use"))
764      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
765    if (json.has("rank"))
766      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
767    if (json.has("_rank"))
768      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
769    if (json.has("period"))
770      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
771  }
772
773  protected MarketingStatus parseMarketingStatus(JsonObject json) throws IOException, FHIRFormatError {
774    MarketingStatus res = new MarketingStatus();
775    parseMarketingStatusProperties(json, res);
776    return res;
777  }
778
779  protected void parseMarketingStatusProperties(JsonObject json, MarketingStatus res) throws IOException, FHIRFormatError {
780    parseBackboneElementProperties(json, res);
781    if (json.has("country"))
782      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
783    if (json.has("jurisdiction"))
784      res.setJurisdiction(parseCodeableConcept(json.getAsJsonObject("jurisdiction")));
785    if (json.has("status"))
786      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
787    if (json.has("dateRange"))
788      res.setDateRange(parsePeriod(json.getAsJsonObject("dateRange")));
789    if (json.has("restoreDate"))
790      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
791    if (json.has("_restoreDate"))
792      parseElementProperties(json.getAsJsonObject("_restoreDate"), res.getRestoreDateElement());
793  }
794
795  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
796    Identifier res = new Identifier();
797    parseIdentifierProperties(json, res);
798    return res;
799  }
800
801  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
802    parseTypeProperties(json, res);
803    if (json.has("use"))
804      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
805    if (json.has("_use"))
806      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
807    if (json.has("type"))
808      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
809    if (json.has("system"))
810      res.setSystemElement(parseUri(json.get("system").getAsString()));
811    if (json.has("_system"))
812      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
813    if (json.has("value"))
814      res.setValueElement(parseString(json.get("value").getAsString()));
815    if (json.has("_value"))
816      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
817    if (json.has("period"))
818      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
819    if (json.has("assigner"))
820      res.setAssigner(parseReference(json.getAsJsonObject("assigner")));
821  }
822
823  protected SubstanceAmount parseSubstanceAmount(JsonObject json) throws IOException, FHIRFormatError {
824    SubstanceAmount res = new SubstanceAmount();
825    parseSubstanceAmountProperties(json, res);
826    return res;
827  }
828
829  protected void parseSubstanceAmountProperties(JsonObject json, SubstanceAmount res) throws IOException, FHIRFormatError {
830    parseBackboneElementProperties(json, res);
831    Type amount = parseType("amount", json);
832    if (amount != null)
833      res.setAmount(amount);
834    if (json.has("amountType"))
835      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
836    if (json.has("amountText"))
837      res.setAmountTextElement(parseString(json.get("amountText").getAsString()));
838    if (json.has("_amountText"))
839      parseElementProperties(json.getAsJsonObject("_amountText"), res.getAmountTextElement());
840    if (json.has("referenceRange"))
841      res.setReferenceRange(parseSubstanceAmountSubstanceAmountReferenceRangeComponent(json.getAsJsonObject("referenceRange"), res));
842  }
843
844  protected SubstanceAmount.SubstanceAmountReferenceRangeComponent parseSubstanceAmountSubstanceAmountReferenceRangeComponent(JsonObject json, SubstanceAmount owner) throws IOException, FHIRFormatError {
845    SubstanceAmount.SubstanceAmountReferenceRangeComponent res = new SubstanceAmount.SubstanceAmountReferenceRangeComponent();
846    parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(json, owner, res);
847    return res;
848  }
849
850  protected void parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(JsonObject json, SubstanceAmount owner, SubstanceAmount.SubstanceAmountReferenceRangeComponent res) throws IOException, FHIRFormatError {
851    parseTypeProperties(json, res);
852    if (json.has("lowLimit"))
853      res.setLowLimit(parseQuantity(json.getAsJsonObject("lowLimit")));
854    if (json.has("highLimit"))
855      res.setHighLimit(parseQuantity(json.getAsJsonObject("highLimit")));
856  }
857
858  protected Statistic parseStatistic(JsonObject json) throws IOException, FHIRFormatError {
859    Statistic res = new Statistic();
860    parseStatisticProperties(json, res);
861    return res;
862  }
863
864  protected void parseStatisticProperties(JsonObject json, Statistic res) throws IOException, FHIRFormatError {
865    parseBackboneElementProperties(json, res);
866    if (json.has("description"))
867      res.setDescriptionElement(parseString(json.get("description").getAsString()));
868    if (json.has("_description"))
869      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
870    if (json.has("note")) {
871      JsonArray array = json.getAsJsonArray("note");
872      for (int i = 0; i < array.size(); i++) {
873        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
874      }
875    };
876    if (json.has("statisticType"))
877      res.setStatisticType(parseCodeableConcept(json.getAsJsonObject("statisticType")));
878    if (json.has("quantity"))
879      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
880    if (json.has("sampleSize"))
881      res.setSampleSize(parseStatisticStatisticSampleSizeComponent(json.getAsJsonObject("sampleSize"), res));
882    if (json.has("attributeEstimate")) {
883      JsonArray array = json.getAsJsonArray("attributeEstimate");
884      for (int i = 0; i < array.size(); i++) {
885        res.getAttributeEstimate().add(parseStatisticStatisticAttributeEstimateComponent(array.get(i).getAsJsonObject(), res));
886      }
887    };
888  }
889
890  protected Statistic.StatisticSampleSizeComponent parseStatisticStatisticSampleSizeComponent(JsonObject json, Statistic owner) throws IOException, FHIRFormatError {
891    Statistic.StatisticSampleSizeComponent res = new Statistic.StatisticSampleSizeComponent();
892    parseStatisticStatisticSampleSizeComponentProperties(json, owner, res);
893    return res;
894  }
895
896  protected void parseStatisticStatisticSampleSizeComponentProperties(JsonObject json, Statistic owner, Statistic.StatisticSampleSizeComponent res) throws IOException, FHIRFormatError {
897    parseTypeProperties(json, res);
898    if (json.has("description"))
899      res.setDescriptionElement(parseString(json.get("description").getAsString()));
900    if (json.has("_description"))
901      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
902    if (json.has("note")) {
903      JsonArray array = json.getAsJsonArray("note");
904      for (int i = 0; i < array.size(); i++) {
905        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
906      }
907    };
908    if (json.has("numberOfStudies"))
909      res.setNumberOfStudiesElement(parseInteger(json.get("numberOfStudies").getAsLong()));
910    if (json.has("_numberOfStudies"))
911      parseElementProperties(json.getAsJsonObject("_numberOfStudies"), res.getNumberOfStudiesElement());
912    if (json.has("numberOfParticipants"))
913      res.setNumberOfParticipantsElement(parseInteger(json.get("numberOfParticipants").getAsLong()));
914    if (json.has("_numberOfParticipants"))
915      parseElementProperties(json.getAsJsonObject("_numberOfParticipants"), res.getNumberOfParticipantsElement());
916    if (json.has("knownDataCount"))
917      res.setKnownDataCountElement(parseInteger(json.get("knownDataCount").getAsLong()));
918    if (json.has("_knownDataCount"))
919      parseElementProperties(json.getAsJsonObject("_knownDataCount"), res.getKnownDataCountElement());
920    if (json.has("numeratorCount"))
921      res.setNumeratorCountElement(parseInteger(json.get("numeratorCount").getAsLong()));
922    if (json.has("_numeratorCount"))
923      parseElementProperties(json.getAsJsonObject("_numeratorCount"), res.getNumeratorCountElement());
924  }
925
926  protected Statistic.StatisticAttributeEstimateComponent parseStatisticStatisticAttributeEstimateComponent(JsonObject json, Statistic owner) throws IOException, FHIRFormatError {
927    Statistic.StatisticAttributeEstimateComponent res = new Statistic.StatisticAttributeEstimateComponent();
928    parseStatisticStatisticAttributeEstimateComponentProperties(json, owner, res);
929    return res;
930  }
931
932  protected void parseStatisticStatisticAttributeEstimateComponentProperties(JsonObject json, Statistic owner, Statistic.StatisticAttributeEstimateComponent res) throws IOException, FHIRFormatError {
933    parseTypeProperties(json, res);
934    if (json.has("description"))
935      res.setDescriptionElement(parseString(json.get("description").getAsString()));
936    if (json.has("_description"))
937      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
938    if (json.has("note")) {
939      JsonArray array = json.getAsJsonArray("note");
940      for (int i = 0; i < array.size(); i++) {
941        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
942      }
943    };
944    if (json.has("type"))
945      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
946    if (json.has("quantity"))
947      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
948    if (json.has("level"))
949      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
950    if (json.has("_level"))
951      parseElementProperties(json.getAsJsonObject("_level"), res.getLevelElement());
952    if (json.has("range"))
953      res.setRange(parseRange(json.getAsJsonObject("range")));
954    if (json.has("estimateQualifier")) {
955      JsonArray array = json.getAsJsonArray("estimateQualifier");
956      for (int i = 0; i < array.size(); i++) {
957        res.getEstimateQualifier().add(parseStatisticStatisticAttributeEstimateEstimateQualifierComponent(array.get(i).getAsJsonObject(), owner));
958      }
959    };
960  }
961
962  protected Statistic.StatisticAttributeEstimateEstimateQualifierComponent parseStatisticStatisticAttributeEstimateEstimateQualifierComponent(JsonObject json, Statistic owner) throws IOException, FHIRFormatError {
963    Statistic.StatisticAttributeEstimateEstimateQualifierComponent res = new Statistic.StatisticAttributeEstimateEstimateQualifierComponent();
964    parseStatisticStatisticAttributeEstimateEstimateQualifierComponentProperties(json, owner, res);
965    return res;
966  }
967
968  protected void parseStatisticStatisticAttributeEstimateEstimateQualifierComponentProperties(JsonObject json, Statistic owner, Statistic.StatisticAttributeEstimateEstimateQualifierComponent res) throws IOException, FHIRFormatError {
969    parseTypeProperties(json, res);
970    if (json.has("description"))
971      res.setDescriptionElement(parseString(json.get("description").getAsString()));
972    if (json.has("_description"))
973      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
974    if (json.has("note")) {
975      JsonArray array = json.getAsJsonArray("note");
976      for (int i = 0; i < array.size(); i++) {
977        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
978      }
979    };
980    if (json.has("type"))
981      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
982    if (json.has("quantity"))
983      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
984    if (json.has("level"))
985      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
986    if (json.has("_level"))
987      parseElementProperties(json.getAsJsonObject("_level"), res.getLevelElement());
988    if (json.has("range"))
989      res.setRange(parseRange(json.getAsJsonObject("range")));
990  }
991
992  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
993    Coding res = new Coding();
994    parseCodingProperties(json, res);
995    return res;
996  }
997
998  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
999    parseTypeProperties(json, res);
1000    if (json.has("system"))
1001      res.setSystemElement(parseUri(json.get("system").getAsString()));
1002    if (json.has("_system"))
1003      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
1004    if (json.has("version"))
1005      res.setVersionElement(parseString(json.get("version").getAsString()));
1006    if (json.has("_version"))
1007      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
1008    if (json.has("code"))
1009      res.setCodeElement(parseCode(json.get("code").getAsString()));
1010    if (json.has("_code"))
1011      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1012    if (json.has("display"))
1013      res.setDisplayElement(parseString(json.get("display").getAsString()));
1014    if (json.has("_display"))
1015      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
1016    if (json.has("userSelected"))
1017      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
1018    if (json.has("_userSelected"))
1019      parseElementProperties(json.getAsJsonObject("_userSelected"), res.getUserSelectedElement());
1020  }
1021
1022  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
1023    SampledData res = new SampledData();
1024    parseSampledDataProperties(json, res);
1025    return res;
1026  }
1027
1028  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
1029    parseTypeProperties(json, res);
1030    if (json.has("origin"))
1031      res.setOrigin(parseQuantity(json.getAsJsonObject("origin")));
1032    if (json.has("period"))
1033      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1034    if (json.has("_period"))
1035      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
1036    if (json.has("factor"))
1037      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
1038    if (json.has("_factor"))
1039      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
1040    if (json.has("lowerLimit"))
1041      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
1042    if (json.has("_lowerLimit"))
1043      parseElementProperties(json.getAsJsonObject("_lowerLimit"), res.getLowerLimitElement());
1044    if (json.has("upperLimit"))
1045      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
1046    if (json.has("_upperLimit"))
1047      parseElementProperties(json.getAsJsonObject("_upperLimit"), res.getUpperLimitElement());
1048    if (json.has("dimensions"))
1049      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
1050    if (json.has("_dimensions"))
1051      parseElementProperties(json.getAsJsonObject("_dimensions"), res.getDimensionsElement());
1052    if (json.has("data"))
1053      res.setDataElement(parseString(json.get("data").getAsString()));
1054    if (json.has("_data"))
1055      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
1056  }
1057
1058  protected Population parsePopulation(JsonObject json) throws IOException, FHIRFormatError {
1059    Population res = new Population();
1060    parsePopulationProperties(json, res);
1061    return res;
1062  }
1063
1064  protected void parsePopulationProperties(JsonObject json, Population res) throws IOException, FHIRFormatError {
1065    parseBackboneElementProperties(json, res);
1066    Type age = parseType("age", json);
1067    if (age != null)
1068      res.setAge(age);
1069    if (json.has("gender"))
1070      res.setGender(parseCodeableConcept(json.getAsJsonObject("gender")));
1071    if (json.has("race"))
1072      res.setRace(parseCodeableConcept(json.getAsJsonObject("race")));
1073    if (json.has("physiologicalCondition"))
1074      res.setPhysiologicalCondition(parseCodeableConcept(json.getAsJsonObject("physiologicalCondition")));
1075  }
1076
1077  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
1078    Ratio res = new Ratio();
1079    parseRatioProperties(json, res);
1080    return res;
1081  }
1082
1083  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
1084    parseTypeProperties(json, res);
1085    if (json.has("numerator"))
1086      res.setNumerator(parseQuantity(json.getAsJsonObject("numerator")));
1087    if (json.has("denominator"))
1088      res.setDenominator(parseQuantity(json.getAsJsonObject("denominator")));
1089  }
1090
1091  protected OrderedDistribution parseOrderedDistribution(JsonObject json) throws IOException, FHIRFormatError {
1092    OrderedDistribution res = new OrderedDistribution();
1093    parseOrderedDistributionProperties(json, res);
1094    return res;
1095  }
1096
1097  protected void parseOrderedDistributionProperties(JsonObject json, OrderedDistribution res) throws IOException, FHIRFormatError {
1098    parseBackboneElementProperties(json, res);
1099    if (json.has("description"))
1100      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1101    if (json.has("_description"))
1102      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1103    if (json.has("note")) {
1104      JsonArray array = json.getAsJsonArray("note");
1105      for (int i = 0; i < array.size(); i++) {
1106        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
1107      }
1108    };
1109    if (json.has("numberOfIntervals"))
1110      res.setNumberOfIntervalsElement(parseInteger(json.get("numberOfIntervals").getAsLong()));
1111    if (json.has("_numberOfIntervals"))
1112      parseElementProperties(json.getAsJsonObject("_numberOfIntervals"), res.getNumberOfIntervalsElement());
1113    if (json.has("bottomOfFirstInterval"))
1114      res.setBottomOfFirstInterval(parseQuantity(json.getAsJsonObject("bottomOfFirstInterval")));
1115    if (json.has("interval")) {
1116      JsonArray array = json.getAsJsonArray("interval");
1117      for (int i = 0; i < array.size(); i++) {
1118        res.getInterval().add(parseOrderedDistributionOrderedDistributionIntervalComponent(array.get(i).getAsJsonObject(), res));
1119      }
1120    };
1121    if (json.has("topOfInterval"))
1122      res.setTopOfInterval(parseQuantity(json.getAsJsonObject("topOfInterval")));
1123  }
1124
1125  protected OrderedDistribution.OrderedDistributionIntervalComponent parseOrderedDistributionOrderedDistributionIntervalComponent(JsonObject json, OrderedDistribution owner) throws IOException, FHIRFormatError {
1126    OrderedDistribution.OrderedDistributionIntervalComponent res = new OrderedDistribution.OrderedDistributionIntervalComponent();
1127    parseOrderedDistributionOrderedDistributionIntervalComponentProperties(json, owner, res);
1128    return res;
1129  }
1130
1131  protected void parseOrderedDistributionOrderedDistributionIntervalComponentProperties(JsonObject json, OrderedDistribution owner, OrderedDistribution.OrderedDistributionIntervalComponent res) throws IOException, FHIRFormatError {
1132    parseTypeProperties(json, res);
1133    if (json.has("rankOrder"))
1134      res.setRankOrderElement(parseInteger(json.get("rankOrder").getAsLong()));
1135    if (json.has("_rankOrder"))
1136      parseElementProperties(json.getAsJsonObject("_rankOrder"), res.getRankOrderElement());
1137    if (json.has("intervalStatistic")) {
1138      JsonArray array = json.getAsJsonArray("intervalStatistic");
1139      for (int i = 0; i < array.size(); i++) {
1140        res.getIntervalStatistic().add(parseStatistic(array.get(i).getAsJsonObject()));
1141      }
1142    };
1143  }
1144
1145  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
1146    Distance res = new Distance();
1147    parseDistanceProperties(json, res);
1148    return res;
1149  }
1150
1151  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
1152    parseQuantityProperties(json, res);
1153  }
1154
1155  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
1156    Age res = new Age();
1157    parseAgeProperties(json, res);
1158    return res;
1159  }
1160
1161  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
1162    parseQuantityProperties(json, res);
1163  }
1164
1165  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
1166    Reference res = new Reference();
1167    parseReferenceProperties(json, res);
1168    return res;
1169  }
1170
1171  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
1172    parseTypeProperties(json, res);
1173    if (json.has("reference"))
1174      res.setReferenceElement(parseString(json.get("reference").getAsString()));
1175    if (json.has("_reference"))
1176      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
1177    if (json.has("type"))
1178      res.setTypeElement(parseUri(json.get("type").getAsString()));
1179    if (json.has("_type"))
1180      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1181    if (json.has("identifier"))
1182      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
1183    if (json.has("display"))
1184      res.setDisplayElement(parseString(json.get("display").getAsString()));
1185    if (json.has("_display"))
1186      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
1187  }
1188
1189  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
1190    TriggerDefinition res = new TriggerDefinition();
1191    parseTriggerDefinitionProperties(json, res);
1192    return res;
1193  }
1194
1195  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
1196    parseTypeProperties(json, res);
1197    if (json.has("type"))
1198      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
1199    if (json.has("_type"))
1200      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1201    if (json.has("name"))
1202      res.setNameElement(parseString(json.get("name").getAsString()));
1203    if (json.has("_name"))
1204      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1205    Type timing = parseType("timing", json);
1206    if (timing != null)
1207      res.setTiming(timing);
1208    if (json.has("data")) {
1209      JsonArray array = json.getAsJsonArray("data");
1210      for (int i = 0; i < array.size(); i++) {
1211        res.getData().add(parseDataRequirement(array.get(i).getAsJsonObject()));
1212      }
1213    };
1214    if (json.has("condition"))
1215      res.setCondition(parseExpression(json.getAsJsonObject("condition")));
1216  }
1217
1218  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
1219    Quantity res = new Quantity();
1220    parseQuantityProperties(json, res);
1221    return res;
1222  }
1223
1224  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
1225    parseTypeProperties(json, res);
1226    if (json.has("value"))
1227      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1228    if (json.has("_value"))
1229      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
1230    if (json.has("comparator"))
1231      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
1232    if (json.has("_comparator"))
1233      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
1234    if (json.has("unit"))
1235      res.setUnitElement(parseString(json.get("unit").getAsString()));
1236    if (json.has("_unit"))
1237      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
1238    if (json.has("system"))
1239      res.setSystemElement(parseUri(json.get("system").getAsString()));
1240    if (json.has("_system"))
1241      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
1242    if (json.has("code"))
1243      res.setCodeElement(parseCode(json.get("code").getAsString()));
1244    if (json.has("_code"))
1245      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1246  }
1247
1248  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
1249    Period res = new Period();
1250    parsePeriodProperties(json, res);
1251    return res;
1252  }
1253
1254  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
1255    parseTypeProperties(json, res);
1256    if (json.has("start"))
1257      res.setStartElement(parseDateTime(json.get("start").getAsString()));
1258    if (json.has("_start"))
1259      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
1260    if (json.has("end"))
1261      res.setEndElement(parseDateTime(json.get("end").getAsString()));
1262    if (json.has("_end"))
1263      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
1264  }
1265
1266  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
1267    Duration res = new Duration();
1268    parseDurationProperties(json, res);
1269    return res;
1270  }
1271
1272  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
1273    parseQuantityProperties(json, res);
1274  }
1275
1276  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
1277    Range res = new Range();
1278    parseRangeProperties(json, res);
1279    return res;
1280  }
1281
1282  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
1283    parseTypeProperties(json, res);
1284    if (json.has("low"))
1285      res.setLow(parseQuantity(json.getAsJsonObject("low")));
1286    if (json.has("high"))
1287      res.setHigh(parseQuantity(json.getAsJsonObject("high")));
1288  }
1289
1290  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
1291    RelatedArtifact res = new RelatedArtifact();
1292    parseRelatedArtifactProperties(json, res);
1293    return res;
1294  }
1295
1296  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
1297    parseTypeProperties(json, res);
1298    if (json.has("type"))
1299      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
1300    if (json.has("_type"))
1301      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1302    if (json.has("label"))
1303      res.setLabelElement(parseString(json.get("label").getAsString()));
1304    if (json.has("_label"))
1305      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1306    if (json.has("display"))
1307      res.setDisplayElement(parseString(json.get("display").getAsString()));
1308    if (json.has("_display"))
1309      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
1310    if (json.has("citation"))
1311      res.setCitationElement(parseMarkdown(json.get("citation").getAsString()));
1312    if (json.has("_citation"))
1313      parseElementProperties(json.getAsJsonObject("_citation"), res.getCitationElement());
1314    if (json.has("url"))
1315      res.setUrlElement(parseUrl(json.get("url").getAsString()));
1316    if (json.has("_url"))
1317      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
1318    if (json.has("document"))
1319      res.setDocument(parseAttachment(json.getAsJsonObject("document")));
1320    if (json.has("resource"))
1321      res.setResourceElement(parseCanonical(json.get("resource").getAsString()));
1322    if (json.has("_resource"))
1323      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
1324  }
1325
1326  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
1327    Annotation res = new Annotation();
1328    parseAnnotationProperties(json, res);
1329    return res;
1330  }
1331
1332  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
1333    parseTypeProperties(json, res);
1334    Type author = parseType("author", json);
1335    if (author != null)
1336      res.setAuthor(author);
1337    if (json.has("time"))
1338      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
1339    if (json.has("_time"))
1340      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
1341    if (json.has("text"))
1342      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
1343    if (json.has("_text"))
1344      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
1345  }
1346
1347  protected ProductShelfLife parseProductShelfLife(JsonObject json) throws IOException, FHIRFormatError {
1348    ProductShelfLife res = new ProductShelfLife();
1349    parseProductShelfLifeProperties(json, res);
1350    return res;
1351  }
1352
1353  protected void parseProductShelfLifeProperties(JsonObject json, ProductShelfLife res) throws IOException, FHIRFormatError {
1354    parseBackboneElementProperties(json, res);
1355    if (json.has("identifier"))
1356      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
1357    if (json.has("type"))
1358      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
1359    if (json.has("period"))
1360      res.setPeriod(parseQuantity(json.getAsJsonObject("period")));
1361    if (json.has("specialPrecautionsForStorage")) {
1362      JsonArray array = json.getAsJsonArray("specialPrecautionsForStorage");
1363      for (int i = 0; i < array.size(); i++) {
1364        res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1365      }
1366    };
1367  }
1368
1369  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
1370    ContactDetail res = new ContactDetail();
1371    parseContactDetailProperties(json, res);
1372    return res;
1373  }
1374
1375  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
1376    parseTypeProperties(json, res);
1377    if (json.has("name"))
1378      res.setNameElement(parseString(json.get("name").getAsString()));
1379    if (json.has("_name"))
1380      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1381    if (json.has("telecom")) {
1382      JsonArray array = json.getAsJsonArray("telecom");
1383      for (int i = 0; i < array.size(); i++) {
1384        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
1385      }
1386    };
1387  }
1388
1389  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
1390    UsageContext res = new UsageContext();
1391    parseUsageContextProperties(json, res);
1392    return res;
1393  }
1394
1395  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
1396    parseTypeProperties(json, res);
1397    if (json.has("code"))
1398      res.setCode(parseCoding(json.getAsJsonObject("code")));
1399    Type value = parseType("value", json);
1400    if (value != null)
1401      res.setValue(value);
1402  }
1403
1404  protected Expression parseExpression(JsonObject json) throws IOException, FHIRFormatError {
1405    Expression res = new Expression();
1406    parseExpressionProperties(json, res);
1407    return res;
1408  }
1409
1410  protected void parseExpressionProperties(JsonObject json, Expression res) throws IOException, FHIRFormatError {
1411    parseElementProperties(json, res);
1412    if (json.has("description"))
1413      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1414    if (json.has("_description"))
1415      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1416    if (json.has("name"))
1417      res.setNameElement(parseId(json.get("name").getAsString()));
1418    if (json.has("_name"))
1419      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1420    if (json.has("language"))
1421      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1422    if (json.has("_language"))
1423      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1424    if (json.has("expression"))
1425      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1426    if (json.has("_expression"))
1427      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
1428    if (json.has("reference"))
1429      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
1430    if (json.has("_reference"))
1431      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
1432  }
1433
1434  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
1435    Signature res = new Signature();
1436    parseSignatureProperties(json, res);
1437    return res;
1438  }
1439
1440  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
1441    parseTypeProperties(json, res);
1442    if (json.has("type")) {
1443      JsonArray array = json.getAsJsonArray("type");
1444      for (int i = 0; i < array.size(); i++) {
1445        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
1446      }
1447    };
1448    if (json.has("when"))
1449      res.setWhenElement(parseInstant(json.get("when").getAsString()));
1450    if (json.has("_when"))
1451      parseElementProperties(json.getAsJsonObject("_when"), res.getWhenElement());
1452    if (json.has("who"))
1453      res.setWho(parseReference(json.getAsJsonObject("who")));
1454    if (json.has("onBehalfOf"))
1455      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
1456    if (json.has("targetFormat"))
1457      res.setTargetFormatElement(parseCode(json.get("targetFormat").getAsString()));
1458    if (json.has("_targetFormat"))
1459      parseElementProperties(json.getAsJsonObject("_targetFormat"), res.getTargetFormatElement());
1460    if (json.has("sigFormat"))
1461      res.setSigFormatElement(parseCode(json.get("sigFormat").getAsString()));
1462    if (json.has("_sigFormat"))
1463      parseElementProperties(json.getAsJsonObject("_sigFormat"), res.getSigFormatElement());
1464    if (json.has("data"))
1465      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
1466    if (json.has("_data"))
1467      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
1468  }
1469
1470  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
1471    Timing res = new Timing();
1472    parseTimingProperties(json, res);
1473    return res;
1474  }
1475
1476  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
1477    parseBackboneElementProperties(json, res);
1478    if (json.has("event")) {
1479      JsonArray array = json.getAsJsonArray("event");
1480      for (int i = 0; i < array.size(); i++) {
1481        res.getEvent().add(parseDateTime(array.get(i).getAsString()));
1482      }
1483    };
1484    if (json.has("_event")) {
1485      JsonArray array = json.getAsJsonArray("_event");
1486      for (int i = 0; i < array.size(); i++) {
1487        if (i == res.getEvent().size())
1488          res.getEvent().add(parseDateTime(null));
1489        if (array.get(i) instanceof JsonObject) 
1490          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
1491      }
1492    };
1493    if (json.has("repeat"))
1494      res.setRepeat(parseTimingTimingRepeatComponent(json.getAsJsonObject("repeat"), res));
1495    if (json.has("code"))
1496      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
1497  }
1498
1499  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(JsonObject json, Timing owner) throws IOException, FHIRFormatError {
1500    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
1501    parseTimingTimingRepeatComponentProperties(json, owner, res);
1502    return res;
1503  }
1504
1505  protected void parseTimingTimingRepeatComponentProperties(JsonObject json, Timing owner, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
1506    parseTypeProperties(json, res);
1507    Type bounds = parseType("bounds", json);
1508    if (bounds != null)
1509      res.setBounds(bounds);
1510    if (json.has("count"))
1511      res.setCountElement(parsePositiveInt(json.get("count").getAsString()));
1512    if (json.has("_count"))
1513      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
1514    if (json.has("countMax"))
1515      res.setCountMaxElement(parsePositiveInt(json.get("countMax").getAsString()));
1516    if (json.has("_countMax"))
1517      parseElementProperties(json.getAsJsonObject("_countMax"), res.getCountMaxElement());
1518    if (json.has("duration"))
1519      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
1520    if (json.has("_duration"))
1521      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
1522    if (json.has("durationMax"))
1523      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
1524    if (json.has("_durationMax"))
1525      parseElementProperties(json.getAsJsonObject("_durationMax"), res.getDurationMaxElement());
1526    if (json.has("durationUnit"))
1527      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1528    if (json.has("_durationUnit"))
1529      parseElementProperties(json.getAsJsonObject("_durationUnit"), res.getDurationUnitElement());
1530    if (json.has("frequency"))
1531      res.setFrequencyElement(parsePositiveInt(json.get("frequency").getAsString()));
1532    if (json.has("_frequency"))
1533      parseElementProperties(json.getAsJsonObject("_frequency"), res.getFrequencyElement());
1534    if (json.has("frequencyMax"))
1535      res.setFrequencyMaxElement(parsePositiveInt(json.get("frequencyMax").getAsString()));
1536    if (json.has("_frequencyMax"))
1537      parseElementProperties(json.getAsJsonObject("_frequencyMax"), res.getFrequencyMaxElement());
1538    if (json.has("period"))
1539      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1540    if (json.has("_period"))
1541      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
1542    if (json.has("periodMax"))
1543      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
1544    if (json.has("_periodMax"))
1545      parseElementProperties(json.getAsJsonObject("_periodMax"), res.getPeriodMaxElement());
1546    if (json.has("periodUnit"))
1547      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1548    if (json.has("_periodUnit"))
1549      parseElementProperties(json.getAsJsonObject("_periodUnit"), res.getPeriodUnitElement());
1550    if (json.has("dayOfWeek")) {
1551      JsonArray array = json.getAsJsonArray("dayOfWeek");
1552      for (int i = 0; i < array.size(); i++) {
1553        res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1554      }
1555    };
1556    if (json.has("_dayOfWeek")) {
1557      JsonArray array = json.getAsJsonArray("_dayOfWeek");
1558      for (int i = 0; i < array.size(); i++) {
1559        if (i == res.getDayOfWeek().size())
1560          res.getDayOfWeek().add(parseEnumeration(null, Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1561        if (array.get(i) instanceof JsonObject) 
1562          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
1563      }
1564    };
1565    if (json.has("timeOfDay")) {
1566      JsonArray array = json.getAsJsonArray("timeOfDay");
1567      for (int i = 0; i < array.size(); i++) {
1568        res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
1569      }
1570    };
1571    if (json.has("_timeOfDay")) {
1572      JsonArray array = json.getAsJsonArray("_timeOfDay");
1573      for (int i = 0; i < array.size(); i++) {
1574        if (i == res.getTimeOfDay().size())
1575          res.getTimeOfDay().add(parseTime(null));
1576        if (array.get(i) instanceof JsonObject) 
1577          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
1578      }
1579    };
1580    if (json.has("when")) {
1581      JsonArray array = json.getAsJsonArray("when");
1582      for (int i = 0; i < array.size(); i++) {
1583        res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1584      }
1585    };
1586    if (json.has("_when")) {
1587      JsonArray array = json.getAsJsonArray("_when");
1588      for (int i = 0; i < array.size(); i++) {
1589        if (i == res.getWhen().size())
1590          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1591        if (array.get(i) instanceof JsonObject) 
1592          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
1593      }
1594    };
1595    if (json.has("offset"))
1596      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
1597    if (json.has("_offset"))
1598      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
1599  }
1600
1601  protected ProdCharacteristic parseProdCharacteristic(JsonObject json) throws IOException, FHIRFormatError {
1602    ProdCharacteristic res = new ProdCharacteristic();
1603    parseProdCharacteristicProperties(json, res);
1604    return res;
1605  }
1606
1607  protected void parseProdCharacteristicProperties(JsonObject json, ProdCharacteristic res) throws IOException, FHIRFormatError {
1608    parseBackboneElementProperties(json, res);
1609    if (json.has("height"))
1610      res.setHeight(parseQuantity(json.getAsJsonObject("height")));
1611    if (json.has("width"))
1612      res.setWidth(parseQuantity(json.getAsJsonObject("width")));
1613    if (json.has("depth"))
1614      res.setDepth(parseQuantity(json.getAsJsonObject("depth")));
1615    if (json.has("weight"))
1616      res.setWeight(parseQuantity(json.getAsJsonObject("weight")));
1617    if (json.has("nominalVolume"))
1618      res.setNominalVolume(parseQuantity(json.getAsJsonObject("nominalVolume")));
1619    if (json.has("externalDiameter"))
1620      res.setExternalDiameter(parseQuantity(json.getAsJsonObject("externalDiameter")));
1621    if (json.has("shape"))
1622      res.setShapeElement(parseString(json.get("shape").getAsString()));
1623    if (json.has("_shape"))
1624      parseElementProperties(json.getAsJsonObject("_shape"), res.getShapeElement());
1625    if (json.has("color")) {
1626      JsonArray array = json.getAsJsonArray("color");
1627      for (int i = 0; i < array.size(); i++) {
1628        res.getColor().add(parseString(array.get(i).getAsString()));
1629      }
1630    };
1631    if (json.has("_color")) {
1632      JsonArray array = json.getAsJsonArray("_color");
1633      for (int i = 0; i < array.size(); i++) {
1634        if (i == res.getColor().size())
1635          res.getColor().add(parseString(null));
1636        if (array.get(i) instanceof JsonObject) 
1637          parseElementProperties(array.get(i).getAsJsonObject(), res.getColor().get(i));
1638      }
1639    };
1640    if (json.has("imprint")) {
1641      JsonArray array = json.getAsJsonArray("imprint");
1642      for (int i = 0; i < array.size(); i++) {
1643        res.getImprint().add(parseString(array.get(i).getAsString()));
1644      }
1645    };
1646    if (json.has("_imprint")) {
1647      JsonArray array = json.getAsJsonArray("_imprint");
1648      for (int i = 0; i < array.size(); i++) {
1649        if (i == res.getImprint().size())
1650          res.getImprint().add(parseString(null));
1651        if (array.get(i) instanceof JsonObject) 
1652          parseElementProperties(array.get(i).getAsJsonObject(), res.getImprint().get(i));
1653      }
1654    };
1655    if (json.has("image")) {
1656      JsonArray array = json.getAsJsonArray("image");
1657      for (int i = 0; i < array.size(); i++) {
1658        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
1659      }
1660    };
1661    if (json.has("scoring"))
1662      res.setScoring(parseCodeableConcept(json.getAsJsonObject("scoring")));
1663  }
1664
1665  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
1666    CodeableConcept res = new CodeableConcept();
1667    parseCodeableConceptProperties(json, res);
1668    return res;
1669  }
1670
1671  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
1672    parseTypeProperties(json, res);
1673    if (json.has("coding")) {
1674      JsonArray array = json.getAsJsonArray("coding");
1675      for (int i = 0; i < array.size(); i++) {
1676        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
1677      }
1678    };
1679    if (json.has("text"))
1680      res.setTextElement(parseString(json.get("text").getAsString()));
1681    if (json.has("_text"))
1682      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
1683  }
1684
1685  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1686    ParameterDefinition res = new ParameterDefinition();
1687    parseParameterDefinitionProperties(json, res);
1688    return res;
1689  }
1690
1691  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1692    parseTypeProperties(json, res);
1693    if (json.has("name"))
1694      res.setNameElement(parseCode(json.get("name").getAsString()));
1695    if (json.has("_name"))
1696      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1697    if (json.has("use"))
1698      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ParameterDefinition.ParameterUse.NULL, new ParameterDefinition.ParameterUseEnumFactory()));
1699    if (json.has("_use"))
1700      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1701    if (json.has("min"))
1702      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1703    if (json.has("_min"))
1704      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1705    if (json.has("max"))
1706      res.setMaxElement(parseString(json.get("max").getAsString()));
1707    if (json.has("_max"))
1708      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1709    if (json.has("documentation"))
1710      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1711    if (json.has("_documentation"))
1712      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
1713    if (json.has("type"))
1714      res.setTypeElement(parseCode(json.get("type").getAsString()));
1715    if (json.has("_type"))
1716      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1717    if (json.has("profile"))
1718      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
1719    if (json.has("_profile"))
1720      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
1721  }
1722
1723  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
1724    ElementDefinition res = new ElementDefinition();
1725    parseElementDefinitionProperties(json, res);
1726    return res;
1727  }
1728
1729  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
1730    parseBackboneElementProperties(json, res);
1731    if (json.has("path"))
1732      res.setPathElement(parseString(json.get("path").getAsString()));
1733    if (json.has("_path"))
1734      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1735    if (json.has("representation")) {
1736      JsonArray array = json.getAsJsonArray("representation");
1737      for (int i = 0; i < array.size(); i++) {
1738        res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1739      }
1740    };
1741    if (json.has("_representation")) {
1742      JsonArray array = json.getAsJsonArray("_representation");
1743      for (int i = 0; i < array.size(); i++) {
1744        if (i == res.getRepresentation().size())
1745          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1746        if (array.get(i) instanceof JsonObject) 
1747          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
1748      }
1749    };
1750    if (json.has("sliceName"))
1751      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
1752    if (json.has("_sliceName"))
1753      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
1754    if (json.has("sliceIsConstraining"))
1755      res.setSliceIsConstrainingElement(parseBoolean(json.get("sliceIsConstraining").getAsBoolean()));
1756    if (json.has("_sliceIsConstraining"))
1757      parseElementProperties(json.getAsJsonObject("_sliceIsConstraining"), res.getSliceIsConstrainingElement());
1758    if (json.has("label"))
1759      res.setLabelElement(parseString(json.get("label").getAsString()));
1760    if (json.has("_label"))
1761      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1762    if (json.has("code")) {
1763      JsonArray array = json.getAsJsonArray("code");
1764      for (int i = 0; i < array.size(); i++) {
1765        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
1766      }
1767    };
1768    if (json.has("slicing"))
1769      res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(json.getAsJsonObject("slicing"), res));
1770    if (json.has("short"))
1771      res.setShortElement(parseString(json.get("short").getAsString()));
1772    if (json.has("_short"))
1773      parseElementProperties(json.getAsJsonObject("_short"), res.getShortElement());
1774    if (json.has("definition"))
1775      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
1776    if (json.has("_definition"))
1777      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
1778    if (json.has("comment"))
1779      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
1780    if (json.has("_comment"))
1781      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1782    if (json.has("requirements"))
1783      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
1784    if (json.has("_requirements"))
1785      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1786    if (json.has("alias")) {
1787      JsonArray array = json.getAsJsonArray("alias");
1788      for (int i = 0; i < array.size(); i++) {
1789        res.getAlias().add(parseString(array.get(i).getAsString()));
1790      }
1791    };
1792    if (json.has("_alias")) {
1793      JsonArray array = json.getAsJsonArray("_alias");
1794      for (int i = 0; i < array.size(); i++) {
1795        if (i == res.getAlias().size())
1796          res.getAlias().add(parseString(null));
1797        if (array.get(i) instanceof JsonObject) 
1798          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
1799      }
1800    };
1801    if (json.has("min"))
1802      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1803    if (json.has("_min"))
1804      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1805    if (json.has("max"))
1806      res.setMaxElement(parseString(json.get("max").getAsString()));
1807    if (json.has("_max"))
1808      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1809    if (json.has("base"))
1810      res.setBase(parseElementDefinitionElementDefinitionBaseComponent(json.getAsJsonObject("base"), res));
1811    if (json.has("contentReference"))
1812      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
1813    if (json.has("_contentReference"))
1814      parseElementProperties(json.getAsJsonObject("_contentReference"), res.getContentReferenceElement());
1815    if (json.has("type")) {
1816      JsonArray array = json.getAsJsonArray("type");
1817      for (int i = 0; i < array.size(); i++) {
1818        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject(), res));
1819      }
1820    };
1821    Type defaultValue = parseType("defaultValue", json);
1822    if (defaultValue != null)
1823      res.setDefaultValue(defaultValue);
1824    if (json.has("meaningWhenMissing"))
1825      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
1826    if (json.has("_meaningWhenMissing"))
1827      parseElementProperties(json.getAsJsonObject("_meaningWhenMissing"), res.getMeaningWhenMissingElement());
1828    if (json.has("orderMeaning"))
1829      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
1830    if (json.has("_orderMeaning"))
1831      parseElementProperties(json.getAsJsonObject("_orderMeaning"), res.getOrderMeaningElement());
1832    Type fixed = parseType("fixed", json);
1833    if (fixed != null)
1834      res.setFixed(fixed);
1835    Type pattern = parseType("pattern", json);
1836    if (pattern != null)
1837      res.setPattern(pattern);
1838    if (json.has("example")) {
1839      JsonArray array = json.getAsJsonArray("example");
1840      for (int i = 0; i < array.size(); i++) {
1841        res.getExample().add(parseElementDefinitionElementDefinitionExampleComponent(array.get(i).getAsJsonObject(), res));
1842      }
1843    };
1844    Type minValue = parseType("minValue", json);
1845    if (minValue != null)
1846      res.setMinValue(minValue);
1847    Type maxValue = parseType("maxValue", json);
1848    if (maxValue != null)
1849      res.setMaxValue(maxValue);
1850    if (json.has("maxLength"))
1851      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
1852    if (json.has("_maxLength"))
1853      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
1854    if (json.has("condition")) {
1855      JsonArray array = json.getAsJsonArray("condition");
1856      for (int i = 0; i < array.size(); i++) {
1857        res.getCondition().add(parseId(array.get(i).getAsString()));
1858      }
1859    };
1860    if (json.has("_condition")) {
1861      JsonArray array = json.getAsJsonArray("_condition");
1862      for (int i = 0; i < array.size(); i++) {
1863        if (i == res.getCondition().size())
1864          res.getCondition().add(parseId(null));
1865        if (array.get(i) instanceof JsonObject) 
1866          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1867      }
1868    };
1869    if (json.has("constraint")) {
1870      JsonArray array = json.getAsJsonArray("constraint");
1871      for (int i = 0; i < array.size(); i++) {
1872        res.getConstraint().add(parseElementDefinitionElementDefinitionConstraintComponent(array.get(i).getAsJsonObject(), res));
1873      }
1874    };
1875    if (json.has("mustSupport"))
1876      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1877    if (json.has("_mustSupport"))
1878      parseElementProperties(json.getAsJsonObject("_mustSupport"), res.getMustSupportElement());
1879    if (json.has("isModifier"))
1880      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1881    if (json.has("_isModifier"))
1882      parseElementProperties(json.getAsJsonObject("_isModifier"), res.getIsModifierElement());
1883    if (json.has("isModifierReason"))
1884      res.setIsModifierReasonElement(parseString(json.get("isModifierReason").getAsString()));
1885    if (json.has("_isModifierReason"))
1886      parseElementProperties(json.getAsJsonObject("_isModifierReason"), res.getIsModifierReasonElement());
1887    if (json.has("isSummary"))
1888      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1889    if (json.has("_isSummary"))
1890      parseElementProperties(json.getAsJsonObject("_isSummary"), res.getIsSummaryElement());
1891    if (json.has("binding"))
1892      res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(json.getAsJsonObject("binding"), res));
1893    if (json.has("mapping")) {
1894      JsonArray array = json.getAsJsonArray("mapping");
1895      for (int i = 0; i < array.size(); i++) {
1896        res.getMapping().add(parseElementDefinitionElementDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
1897      }
1898    };
1899  }
1900
1901  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1902    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1903    parseElementDefinitionElementDefinitionSlicingComponentProperties(json, owner, res);
1904    return res;
1905  }
1906
1907  protected void parseElementDefinitionElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
1908    parseTypeProperties(json, res);
1909    if (json.has("discriminator")) {
1910      JsonArray array = json.getAsJsonArray("discriminator");
1911      for (int i = 0; i < array.size(); i++) {
1912        res.getDiscriminator().add(parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject(), owner));
1913      }
1914    };
1915    if (json.has("description"))
1916      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1917    if (json.has("_description"))
1918      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1919    if (json.has("ordered"))
1920      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1921    if (json.has("_ordered"))
1922      parseElementProperties(json.getAsJsonObject("_ordered"), res.getOrderedElement());
1923    if (json.has("rules"))
1924      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1925    if (json.has("_rules"))
1926      parseElementProperties(json.getAsJsonObject("_rules"), res.getRulesElement());
1927  }
1928
1929  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1930    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
1931    parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(json, owner, res);
1932    return res;
1933  }
1934
1935  protected void parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
1936    parseTypeProperties(json, res);
1937    if (json.has("type"))
1938      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
1939    if (json.has("_type"))
1940      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1941    if (json.has("path"))
1942      res.setPathElement(parseString(json.get("path").getAsString()));
1943    if (json.has("_path"))
1944      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1945  }
1946
1947  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1948    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1949    parseElementDefinitionElementDefinitionBaseComponentProperties(json, owner, res);
1950    return res;
1951  }
1952
1953  protected void parseElementDefinitionElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
1954    parseTypeProperties(json, res);
1955    if (json.has("path"))
1956      res.setPathElement(parseString(json.get("path").getAsString()));
1957    if (json.has("_path"))
1958      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1959    if (json.has("min"))
1960      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1961    if (json.has("_min"))
1962      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1963    if (json.has("max"))
1964      res.setMaxElement(parseString(json.get("max").getAsString()));
1965    if (json.has("_max"))
1966      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1967  }
1968
1969  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1970    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1971    parseElementDefinitionTypeRefComponentProperties(json, owner, res);
1972    return res;
1973  }
1974
1975  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1976    parseTypeProperties(json, res);
1977    if (json.has("code"))
1978      res.setCodeElement(parseUri(json.get("code").getAsString()));
1979    if (json.has("_code"))
1980      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1981    if (json.has("profile")) {
1982      JsonArray array = json.getAsJsonArray("profile");
1983      for (int i = 0; i < array.size(); i++) {
1984        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1985      }
1986    };
1987    if (json.has("_profile")) {
1988      JsonArray array = json.getAsJsonArray("_profile");
1989      for (int i = 0; i < array.size(); i++) {
1990        if (i == res.getProfile().size())
1991          res.getProfile().add(parseCanonical(null));
1992        if (array.get(i) instanceof JsonObject) 
1993          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1994      }
1995    };
1996    if (json.has("targetProfile")) {
1997      JsonArray array = json.getAsJsonArray("targetProfile");
1998      for (int i = 0; i < array.size(); i++) {
1999        res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
2000      }
2001    };
2002    if (json.has("_targetProfile")) {
2003      JsonArray array = json.getAsJsonArray("_targetProfile");
2004      for (int i = 0; i < array.size(); i++) {
2005        if (i == res.getTargetProfile().size())
2006          res.getTargetProfile().add(parseCanonical(null));
2007        if (array.get(i) instanceof JsonObject) 
2008          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
2009      }
2010    };
2011    if (json.has("aggregation")) {
2012      JsonArray array = json.getAsJsonArray("aggregation");
2013      for (int i = 0; i < array.size(); i++) {
2014        res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
2015      }
2016    };
2017    if (json.has("_aggregation")) {
2018      JsonArray array = json.getAsJsonArray("_aggregation");
2019      for (int i = 0; i < array.size(); i++) {
2020        if (i == res.getAggregation().size())
2021          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
2022        if (array.get(i) instanceof JsonObject) 
2023          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
2024      }
2025    };
2026    if (json.has("versioning"))
2027      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
2028    if (json.has("_versioning"))
2029      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
2030  }
2031
2032  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionElementDefinitionExampleComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
2033    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
2034    parseElementDefinitionElementDefinitionExampleComponentProperties(json, owner, res);
2035    return res;
2036  }
2037
2038  protected void parseElementDefinitionElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
2039    parseTypeProperties(json, res);
2040    if (json.has("label"))
2041      res.setLabelElement(parseString(json.get("label").getAsString()));
2042    if (json.has("_label"))
2043      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
2044    Type value = parseType("value", json);
2045    if (value != null)
2046      res.setValue(value);
2047  }
2048
2049  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
2050    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
2051    parseElementDefinitionElementDefinitionConstraintComponentProperties(json, owner, res);
2052    return res;
2053  }
2054
2055  protected void parseElementDefinitionElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
2056    parseTypeProperties(json, res);
2057    if (json.has("key"))
2058      res.setKeyElement(parseId(json.get("key").getAsString()));
2059    if (json.has("_key"))
2060      parseElementProperties(json.getAsJsonObject("_key"), res.getKeyElement());
2061    if (json.has("requirements"))
2062      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
2063    if (json.has("_requirements"))
2064      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
2065    if (json.has("severity"))
2066      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
2067    if (json.has("_severity"))
2068      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
2069    if (json.has("human"))
2070      res.setHumanElement(parseString(json.get("human").getAsString()));
2071    if (json.has("_human"))
2072      parseElementProperties(json.getAsJsonObject("_human"), res.getHumanElement());
2073    if (json.has("expression"))
2074      res.setExpressionElement(parseString(json.get("expression").getAsString()));
2075    if (json.has("_expression"))
2076      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
2077    if (json.has("xpath"))
2078      res.setXpathElement(parseString(json.get("xpath").getAsString()));
2079    if (json.has("_xpath"))
2080      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
2081    if (json.has("source"))
2082      res.setSourceElement(parseCanonical(json.get("source").getAsString()));
2083    if (json.has("_source"))
2084      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
2085  }
2086
2087  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
2088    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
2089    parseElementDefinitionElementDefinitionBindingComponentProperties(json, owner, res);
2090    return res;
2091  }
2092
2093  protected void parseElementDefinitionElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
2094    parseTypeProperties(json, res);
2095    if (json.has("strength"))
2096      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
2097    if (json.has("_strength"))
2098      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
2099    if (json.has("description"))
2100      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2101    if (json.has("_description"))
2102      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2103    if (json.has("valueSet"))
2104      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
2105    if (json.has("_valueSet"))
2106      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
2107  }
2108
2109  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
2110    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
2111    parseElementDefinitionElementDefinitionMappingComponentProperties(json, owner, res);
2112    return res;
2113  }
2114
2115  protected void parseElementDefinitionElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
2116    parseTypeProperties(json, res);
2117    if (json.has("identity"))
2118      res.setIdentityElement(parseId(json.get("identity").getAsString()));
2119    if (json.has("_identity"))
2120      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
2121    if (json.has("language"))
2122      res.setLanguageElement(parseCode(json.get("language").getAsString()));
2123    if (json.has("_language"))
2124      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
2125    if (json.has("map"))
2126      res.setMapElement(parseString(json.get("map").getAsString()));
2127    if (json.has("_map"))
2128      parseElementProperties(json.getAsJsonObject("_map"), res.getMapElement());
2129    if (json.has("comment"))
2130      res.setCommentElement(parseString(json.get("comment").getAsString()));
2131    if (json.has("_comment"))
2132      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
2133  }
2134
2135  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
2136    parseResourceProperties(json, res);
2137    if (json.has("text"))
2138      res.setText(parseNarrative(json.getAsJsonObject("text")));
2139    if (json.has("contained")) {
2140      JsonArray array = json.getAsJsonArray("contained");
2141      for (int i = 0; i < array.size(); i++) {
2142        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
2143      }
2144    };
2145    if (json.has("extension")) {
2146      JsonArray array = json.getAsJsonArray("extension");
2147      for (int i = 0; i < array.size(); i++) {
2148        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2149      }
2150    };
2151    if (json.has("modifierExtension")) {
2152      JsonArray array = json.getAsJsonArray("modifierExtension");
2153      for (int i = 0; i < array.size(); i++) {
2154        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2155      }
2156    };
2157  }
2158
2159  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
2160    Parameters res = new Parameters();
2161    parseParametersProperties(json, res);
2162    return res;
2163  }
2164
2165  protected void parseParametersProperties(JsonObject json, Parameters res) throws IOException, FHIRFormatError {
2166    parseResourceProperties(json, res);
2167    if (json.has("parameter")) {
2168      JsonArray array = json.getAsJsonArray("parameter");
2169      for (int i = 0; i < array.size(); i++) {
2170        res.getParameter().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), res));
2171      }
2172    };
2173  }
2174
2175  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(JsonObject json, Parameters owner) throws IOException, FHIRFormatError {
2176    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
2177    parseParametersParametersParameterComponentProperties(json, owner, res);
2178    return res;
2179  }
2180
2181  protected void parseParametersParametersParameterComponentProperties(JsonObject json, Parameters owner, Parameters.ParametersParameterComponent res) throws IOException, FHIRFormatError {
2182    parseBackboneElementProperties(json, res);
2183    if (json.has("name"))
2184      res.setNameElement(parseString(json.get("name").getAsString()));
2185    if (json.has("_name"))
2186      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2187    Type value = parseType("value", json);
2188    if (value != null)
2189      res.setValue(value);
2190    if (json.has("resource"))
2191      res.setResource(parseResource(json.getAsJsonObject("resource")));
2192    if (json.has("part")) {
2193      JsonArray array = json.getAsJsonArray("part");
2194      for (int i = 0; i < array.size(); i++) {
2195        res.getPart().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), owner));
2196      }
2197    };
2198  }
2199
2200  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
2201    if (json.has("id"))
2202      res.setIdElement(parseId(json.get("id").getAsString()));
2203    if (json.has("_id"))
2204      parseElementProperties(json.getAsJsonObject("_id"), res.getIdElement());
2205    if (json.has("meta"))
2206      res.setMeta(parseMeta(json.getAsJsonObject("meta")));
2207    if (json.has("implicitRules"))
2208      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
2209    if (json.has("_implicitRules"))
2210      parseElementProperties(json.getAsJsonObject("_implicitRules"), res.getImplicitRulesElement());
2211    if (json.has("language"))
2212      res.setLanguageElement(parseCode(json.get("language").getAsString()));
2213    if (json.has("_language"))
2214      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
2215  }
2216
2217  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
2218    Account res = new Account();
2219    parseAccountProperties(json, res);
2220    return res;
2221  }
2222
2223  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
2224    parseDomainResourceProperties(json, res);
2225    if (json.has("identifier")) {
2226      JsonArray array = json.getAsJsonArray("identifier");
2227      for (int i = 0; i < array.size(); i++) {
2228        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2229      }
2230    };
2231    if (json.has("status"))
2232      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
2233    if (json.has("_status"))
2234      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2235    if (json.has("type"))
2236      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
2237    if (json.has("name"))
2238      res.setNameElement(parseString(json.get("name").getAsString()));
2239    if (json.has("_name"))
2240      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2241    if (json.has("subject")) {
2242      JsonArray array = json.getAsJsonArray("subject");
2243      for (int i = 0; i < array.size(); i++) {
2244        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
2245      }
2246    };
2247    if (json.has("servicePeriod"))
2248      res.setServicePeriod(parsePeriod(json.getAsJsonObject("servicePeriod")));
2249    if (json.has("coverage")) {
2250      JsonArray array = json.getAsJsonArray("coverage");
2251      for (int i = 0; i < array.size(); i++) {
2252        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject(), res));
2253      }
2254    };
2255    if (json.has("owner"))
2256      res.setOwner(parseReference(json.getAsJsonObject("owner")));
2257    if (json.has("description"))
2258      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2259    if (json.has("_description"))
2260      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2261    if (json.has("guarantor")) {
2262      JsonArray array = json.getAsJsonArray("guarantor");
2263      for (int i = 0; i < array.size(); i++) {
2264        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject(), res));
2265      }
2266    };
2267    if (json.has("partOf"))
2268      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
2269  }
2270
2271  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
2272    Account.CoverageComponent res = new Account.CoverageComponent();
2273    parseAccountCoverageComponentProperties(json, owner, res);
2274    return res;
2275  }
2276
2277  protected void parseAccountCoverageComponentProperties(JsonObject json, Account owner, Account.CoverageComponent res) throws IOException, FHIRFormatError {
2278    parseBackboneElementProperties(json, res);
2279    if (json.has("coverage"))
2280      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
2281    if (json.has("priority"))
2282      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
2283    if (json.has("_priority"))
2284      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2285  }
2286
2287  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
2288    Account.GuarantorComponent res = new Account.GuarantorComponent();
2289    parseAccountGuarantorComponentProperties(json, owner, res);
2290    return res;
2291  }
2292
2293  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account owner, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
2294    parseBackboneElementProperties(json, res);
2295    if (json.has("party"))
2296      res.setParty(parseReference(json.getAsJsonObject("party")));
2297    if (json.has("onHold"))
2298      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
2299    if (json.has("_onHold"))
2300      parseElementProperties(json.getAsJsonObject("_onHold"), res.getOnHoldElement());
2301    if (json.has("period"))
2302      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2303  }
2304
2305  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
2306    ActivityDefinition res = new ActivityDefinition();
2307    parseActivityDefinitionProperties(json, res);
2308    return res;
2309  }
2310
2311  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
2312    parseDomainResourceProperties(json, res);
2313    if (json.has("url"))
2314      res.setUrlElement(parseUri(json.get("url").getAsString()));
2315    if (json.has("_url"))
2316      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
2317    if (json.has("identifier")) {
2318      JsonArray array = json.getAsJsonArray("identifier");
2319      for (int i = 0; i < array.size(); i++) {
2320        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2321      }
2322    };
2323    if (json.has("version"))
2324      res.setVersionElement(parseString(json.get("version").getAsString()));
2325    if (json.has("_version"))
2326      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
2327    if (json.has("name"))
2328      res.setNameElement(parseString(json.get("name").getAsString()));
2329    if (json.has("_name"))
2330      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2331    if (json.has("title"))
2332      res.setTitleElement(parseString(json.get("title").getAsString()));
2333    if (json.has("_title"))
2334      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
2335    if (json.has("subtitle"))
2336      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
2337    if (json.has("_subtitle"))
2338      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
2339    if (json.has("status"))
2340      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2341    if (json.has("_status"))
2342      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2343    if (json.has("experimental"))
2344      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2345    if (json.has("_experimental"))
2346      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
2347    Type subject = parseType("subject", json);
2348    if (subject != null)
2349      res.setSubject(subject);
2350    if (json.has("date"))
2351      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2352    if (json.has("_date"))
2353      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2354    if (json.has("publisher"))
2355      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2356    if (json.has("_publisher"))
2357      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
2358    if (json.has("contact")) {
2359      JsonArray array = json.getAsJsonArray("contact");
2360      for (int i = 0; i < array.size(); i++) {
2361        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2362      }
2363    };
2364    if (json.has("description"))
2365      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2366    if (json.has("_description"))
2367      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2368    if (json.has("useContext")) {
2369      JsonArray array = json.getAsJsonArray("useContext");
2370      for (int i = 0; i < array.size(); i++) {
2371        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2372      }
2373    };
2374    if (json.has("jurisdiction")) {
2375      JsonArray array = json.getAsJsonArray("jurisdiction");
2376      for (int i = 0; i < array.size(); i++) {
2377        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2378      }
2379    };
2380    if (json.has("purpose"))
2381      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2382    if (json.has("_purpose"))
2383      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
2384    if (json.has("usage"))
2385      res.setUsageElement(parseString(json.get("usage").getAsString()));
2386    if (json.has("_usage"))
2387      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
2388    if (json.has("copyright"))
2389      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2390    if (json.has("_copyright"))
2391      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
2392    if (json.has("approvalDate"))
2393      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
2394    if (json.has("_approvalDate"))
2395      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
2396    if (json.has("lastReviewDate"))
2397      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
2398    if (json.has("_lastReviewDate"))
2399      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
2400    if (json.has("effectivePeriod"))
2401      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
2402    if (json.has("topic")) {
2403      JsonArray array = json.getAsJsonArray("topic");
2404      for (int i = 0; i < array.size(); i++) {
2405        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2406      }
2407    };
2408    if (json.has("author")) {
2409      JsonArray array = json.getAsJsonArray("author");
2410      for (int i = 0; i < array.size(); i++) {
2411        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2412      }
2413    };
2414    if (json.has("editor")) {
2415      JsonArray array = json.getAsJsonArray("editor");
2416      for (int i = 0; i < array.size(); i++) {
2417        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2418      }
2419    };
2420    if (json.has("reviewer")) {
2421      JsonArray array = json.getAsJsonArray("reviewer");
2422      for (int i = 0; i < array.size(); i++) {
2423        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
2424      }
2425    };
2426    if (json.has("endorser")) {
2427      JsonArray array = json.getAsJsonArray("endorser");
2428      for (int i = 0; i < array.size(); i++) {
2429        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
2430      }
2431    };
2432    if (json.has("relatedArtifact")) {
2433      JsonArray array = json.getAsJsonArray("relatedArtifact");
2434      for (int i = 0; i < array.size(); i++) {
2435        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
2436      }
2437    };
2438    if (json.has("library")) {
2439      JsonArray array = json.getAsJsonArray("library");
2440      for (int i = 0; i < array.size(); i++) {
2441        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
2442      }
2443    };
2444    if (json.has("_library")) {
2445      JsonArray array = json.getAsJsonArray("_library");
2446      for (int i = 0; i < array.size(); i++) {
2447        if (i == res.getLibrary().size())
2448          res.getLibrary().add(parseCanonical(null));
2449        if (array.get(i) instanceof JsonObject) 
2450          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
2451      }
2452    };
2453    if (json.has("kind"))
2454      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.ActivityDefinitionKind.NULL, new ActivityDefinition.ActivityDefinitionKindEnumFactory()));
2455    if (json.has("_kind"))
2456      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
2457    if (json.has("profile"))
2458      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
2459    if (json.has("_profile"))
2460      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
2461    if (json.has("code"))
2462      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2463    if (json.has("intent"))
2464      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ActivityDefinition.RequestIntent.NULL, new ActivityDefinition.RequestIntentEnumFactory()));
2465    if (json.has("_intent"))
2466      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
2467    if (json.has("priority"))
2468      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ActivityDefinition.RequestPriority.NULL, new ActivityDefinition.RequestPriorityEnumFactory()));
2469    if (json.has("_priority"))
2470      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2471    if (json.has("doNotPerform"))
2472      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
2473    if (json.has("_doNotPerform"))
2474      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
2475    Type timing = parseType("timing", json);
2476    if (timing != null)
2477      res.setTiming(timing);
2478    if (json.has("location"))
2479      res.setLocation(parseReference(json.getAsJsonObject("location")));
2480    if (json.has("participant")) {
2481      JsonArray array = json.getAsJsonArray("participant");
2482      for (int i = 0; i < array.size(); i++) {
2483        res.getParticipant().add(parseActivityDefinitionActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject(), res));
2484      }
2485    };
2486    Type product = parseType("product", json);
2487    if (product != null)
2488      res.setProduct(product);
2489    if (json.has("quantity"))
2490      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
2491    if (json.has("dosage")) {
2492      JsonArray array = json.getAsJsonArray("dosage");
2493      for (int i = 0; i < array.size(); i++) {
2494        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
2495      }
2496    };
2497    if (json.has("bodySite")) {
2498      JsonArray array = json.getAsJsonArray("bodySite");
2499      for (int i = 0; i < array.size(); i++) {
2500        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2501      }
2502    };
2503    if (json.has("specimenRequirement")) {
2504      JsonArray array = json.getAsJsonArray("specimenRequirement");
2505      for (int i = 0; i < array.size(); i++) {
2506        res.getSpecimenRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2507      }
2508    };
2509    if (json.has("observationRequirement")) {
2510      JsonArray array = json.getAsJsonArray("observationRequirement");
2511      for (int i = 0; i < array.size(); i++) {
2512        res.getObservationRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2513      }
2514    };
2515    if (json.has("observationResultRequirement")) {
2516      JsonArray array = json.getAsJsonArray("observationResultRequirement");
2517      for (int i = 0; i < array.size(); i++) {
2518        res.getObservationResultRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2519      }
2520    };
2521    if (json.has("transform"))
2522      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
2523    if (json.has("_transform"))
2524      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
2525    if (json.has("dynamicValue")) {
2526      JsonArray array = json.getAsJsonArray("dynamicValue");
2527      for (int i = 0; i < array.size(); i++) {
2528        res.getDynamicValue().add(parseActivityDefinitionActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject(), res));
2529      }
2530    };
2531  }
2532
2533  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionActivityDefinitionParticipantComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2534    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2535    parseActivityDefinitionActivityDefinitionParticipantComponentProperties(json, owner, res);
2536    return res;
2537  }
2538
2539  protected void parseActivityDefinitionActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
2540    parseBackboneElementProperties(json, res);
2541    if (json.has("type"))
2542      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ActivityDefinition.ActivityParticipantType.NULL, new ActivityDefinition.ActivityParticipantTypeEnumFactory()));
2543    if (json.has("_type"))
2544      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2545    if (json.has("role"))
2546      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
2547  }
2548
2549  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionActivityDefinitionDynamicValueComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2550    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2551    parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(json, owner, res);
2552    return res;
2553  }
2554
2555  protected void parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
2556    parseBackboneElementProperties(json, res);
2557    if (json.has("path"))
2558      res.setPathElement(parseString(json.get("path").getAsString()));
2559    if (json.has("_path"))
2560      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
2561    if (json.has("expression"))
2562      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
2563  }
2564
2565  protected AdministrableProductDefinition parseAdministrableProductDefinition(JsonObject json) throws IOException, FHIRFormatError {
2566    AdministrableProductDefinition res = new AdministrableProductDefinition();
2567    parseAdministrableProductDefinitionProperties(json, res);
2568    return res;
2569  }
2570
2571  protected void parseAdministrableProductDefinitionProperties(JsonObject json, AdministrableProductDefinition res) throws IOException, FHIRFormatError {
2572    parseDomainResourceProperties(json, res);
2573    if (json.has("identifier")) {
2574      JsonArray array = json.getAsJsonArray("identifier");
2575      for (int i = 0; i < array.size(); i++) {
2576        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2577      }
2578    };
2579    if (json.has("subject")) {
2580      JsonArray array = json.getAsJsonArray("subject");
2581      for (int i = 0; i < array.size(); i++) {
2582        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
2583      }
2584    };
2585    if (json.has("administrableDoseForm"))
2586      res.setAdministrableDoseForm(parseCodeableConcept(json.getAsJsonObject("administrableDoseForm")));
2587    if (json.has("unitOfPresentation"))
2588      res.setUnitOfPresentation(parseCodeableConcept(json.getAsJsonObject("unitOfPresentation")));
2589    if (json.has("ingredient")) {
2590      JsonArray array = json.getAsJsonArray("ingredient");
2591      for (int i = 0; i < array.size(); i++) {
2592        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
2593      }
2594    };
2595    if (json.has("device")) {
2596      JsonArray array = json.getAsJsonArray("device");
2597      for (int i = 0; i < array.size(); i++) {
2598        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
2599      }
2600    };
2601    if (json.has("characteristic")) {
2602      JsonArray array = json.getAsJsonArray("characteristic");
2603      for (int i = 0; i < array.size(); i++) {
2604        res.getCharacteristic().add(parseAdministrableProductDefinitionAdministrableProductDefinitionCharacteristicComponent(array.get(i).getAsJsonObject(), res));
2605      }
2606    };
2607    if (json.has("routeOfAdministration")) {
2608      JsonArray array = json.getAsJsonArray("routeOfAdministration");
2609      for (int i = 0; i < array.size(); i++) {
2610        res.getRouteOfAdministration().add(parseAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationComponent(array.get(i).getAsJsonObject(), res));
2611      }
2612    };
2613  }
2614
2615  protected AdministrableProductDefinition.AdministrableProductDefinitionCharacteristicComponent parseAdministrableProductDefinitionAdministrableProductDefinitionCharacteristicComponent(JsonObject json, AdministrableProductDefinition owner) throws IOException, FHIRFormatError {
2616    AdministrableProductDefinition.AdministrableProductDefinitionCharacteristicComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionCharacteristicComponent();
2617    parseAdministrableProductDefinitionAdministrableProductDefinitionCharacteristicComponentProperties(json, owner, res);
2618    return res;
2619  }
2620
2621  protected void parseAdministrableProductDefinitionAdministrableProductDefinitionCharacteristicComponentProperties(JsonObject json, AdministrableProductDefinition owner, AdministrableProductDefinition.AdministrableProductDefinitionCharacteristicComponent res) throws IOException, FHIRFormatError {
2622    parseBackboneElementProperties(json, res);
2623    if (json.has("code"))
2624      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2625    if (json.has("status"))
2626      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
2627  }
2628
2629  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent parseAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationComponent(JsonObject json, AdministrableProductDefinition owner) throws IOException, FHIRFormatError {
2630    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent();
2631    parseAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationComponentProperties(json, owner, res);
2632    return res;
2633  }
2634
2635  protected void parseAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationComponentProperties(JsonObject json, AdministrableProductDefinition owner, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent res) throws IOException, FHIRFormatError {
2636    parseBackboneElementProperties(json, res);
2637    if (json.has("code"))
2638      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2639    if (json.has("firstDose"))
2640      res.setFirstDose(parseQuantity(json.getAsJsonObject("firstDose")));
2641    if (json.has("maxSingleDose"))
2642      res.setMaxSingleDose(parseQuantity(json.getAsJsonObject("maxSingleDose")));
2643    if (json.has("maxDosePerDay"))
2644      res.setMaxDosePerDay(parseQuantity(json.getAsJsonObject("maxDosePerDay")));
2645    if (json.has("maxDosePerTreatmentPeriod"))
2646      res.setMaxDosePerTreatmentPeriod(parseRatio(json.getAsJsonObject("maxDosePerTreatmentPeriod")));
2647    if (json.has("maxTreatmentPeriod"))
2648      res.setMaxTreatmentPeriod(parseDuration(json.getAsJsonObject("maxTreatmentPeriod")));
2649    if (json.has("targetSpecies")) {
2650      JsonArray array = json.getAsJsonArray("targetSpecies");
2651      for (int i = 0; i < array.size(); i++) {
2652        res.getTargetSpecies().add(parseAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(array.get(i).getAsJsonObject(), owner));
2653      }
2654    };
2655  }
2656
2657  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent parseAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(JsonObject json, AdministrableProductDefinition owner) throws IOException, FHIRFormatError {
2658    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent();
2659    parseAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(json, owner, res);
2660    return res;
2661  }
2662
2663  protected void parseAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(JsonObject json, AdministrableProductDefinition owner, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent res) throws IOException, FHIRFormatError {
2664    parseBackboneElementProperties(json, res);
2665    if (json.has("code"))
2666      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2667    if (json.has("withdrawalPeriod")) {
2668      JsonArray array = json.getAsJsonArray("withdrawalPeriod");
2669      for (int i = 0; i < array.size(); i++) {
2670        res.getWithdrawalPeriod().add(parseAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(array.get(i).getAsJsonObject(), owner));
2671      }
2672    };
2673  }
2674
2675  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent parseAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(JsonObject json, AdministrableProductDefinition owner) throws IOException, FHIRFormatError {
2676    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
2677    parseAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(json, owner, res);
2678    return res;
2679  }
2680
2681  protected void parseAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(JsonObject json, AdministrableProductDefinition owner, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res) throws IOException, FHIRFormatError {
2682    parseBackboneElementProperties(json, res);
2683    if (json.has("tissue"))
2684      res.setTissue(parseCodeableConcept(json.getAsJsonObject("tissue")));
2685    if (json.has("value"))
2686      res.setValue(parseQuantity(json.getAsJsonObject("value")));
2687    if (json.has("supportingInformation"))
2688      res.setSupportingInformationElement(parseString(json.get("supportingInformation").getAsString()));
2689    if (json.has("_supportingInformation"))
2690      parseElementProperties(json.getAsJsonObject("_supportingInformation"), res.getSupportingInformationElement());
2691  }
2692
2693  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
2694    AdverseEvent res = new AdverseEvent();
2695    parseAdverseEventProperties(json, res);
2696    return res;
2697  }
2698
2699  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2700    parseDomainResourceProperties(json, res);
2701    if (json.has("identifier")) {
2702      JsonArray array = json.getAsJsonArray("identifier");
2703      for (int i = 0; i < array.size(); i++) {
2704        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2705      }
2706    };
2707    if (json.has("status"))
2708      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), AdverseEvent.AdverseEventStatus.NULL, new AdverseEvent.AdverseEventStatusEnumFactory()));
2709    if (json.has("_status"))
2710      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2711    if (json.has("actuality"))
2712      res.setActualityElement(parseEnumeration(json.get("actuality").getAsString(), AdverseEvent.AdverseEventActuality.NULL, new AdverseEvent.AdverseEventActualityEnumFactory()));
2713    if (json.has("_actuality"))
2714      parseElementProperties(json.getAsJsonObject("_actuality"), res.getActualityElement());
2715    if (json.has("category")) {
2716      JsonArray array = json.getAsJsonArray("category");
2717      for (int i = 0; i < array.size(); i++) {
2718        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2719      }
2720    };
2721    if (json.has("code"))
2722      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2723    if (json.has("subject"))
2724      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2725    if (json.has("encounter"))
2726      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
2727    Type occurrence = parseType("occurrence", json);
2728    if (occurrence != null)
2729      res.setOccurrence(occurrence);
2730    if (json.has("detected"))
2731      res.setDetectedElement(parseDateTime(json.get("detected").getAsString()));
2732    if (json.has("_detected"))
2733      parseElementProperties(json.getAsJsonObject("_detected"), res.getDetectedElement());
2734    if (json.has("recordedDate"))
2735      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2736    if (json.has("_recordedDate"))
2737      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
2738    if (json.has("resultingCondition")) {
2739      JsonArray array = json.getAsJsonArray("resultingCondition");
2740      for (int i = 0; i < array.size(); i++) {
2741        res.getResultingCondition().add(parseReference(array.get(i).getAsJsonObject()));
2742      }
2743    };
2744    if (json.has("location"))
2745      res.setLocation(parseReference(json.getAsJsonObject("location")));
2746    if (json.has("seriousness"))
2747      res.setSeriousness(parseCodeableConcept(json.getAsJsonObject("seriousness")));
2748    if (json.has("outcome"))
2749      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
2750    if (json.has("recorder"))
2751      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
2752    if (json.has("participant")) {
2753      JsonArray array = json.getAsJsonArray("participant");
2754      for (int i = 0; i < array.size(); i++) {
2755        res.getParticipant().add(parseAdverseEventAdverseEventParticipantComponent(array.get(i).getAsJsonObject(), res));
2756      }
2757    };
2758    if (json.has("suspectEntity")) {
2759      JsonArray array = json.getAsJsonArray("suspectEntity");
2760      for (int i = 0; i < array.size(); i++) {
2761        res.getSuspectEntity().add(parseAdverseEventAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject(), res));
2762      }
2763    };
2764    if (json.has("supportingInfo")) {
2765      JsonArray array = json.getAsJsonArray("supportingInfo");
2766      for (int i = 0; i < array.size(); i++) {
2767        res.getSupportingInfo().add(parseAdverseEventAdverseEventSupportingInfoComponent(array.get(i).getAsJsonObject(), res));
2768      }
2769    };
2770    if (json.has("study")) {
2771      JsonArray array = json.getAsJsonArray("study");
2772      for (int i = 0; i < array.size(); i++) {
2773        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
2774      }
2775    };
2776  }
2777
2778  protected AdverseEvent.AdverseEventParticipantComponent parseAdverseEventAdverseEventParticipantComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2779    AdverseEvent.AdverseEventParticipantComponent res = new AdverseEvent.AdverseEventParticipantComponent();
2780    parseAdverseEventAdverseEventParticipantComponentProperties(json, owner, res);
2781    return res;
2782  }
2783
2784  protected void parseAdverseEventAdverseEventParticipantComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventParticipantComponent res) throws IOException, FHIRFormatError {
2785    parseBackboneElementProperties(json, res);
2786    if (json.has("function"))
2787      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
2788    if (json.has("actor"))
2789      res.setActor(parseReference(json.getAsJsonObject("actor")));
2790  }
2791
2792  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventAdverseEventSuspectEntityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2793    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2794    parseAdverseEventAdverseEventSuspectEntityComponentProperties(json, owner, res);
2795    return res;
2796  }
2797
2798  protected void parseAdverseEventAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
2799    parseBackboneElementProperties(json, res);
2800    Type instance = parseType("instance", json);
2801    if (instance != null)
2802      res.setInstance(instance);
2803    if (json.has("causality"))
2804      res.setCausality(parseAdverseEventAdverseEventSuspectEntityCausalityComponent(json.getAsJsonObject("causality"), owner));
2805  }
2806
2807  protected AdverseEvent.AdverseEventSuspectEntityCausalityComponent parseAdverseEventAdverseEventSuspectEntityCausalityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2808    AdverseEvent.AdverseEventSuspectEntityCausalityComponent res = new AdverseEvent.AdverseEventSuspectEntityCausalityComponent();
2809    parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(json, owner, res);
2810    return res;
2811  }
2812
2813  protected void parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res) throws IOException, FHIRFormatError {
2814    parseBackboneElementProperties(json, res);
2815    if (json.has("assessmentMethod"))
2816      res.setAssessmentMethod(parseCodeableConcept(json.getAsJsonObject("assessmentMethod")));
2817    if (json.has("entityRelatedness"))
2818      res.setEntityRelatedness(parseCodeableConcept(json.getAsJsonObject("entityRelatedness")));
2819    if (json.has("author"))
2820      res.setAuthor(parseReference(json.getAsJsonObject("author")));
2821  }
2822
2823  protected AdverseEvent.AdverseEventSupportingInfoComponent parseAdverseEventAdverseEventSupportingInfoComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2824    AdverseEvent.AdverseEventSupportingInfoComponent res = new AdverseEvent.AdverseEventSupportingInfoComponent();
2825    parseAdverseEventAdverseEventSupportingInfoComponentProperties(json, owner, res);
2826    return res;
2827  }
2828
2829  protected void parseAdverseEventAdverseEventSupportingInfoComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSupportingInfoComponent res) throws IOException, FHIRFormatError {
2830    parseBackboneElementProperties(json, res);
2831    if (json.has("item"))
2832      res.setItem(parseReference(json.getAsJsonObject("item")));
2833    if (json.has("contributingFactor"))
2834      res.setContributingFactorElement(parseBoolean(json.get("contributingFactor").getAsBoolean()));
2835    if (json.has("_contributingFactor"))
2836      parseElementProperties(json.getAsJsonObject("_contributingFactor"), res.getContributingFactorElement());
2837  }
2838
2839  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
2840    AllergyIntolerance res = new AllergyIntolerance();
2841    parseAllergyIntoleranceProperties(json, res);
2842    return res;
2843  }
2844
2845  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
2846    parseDomainResourceProperties(json, res);
2847    if (json.has("identifier")) {
2848      JsonArray array = json.getAsJsonArray("identifier");
2849      for (int i = 0; i < array.size(); i++) {
2850        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2851      }
2852    };
2853    if (json.has("clinicalStatus"))
2854      res.setClinicalStatus(parseCodeableConcept(json.getAsJsonObject("clinicalStatus")));
2855    if (json.has("verificationStatus"))
2856      res.setVerificationStatus(parseCodeableConcept(json.getAsJsonObject("verificationStatus")));
2857    if (json.has("type"))
2858      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
2859    if (json.has("_type"))
2860      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2861    if (json.has("category")) {
2862      JsonArray array = json.getAsJsonArray("category");
2863      for (int i = 0; i < array.size(); i++) {
2864        res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2865      }
2866    };
2867    if (json.has("_category")) {
2868      JsonArray array = json.getAsJsonArray("_category");
2869      for (int i = 0; i < array.size(); i++) {
2870        if (i == res.getCategory().size())
2871          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2872        if (array.get(i) instanceof JsonObject) 
2873          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
2874      }
2875    };
2876    if (json.has("criticality"))
2877      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
2878    if (json.has("_criticality"))
2879      parseElementProperties(json.getAsJsonObject("_criticality"), res.getCriticalityElement());
2880    if (json.has("code"))
2881      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2882    if (json.has("patient"))
2883      res.setPatient(parseReference(json.getAsJsonObject("patient")));
2884    if (json.has("encounter"))
2885      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
2886    Type onset = parseType("onset", json);
2887    if (onset != null)
2888      res.setOnset(onset);
2889    if (json.has("recordedDate"))
2890      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2891    if (json.has("_recordedDate"))
2892      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
2893    if (json.has("recorder"))
2894      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
2895    if (json.has("asserter"))
2896      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
2897    if (json.has("lastOccurrence"))
2898      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
2899    if (json.has("_lastOccurrence"))
2900      parseElementProperties(json.getAsJsonObject("_lastOccurrence"), res.getLastOccurrenceElement());
2901    if (json.has("note")) {
2902      JsonArray array = json.getAsJsonArray("note");
2903      for (int i = 0; i < array.size(); i++) {
2904        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2905      }
2906    };
2907    if (json.has("reaction")) {
2908      JsonArray array = json.getAsJsonArray("reaction");
2909      for (int i = 0; i < array.size(); i++) {
2910        res.getReaction().add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject(), res));
2911      }
2912    };
2913  }
2914
2915  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(JsonObject json, AllergyIntolerance owner) throws IOException, FHIRFormatError {
2916    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
2917    parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(json, owner, res);
2918    return res;
2919  }
2920
2921  protected void parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance owner, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
2922    parseBackboneElementProperties(json, res);
2923    if (json.has("substance"))
2924      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
2925    if (json.has("manifestation")) {
2926      JsonArray array = json.getAsJsonArray("manifestation");
2927      for (int i = 0; i < array.size(); i++) {
2928        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2929      }
2930    };
2931    if (json.has("description"))
2932      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2933    if (json.has("_description"))
2934      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2935    if (json.has("onset"))
2936      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
2937    if (json.has("_onset"))
2938      parseElementProperties(json.getAsJsonObject("_onset"), res.getOnsetElement());
2939    if (json.has("severity"))
2940      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
2941    if (json.has("_severity"))
2942      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
2943    if (json.has("exposureRoute"))
2944      res.setExposureRoute(parseCodeableConcept(json.getAsJsonObject("exposureRoute")));
2945    if (json.has("note")) {
2946      JsonArray array = json.getAsJsonArray("note");
2947      for (int i = 0; i < array.size(); i++) {
2948        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2949      }
2950    };
2951  }
2952
2953  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
2954    Appointment res = new Appointment();
2955    parseAppointmentProperties(json, res);
2956    return res;
2957  }
2958
2959  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
2960    parseDomainResourceProperties(json, res);
2961    if (json.has("identifier")) {
2962      JsonArray array = json.getAsJsonArray("identifier");
2963      for (int i = 0; i < array.size(); i++) {
2964        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2965      }
2966    };
2967    if (json.has("status"))
2968      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
2969    if (json.has("_status"))
2970      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2971    if (json.has("cancelationReason"))
2972      res.setCancelationReason(parseCodeableConcept(json.getAsJsonObject("cancelationReason")));
2973    if (json.has("serviceCategory")) {
2974      JsonArray array = json.getAsJsonArray("serviceCategory");
2975      for (int i = 0; i < array.size(); i++) {
2976        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2977      }
2978    };
2979    if (json.has("serviceType")) {
2980      JsonArray array = json.getAsJsonArray("serviceType");
2981      for (int i = 0; i < array.size(); i++) {
2982        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2983      }
2984    };
2985    if (json.has("specialty")) {
2986      JsonArray array = json.getAsJsonArray("specialty");
2987      for (int i = 0; i < array.size(); i++) {
2988        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2989      }
2990    };
2991    if (json.has("appointmentType"))
2992      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
2993    if (json.has("reasonCode")) {
2994      JsonArray array = json.getAsJsonArray("reasonCode");
2995      for (int i = 0; i < array.size(); i++) {
2996        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2997      }
2998    };
2999    if (json.has("reasonReference")) {
3000      JsonArray array = json.getAsJsonArray("reasonReference");
3001      for (int i = 0; i < array.size(); i++) {
3002        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
3003      }
3004    };
3005    if (json.has("priority"))
3006      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
3007    if (json.has("_priority"))
3008      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
3009    if (json.has("description"))
3010      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3011    if (json.has("_description"))
3012      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3013    if (json.has("supportingInformation")) {
3014      JsonArray array = json.getAsJsonArray("supportingInformation");
3015      for (int i = 0; i < array.size(); i++) {
3016        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
3017      }
3018    };
3019    if (json.has("start"))
3020      res.setStartElement(parseInstant(json.get("start").getAsString()));
3021    if (json.has("_start"))
3022      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
3023    if (json.has("end"))
3024      res.setEndElement(parseInstant(json.get("end").getAsString()));
3025    if (json.has("_end"))
3026      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
3027    if (json.has("minutesDuration"))
3028      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
3029    if (json.has("_minutesDuration"))
3030      parseElementProperties(json.getAsJsonObject("_minutesDuration"), res.getMinutesDurationElement());
3031    if (json.has("slot")) {
3032      JsonArray array = json.getAsJsonArray("slot");
3033      for (int i = 0; i < array.size(); i++) {
3034        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
3035      }
3036    };
3037    if (json.has("created"))
3038      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
3039    if (json.has("_created"))
3040      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
3041    if (json.has("comment"))
3042      res.setCommentElement(parseString(json.get("comment").getAsString()));
3043    if (json.has("_comment"))
3044      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
3045    if (json.has("patientInstruction"))
3046      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
3047    if (json.has("_patientInstruction"))
3048      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
3049    if (json.has("basedOn")) {
3050      JsonArray array = json.getAsJsonArray("basedOn");
3051      for (int i = 0; i < array.size(); i++) {
3052        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
3053      }
3054    };
3055    if (json.has("participant")) {
3056      JsonArray array = json.getAsJsonArray("participant");
3057      for (int i = 0; i < array.size(); i++) {
3058        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(array.get(i).getAsJsonObject(), res));
3059      }
3060    };
3061    if (json.has("requestedPeriod")) {
3062      JsonArray array = json.getAsJsonArray("requestedPeriod");
3063      for (int i = 0; i < array.size(); i++) {
3064        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
3065      }
3066    };
3067  }
3068
3069  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(JsonObject json, Appointment owner) throws IOException, FHIRFormatError {
3070    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
3071    parseAppointmentAppointmentParticipantComponentProperties(json, owner, res);
3072    return res;
3073  }
3074
3075  protected void parseAppointmentAppointmentParticipantComponentProperties(JsonObject json, Appointment owner, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
3076    parseBackboneElementProperties(json, res);
3077    if (json.has("type")) {
3078      JsonArray array = json.getAsJsonArray("type");
3079      for (int i = 0; i < array.size(); i++) {
3080        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3081      }
3082    };
3083    if (json.has("actor"))
3084      res.setActor(parseReference(json.getAsJsonObject("actor")));
3085    if (json.has("required"))
3086      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
3087    if (json.has("_required"))
3088      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
3089    if (json.has("status"))
3090      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
3091    if (json.has("_status"))
3092      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3093    if (json.has("period"))
3094      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
3095  }
3096
3097  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
3098    AppointmentResponse res = new AppointmentResponse();
3099    parseAppointmentResponseProperties(json, res);
3100    return res;
3101  }
3102
3103  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
3104    parseDomainResourceProperties(json, res);
3105    if (json.has("identifier")) {
3106      JsonArray array = json.getAsJsonArray("identifier");
3107      for (int i = 0; i < array.size(); i++) {
3108        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3109      }
3110    };
3111    if (json.has("appointment"))
3112      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
3113    if (json.has("start"))
3114      res.setStartElement(parseInstant(json.get("start").getAsString()));
3115    if (json.has("_start"))
3116      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
3117    if (json.has("end"))
3118      res.setEndElement(parseInstant(json.get("end").getAsString()));
3119    if (json.has("_end"))
3120      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
3121    if (json.has("participantType")) {
3122      JsonArray array = json.getAsJsonArray("participantType");
3123      for (int i = 0; i < array.size(); i++) {
3124        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3125      }
3126    };
3127    if (json.has("actor"))
3128      res.setActor(parseReference(json.getAsJsonObject("actor")));
3129    if (json.has("participantStatus"))
3130      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), AppointmentResponse.ParticipantStatus.NULL, new AppointmentResponse.ParticipantStatusEnumFactory()));
3131    if (json.has("_participantStatus"))
3132      parseElementProperties(json.getAsJsonObject("_participantStatus"), res.getParticipantStatusElement());
3133    if (json.has("comment"))
3134      res.setCommentElement(parseString(json.get("comment").getAsString()));
3135    if (json.has("_comment"))
3136      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
3137  }
3138
3139  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
3140    AuditEvent res = new AuditEvent();
3141    parseAuditEventProperties(json, res);
3142    return res;
3143  }
3144
3145  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
3146    parseDomainResourceProperties(json, res);
3147    if (json.has("type"))
3148      res.setType(parseCoding(json.getAsJsonObject("type")));
3149    if (json.has("subtype")) {
3150      JsonArray array = json.getAsJsonArray("subtype");
3151      for (int i = 0; i < array.size(); i++) {
3152        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
3153      }
3154    };
3155    if (json.has("action"))
3156      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
3157    if (json.has("_action"))
3158      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
3159    if (json.has("period"))
3160      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
3161    if (json.has("recorded"))
3162      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
3163    if (json.has("_recorded"))
3164      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
3165    if (json.has("outcome"))
3166      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
3167    if (json.has("_outcome"))
3168      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
3169    if (json.has("outcomeDesc"))
3170      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
3171    if (json.has("_outcomeDesc"))
3172      parseElementProperties(json.getAsJsonObject("_outcomeDesc"), res.getOutcomeDescElement());
3173    if (json.has("purposeOfEvent")) {
3174      JsonArray array = json.getAsJsonArray("purposeOfEvent");
3175      for (int i = 0; i < array.size(); i++) {
3176        res.getPurposeOfEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3177      }
3178    };
3179    if (json.has("agent")) {
3180      JsonArray array = json.getAsJsonArray("agent");
3181      for (int i = 0; i < array.size(); i++) {
3182        res.getAgent().add(parseAuditEventAuditEventAgentComponent(array.get(i).getAsJsonObject(), res));
3183      }
3184    };
3185    if (json.has("source"))
3186      res.setSource(parseAuditEventAuditEventSourceComponent(json.getAsJsonObject("source"), res));
3187    if (json.has("entity")) {
3188      JsonArray array = json.getAsJsonArray("entity");
3189      for (int i = 0; i < array.size(); i++) {
3190        res.getEntity().add(parseAuditEventAuditEventEntityComponent(array.get(i).getAsJsonObject(), res));
3191      }
3192    };
3193  }
3194
3195  protected AuditEvent.AuditEventAgentComponent parseAuditEventAuditEventAgentComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
3196    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
3197    parseAuditEventAuditEventAgentComponentProperties(json, owner, res);
3198    return res;
3199  }
3200
3201  protected void parseAuditEventAuditEventAgentComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
3202    parseBackboneElementProperties(json, res);
3203    if (json.has("type"))
3204      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
3205    if (json.has("role")) {
3206      JsonArray array = json.getAsJsonArray("role");
3207      for (int i = 0; i < array.size(); i++) {
3208        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3209      }
3210    };
3211    if (json.has("who"))
3212      res.setWho(parseReference(json.getAsJsonObject("who")));
3213    if (json.has("altId"))
3214      res.setAltIdElement(parseString(json.get("altId").getAsString()));
3215    if (json.has("_altId"))
3216      parseElementProperties(json.getAsJsonObject("_altId"), res.getAltIdElement());
3217    if (json.has("name"))
3218      res.setNameElement(parseString(json.get("name").getAsString()));
3219    if (json.has("_name"))
3220      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3221    if (json.has("requestor"))
3222      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
3223    if (json.has("_requestor"))
3224      parseElementProperties(json.getAsJsonObject("_requestor"), res.getRequestorElement());
3225    if (json.has("location"))
3226      res.setLocation(parseReference(json.getAsJsonObject("location")));
3227    if (json.has("policy")) {
3228      JsonArray array = json.getAsJsonArray("policy");
3229      for (int i = 0; i < array.size(); i++) {
3230        res.getPolicy().add(parseUri(array.get(i).getAsString()));
3231      }
3232    };
3233    if (json.has("_policy")) {
3234      JsonArray array = json.getAsJsonArray("_policy");
3235      for (int i = 0; i < array.size(); i++) {
3236        if (i == res.getPolicy().size())
3237          res.getPolicy().add(parseUri(null));
3238        if (array.get(i) instanceof JsonObject) 
3239          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
3240      }
3241    };
3242    if (json.has("media"))
3243      res.setMedia(parseCoding(json.getAsJsonObject("media")));
3244    if (json.has("network"))
3245      res.setNetwork(parseAuditEventAuditEventAgentNetworkComponent(json.getAsJsonObject("network"), owner));
3246    if (json.has("purposeOfUse")) {
3247      JsonArray array = json.getAsJsonArray("purposeOfUse");
3248      for (int i = 0; i < array.size(); i++) {
3249        res.getPurposeOfUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3250      }
3251    };
3252  }
3253
3254  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAuditEventAgentNetworkComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
3255    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
3256    parseAuditEventAuditEventAgentNetworkComponentProperties(json, owner, res);
3257    return res;
3258  }
3259
3260  protected void parseAuditEventAuditEventAgentNetworkComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentNetworkComponent res) throws IOException, FHIRFormatError {
3261    parseBackboneElementProperties(json, res);
3262    if (json.has("address"))
3263      res.setAddressElement(parseString(json.get("address").getAsString()));
3264    if (json.has("_address"))
3265      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
3266    if (json.has("type"))
3267      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventAgentNetworkType.NULL, new AuditEvent.AuditEventAgentNetworkTypeEnumFactory()));
3268    if (json.has("_type"))
3269      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3270  }
3271
3272  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
3273    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
3274    parseAuditEventAuditEventSourceComponentProperties(json, owner, res);
3275    return res;
3276  }
3277
3278  protected void parseAuditEventAuditEventSourceComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
3279    parseBackboneElementProperties(json, res);
3280    if (json.has("site"))
3281      res.setSiteElement(parseString(json.get("site").getAsString()));
3282    if (json.has("_site"))
3283      parseElementProperties(json.getAsJsonObject("_site"), res.getSiteElement());
3284    if (json.has("observer"))
3285      res.setObserver(parseReference(json.getAsJsonObject("observer")));
3286    if (json.has("type")) {
3287      JsonArray array = json.getAsJsonArray("type");
3288      for (int i = 0; i < array.size(); i++) {
3289        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
3290      }
3291    };
3292  }
3293
3294  protected AuditEvent.AuditEventEntityComponent parseAuditEventAuditEventEntityComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
3295    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
3296    parseAuditEventAuditEventEntityComponentProperties(json, owner, res);
3297    return res;
3298  }
3299
3300  protected void parseAuditEventAuditEventEntityComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
3301    parseBackboneElementProperties(json, res);
3302    if (json.has("what"))
3303      res.setWhat(parseReference(json.getAsJsonObject("what")));
3304    if (json.has("type"))
3305      res.setType(parseCoding(json.getAsJsonObject("type")));
3306    if (json.has("role"))
3307      res.setRole(parseCoding(json.getAsJsonObject("role")));
3308    if (json.has("lifecycle"))
3309      res.setLifecycle(parseCoding(json.getAsJsonObject("lifecycle")));
3310    if (json.has("securityLabel")) {
3311      JsonArray array = json.getAsJsonArray("securityLabel");
3312      for (int i = 0; i < array.size(); i++) {
3313        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
3314      }
3315    };
3316    if (json.has("name"))
3317      res.setNameElement(parseString(json.get("name").getAsString()));
3318    if (json.has("_name"))
3319      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3320    if (json.has("description"))
3321      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3322    if (json.has("_description"))
3323      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3324    if (json.has("query"))
3325      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
3326    if (json.has("_query"))
3327      parseElementProperties(json.getAsJsonObject("_query"), res.getQueryElement());
3328    if (json.has("detail")) {
3329      JsonArray array = json.getAsJsonArray("detail");
3330      for (int i = 0; i < array.size(); i++) {
3331        res.getDetail().add(parseAuditEventAuditEventEntityDetailComponent(array.get(i).getAsJsonObject(), owner));
3332      }
3333    };
3334  }
3335
3336  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventAuditEventEntityDetailComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
3337    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
3338    parseAuditEventAuditEventEntityDetailComponentProperties(json, owner, res);
3339    return res;
3340  }
3341
3342  protected void parseAuditEventAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
3343    parseBackboneElementProperties(json, res);
3344    if (json.has("type"))
3345      res.setTypeElement(parseString(json.get("type").getAsString()));
3346    if (json.has("_type"))
3347      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3348    Type value = parseType("value", json);
3349    if (value != null)
3350      res.setValue(value);
3351  }
3352
3353  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
3354    Basic res = new Basic();
3355    parseBasicProperties(json, res);
3356    return res;
3357  }
3358
3359  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
3360    parseDomainResourceProperties(json, res);
3361    if (json.has("identifier")) {
3362      JsonArray array = json.getAsJsonArray("identifier");
3363      for (int i = 0; i < array.size(); i++) {
3364        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3365      }
3366    };
3367    if (json.has("code"))
3368      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3369    if (json.has("subject"))
3370      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3371    if (json.has("created"))
3372      res.setCreatedElement(parseDate(json.get("created").getAsString()));
3373    if (json.has("_created"))
3374      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
3375    if (json.has("author"))
3376      res.setAuthor(parseReference(json.getAsJsonObject("author")));
3377  }
3378
3379  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
3380    Binary res = new Binary();
3381    parseBinaryProperties(json, res);
3382    return res;
3383  }
3384
3385  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
3386    parseResourceProperties(json, res);
3387    if (json.has("contentType"))
3388      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
3389    if (json.has("_contentType"))
3390      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
3391    if (json.has("securityContext"))
3392      res.setSecurityContext(parseReference(json.getAsJsonObject("securityContext")));
3393    if (json.has("data"))
3394      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
3395    if (json.has("_data"))
3396      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
3397  }
3398
3399  protected BiologicallyDerivedProduct parseBiologicallyDerivedProduct(JsonObject json) throws IOException, FHIRFormatError {
3400    BiologicallyDerivedProduct res = new BiologicallyDerivedProduct();
3401    parseBiologicallyDerivedProductProperties(json, res);
3402    return res;
3403  }
3404
3405  protected void parseBiologicallyDerivedProductProperties(JsonObject json, BiologicallyDerivedProduct res) throws IOException, FHIRFormatError {
3406    parseDomainResourceProperties(json, res);
3407    if (json.has("identifier")) {
3408      JsonArray array = json.getAsJsonArray("identifier");
3409      for (int i = 0; i < array.size(); i++) {
3410        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3411      }
3412    };
3413    if (json.has("productCategory"))
3414      res.setProductCategoryElement(parseEnumeration(json.get("productCategory").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory()));
3415    if (json.has("_productCategory"))
3416      parseElementProperties(json.getAsJsonObject("_productCategory"), res.getProductCategoryElement());
3417    if (json.has("productCode"))
3418      res.setProductCode(parseCodeableConcept(json.getAsJsonObject("productCode")));
3419    if (json.has("status"))
3420      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory()));
3421    if (json.has("_status"))
3422      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3423    if (json.has("request")) {
3424      JsonArray array = json.getAsJsonArray("request");
3425      for (int i = 0; i < array.size(); i++) {
3426        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
3427      }
3428    };
3429    if (json.has("quantity"))
3430      res.setQuantityElement(parseInteger(json.get("quantity").getAsLong()));
3431    if (json.has("_quantity"))
3432      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
3433    if (json.has("parent")) {
3434      JsonArray array = json.getAsJsonArray("parent");
3435      for (int i = 0; i < array.size(); i++) {
3436        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
3437      }
3438    };
3439    if (json.has("collection"))
3440      res.setCollection(parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(json.getAsJsonObject("collection"), res));
3441    if (json.has("processing")) {
3442      JsonArray array = json.getAsJsonArray("processing");
3443      for (int i = 0; i < array.size(); i++) {
3444        res.getProcessing().add(parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(array.get(i).getAsJsonObject(), res));
3445      }
3446    };
3447    if (json.has("manipulation"))
3448      res.setManipulation(parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(json.getAsJsonObject("manipulation"), res));
3449    if (json.has("storage")) {
3450      JsonArray array = json.getAsJsonArray("storage");
3451      for (int i = 0; i < array.size(); i++) {
3452        res.getStorage().add(parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(array.get(i).getAsJsonObject(), res));
3453      }
3454    };
3455  }
3456
3457  protected BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3458    BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent();
3459    parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(json, owner, res);
3460    return res;
3461  }
3462
3463  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res) throws IOException, FHIRFormatError {
3464    parseBackboneElementProperties(json, res);
3465    if (json.has("collector"))
3466      res.setCollector(parseReference(json.getAsJsonObject("collector")));
3467    if (json.has("source"))
3468      res.setSource(parseReference(json.getAsJsonObject("source")));
3469    Type collected = parseType("collected", json);
3470    if (collected != null)
3471      res.setCollected(collected);
3472  }
3473
3474  protected BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3475    BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent();
3476    parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(json, owner, res);
3477    return res;
3478  }
3479
3480  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res) throws IOException, FHIRFormatError {
3481    parseBackboneElementProperties(json, res);
3482    if (json.has("description"))
3483      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3484    if (json.has("_description"))
3485      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3486    if (json.has("procedure"))
3487      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
3488    if (json.has("additive"))
3489      res.setAdditive(parseReference(json.getAsJsonObject("additive")));
3490    Type time = parseType("time", json);
3491    if (time != null)
3492      res.setTime(time);
3493  }
3494
3495  protected BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3496    BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent();
3497    parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(json, owner, res);
3498    return res;
3499  }
3500
3501  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res) throws IOException, FHIRFormatError {
3502    parseBackboneElementProperties(json, res);
3503    if (json.has("description"))
3504      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3505    if (json.has("_description"))
3506      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3507    Type time = parseType("time", json);
3508    if (time != null)
3509      res.setTime(time);
3510  }
3511
3512  protected BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3513    BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent();
3514    parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(json, owner, res);
3515    return res;
3516  }
3517
3518  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res) throws IOException, FHIRFormatError {
3519    parseBackboneElementProperties(json, res);
3520    if (json.has("description"))
3521      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3522    if (json.has("_description"))
3523      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3524    if (json.has("temperature"))
3525      res.setTemperatureElement(parseDecimal(json.get("temperature").getAsBigDecimal()));
3526    if (json.has("_temperature"))
3527      parseElementProperties(json.getAsJsonObject("_temperature"), res.getTemperatureElement());
3528    if (json.has("scale"))
3529      res.setScaleElement(parseEnumeration(json.get("scale").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory()));
3530    if (json.has("_scale"))
3531      parseElementProperties(json.getAsJsonObject("_scale"), res.getScaleElement());
3532    if (json.has("duration"))
3533      res.setDuration(parsePeriod(json.getAsJsonObject("duration")));
3534  }
3535
3536  protected BodyStructure parseBodyStructure(JsonObject json) throws IOException, FHIRFormatError {
3537    BodyStructure res = new BodyStructure();
3538    parseBodyStructureProperties(json, res);
3539    return res;
3540  }
3541
3542  protected void parseBodyStructureProperties(JsonObject json, BodyStructure res) throws IOException, FHIRFormatError {
3543    parseDomainResourceProperties(json, res);
3544    if (json.has("identifier")) {
3545      JsonArray array = json.getAsJsonArray("identifier");
3546      for (int i = 0; i < array.size(); i++) {
3547        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3548      }
3549    };
3550    if (json.has("active"))
3551      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
3552    if (json.has("_active"))
3553      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
3554    if (json.has("morphology"))
3555      res.setMorphology(parseCodeableConcept(json.getAsJsonObject("morphology")));
3556    if (json.has("location"))
3557      res.setLocation(parseCodeableConcept(json.getAsJsonObject("location")));
3558    if (json.has("locationQualifier")) {
3559      JsonArray array = json.getAsJsonArray("locationQualifier");
3560      for (int i = 0; i < array.size(); i++) {
3561        res.getLocationQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3562      }
3563    };
3564    if (json.has("description"))
3565      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3566    if (json.has("_description"))
3567      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3568    if (json.has("image")) {
3569      JsonArray array = json.getAsJsonArray("image");
3570      for (int i = 0; i < array.size(); i++) {
3571        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
3572      }
3573    };
3574    if (json.has("patient"))
3575      res.setPatient(parseReference(json.getAsJsonObject("patient")));
3576  }
3577
3578  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
3579    Bundle res = new Bundle();
3580    parseBundleProperties(json, res);
3581    return res;
3582  }
3583
3584  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
3585    parseResourceProperties(json, res);
3586    if (json.has("identifier"))
3587      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
3588    if (json.has("type"))
3589      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
3590    if (json.has("_type"))
3591      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3592    if (json.has("timestamp"))
3593      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
3594    if (json.has("_timestamp"))
3595      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
3596    if (json.has("total"))
3597      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
3598    if (json.has("_total"))
3599      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
3600    if (json.has("link")) {
3601      JsonArray array = json.getAsJsonArray("link");
3602      for (int i = 0; i < array.size(); i++) {
3603        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), res));
3604      }
3605    };
3606    if (json.has("entry")) {
3607      JsonArray array = json.getAsJsonArray("entry");
3608      for (int i = 0; i < array.size(); i++) {
3609        res.getEntry().add(parseBundleBundleEntryComponent(array.get(i).getAsJsonObject(), res));
3610      }
3611    };
3612    if (json.has("signature"))
3613      res.setSignature(parseSignature(json.getAsJsonObject("signature")));
3614  }
3615
3616  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3617    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
3618    parseBundleBundleLinkComponentProperties(json, owner, res);
3619    return res;
3620  }
3621
3622  protected void parseBundleBundleLinkComponentProperties(JsonObject json, Bundle owner, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
3623    parseBackboneElementProperties(json, res);
3624    if (json.has("relation"))
3625      res.setRelationElement(parseString(json.get("relation").getAsString()));
3626    if (json.has("_relation"))
3627      parseElementProperties(json.getAsJsonObject("_relation"), res.getRelationElement());
3628    if (json.has("url"))
3629      res.setUrlElement(parseUri(json.get("url").getAsString()));
3630    if (json.has("_url"))
3631      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3632  }
3633
3634  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3635    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
3636    parseBundleBundleEntryComponentProperties(json, owner, res);
3637    return res;
3638  }
3639
3640  protected void parseBundleBundleEntryComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
3641    parseBackboneElementProperties(json, res);
3642    if (json.has("link")) {
3643      JsonArray array = json.getAsJsonArray("link");
3644      for (int i = 0; i < array.size(); i++) {
3645        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), owner));
3646      }
3647    };
3648    if (json.has("fullUrl"))
3649      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
3650    if (json.has("_fullUrl"))
3651      parseElementProperties(json.getAsJsonObject("_fullUrl"), res.getFullUrlElement());
3652    if (json.has("resource"))
3653      res.setResource(parseResource(json.getAsJsonObject("resource")));
3654    if (json.has("search"))
3655      res.setSearch(parseBundleBundleEntrySearchComponent(json.getAsJsonObject("search"), owner));
3656    if (json.has("request"))
3657      res.setRequest(parseBundleBundleEntryRequestComponent(json.getAsJsonObject("request"), owner));
3658    if (json.has("response"))
3659      res.setResponse(parseBundleBundleEntryResponseComponent(json.getAsJsonObject("response"), owner));
3660  }
3661
3662  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3663    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
3664    parseBundleBundleEntrySearchComponentProperties(json, owner, res);
3665    return res;
3666  }
3667
3668  protected void parseBundleBundleEntrySearchComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
3669    parseBackboneElementProperties(json, res);
3670    if (json.has("mode"))
3671      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
3672    if (json.has("_mode"))
3673      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3674    if (json.has("score"))
3675      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
3676    if (json.has("_score"))
3677      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
3678  }
3679
3680  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3681    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
3682    parseBundleBundleEntryRequestComponentProperties(json, owner, res);
3683    return res;
3684  }
3685
3686  protected void parseBundleBundleEntryRequestComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
3687    parseBackboneElementProperties(json, res);
3688    if (json.has("method"))
3689      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
3690    if (json.has("_method"))
3691      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
3692    if (json.has("url"))
3693      res.setUrlElement(parseUri(json.get("url").getAsString()));
3694    if (json.has("_url"))
3695      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3696    if (json.has("ifNoneMatch"))
3697      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
3698    if (json.has("_ifNoneMatch"))
3699      parseElementProperties(json.getAsJsonObject("_ifNoneMatch"), res.getIfNoneMatchElement());
3700    if (json.has("ifModifiedSince"))
3701      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
3702    if (json.has("_ifModifiedSince"))
3703      parseElementProperties(json.getAsJsonObject("_ifModifiedSince"), res.getIfModifiedSinceElement());
3704    if (json.has("ifMatch"))
3705      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
3706    if (json.has("_ifMatch"))
3707      parseElementProperties(json.getAsJsonObject("_ifMatch"), res.getIfMatchElement());
3708    if (json.has("ifNoneExist"))
3709      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
3710    if (json.has("_ifNoneExist"))
3711      parseElementProperties(json.getAsJsonObject("_ifNoneExist"), res.getIfNoneExistElement());
3712  }
3713
3714  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3715    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
3716    parseBundleBundleEntryResponseComponentProperties(json, owner, res);
3717    return res;
3718  }
3719
3720  protected void parseBundleBundleEntryResponseComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
3721    parseBackboneElementProperties(json, res);
3722    if (json.has("status"))
3723      res.setStatusElement(parseString(json.get("status").getAsString()));
3724    if (json.has("_status"))
3725      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3726    if (json.has("location"))
3727      res.setLocationElement(parseUri(json.get("location").getAsString()));
3728    if (json.has("_location"))
3729      parseElementProperties(json.getAsJsonObject("_location"), res.getLocationElement());
3730    if (json.has("etag"))
3731      res.setEtagElement(parseString(json.get("etag").getAsString()));
3732    if (json.has("_etag"))
3733      parseElementProperties(json.getAsJsonObject("_etag"), res.getEtagElement());
3734    if (json.has("lastModified"))
3735      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
3736    if (json.has("_lastModified"))
3737      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
3738    if (json.has("outcome"))
3739      res.setOutcome(parseResource(json.getAsJsonObject("outcome")));
3740  }
3741
3742  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
3743    CapabilityStatement res = new CapabilityStatement();
3744    parseCapabilityStatementProperties(json, res);
3745    return res;
3746  }
3747
3748  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
3749    parseDomainResourceProperties(json, res);
3750    if (json.has("url"))
3751      res.setUrlElement(parseUri(json.get("url").getAsString()));
3752    if (json.has("_url"))
3753      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3754    if (json.has("version"))
3755      res.setVersionElement(parseString(json.get("version").getAsString()));
3756    if (json.has("_version"))
3757      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3758    if (json.has("name"))
3759      res.setNameElement(parseString(json.get("name").getAsString()));
3760    if (json.has("_name"))
3761      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3762    if (json.has("title"))
3763      res.setTitleElement(parseString(json.get("title").getAsString()));
3764    if (json.has("_title"))
3765      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
3766    if (json.has("status"))
3767      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
3768    if (json.has("_status"))
3769      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3770    if (json.has("experimental"))
3771      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3772    if (json.has("_experimental"))
3773      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
3774    if (json.has("date"))
3775      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3776    if (json.has("_date"))
3777      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
3778    if (json.has("publisher"))
3779      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3780    if (json.has("_publisher"))
3781      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
3782    if (json.has("contact")) {
3783      JsonArray array = json.getAsJsonArray("contact");
3784      for (int i = 0; i < array.size(); i++) {
3785        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
3786      }
3787    };
3788    if (json.has("description"))
3789      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3790    if (json.has("_description"))
3791      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3792    if (json.has("useContext")) {
3793      JsonArray array = json.getAsJsonArray("useContext");
3794      for (int i = 0; i < array.size(); i++) {
3795        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
3796      }
3797    };
3798    if (json.has("jurisdiction")) {
3799      JsonArray array = json.getAsJsonArray("jurisdiction");
3800      for (int i = 0; i < array.size(); i++) {
3801        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3802      }
3803    };
3804    if (json.has("purpose"))
3805      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
3806    if (json.has("_purpose"))
3807      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
3808    if (json.has("copyright"))
3809      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
3810    if (json.has("_copyright"))
3811      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
3812    if (json.has("kind"))
3813      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CapabilityStatement.CapabilityStatementKind.NULL, new CapabilityStatement.CapabilityStatementKindEnumFactory()));
3814    if (json.has("_kind"))
3815      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
3816    if (json.has("instantiates")) {
3817      JsonArray array = json.getAsJsonArray("instantiates");
3818      for (int i = 0; i < array.size(); i++) {
3819        res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
3820      }
3821    };
3822    if (json.has("_instantiates")) {
3823      JsonArray array = json.getAsJsonArray("_instantiates");
3824      for (int i = 0; i < array.size(); i++) {
3825        if (i == res.getInstantiates().size())
3826          res.getInstantiates().add(parseCanonical(null));
3827        if (array.get(i) instanceof JsonObject) 
3828          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
3829      }
3830    };
3831    if (json.has("imports")) {
3832      JsonArray array = json.getAsJsonArray("imports");
3833      for (int i = 0; i < array.size(); i++) {
3834        res.getImports().add(parseCanonical(array.get(i).getAsString()));
3835      }
3836    };
3837    if (json.has("_imports")) {
3838      JsonArray array = json.getAsJsonArray("_imports");
3839      for (int i = 0; i < array.size(); i++) {
3840        if (i == res.getImports().size())
3841          res.getImports().add(parseCanonical(null));
3842        if (array.get(i) instanceof JsonObject) 
3843          parseElementProperties(array.get(i).getAsJsonObject(), res.getImports().get(i));
3844      }
3845    };
3846    if (json.has("software"))
3847      res.setSoftware(parseCapabilityStatementCapabilityStatementSoftwareComponent(json.getAsJsonObject("software"), res));
3848    if (json.has("implementation"))
3849      res.setImplementation(parseCapabilityStatementCapabilityStatementImplementationComponent(json.getAsJsonObject("implementation"), res));
3850    if (json.has("fhirVersion"))
3851      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
3852    if (json.has("_fhirVersion"))
3853      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
3854    if (json.has("format")) {
3855      JsonArray array = json.getAsJsonArray("format");
3856      for (int i = 0; i < array.size(); i++) {
3857        res.getFormat().add(parseCode(array.get(i).getAsString()));
3858      }
3859    };
3860    if (json.has("_format")) {
3861      JsonArray array = json.getAsJsonArray("_format");
3862      for (int i = 0; i < array.size(); i++) {
3863        if (i == res.getFormat().size())
3864          res.getFormat().add(parseCode(null));
3865        if (array.get(i) instanceof JsonObject) 
3866          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
3867      }
3868    };
3869    if (json.has("patchFormat")) {
3870      JsonArray array = json.getAsJsonArray("patchFormat");
3871      for (int i = 0; i < array.size(); i++) {
3872        res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
3873      }
3874    };
3875    if (json.has("_patchFormat")) {
3876      JsonArray array = json.getAsJsonArray("_patchFormat");
3877      for (int i = 0; i < array.size(); i++) {
3878        if (i == res.getPatchFormat().size())
3879          res.getPatchFormat().add(parseCode(null));
3880        if (array.get(i) instanceof JsonObject) 
3881          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
3882      }
3883    };
3884    if (json.has("implementationGuide")) {
3885      JsonArray array = json.getAsJsonArray("implementationGuide");
3886      for (int i = 0; i < array.size(); i++) {
3887        res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
3888      }
3889    };
3890    if (json.has("_implementationGuide")) {
3891      JsonArray array = json.getAsJsonArray("_implementationGuide");
3892      for (int i = 0; i < array.size(); i++) {
3893        if (i == res.getImplementationGuide().size())
3894          res.getImplementationGuide().add(parseCanonical(null));
3895        if (array.get(i) instanceof JsonObject) 
3896          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
3897      }
3898    };
3899    if (json.has("rest")) {
3900      JsonArray array = json.getAsJsonArray("rest");
3901      for (int i = 0; i < array.size(); i++) {
3902        res.getRest().add(parseCapabilityStatementCapabilityStatementRestComponent(array.get(i).getAsJsonObject(), res));
3903      }
3904    };
3905    if (json.has("messaging")) {
3906      JsonArray array = json.getAsJsonArray("messaging");
3907      for (int i = 0; i < array.size(); i++) {
3908        res.getMessaging().add(parseCapabilityStatementCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject(), res));
3909      }
3910    };
3911    if (json.has("document")) {
3912      JsonArray array = json.getAsJsonArray("document");
3913      for (int i = 0; i < array.size(); i++) {
3914        res.getDocument().add(parseCapabilityStatementCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject(), res));
3915      }
3916    };
3917  }
3918
3919  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementCapabilityStatementSoftwareComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3920    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
3921    parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(json, owner, res);
3922    return res;
3923  }
3924
3925  protected void parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
3926    parseBackboneElementProperties(json, res);
3927    if (json.has("name"))
3928      res.setNameElement(parseString(json.get("name").getAsString()));
3929    if (json.has("_name"))
3930      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3931    if (json.has("version"))
3932      res.setVersionElement(parseString(json.get("version").getAsString()));
3933    if (json.has("_version"))
3934      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3935    if (json.has("releaseDate"))
3936      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
3937    if (json.has("_releaseDate"))
3938      parseElementProperties(json.getAsJsonObject("_releaseDate"), res.getReleaseDateElement());
3939  }
3940
3941  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementCapabilityStatementImplementationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3942    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
3943    parseCapabilityStatementCapabilityStatementImplementationComponentProperties(json, owner, res);
3944    return res;
3945  }
3946
3947  protected void parseCapabilityStatementCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
3948    parseBackboneElementProperties(json, res);
3949    if (json.has("description"))
3950      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3951    if (json.has("_description"))
3952      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3953    if (json.has("url"))
3954      res.setUrlElement(parseUrl(json.get("url").getAsString()));
3955    if (json.has("_url"))
3956      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3957    if (json.has("custodian"))
3958      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
3959  }
3960
3961  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementCapabilityStatementRestComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3962    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
3963    parseCapabilityStatementCapabilityStatementRestComponentProperties(json, owner, res);
3964    return res;
3965  }
3966
3967  protected void parseCapabilityStatementCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
3968    parseBackboneElementProperties(json, res);
3969    if (json.has("mode"))
3970      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
3971    if (json.has("_mode"))
3972      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3973    if (json.has("documentation"))
3974      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3975    if (json.has("_documentation"))
3976      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3977    if (json.has("security"))
3978      res.setSecurity(parseCapabilityStatementCapabilityStatementRestSecurityComponent(json.getAsJsonObject("security"), owner));
3979    if (json.has("resource")) {
3980      JsonArray array = json.getAsJsonArray("resource");
3981      for (int i = 0; i < array.size(); i++) {
3982        res.getResource().add(parseCapabilityStatementCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject(), owner));
3983      }
3984    };
3985    if (json.has("interaction")) {
3986      JsonArray array = json.getAsJsonArray("interaction");
3987      for (int i = 0; i < array.size(); i++) {
3988        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
3989      }
3990    };
3991    if (json.has("searchParam")) {
3992      JsonArray array = json.getAsJsonArray("searchParam");
3993      for (int i = 0; i < array.size(); i++) {
3994        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3995      }
3996    };
3997    if (json.has("operation")) {
3998      JsonArray array = json.getAsJsonArray("operation");
3999      for (int i = 0; i < array.size(); i++) {
4000        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
4001      }
4002    };
4003    if (json.has("compartment")) {
4004      JsonArray array = json.getAsJsonArray("compartment");
4005      for (int i = 0; i < array.size(); i++) {
4006        res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
4007      }
4008    };
4009    if (json.has("_compartment")) {
4010      JsonArray array = json.getAsJsonArray("_compartment");
4011      for (int i = 0; i < array.size(); i++) {
4012        if (i == res.getCompartment().size())
4013          res.getCompartment().add(parseCanonical(null));
4014        if (array.get(i) instanceof JsonObject) 
4015          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
4016      }
4017    };
4018  }
4019
4020  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementCapabilityStatementRestSecurityComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4021    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
4022    parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(json, owner, res);
4023    return res;
4024  }
4025
4026  protected void parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
4027    parseBackboneElementProperties(json, res);
4028    if (json.has("cors"))
4029      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
4030    if (json.has("_cors"))
4031      parseElementProperties(json.getAsJsonObject("_cors"), res.getCorsElement());
4032    if (json.has("service")) {
4033      JsonArray array = json.getAsJsonArray("service");
4034      for (int i = 0; i < array.size(); i++) {
4035        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4036      }
4037    };
4038    if (json.has("description"))
4039      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4040    if (json.has("_description"))
4041      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4042  }
4043
4044  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementCapabilityStatementRestResourceComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4045    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
4046    parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(json, owner, res);
4047    return res;
4048  }
4049
4050  protected void parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
4051    parseBackboneElementProperties(json, res);
4052    if (json.has("type"))
4053      res.setTypeElement(parseCode(json.get("type").getAsString()));
4054    if (json.has("_type"))
4055      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4056    if (json.has("profile"))
4057      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
4058    if (json.has("_profile"))
4059      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
4060    if (json.has("supportedProfile")) {
4061      JsonArray array = json.getAsJsonArray("supportedProfile");
4062      for (int i = 0; i < array.size(); i++) {
4063        res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
4064      }
4065    };
4066    if (json.has("_supportedProfile")) {
4067      JsonArray array = json.getAsJsonArray("_supportedProfile");
4068      for (int i = 0; i < array.size(); i++) {
4069        if (i == res.getSupportedProfile().size())
4070          res.getSupportedProfile().add(parseCanonical(null));
4071        if (array.get(i) instanceof JsonObject) 
4072          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
4073      }
4074    };
4075    if (json.has("documentation"))
4076      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4077    if (json.has("_documentation"))
4078      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4079    if (json.has("interaction")) {
4080      JsonArray array = json.getAsJsonArray("interaction");
4081      for (int i = 0; i < array.size(); i++) {
4082        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
4083      }
4084    };
4085    if (json.has("versioning"))
4086      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
4087    if (json.has("_versioning"))
4088      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
4089    if (json.has("readHistory"))
4090      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
4091    if (json.has("_readHistory"))
4092      parseElementProperties(json.getAsJsonObject("_readHistory"), res.getReadHistoryElement());
4093    if (json.has("updateCreate"))
4094      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
4095    if (json.has("_updateCreate"))
4096      parseElementProperties(json.getAsJsonObject("_updateCreate"), res.getUpdateCreateElement());
4097    if (json.has("conditionalCreate"))
4098      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
4099    if (json.has("_conditionalCreate"))
4100      parseElementProperties(json.getAsJsonObject("_conditionalCreate"), res.getConditionalCreateElement());
4101    if (json.has("conditionalRead"))
4102      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
4103    if (json.has("_conditionalRead"))
4104      parseElementProperties(json.getAsJsonObject("_conditionalRead"), res.getConditionalReadElement());
4105    if (json.has("conditionalUpdate"))
4106      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
4107    if (json.has("_conditionalUpdate"))
4108      parseElementProperties(json.getAsJsonObject("_conditionalUpdate"), res.getConditionalUpdateElement());
4109    if (json.has("conditionalDelete"))
4110      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
4111    if (json.has("_conditionalDelete"))
4112      parseElementProperties(json.getAsJsonObject("_conditionalDelete"), res.getConditionalDeleteElement());
4113    if (json.has("referencePolicy")) {
4114      JsonArray array = json.getAsJsonArray("referencePolicy");
4115      for (int i = 0; i < array.size(); i++) {
4116        res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
4117      }
4118    };
4119    if (json.has("_referencePolicy")) {
4120      JsonArray array = json.getAsJsonArray("_referencePolicy");
4121      for (int i = 0; i < array.size(); i++) {
4122        if (i == res.getReferencePolicy().size())
4123          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
4124        if (array.get(i) instanceof JsonObject) 
4125          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
4126      }
4127    };
4128    if (json.has("searchInclude")) {
4129      JsonArray array = json.getAsJsonArray("searchInclude");
4130      for (int i = 0; i < array.size(); i++) {
4131        res.getSearchInclude().add(parseString(array.get(i).getAsString()));
4132      }
4133    };
4134    if (json.has("_searchInclude")) {
4135      JsonArray array = json.getAsJsonArray("_searchInclude");
4136      for (int i = 0; i < array.size(); i++) {
4137        if (i == res.getSearchInclude().size())
4138          res.getSearchInclude().add(parseString(null));
4139        if (array.get(i) instanceof JsonObject) 
4140          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
4141      }
4142    };
4143    if (json.has("searchRevInclude")) {
4144      JsonArray array = json.getAsJsonArray("searchRevInclude");
4145      for (int i = 0; i < array.size(); i++) {
4146        res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
4147      }
4148    };
4149    if (json.has("_searchRevInclude")) {
4150      JsonArray array = json.getAsJsonArray("_searchRevInclude");
4151      for (int i = 0; i < array.size(); i++) {
4152        if (i == res.getSearchRevInclude().size())
4153          res.getSearchRevInclude().add(parseString(null));
4154        if (array.get(i) instanceof JsonObject) 
4155          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
4156      }
4157    };
4158    if (json.has("searchParam")) {
4159      JsonArray array = json.getAsJsonArray("searchParam");
4160      for (int i = 0; i < array.size(); i++) {
4161        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
4162      }
4163    };
4164    if (json.has("operation")) {
4165      JsonArray array = json.getAsJsonArray("operation");
4166      for (int i = 0; i < array.size(); i++) {
4167        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
4168      }
4169    };
4170  }
4171
4172  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4173    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
4174    parseCapabilityStatementResourceInteractionComponentProperties(json, owner, res);
4175    return res;
4176  }
4177
4178  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
4179    parseBackboneElementProperties(json, res);
4180    if (json.has("code"))
4181      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
4182    if (json.has("_code"))
4183      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
4184    if (json.has("documentation"))
4185      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4186    if (json.has("_documentation"))
4187      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4188  }
4189
4190  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4191    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
4192    parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(json, owner, res);
4193    return res;
4194  }
4195
4196  protected void parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
4197    parseBackboneElementProperties(json, res);
4198    if (json.has("name"))
4199      res.setNameElement(parseString(json.get("name").getAsString()));
4200    if (json.has("_name"))
4201      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4202    if (json.has("definition"))
4203      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4204    if (json.has("_definition"))
4205      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
4206    if (json.has("type"))
4207      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
4208    if (json.has("_type"))
4209      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4210    if (json.has("documentation"))
4211      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4212    if (json.has("_documentation"))
4213      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4214  }
4215
4216  protected CapabilityStatement.CapabilityStatementRestResourceOperationComponent parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4217    CapabilityStatement.CapabilityStatementRestResourceOperationComponent res = new CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
4218    parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(json, owner, res);
4219    return res;
4220  }
4221
4222  protected void parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceOperationComponent res) throws IOException, FHIRFormatError {
4223    parseBackboneElementProperties(json, res);
4224    if (json.has("name"))
4225      res.setNameElement(parseString(json.get("name").getAsString()));
4226    if (json.has("_name"))
4227      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4228    if (json.has("definition"))
4229      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4230    if (json.has("_definition"))
4231      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
4232    if (json.has("documentation"))
4233      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4234    if (json.has("_documentation"))
4235      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4236  }
4237
4238  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4239    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
4240    parseCapabilityStatementSystemInteractionComponentProperties(json, owner, res);
4241    return res;
4242  }
4243
4244  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
4245    parseBackboneElementProperties(json, res);
4246    if (json.has("code"))
4247      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
4248    if (json.has("_code"))
4249      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
4250    if (json.has("documentation"))
4251      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4252    if (json.has("_documentation"))
4253      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4254  }
4255
4256  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementCapabilityStatementMessagingComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4257    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
4258    parseCapabilityStatementCapabilityStatementMessagingComponentProperties(json, owner, res);
4259    return res;
4260  }
4261
4262  protected void parseCapabilityStatementCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
4263    parseBackboneElementProperties(json, res);
4264    if (json.has("endpoint")) {
4265      JsonArray array = json.getAsJsonArray("endpoint");
4266      for (int i = 0; i < array.size(); i++) {
4267        res.getEndpoint().add(parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject(), owner));
4268      }
4269    };
4270    if (json.has("reliableCache"))
4271      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
4272    if (json.has("_reliableCache"))
4273      parseElementProperties(json.getAsJsonObject("_reliableCache"), res.getReliableCacheElement());
4274    if (json.has("documentation"))
4275      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4276    if (json.has("_documentation"))
4277      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4278    if (json.has("supportedMessage")) {
4279      JsonArray array = json.getAsJsonArray("supportedMessage");
4280      for (int i = 0; i < array.size(); i++) {
4281        res.getSupportedMessage().add(parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject(), owner));
4282      }
4283    };
4284  }
4285
4286  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4287    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
4288    parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(json, owner, res);
4289    return res;
4290  }
4291
4292  protected void parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
4293    parseBackboneElementProperties(json, res);
4294    if (json.has("protocol"))
4295      res.setProtocol(parseCoding(json.getAsJsonObject("protocol")));
4296    if (json.has("address"))
4297      res.setAddressElement(parseUrl(json.get("address").getAsString()));
4298    if (json.has("_address"))
4299      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
4300  }
4301
4302  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4303    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
4304    parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(json, owner, res);
4305    return res;
4306  }
4307
4308  protected void parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
4309    parseBackboneElementProperties(json, res);
4310    if (json.has("mode"))
4311      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
4312    if (json.has("_mode"))
4313      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
4314    if (json.has("definition"))
4315      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4316    if (json.has("_definition"))
4317      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
4318  }
4319
4320  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementCapabilityStatementDocumentComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4321    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
4322    parseCapabilityStatementCapabilityStatementDocumentComponentProperties(json, owner, res);
4323    return res;
4324  }
4325
4326  protected void parseCapabilityStatementCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
4327    parseBackboneElementProperties(json, res);
4328    if (json.has("mode"))
4329      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
4330    if (json.has("_mode"))
4331      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
4332    if (json.has("documentation"))
4333      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4334    if (json.has("_documentation"))
4335      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4336    if (json.has("profile"))
4337      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
4338    if (json.has("_profile"))
4339      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
4340  }
4341
4342  protected CapabilityStatement2 parseCapabilityStatement2(JsonObject json) throws IOException, FHIRFormatError {
4343    CapabilityStatement2 res = new CapabilityStatement2();
4344    parseCapabilityStatement2Properties(json, res);
4345    return res;
4346  }
4347
4348  protected void parseCapabilityStatement2Properties(JsonObject json, CapabilityStatement2 res) throws IOException, FHIRFormatError {
4349    parseDomainResourceProperties(json, res);
4350    if (json.has("url"))
4351      res.setUrlElement(parseUri(json.get("url").getAsString()));
4352    if (json.has("_url"))
4353      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
4354    if (json.has("version"))
4355      res.setVersionElement(parseString(json.get("version").getAsString()));
4356    if (json.has("_version"))
4357      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4358    if (json.has("name"))
4359      res.setNameElement(parseString(json.get("name").getAsString()));
4360    if (json.has("_name"))
4361      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4362    if (json.has("title"))
4363      res.setTitleElement(parseString(json.get("title").getAsString()));
4364    if (json.has("_title"))
4365      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
4366    if (json.has("status"))
4367      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4368    if (json.has("_status"))
4369      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4370    if (json.has("experimental"))
4371      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
4372    if (json.has("_experimental"))
4373      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
4374    if (json.has("date"))
4375      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4376    if (json.has("_date"))
4377      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4378    if (json.has("publisher"))
4379      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
4380    if (json.has("_publisher"))
4381      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
4382    if (json.has("contact")) {
4383      JsonArray array = json.getAsJsonArray("contact");
4384      for (int i = 0; i < array.size(); i++) {
4385        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
4386      }
4387    };
4388    if (json.has("description"))
4389      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4390    if (json.has("_description"))
4391      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4392    if (json.has("useContext")) {
4393      JsonArray array = json.getAsJsonArray("useContext");
4394      for (int i = 0; i < array.size(); i++) {
4395        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
4396      }
4397    };
4398    if (json.has("jurisdiction")) {
4399      JsonArray array = json.getAsJsonArray("jurisdiction");
4400      for (int i = 0; i < array.size(); i++) {
4401        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4402      }
4403    };
4404    if (json.has("purpose"))
4405      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
4406    if (json.has("_purpose"))
4407      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
4408    if (json.has("copyright"))
4409      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
4410    if (json.has("_copyright"))
4411      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
4412    if (json.has("kind"))
4413      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CapabilityStatement2.CapabilityStatement2Kind.NULL, new CapabilityStatement2.CapabilityStatement2KindEnumFactory()));
4414    if (json.has("_kind"))
4415      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
4416    if (json.has("instantiates")) {
4417      JsonArray array = json.getAsJsonArray("instantiates");
4418      for (int i = 0; i < array.size(); i++) {
4419        res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
4420      }
4421    };
4422    if (json.has("_instantiates")) {
4423      JsonArray array = json.getAsJsonArray("_instantiates");
4424      for (int i = 0; i < array.size(); i++) {
4425        if (i == res.getInstantiates().size())
4426          res.getInstantiates().add(parseCanonical(null));
4427        if (array.get(i) instanceof JsonObject) 
4428          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
4429      }
4430    };
4431    if (json.has("imports")) {
4432      JsonArray array = json.getAsJsonArray("imports");
4433      for (int i = 0; i < array.size(); i++) {
4434        res.getImports().add(parseCanonical(array.get(i).getAsString()));
4435      }
4436    };
4437    if (json.has("_imports")) {
4438      JsonArray array = json.getAsJsonArray("_imports");
4439      for (int i = 0; i < array.size(); i++) {
4440        if (i == res.getImports().size())
4441          res.getImports().add(parseCanonical(null));
4442        if (array.get(i) instanceof JsonObject) 
4443          parseElementProperties(array.get(i).getAsJsonObject(), res.getImports().get(i));
4444      }
4445    };
4446    if (json.has("software"))
4447      res.setSoftware(parseCapabilityStatement2CapabilityStatement2SoftwareComponent(json.getAsJsonObject("software"), res));
4448    if (json.has("implementation"))
4449      res.setImplementation(parseCapabilityStatement2CapabilityStatement2ImplementationComponent(json.getAsJsonObject("implementation"), res));
4450    if (json.has("fhirVersion"))
4451      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
4452    if (json.has("_fhirVersion"))
4453      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
4454    if (json.has("format")) {
4455      JsonArray array = json.getAsJsonArray("format");
4456      for (int i = 0; i < array.size(); i++) {
4457        res.getFormat().add(parseCode(array.get(i).getAsString()));
4458      }
4459    };
4460    if (json.has("_format")) {
4461      JsonArray array = json.getAsJsonArray("_format");
4462      for (int i = 0; i < array.size(); i++) {
4463        if (i == res.getFormat().size())
4464          res.getFormat().add(parseCode(null));
4465        if (array.get(i) instanceof JsonObject) 
4466          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
4467      }
4468    };
4469    if (json.has("patchFormat")) {
4470      JsonArray array = json.getAsJsonArray("patchFormat");
4471      for (int i = 0; i < array.size(); i++) {
4472        res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
4473      }
4474    };
4475    if (json.has("_patchFormat")) {
4476      JsonArray array = json.getAsJsonArray("_patchFormat");
4477      for (int i = 0; i < array.size(); i++) {
4478        if (i == res.getPatchFormat().size())
4479          res.getPatchFormat().add(parseCode(null));
4480        if (array.get(i) instanceof JsonObject) 
4481          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
4482      }
4483    };
4484    if (json.has("implementationGuide")) {
4485      JsonArray array = json.getAsJsonArray("implementationGuide");
4486      for (int i = 0; i < array.size(); i++) {
4487        res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
4488      }
4489    };
4490    if (json.has("_implementationGuide")) {
4491      JsonArray array = json.getAsJsonArray("_implementationGuide");
4492      for (int i = 0; i < array.size(); i++) {
4493        if (i == res.getImplementationGuide().size())
4494          res.getImplementationGuide().add(parseCanonical(null));
4495        if (array.get(i) instanceof JsonObject) 
4496          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
4497      }
4498    };
4499    if (json.has("rest")) {
4500      JsonArray array = json.getAsJsonArray("rest");
4501      for (int i = 0; i < array.size(); i++) {
4502        res.getRest().add(parseCapabilityStatement2CapabilityStatement2RestComponent(array.get(i).getAsJsonObject(), res));
4503      }
4504    };
4505  }
4506
4507  protected CapabilityStatement2.CapabilityStatement2SoftwareComponent parseCapabilityStatement2CapabilityStatement2SoftwareComponent(JsonObject json, CapabilityStatement2 owner) throws IOException, FHIRFormatError {
4508    CapabilityStatement2.CapabilityStatement2SoftwareComponent res = new CapabilityStatement2.CapabilityStatement2SoftwareComponent();
4509    parseCapabilityStatement2CapabilityStatement2SoftwareComponentProperties(json, owner, res);
4510    return res;
4511  }
4512
4513  protected void parseCapabilityStatement2CapabilityStatement2SoftwareComponentProperties(JsonObject json, CapabilityStatement2 owner, CapabilityStatement2.CapabilityStatement2SoftwareComponent res) throws IOException, FHIRFormatError {
4514    parseBackboneElementProperties(json, res);
4515    if (json.has("name"))
4516      res.setNameElement(parseString(json.get("name").getAsString()));
4517    if (json.has("_name"))
4518      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4519    if (json.has("version"))
4520      res.setVersionElement(parseString(json.get("version").getAsString()));
4521    if (json.has("_version"))
4522      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4523    if (json.has("releaseDate"))
4524      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
4525    if (json.has("_releaseDate"))
4526      parseElementProperties(json.getAsJsonObject("_releaseDate"), res.getReleaseDateElement());
4527  }
4528
4529  protected CapabilityStatement2.CapabilityStatement2ImplementationComponent parseCapabilityStatement2CapabilityStatement2ImplementationComponent(JsonObject json, CapabilityStatement2 owner) throws IOException, FHIRFormatError {
4530    CapabilityStatement2.CapabilityStatement2ImplementationComponent res = new CapabilityStatement2.CapabilityStatement2ImplementationComponent();
4531    parseCapabilityStatement2CapabilityStatement2ImplementationComponentProperties(json, owner, res);
4532    return res;
4533  }
4534
4535  protected void parseCapabilityStatement2CapabilityStatement2ImplementationComponentProperties(JsonObject json, CapabilityStatement2 owner, CapabilityStatement2.CapabilityStatement2ImplementationComponent res) throws IOException, FHIRFormatError {
4536    parseBackboneElementProperties(json, res);
4537    if (json.has("description"))
4538      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4539    if (json.has("_description"))
4540      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4541    if (json.has("url"))
4542      res.setUrlElement(parseUrl(json.get("url").getAsString()));
4543    if (json.has("_url"))
4544      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
4545    if (json.has("custodian"))
4546      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
4547  }
4548
4549  protected CapabilityStatement2.CapabilityStatement2RestComponent parseCapabilityStatement2CapabilityStatement2RestComponent(JsonObject json, CapabilityStatement2 owner) throws IOException, FHIRFormatError {
4550    CapabilityStatement2.CapabilityStatement2RestComponent res = new CapabilityStatement2.CapabilityStatement2RestComponent();
4551    parseCapabilityStatement2CapabilityStatement2RestComponentProperties(json, owner, res);
4552    return res;
4553  }
4554
4555  protected void parseCapabilityStatement2CapabilityStatement2RestComponentProperties(JsonObject json, CapabilityStatement2 owner, CapabilityStatement2.CapabilityStatement2RestComponent res) throws IOException, FHIRFormatError {
4556    parseBackboneElementProperties(json, res);
4557    if (json.has("mode"))
4558      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement2.RestfulCapabilityMode.NULL, new CapabilityStatement2.RestfulCapabilityModeEnumFactory()));
4559    if (json.has("_mode"))
4560      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
4561    if (json.has("documentation"))
4562      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4563    if (json.has("_documentation"))
4564      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4565    if (json.has("resource")) {
4566      JsonArray array = json.getAsJsonArray("resource");
4567      for (int i = 0; i < array.size(); i++) {
4568        res.getResource().add(parseCapabilityStatement2CapabilityStatement2RestResourceComponent(array.get(i).getAsJsonObject(), owner));
4569      }
4570    };
4571    if (json.has("interaction")) {
4572      JsonArray array = json.getAsJsonArray("interaction");
4573      for (int i = 0; i < array.size(); i++) {
4574        res.getInteraction().add(parseCapabilityStatement2SystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
4575      }
4576    };
4577    if (json.has("searchParam")) {
4578      JsonArray array = json.getAsJsonArray("searchParam");
4579      for (int i = 0; i < array.size(); i++) {
4580        res.getSearchParam().add(parseCapabilityStatement2CapabilityStatement2RestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
4581      }
4582    };
4583    if (json.has("operation")) {
4584      JsonArray array = json.getAsJsonArray("operation");
4585      for (int i = 0; i < array.size(); i++) {
4586        res.getOperation().add(parseCapabilityStatement2CapabilityStatement2RestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
4587      }
4588    };
4589    if (json.has("compartment")) {
4590      JsonArray array = json.getAsJsonArray("compartment");
4591      for (int i = 0; i < array.size(); i++) {
4592        res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
4593      }
4594    };
4595    if (json.has("_compartment")) {
4596      JsonArray array = json.getAsJsonArray("_compartment");
4597      for (int i = 0; i < array.size(); i++) {
4598        if (i == res.getCompartment().size())
4599          res.getCompartment().add(parseCanonical(null));
4600        if (array.get(i) instanceof JsonObject) 
4601          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
4602      }
4603    };
4604  }
4605
4606  protected CapabilityStatement2.CapabilityStatement2RestResourceComponent parseCapabilityStatement2CapabilityStatement2RestResourceComponent(JsonObject json, CapabilityStatement2 owner) throws IOException, FHIRFormatError {
4607    CapabilityStatement2.CapabilityStatement2RestResourceComponent res = new CapabilityStatement2.CapabilityStatement2RestResourceComponent();
4608    parseCapabilityStatement2CapabilityStatement2RestResourceComponentProperties(json, owner, res);
4609    return res;
4610  }
4611
4612  protected void parseCapabilityStatement2CapabilityStatement2RestResourceComponentProperties(JsonObject json, CapabilityStatement2 owner, CapabilityStatement2.CapabilityStatement2RestResourceComponent res) throws IOException, FHIRFormatError {
4613    parseBackboneElementProperties(json, res);
4614    if (json.has("type"))
4615      res.setTypeElement(parseCode(json.get("type").getAsString()));
4616    if (json.has("_type"))
4617      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4618    if (json.has("profile"))
4619      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
4620    if (json.has("_profile"))
4621      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
4622    if (json.has("supportedProfile")) {
4623      JsonArray array = json.getAsJsonArray("supportedProfile");
4624      for (int i = 0; i < array.size(); i++) {
4625        res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
4626      }
4627    };
4628    if (json.has("_supportedProfile")) {
4629      JsonArray array = json.getAsJsonArray("_supportedProfile");
4630      for (int i = 0; i < array.size(); i++) {
4631        if (i == res.getSupportedProfile().size())
4632          res.getSupportedProfile().add(parseCanonical(null));
4633        if (array.get(i) instanceof JsonObject) 
4634          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
4635      }
4636    };
4637    if (json.has("documentation"))
4638      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4639    if (json.has("_documentation"))
4640      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4641    if (json.has("interaction")) {
4642      JsonArray array = json.getAsJsonArray("interaction");
4643      for (int i = 0; i < array.size(); i++) {
4644        res.getInteraction().add(parseCapabilityStatement2ResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
4645      }
4646    };
4647    if (json.has("searchParam")) {
4648      JsonArray array = json.getAsJsonArray("searchParam");
4649      for (int i = 0; i < array.size(); i++) {
4650        res.getSearchParam().add(parseCapabilityStatement2CapabilityStatement2RestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
4651      }
4652    };
4653    if (json.has("operation")) {
4654      JsonArray array = json.getAsJsonArray("operation");
4655      for (int i = 0; i < array.size(); i++) {
4656        res.getOperation().add(parseCapabilityStatement2CapabilityStatement2RestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
4657      }
4658    };
4659  }
4660
4661  protected CapabilityStatement2.ResourceInteractionComponent parseCapabilityStatement2ResourceInteractionComponent(JsonObject json, CapabilityStatement2 owner) throws IOException, FHIRFormatError {
4662    CapabilityStatement2.ResourceInteractionComponent res = new CapabilityStatement2.ResourceInteractionComponent();
4663    parseCapabilityStatement2ResourceInteractionComponentProperties(json, owner, res);
4664    return res;
4665  }
4666
4667  protected void parseCapabilityStatement2ResourceInteractionComponentProperties(JsonObject json, CapabilityStatement2 owner, CapabilityStatement2.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
4668    parseBackboneElementProperties(json, res);
4669    if (json.has("code"))
4670      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement2.TypeRestfulInteraction.NULL, new CapabilityStatement2.TypeRestfulInteractionEnumFactory()));
4671    if (json.has("_code"))
4672      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
4673    if (json.has("documentation"))
4674      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4675    if (json.has("_documentation"))
4676      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4677  }
4678
4679  protected CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent parseCapabilityStatement2CapabilityStatement2RestResourceSearchParamComponent(JsonObject json, CapabilityStatement2 owner) throws IOException, FHIRFormatError {
4680    CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent res = new CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent();
4681    parseCapabilityStatement2CapabilityStatement2RestResourceSearchParamComponentProperties(json, owner, res);
4682    return res;
4683  }
4684
4685  protected void parseCapabilityStatement2CapabilityStatement2RestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement2 owner, CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
4686    parseBackboneElementProperties(json, res);
4687    if (json.has("name"))
4688      res.setNameElement(parseString(json.get("name").getAsString()));
4689    if (json.has("_name"))
4690      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4691    if (json.has("definition"))
4692      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4693    if (json.has("_definition"))
4694      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
4695    if (json.has("type"))
4696      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
4697    if (json.has("_type"))
4698      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4699    if (json.has("documentation"))
4700      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4701    if (json.has("_documentation"))
4702      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4703  }
4704
4705  protected CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent parseCapabilityStatement2CapabilityStatement2RestResourceOperationComponent(JsonObject json, CapabilityStatement2 owner) throws IOException, FHIRFormatError {
4706    CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent res = new CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent();
4707    parseCapabilityStatement2CapabilityStatement2RestResourceOperationComponentProperties(json, owner, res);
4708    return res;
4709  }
4710
4711  protected void parseCapabilityStatement2CapabilityStatement2RestResourceOperationComponentProperties(JsonObject json, CapabilityStatement2 owner, CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent res) throws IOException, FHIRFormatError {
4712    parseBackboneElementProperties(json, res);
4713    if (json.has("name"))
4714      res.setNameElement(parseString(json.get("name").getAsString()));
4715    if (json.has("_name"))
4716      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4717    if (json.has("definition"))
4718      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4719    if (json.has("_definition"))
4720      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
4721    if (json.has("documentation"))
4722      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4723    if (json.has("_documentation"))
4724      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4725  }
4726
4727  protected CapabilityStatement2.SystemInteractionComponent parseCapabilityStatement2SystemInteractionComponent(JsonObject json, CapabilityStatement2 owner) throws IOException, FHIRFormatError {
4728    CapabilityStatement2.SystemInteractionComponent res = new CapabilityStatement2.SystemInteractionComponent();
4729    parseCapabilityStatement2SystemInteractionComponentProperties(json, owner, res);
4730    return res;
4731  }
4732
4733  protected void parseCapabilityStatement2SystemInteractionComponentProperties(JsonObject json, CapabilityStatement2 owner, CapabilityStatement2.SystemInteractionComponent res) throws IOException, FHIRFormatError {
4734    parseBackboneElementProperties(json, res);
4735    if (json.has("code"))
4736      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement2.SystemRestfulInteraction.NULL, new CapabilityStatement2.SystemRestfulInteractionEnumFactory()));
4737    if (json.has("_code"))
4738      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
4739    if (json.has("documentation"))
4740      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4741    if (json.has("_documentation"))
4742      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4743  }
4744
4745  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
4746    CarePlan res = new CarePlan();
4747    parseCarePlanProperties(json, res);
4748    return res;
4749  }
4750
4751  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
4752    parseDomainResourceProperties(json, res);
4753    if (json.has("identifier")) {
4754      JsonArray array = json.getAsJsonArray("identifier");
4755      for (int i = 0; i < array.size(); i++) {
4756        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4757      }
4758    };
4759    if (json.has("instantiatesCanonical")) {
4760      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
4761      for (int i = 0; i < array.size(); i++) {
4762        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
4763      }
4764    };
4765    if (json.has("_instantiatesCanonical")) {
4766      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
4767      for (int i = 0; i < array.size(); i++) {
4768        if (i == res.getInstantiatesCanonical().size())
4769          res.getInstantiatesCanonical().add(parseCanonical(null));
4770        if (array.get(i) instanceof JsonObject) 
4771          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4772      }
4773    };
4774    if (json.has("instantiatesUri")) {
4775      JsonArray array = json.getAsJsonArray("instantiatesUri");
4776      for (int i = 0; i < array.size(); i++) {
4777        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4778      }
4779    };
4780    if (json.has("_instantiatesUri")) {
4781      JsonArray array = json.getAsJsonArray("_instantiatesUri");
4782      for (int i = 0; i < array.size(); i++) {
4783        if (i == res.getInstantiatesUri().size())
4784          res.getInstantiatesUri().add(parseUri(null));
4785        if (array.get(i) instanceof JsonObject) 
4786          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4787      }
4788    };
4789    if (json.has("basedOn")) {
4790      JsonArray array = json.getAsJsonArray("basedOn");
4791      for (int i = 0; i < array.size(); i++) {
4792        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
4793      }
4794    };
4795    if (json.has("replaces")) {
4796      JsonArray array = json.getAsJsonArray("replaces");
4797      for (int i = 0; i < array.size(); i++) {
4798        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
4799      }
4800    };
4801    if (json.has("partOf")) {
4802      JsonArray array = json.getAsJsonArray("partOf");
4803      for (int i = 0; i < array.size(); i++) {
4804        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4805      }
4806    };
4807    if (json.has("status"))
4808      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanStatus.NULL, new CarePlan.CarePlanStatusEnumFactory()));
4809    if (json.has("_status"))
4810      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4811    if (json.has("intent"))
4812      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
4813    if (json.has("_intent"))
4814      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
4815    if (json.has("category")) {
4816      JsonArray array = json.getAsJsonArray("category");
4817      for (int i = 0; i < array.size(); i++) {
4818        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4819      }
4820    };
4821    if (json.has("title"))
4822      res.setTitleElement(parseString(json.get("title").getAsString()));
4823    if (json.has("_title"))
4824      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
4825    if (json.has("description"))
4826      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4827    if (json.has("_description"))
4828      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4829    if (json.has("subject"))
4830      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4831    if (json.has("encounter"))
4832      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
4833    if (json.has("period"))
4834      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
4835    if (json.has("created"))
4836      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4837    if (json.has("_created"))
4838      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
4839    if (json.has("author"))
4840      res.setAuthor(parseReference(json.getAsJsonObject("author")));
4841    if (json.has("contributor")) {
4842      JsonArray array = json.getAsJsonArray("contributor");
4843      for (int i = 0; i < array.size(); i++) {
4844        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
4845      }
4846    };
4847    if (json.has("careTeam")) {
4848      JsonArray array = json.getAsJsonArray("careTeam");
4849      for (int i = 0; i < array.size(); i++) {
4850        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
4851      }
4852    };
4853    if (json.has("addressesCode")) {
4854      JsonArray array = json.getAsJsonArray("addressesCode");
4855      for (int i = 0; i < array.size(); i++) {
4856        res.getAddressesCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4857      }
4858    };
4859    if (json.has("addressesReference")) {
4860      JsonArray array = json.getAsJsonArray("addressesReference");
4861      for (int i = 0; i < array.size(); i++) {
4862        res.getAddressesReference().add(parseReference(array.get(i).getAsJsonObject()));
4863      }
4864    };
4865    if (json.has("supportingInfo")) {
4866      JsonArray array = json.getAsJsonArray("supportingInfo");
4867      for (int i = 0; i < array.size(); i++) {
4868        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
4869      }
4870    };
4871    if (json.has("goal")) {
4872      JsonArray array = json.getAsJsonArray("goal");
4873      for (int i = 0; i < array.size(); i++) {
4874        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4875      }
4876    };
4877    if (json.has("activity")) {
4878      JsonArray array = json.getAsJsonArray("activity");
4879      for (int i = 0; i < array.size(); i++) {
4880        res.getActivity().add(parseCarePlanCarePlanActivityComponent(array.get(i).getAsJsonObject(), res));
4881      }
4882    };
4883    if (json.has("note")) {
4884      JsonArray array = json.getAsJsonArray("note");
4885      for (int i = 0; i < array.size(); i++) {
4886        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4887      }
4888    };
4889  }
4890
4891  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
4892    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
4893    parseCarePlanCarePlanActivityComponentProperties(json, owner, res);
4894    return res;
4895  }
4896
4897  protected void parseCarePlanCarePlanActivityComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
4898    parseBackboneElementProperties(json, res);
4899    if (json.has("outcomeCodeableConcept")) {
4900      JsonArray array = json.getAsJsonArray("outcomeCodeableConcept");
4901      for (int i = 0; i < array.size(); i++) {
4902        res.getOutcomeCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4903      }
4904    };
4905    if (json.has("outcomeReference")) {
4906      JsonArray array = json.getAsJsonArray("outcomeReference");
4907      for (int i = 0; i < array.size(); i++) {
4908        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
4909      }
4910    };
4911    if (json.has("progress")) {
4912      JsonArray array = json.getAsJsonArray("progress");
4913      for (int i = 0; i < array.size(); i++) {
4914        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
4915      }
4916    };
4917    if (json.has("reference"))
4918      res.setReference(parseReference(json.getAsJsonObject("reference")));
4919    if (json.has("detail"))
4920      res.setDetail(parseCarePlanCarePlanActivityDetailComponent(json.getAsJsonObject("detail"), owner));
4921  }
4922
4923  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
4924    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
4925    parseCarePlanCarePlanActivityDetailComponentProperties(json, owner, res);
4926    return res;
4927  }
4928
4929  protected void parseCarePlanCarePlanActivityDetailComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityDetailComponent res) throws IOException, FHIRFormatError {
4930    parseBackboneElementProperties(json, res);
4931    if (json.has("kind"))
4932      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CarePlan.CarePlanActivityKind.NULL, new CarePlan.CarePlanActivityKindEnumFactory()));
4933    if (json.has("_kind"))
4934      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
4935    if (json.has("instantiatesCanonical")) {
4936      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
4937      for (int i = 0; i < array.size(); i++) {
4938        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
4939      }
4940    };
4941    if (json.has("_instantiatesCanonical")) {
4942      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
4943      for (int i = 0; i < array.size(); i++) {
4944        if (i == res.getInstantiatesCanonical().size())
4945          res.getInstantiatesCanonical().add(parseCanonical(null));
4946        if (array.get(i) instanceof JsonObject) 
4947          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4948      }
4949    };
4950    if (json.has("instantiatesUri")) {
4951      JsonArray array = json.getAsJsonArray("instantiatesUri");
4952      for (int i = 0; i < array.size(); i++) {
4953        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4954      }
4955    };
4956    if (json.has("_instantiatesUri")) {
4957      JsonArray array = json.getAsJsonArray("_instantiatesUri");
4958      for (int i = 0; i < array.size(); i++) {
4959        if (i == res.getInstantiatesUri().size())
4960          res.getInstantiatesUri().add(parseUri(null));
4961        if (array.get(i) instanceof JsonObject) 
4962          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4963      }
4964    };
4965    if (json.has("code"))
4966      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4967    if (json.has("reasonCode")) {
4968      JsonArray array = json.getAsJsonArray("reasonCode");
4969      for (int i = 0; i < array.size(); i++) {
4970        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4971      }
4972    };
4973    if (json.has("reasonReference")) {
4974      JsonArray array = json.getAsJsonArray("reasonReference");
4975      for (int i = 0; i < array.size(); i++) {
4976        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4977      }
4978    };
4979    if (json.has("goal")) {
4980      JsonArray array = json.getAsJsonArray("goal");
4981      for (int i = 0; i < array.size(); i++) {
4982        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4983      }
4984    };
4985    if (json.has("status"))
4986      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
4987    if (json.has("_status"))
4988      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4989    if (json.has("statusReason"))
4990      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
4991    if (json.has("doNotPerform"))
4992      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
4993    if (json.has("_doNotPerform"))
4994      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
4995    Type scheduled = parseType("scheduled", json);
4996    if (scheduled != null)
4997      res.setScheduled(scheduled);
4998    if (json.has("location"))
4999      res.setLocation(parseReference(json.getAsJsonObject("location")));
5000    Type reported = parseType("reported", json);
5001    if (reported != null)
5002      res.setReported(reported);
5003    if (json.has("performer")) {
5004      JsonArray array = json.getAsJsonArray("performer");
5005      for (int i = 0; i < array.size(); i++) {
5006        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
5007      }
5008    };
5009    Type product = parseType("product", json);
5010    if (product != null)
5011      res.setProduct(product);
5012    if (json.has("dailyAmount"))
5013      res.setDailyAmount(parseQuantity(json.getAsJsonObject("dailyAmount")));
5014    if (json.has("quantity"))
5015      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5016    if (json.has("description"))
5017      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5018    if (json.has("_description"))
5019      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5020  }
5021
5022  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
5023    CareTeam res = new CareTeam();
5024    parseCareTeamProperties(json, res);
5025    return res;
5026  }
5027
5028  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
5029    parseDomainResourceProperties(json, res);
5030    if (json.has("identifier")) {
5031      JsonArray array = json.getAsJsonArray("identifier");
5032      for (int i = 0; i < array.size(); i++) {
5033        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5034      }
5035    };
5036    if (json.has("status"))
5037      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
5038    if (json.has("_status"))
5039      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5040    if (json.has("category")) {
5041      JsonArray array = json.getAsJsonArray("category");
5042      for (int i = 0; i < array.size(); i++) {
5043        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5044      }
5045    };
5046    if (json.has("name"))
5047      res.setNameElement(parseString(json.get("name").getAsString()));
5048    if (json.has("_name"))
5049      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5050    if (json.has("subject"))
5051      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5052    if (json.has("period"))
5053      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5054    if (json.has("participant")) {
5055      JsonArray array = json.getAsJsonArray("participant");
5056      for (int i = 0; i < array.size(); i++) {
5057        res.getParticipant().add(parseCareTeamCareTeamParticipantComponent(array.get(i).getAsJsonObject(), res));
5058      }
5059    };
5060    if (json.has("reasonCode")) {
5061      JsonArray array = json.getAsJsonArray("reasonCode");
5062      for (int i = 0; i < array.size(); i++) {
5063        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5064      }
5065    };
5066    if (json.has("reasonReference")) {
5067      JsonArray array = json.getAsJsonArray("reasonReference");
5068      for (int i = 0; i < array.size(); i++) {
5069        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
5070      }
5071    };
5072    if (json.has("managingOrganization")) {
5073      JsonArray array = json.getAsJsonArray("managingOrganization");
5074      for (int i = 0; i < array.size(); i++) {
5075        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
5076      }
5077    };
5078    if (json.has("telecom")) {
5079      JsonArray array = json.getAsJsonArray("telecom");
5080      for (int i = 0; i < array.size(); i++) {
5081        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
5082      }
5083    };
5084    if (json.has("note")) {
5085      JsonArray array = json.getAsJsonArray("note");
5086      for (int i = 0; i < array.size(); i++) {
5087        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5088      }
5089    };
5090  }
5091
5092  protected CareTeam.CareTeamParticipantComponent parseCareTeamCareTeamParticipantComponent(JsonObject json, CareTeam owner) throws IOException, FHIRFormatError {
5093    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
5094    parseCareTeamCareTeamParticipantComponentProperties(json, owner, res);
5095    return res;
5096  }
5097
5098  protected void parseCareTeamCareTeamParticipantComponentProperties(JsonObject json, CareTeam owner, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
5099    parseBackboneElementProperties(json, res);
5100    if (json.has("role"))
5101      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
5102    if (json.has("member"))
5103      res.setMember(parseReference(json.getAsJsonObject("member")));
5104    if (json.has("onBehalfOf"))
5105      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
5106    Type coverage = parseType("coverage", json);
5107    if (coverage != null)
5108      res.setCoverage(coverage);
5109  }
5110
5111  protected CatalogEntry parseCatalogEntry(JsonObject json) throws IOException, FHIRFormatError {
5112    CatalogEntry res = new CatalogEntry();
5113    parseCatalogEntryProperties(json, res);
5114    return res;
5115  }
5116
5117  protected void parseCatalogEntryProperties(JsonObject json, CatalogEntry res) throws IOException, FHIRFormatError {
5118    parseDomainResourceProperties(json, res);
5119    if (json.has("identifier")) {
5120      JsonArray array = json.getAsJsonArray("identifier");
5121      for (int i = 0; i < array.size(); i++) {
5122        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5123      }
5124    };
5125    if (json.has("name"))
5126      res.setNameElement(parseString(json.get("name").getAsString()));
5127    if (json.has("_name"))
5128      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5129    if (json.has("type"))
5130      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CatalogEntry.CatalogEntryType.NULL, new CatalogEntry.CatalogEntryTypeEnumFactory()));
5131    if (json.has("_type"))
5132      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
5133    if (json.has("status"))
5134      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CatalogEntry.CatalogEntryStatus.NULL, new CatalogEntry.CatalogEntryStatusEnumFactory()));
5135    if (json.has("_status"))
5136      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5137    if (json.has("effectivePeriod"))
5138      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
5139    if (json.has("orderable"))
5140      res.setOrderableElement(parseBoolean(json.get("orderable").getAsBoolean()));
5141    if (json.has("_orderable"))
5142      parseElementProperties(json.getAsJsonObject("_orderable"), res.getOrderableElement());
5143    if (json.has("referencedItem"))
5144      res.setReferencedItem(parseReference(json.getAsJsonObject("referencedItem")));
5145    if (json.has("relatedEntry")) {
5146      JsonArray array = json.getAsJsonArray("relatedEntry");
5147      for (int i = 0; i < array.size(); i++) {
5148        res.getRelatedEntry().add(parseCatalogEntryCatalogEntryRelatedEntryComponent(array.get(i).getAsJsonObject(), res));
5149      }
5150    };
5151    if (json.has("updatedBy"))
5152      res.setUpdatedBy(parseReference(json.getAsJsonObject("updatedBy")));
5153    if (json.has("note")) {
5154      JsonArray array = json.getAsJsonArray("note");
5155      for (int i = 0; i < array.size(); i++) {
5156        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5157      }
5158    };
5159    if (json.has("estimatedDuration"))
5160      res.setEstimatedDuration(parseDuration(json.getAsJsonObject("estimatedDuration")));
5161    if (json.has("billingCode")) {
5162      JsonArray array = json.getAsJsonArray("billingCode");
5163      for (int i = 0; i < array.size(); i++) {
5164        res.getBillingCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5165      }
5166    };
5167    if (json.has("billingSummary"))
5168      res.setBillingSummaryElement(parseString(json.get("billingSummary").getAsString()));
5169    if (json.has("_billingSummary"))
5170      parseElementProperties(json.getAsJsonObject("_billingSummary"), res.getBillingSummaryElement());
5171    if (json.has("scheduleSummary"))
5172      res.setScheduleSummaryElement(parseString(json.get("scheduleSummary").getAsString()));
5173    if (json.has("_scheduleSummary"))
5174      parseElementProperties(json.getAsJsonObject("_scheduleSummary"), res.getScheduleSummaryElement());
5175    if (json.has("limitationSummary"))
5176      res.setLimitationSummaryElement(parseString(json.get("limitationSummary").getAsString()));
5177    if (json.has("_limitationSummary"))
5178      parseElementProperties(json.getAsJsonObject("_limitationSummary"), res.getLimitationSummaryElement());
5179    if (json.has("regulatorySummary"))
5180      res.setRegulatorySummaryElement(parseString(json.get("regulatorySummary").getAsString()));
5181    if (json.has("_regulatorySummary"))
5182      parseElementProperties(json.getAsJsonObject("_regulatorySummary"), res.getRegulatorySummaryElement());
5183  }
5184
5185  protected CatalogEntry.CatalogEntryRelatedEntryComponent parseCatalogEntryCatalogEntryRelatedEntryComponent(JsonObject json, CatalogEntry owner) throws IOException, FHIRFormatError {
5186    CatalogEntry.CatalogEntryRelatedEntryComponent res = new CatalogEntry.CatalogEntryRelatedEntryComponent();
5187    parseCatalogEntryCatalogEntryRelatedEntryComponentProperties(json, owner, res);
5188    return res;
5189  }
5190
5191  protected void parseCatalogEntryCatalogEntryRelatedEntryComponentProperties(JsonObject json, CatalogEntry owner, CatalogEntry.CatalogEntryRelatedEntryComponent res) throws IOException, FHIRFormatError {
5192    parseBackboneElementProperties(json, res);
5193    if (json.has("relationship"))
5194      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), CatalogEntry.CatalogEntryRelationType.NULL, new CatalogEntry.CatalogEntryRelationTypeEnumFactory()));
5195    if (json.has("_relationship"))
5196      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
5197    if (json.has("target"))
5198      res.setTarget(parseReference(json.getAsJsonObject("target")));
5199  }
5200
5201  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
5202    ChargeItem res = new ChargeItem();
5203    parseChargeItemProperties(json, res);
5204    return res;
5205  }
5206
5207  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
5208    parseDomainResourceProperties(json, res);
5209    if (json.has("identifier")) {
5210      JsonArray array = json.getAsJsonArray("identifier");
5211      for (int i = 0; i < array.size(); i++) {
5212        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5213      }
5214    };
5215    if (json.has("definitionUri")) {
5216      JsonArray array = json.getAsJsonArray("definitionUri");
5217      for (int i = 0; i < array.size(); i++) {
5218        res.getDefinitionUri().add(parseUri(array.get(i).getAsString()));
5219      }
5220    };
5221    if (json.has("_definitionUri")) {
5222      JsonArray array = json.getAsJsonArray("_definitionUri");
5223      for (int i = 0; i < array.size(); i++) {
5224        if (i == res.getDefinitionUri().size())
5225          res.getDefinitionUri().add(parseUri(null));
5226        if (array.get(i) instanceof JsonObject) 
5227          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionUri().get(i));
5228      }
5229    };
5230    if (json.has("definitionCanonical")) {
5231      JsonArray array = json.getAsJsonArray("definitionCanonical");
5232      for (int i = 0; i < array.size(); i++) {
5233        res.getDefinitionCanonical().add(parseCanonical(array.get(i).getAsString()));
5234      }
5235    };
5236    if (json.has("_definitionCanonical")) {
5237      JsonArray array = json.getAsJsonArray("_definitionCanonical");
5238      for (int i = 0; i < array.size(); i++) {
5239        if (i == res.getDefinitionCanonical().size())
5240          res.getDefinitionCanonical().add(parseCanonical(null));
5241        if (array.get(i) instanceof JsonObject) 
5242          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionCanonical().get(i));
5243      }
5244    };
5245    if (json.has("status"))
5246      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
5247    if (json.has("_status"))
5248      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5249    if (json.has("partOf")) {
5250      JsonArray array = json.getAsJsonArray("partOf");
5251      for (int i = 0; i < array.size(); i++) {
5252        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
5253      }
5254    };
5255    if (json.has("code"))
5256      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5257    if (json.has("subject"))
5258      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5259    if (json.has("context"))
5260      res.setContext(parseReference(json.getAsJsonObject("context")));
5261    Type occurrence = parseType("occurrence", json);
5262    if (occurrence != null)
5263      res.setOccurrence(occurrence);
5264    if (json.has("performer")) {
5265      JsonArray array = json.getAsJsonArray("performer");
5266      for (int i = 0; i < array.size(); i++) {
5267        res.getPerformer().add(parseChargeItemChargeItemPerformerComponent(array.get(i).getAsJsonObject(), res));
5268      }
5269    };
5270    if (json.has("performingOrganization"))
5271      res.setPerformingOrganization(parseReference(json.getAsJsonObject("performingOrganization")));
5272    if (json.has("requestingOrganization"))
5273      res.setRequestingOrganization(parseReference(json.getAsJsonObject("requestingOrganization")));
5274    if (json.has("costCenter"))
5275      res.setCostCenter(parseReference(json.getAsJsonObject("costCenter")));
5276    if (json.has("quantity"))
5277      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5278    if (json.has("bodysite")) {
5279      JsonArray array = json.getAsJsonArray("bodysite");
5280      for (int i = 0; i < array.size(); i++) {
5281        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5282      }
5283    };
5284    if (json.has("factorOverride"))
5285      res.setFactorOverrideElement(parseDecimal(json.get("factorOverride").getAsBigDecimal()));
5286    if (json.has("_factorOverride"))
5287      parseElementProperties(json.getAsJsonObject("_factorOverride"), res.getFactorOverrideElement());
5288    if (json.has("priceOverride"))
5289      res.setPriceOverride(parseMoney(json.getAsJsonObject("priceOverride")));
5290    if (json.has("overrideReason"))
5291      res.setOverrideReasonElement(parseString(json.get("overrideReason").getAsString()));
5292    if (json.has("_overrideReason"))
5293      parseElementProperties(json.getAsJsonObject("_overrideReason"), res.getOverrideReasonElement());
5294    if (json.has("enterer"))
5295      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
5296    if (json.has("enteredDate"))
5297      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
5298    if (json.has("_enteredDate"))
5299      parseElementProperties(json.getAsJsonObject("_enteredDate"), res.getEnteredDateElement());
5300    if (json.has("reason")) {
5301      JsonArray array = json.getAsJsonArray("reason");
5302      for (int i = 0; i < array.size(); i++) {
5303        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5304      }
5305    };
5306    if (json.has("service")) {
5307      JsonArray array = json.getAsJsonArray("service");
5308      for (int i = 0; i < array.size(); i++) {
5309        res.getService().add(parseReference(array.get(i).getAsJsonObject()));
5310      }
5311    };
5312    Type product = parseType("product", json);
5313    if (product != null)
5314      res.setProduct(product);
5315    if (json.has("account")) {
5316      JsonArray array = json.getAsJsonArray("account");
5317      for (int i = 0; i < array.size(); i++) {
5318        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
5319      }
5320    };
5321    if (json.has("note")) {
5322      JsonArray array = json.getAsJsonArray("note");
5323      for (int i = 0; i < array.size(); i++) {
5324        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5325      }
5326    };
5327    if (json.has("supportingInformation")) {
5328      JsonArray array = json.getAsJsonArray("supportingInformation");
5329      for (int i = 0; i < array.size(); i++) {
5330        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
5331      }
5332    };
5333  }
5334
5335  protected ChargeItem.ChargeItemPerformerComponent parseChargeItemChargeItemPerformerComponent(JsonObject json, ChargeItem owner) throws IOException, FHIRFormatError {
5336    ChargeItem.ChargeItemPerformerComponent res = new ChargeItem.ChargeItemPerformerComponent();
5337    parseChargeItemChargeItemPerformerComponentProperties(json, owner, res);
5338    return res;
5339  }
5340
5341  protected void parseChargeItemChargeItemPerformerComponentProperties(JsonObject json, ChargeItem owner, ChargeItem.ChargeItemPerformerComponent res) throws IOException, FHIRFormatError {
5342    parseBackboneElementProperties(json, res);
5343    if (json.has("function"))
5344      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
5345    if (json.has("actor"))
5346      res.setActor(parseReference(json.getAsJsonObject("actor")));
5347  }
5348
5349  protected ChargeItemDefinition parseChargeItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
5350    ChargeItemDefinition res = new ChargeItemDefinition();
5351    parseChargeItemDefinitionProperties(json, res);
5352    return res;
5353  }
5354
5355  protected void parseChargeItemDefinitionProperties(JsonObject json, ChargeItemDefinition res) throws IOException, FHIRFormatError {
5356    parseDomainResourceProperties(json, res);
5357    if (json.has("url"))
5358      res.setUrlElement(parseUri(json.get("url").getAsString()));
5359    if (json.has("_url"))
5360      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
5361    if (json.has("identifier")) {
5362      JsonArray array = json.getAsJsonArray("identifier");
5363      for (int i = 0; i < array.size(); i++) {
5364        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5365      }
5366    };
5367    if (json.has("version"))
5368      res.setVersionElement(parseString(json.get("version").getAsString()));
5369    if (json.has("_version"))
5370      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
5371    if (json.has("title"))
5372      res.setTitleElement(parseString(json.get("title").getAsString()));
5373    if (json.has("_title"))
5374      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
5375    if (json.has("derivedFromUri")) {
5376      JsonArray array = json.getAsJsonArray("derivedFromUri");
5377      for (int i = 0; i < array.size(); i++) {
5378        res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
5379      }
5380    };
5381    if (json.has("_derivedFromUri")) {
5382      JsonArray array = json.getAsJsonArray("_derivedFromUri");
5383      for (int i = 0; i < array.size(); i++) {
5384        if (i == res.getDerivedFromUri().size())
5385          res.getDerivedFromUri().add(parseUri(null));
5386        if (array.get(i) instanceof JsonObject) 
5387          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
5388      }
5389    };
5390    if (json.has("partOf")) {
5391      JsonArray array = json.getAsJsonArray("partOf");
5392      for (int i = 0; i < array.size(); i++) {
5393        res.getPartOf().add(parseCanonical(array.get(i).getAsString()));
5394      }
5395    };
5396    if (json.has("_partOf")) {
5397      JsonArray array = json.getAsJsonArray("_partOf");
5398      for (int i = 0; i < array.size(); i++) {
5399        if (i == res.getPartOf().size())
5400          res.getPartOf().add(parseCanonical(null));
5401        if (array.get(i) instanceof JsonObject) 
5402          parseElementProperties(array.get(i).getAsJsonObject(), res.getPartOf().get(i));
5403      }
5404    };
5405    if (json.has("replaces")) {
5406      JsonArray array = json.getAsJsonArray("replaces");
5407      for (int i = 0; i < array.size(); i++) {
5408        res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
5409      }
5410    };
5411    if (json.has("_replaces")) {
5412      JsonArray array = json.getAsJsonArray("_replaces");
5413      for (int i = 0; i < array.size(); i++) {
5414        if (i == res.getReplaces().size())
5415          res.getReplaces().add(parseCanonical(null));
5416        if (array.get(i) instanceof JsonObject) 
5417          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
5418      }
5419    };
5420    if (json.has("status"))
5421      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5422    if (json.has("_status"))
5423      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5424    if (json.has("experimental"))
5425      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5426    if (json.has("_experimental"))
5427      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
5428    if (json.has("date"))
5429      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5430    if (json.has("_date"))
5431      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5432    if (json.has("publisher"))
5433      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5434    if (json.has("_publisher"))
5435      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
5436    if (json.has("contact")) {
5437      JsonArray array = json.getAsJsonArray("contact");
5438      for (int i = 0; i < array.size(); i++) {
5439        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5440      }
5441    };
5442    if (json.has("description"))
5443      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5444    if (json.has("_description"))
5445      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5446    if (json.has("useContext")) {
5447      JsonArray array = json.getAsJsonArray("useContext");
5448      for (int i = 0; i < array.size(); i++) {
5449        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5450      }
5451    };
5452    if (json.has("jurisdiction")) {
5453      JsonArray array = json.getAsJsonArray("jurisdiction");
5454      for (int i = 0; i < array.size(); i++) {
5455        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5456      }
5457    };
5458    if (json.has("copyright"))
5459      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5460    if (json.has("_copyright"))
5461      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
5462    if (json.has("approvalDate"))
5463      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
5464    if (json.has("_approvalDate"))
5465      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
5466    if (json.has("lastReviewDate"))
5467      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
5468    if (json.has("_lastReviewDate"))
5469      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
5470    if (json.has("effectivePeriod"))
5471      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
5472    if (json.has("code"))
5473      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5474    if (json.has("instance")) {
5475      JsonArray array = json.getAsJsonArray("instance");
5476      for (int i = 0; i < array.size(); i++) {
5477        res.getInstance().add(parseReference(array.get(i).getAsJsonObject()));
5478      }
5479    };
5480    if (json.has("applicability")) {
5481      JsonArray array = json.getAsJsonArray("applicability");
5482      for (int i = 0; i < array.size(); i++) {
5483        res.getApplicability().add(parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject(), res));
5484      }
5485    };
5486    if (json.has("propertyGroup")) {
5487      JsonArray array = json.getAsJsonArray("propertyGroup");
5488      for (int i = 0; i < array.size(); i++) {
5489        res.getPropertyGroup().add(parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(array.get(i).getAsJsonObject(), res));
5490      }
5491    };
5492  }
5493
5494  protected ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
5495    ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res = new ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent();
5496    parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentProperties(json, owner, res);
5497    return res;
5498  }
5499
5500  protected void parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res) throws IOException, FHIRFormatError {
5501    parseBackboneElementProperties(json, res);
5502    if (json.has("description"))
5503      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5504    if (json.has("_description"))
5505      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5506    if (json.has("language"))
5507      res.setLanguageElement(parseString(json.get("language").getAsString()));
5508    if (json.has("_language"))
5509      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
5510    if (json.has("expression"))
5511      res.setExpressionElement(parseString(json.get("expression").getAsString()));
5512    if (json.has("_expression"))
5513      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
5514  }
5515
5516  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
5517    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent();
5518    parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentProperties(json, owner, res);
5519    return res;
5520  }
5521
5522  protected void parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res) throws IOException, FHIRFormatError {
5523    parseBackboneElementProperties(json, res);
5524    if (json.has("applicability")) {
5525      JsonArray array = json.getAsJsonArray("applicability");
5526      for (int i = 0; i < array.size(); i++) {
5527        res.getApplicability().add(parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject(), owner));
5528      }
5529    };
5530    if (json.has("priceComponent")) {
5531      JsonArray array = json.getAsJsonArray("priceComponent");
5532      for (int i = 0; i < array.size(); i++) {
5533        res.getPriceComponent().add(parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(array.get(i).getAsJsonObject(), owner));
5534      }
5535    };
5536  }
5537
5538  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
5539    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent();
5540    parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(json, owner, res);
5541    return res;
5542  }
5543
5544  protected void parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res) throws IOException, FHIRFormatError {
5545    parseBackboneElementProperties(json, res);
5546    if (json.has("type"))
5547      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.NULL, new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory()));
5548    if (json.has("_type"))
5549      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
5550    if (json.has("code"))
5551      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5552    if (json.has("factor"))
5553      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5554    if (json.has("_factor"))
5555      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5556    if (json.has("amount"))
5557      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
5558  }
5559
5560  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
5561    Claim res = new Claim();
5562    parseClaimProperties(json, res);
5563    return res;
5564  }
5565
5566  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
5567    parseDomainResourceProperties(json, res);
5568    if (json.has("identifier")) {
5569      JsonArray array = json.getAsJsonArray("identifier");
5570      for (int i = 0; i < array.size(); i++) {
5571        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5572      }
5573    };
5574    if (json.has("status"))
5575      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Claim.ClaimStatus.NULL, new Claim.ClaimStatusEnumFactory()));
5576    if (json.has("_status"))
5577      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5578    if (json.has("type"))
5579      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5580    if (json.has("subType"))
5581      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
5582    if (json.has("use"))
5583      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Claim.Use.NULL, new Claim.UseEnumFactory()));
5584    if (json.has("_use"))
5585      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
5586    if (json.has("patient"))
5587      res.setPatient(parseReference(json.getAsJsonObject("patient")));
5588    if (json.has("billablePeriod"))
5589      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
5590    if (json.has("created"))
5591      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5592    if (json.has("_created"))
5593      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5594    if (json.has("enterer"))
5595      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
5596    if (json.has("insurer"))
5597      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
5598    if (json.has("provider"))
5599      res.setProvider(parseReference(json.getAsJsonObject("provider")));
5600    if (json.has("priority"))
5601      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
5602    if (json.has("fundsReserve"))
5603      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
5604    if (json.has("related")) {
5605      JsonArray array = json.getAsJsonArray("related");
5606      for (int i = 0; i < array.size(); i++) {
5607        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
5608      }
5609    };
5610    if (json.has("prescription"))
5611      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
5612    if (json.has("originalPrescription"))
5613      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
5614    if (json.has("payee"))
5615      res.setPayee(parseClaimPayeeComponent(json.getAsJsonObject("payee"), res));
5616    if (json.has("referral"))
5617      res.setReferral(parseReference(json.getAsJsonObject("referral")));
5618    if (json.has("facility"))
5619      res.setFacility(parseReference(json.getAsJsonObject("facility")));
5620    if (json.has("careTeam")) {
5621      JsonArray array = json.getAsJsonArray("careTeam");
5622      for (int i = 0; i < array.size(); i++) {
5623        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject(), res));
5624      }
5625    };
5626    if (json.has("supportingInfo")) {
5627      JsonArray array = json.getAsJsonArray("supportingInfo");
5628      for (int i = 0; i < array.size(); i++) {
5629        res.getSupportingInfo().add(parseClaimSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
5630      }
5631    };
5632    if (json.has("diagnosis")) {
5633      JsonArray array = json.getAsJsonArray("diagnosis");
5634      for (int i = 0; i < array.size(); i++) {
5635        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject(), res));
5636      }
5637    };
5638    if (json.has("procedure")) {
5639      JsonArray array = json.getAsJsonArray("procedure");
5640      for (int i = 0; i < array.size(); i++) {
5641        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject(), res));
5642      }
5643    };
5644    if (json.has("insurance")) {
5645      JsonArray array = json.getAsJsonArray("insurance");
5646      for (int i = 0; i < array.size(); i++) {
5647        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject(), res));
5648      }
5649    };
5650    if (json.has("accident"))
5651      res.setAccident(parseClaimAccidentComponent(json.getAsJsonObject("accident"), res));
5652    if (json.has("item")) {
5653      JsonArray array = json.getAsJsonArray("item");
5654      for (int i = 0; i < array.size(); i++) {
5655        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject(), res));
5656      }
5657    };
5658    if (json.has("total"))
5659      res.setTotal(parseMoney(json.getAsJsonObject("total")));
5660  }
5661
5662  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5663    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
5664    parseClaimRelatedClaimComponentProperties(json, owner, res);
5665    return res;
5666  }
5667
5668  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim owner, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
5669    parseBackboneElementProperties(json, res);
5670    if (json.has("claim"))
5671      res.setClaim(parseReference(json.getAsJsonObject("claim")));
5672    if (json.has("relationship"))
5673      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
5674    if (json.has("reference"))
5675      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
5676  }
5677
5678  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5679    Claim.PayeeComponent res = new Claim.PayeeComponent();
5680    parseClaimPayeeComponentProperties(json, owner, res);
5681    return res;
5682  }
5683
5684  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim owner, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
5685    parseBackboneElementProperties(json, res);
5686    if (json.has("type"))
5687      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5688    if (json.has("party"))
5689      res.setParty(parseReference(json.getAsJsonObject("party")));
5690  }
5691
5692  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5693    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
5694    parseClaimCareTeamComponentProperties(json, owner, res);
5695    return res;
5696  }
5697
5698  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim owner, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
5699    parseBackboneElementProperties(json, res);
5700    if (json.has("sequence"))
5701      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5702    if (json.has("_sequence"))
5703      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5704    if (json.has("provider"))
5705      res.setProvider(parseReference(json.getAsJsonObject("provider")));
5706    if (json.has("responsible"))
5707      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
5708    if (json.has("_responsible"))
5709      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
5710    if (json.has("role"))
5711      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
5712    if (json.has("qualification"))
5713      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
5714  }
5715
5716  protected Claim.SupportingInformationComponent parseClaimSupportingInformationComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5717    Claim.SupportingInformationComponent res = new Claim.SupportingInformationComponent();
5718    parseClaimSupportingInformationComponentProperties(json, owner, res);
5719    return res;
5720  }
5721
5722  protected void parseClaimSupportingInformationComponentProperties(JsonObject json, Claim owner, Claim.SupportingInformationComponent res) throws IOException, FHIRFormatError {
5723    parseBackboneElementProperties(json, res);
5724    if (json.has("sequence"))
5725      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5726    if (json.has("_sequence"))
5727      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5728    if (json.has("category"))
5729      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5730    if (json.has("code"))
5731      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5732    Type timing = parseType("timing", json);
5733    if (timing != null)
5734      res.setTiming(timing);
5735    Type value = parseType("value", json);
5736    if (value != null)
5737      res.setValue(value);
5738    if (json.has("reason"))
5739      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
5740  }
5741
5742  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5743    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
5744    parseClaimDiagnosisComponentProperties(json, owner, res);
5745    return res;
5746  }
5747
5748  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim owner, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
5749    parseBackboneElementProperties(json, res);
5750    if (json.has("sequence"))
5751      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5752    if (json.has("_sequence"))
5753      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5754    Type diagnosis = parseType("diagnosis", json);
5755    if (diagnosis != null)
5756      res.setDiagnosis(diagnosis);
5757    if (json.has("type")) {
5758      JsonArray array = json.getAsJsonArray("type");
5759      for (int i = 0; i < array.size(); i++) {
5760        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5761      }
5762    };
5763    if (json.has("onAdmission"))
5764      res.setOnAdmission(parseCodeableConcept(json.getAsJsonObject("onAdmission")));
5765    if (json.has("packageCode"))
5766      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
5767  }
5768
5769  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5770    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
5771    parseClaimProcedureComponentProperties(json, owner, res);
5772    return res;
5773  }
5774
5775  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim owner, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
5776    parseBackboneElementProperties(json, res);
5777    if (json.has("sequence"))
5778      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5779    if (json.has("_sequence"))
5780      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5781    if (json.has("type")) {
5782      JsonArray array = json.getAsJsonArray("type");
5783      for (int i = 0; i < array.size(); i++) {
5784        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5785      }
5786    };
5787    if (json.has("date"))
5788      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5789    if (json.has("_date"))
5790      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5791    Type procedure = parseType("procedure", json);
5792    if (procedure != null)
5793      res.setProcedure(procedure);
5794    if (json.has("udi")) {
5795      JsonArray array = json.getAsJsonArray("udi");
5796      for (int i = 0; i < array.size(); i++) {
5797        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5798      }
5799    };
5800  }
5801
5802  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5803    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
5804    parseClaimInsuranceComponentProperties(json, owner, res);
5805    return res;
5806  }
5807
5808  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim owner, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
5809    parseBackboneElementProperties(json, res);
5810    if (json.has("sequence"))
5811      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5812    if (json.has("_sequence"))
5813      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5814    if (json.has("focal"))
5815      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
5816    if (json.has("_focal"))
5817      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
5818    if (json.has("identifier"))
5819      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5820    if (json.has("coverage"))
5821      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
5822    if (json.has("businessArrangement"))
5823      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
5824    if (json.has("_businessArrangement"))
5825      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
5826    if (json.has("preAuthRef")) {
5827      JsonArray array = json.getAsJsonArray("preAuthRef");
5828      for (int i = 0; i < array.size(); i++) {
5829        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
5830      }
5831    };
5832    if (json.has("_preAuthRef")) {
5833      JsonArray array = json.getAsJsonArray("_preAuthRef");
5834      for (int i = 0; i < array.size(); i++) {
5835        if (i == res.getPreAuthRef().size())
5836          res.getPreAuthRef().add(parseString(null));
5837        if (array.get(i) instanceof JsonObject) 
5838          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
5839      }
5840    };
5841    if (json.has("claimResponse"))
5842      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
5843  }
5844
5845  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5846    Claim.AccidentComponent res = new Claim.AccidentComponent();
5847    parseClaimAccidentComponentProperties(json, owner, res);
5848    return res;
5849  }
5850
5851  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim owner, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
5852    parseBackboneElementProperties(json, res);
5853    if (json.has("date"))
5854      res.setDateElement(parseDate(json.get("date").getAsString()));
5855    if (json.has("_date"))
5856      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5857    if (json.has("type"))
5858      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5859    Type location = parseType("location", json);
5860    if (location != null)
5861      res.setLocation(location);
5862  }
5863
5864  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5865    Claim.ItemComponent res = new Claim.ItemComponent();
5866    parseClaimItemComponentProperties(json, owner, res);
5867    return res;
5868  }
5869
5870  protected void parseClaimItemComponentProperties(JsonObject json, Claim owner, Claim.ItemComponent res) throws IOException, FHIRFormatError {
5871    parseBackboneElementProperties(json, res);
5872    if (json.has("sequence"))
5873      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5874    if (json.has("_sequence"))
5875      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5876    if (json.has("careTeamSequence")) {
5877      JsonArray array = json.getAsJsonArray("careTeamSequence");
5878      for (int i = 0; i < array.size(); i++) {
5879        res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
5880      }
5881    };
5882    if (json.has("_careTeamSequence")) {
5883      JsonArray array = json.getAsJsonArray("_careTeamSequence");
5884      for (int i = 0; i < array.size(); i++) {
5885        if (i == res.getCareTeamSequence().size())
5886          res.getCareTeamSequence().add(parsePositiveInt(null));
5887        if (array.get(i) instanceof JsonObject) 
5888          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
5889      }
5890    };
5891    if (json.has("diagnosisSequence")) {
5892      JsonArray array = json.getAsJsonArray("diagnosisSequence");
5893      for (int i = 0; i < array.size(); i++) {
5894        res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
5895      }
5896    };
5897    if (json.has("_diagnosisSequence")) {
5898      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
5899      for (int i = 0; i < array.size(); i++) {
5900        if (i == res.getDiagnosisSequence().size())
5901          res.getDiagnosisSequence().add(parsePositiveInt(null));
5902        if (array.get(i) instanceof JsonObject) 
5903          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
5904      }
5905    };
5906    if (json.has("procedureSequence")) {
5907      JsonArray array = json.getAsJsonArray("procedureSequence");
5908      for (int i = 0; i < array.size(); i++) {
5909        res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
5910      }
5911    };
5912    if (json.has("_procedureSequence")) {
5913      JsonArray array = json.getAsJsonArray("_procedureSequence");
5914      for (int i = 0; i < array.size(); i++) {
5915        if (i == res.getProcedureSequence().size())
5916          res.getProcedureSequence().add(parsePositiveInt(null));
5917        if (array.get(i) instanceof JsonObject) 
5918          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
5919      }
5920    };
5921    if (json.has("informationSequence")) {
5922      JsonArray array = json.getAsJsonArray("informationSequence");
5923      for (int i = 0; i < array.size(); i++) {
5924        res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
5925      }
5926    };
5927    if (json.has("_informationSequence")) {
5928      JsonArray array = json.getAsJsonArray("_informationSequence");
5929      for (int i = 0; i < array.size(); i++) {
5930        if (i == res.getInformationSequence().size())
5931          res.getInformationSequence().add(parsePositiveInt(null));
5932        if (array.get(i) instanceof JsonObject) 
5933          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
5934      }
5935    };
5936    if (json.has("revenue"))
5937      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
5938    if (json.has("category"))
5939      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5940    if (json.has("productOrService"))
5941      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
5942    if (json.has("modifier")) {
5943      JsonArray array = json.getAsJsonArray("modifier");
5944      for (int i = 0; i < array.size(); i++) {
5945        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5946      }
5947    };
5948    if (json.has("programCode")) {
5949      JsonArray array = json.getAsJsonArray("programCode");
5950      for (int i = 0; i < array.size(); i++) {
5951        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5952      }
5953    };
5954    Type serviced = parseType("serviced", json);
5955    if (serviced != null)
5956      res.setServiced(serviced);
5957    Type location = parseType("location", json);
5958    if (location != null)
5959      res.setLocation(location);
5960    if (json.has("quantity"))
5961      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5962    if (json.has("unitPrice"))
5963      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5964    if (json.has("factor"))
5965      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5966    if (json.has("_factor"))
5967      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5968    if (json.has("net"))
5969      res.setNet(parseMoney(json.getAsJsonObject("net")));
5970    if (json.has("udi")) {
5971      JsonArray array = json.getAsJsonArray("udi");
5972      for (int i = 0; i < array.size(); i++) {
5973        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5974      }
5975    };
5976    if (json.has("bodySite"))
5977      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
5978    if (json.has("subSite")) {
5979      JsonArray array = json.getAsJsonArray("subSite");
5980      for (int i = 0; i < array.size(); i++) {
5981        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5982      }
5983    };
5984    if (json.has("encounter")) {
5985      JsonArray array = json.getAsJsonArray("encounter");
5986      for (int i = 0; i < array.size(); i++) {
5987        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
5988      }
5989    };
5990    if (json.has("detail")) {
5991      JsonArray array = json.getAsJsonArray("detail");
5992      for (int i = 0; i < array.size(); i++) {
5993        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject(), owner));
5994      }
5995    };
5996  }
5997
5998  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5999    Claim.DetailComponent res = new Claim.DetailComponent();
6000    parseClaimDetailComponentProperties(json, owner, res);
6001    return res;
6002  }
6003
6004  protected void parseClaimDetailComponentProperties(JsonObject json, Claim owner, Claim.DetailComponent res) throws IOException, FHIRFormatError {
6005    parseBackboneElementProperties(json, res);
6006    if (json.has("sequence"))
6007      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6008    if (json.has("_sequence"))
6009      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
6010    if (json.has("revenue"))
6011      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
6012    if (json.has("category"))
6013      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
6014    if (json.has("productOrService"))
6015      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
6016    if (json.has("modifier")) {
6017      JsonArray array = json.getAsJsonArray("modifier");
6018      for (int i = 0; i < array.size(); i++) {
6019        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6020      }
6021    };
6022    if (json.has("programCode")) {
6023      JsonArray array = json.getAsJsonArray("programCode");
6024      for (int i = 0; i < array.size(); i++) {
6025        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6026      }
6027    };
6028    if (json.has("quantity"))
6029      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
6030    if (json.has("unitPrice"))
6031      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
6032    if (json.has("factor"))
6033      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6034    if (json.has("_factor"))
6035      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
6036    if (json.has("net"))
6037      res.setNet(parseMoney(json.getAsJsonObject("net")));
6038    if (json.has("udi")) {
6039      JsonArray array = json.getAsJsonArray("udi");
6040      for (int i = 0; i < array.size(); i++) {
6041        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6042      }
6043    };
6044    if (json.has("subDetail")) {
6045      JsonArray array = json.getAsJsonArray("subDetail");
6046      for (int i = 0; i < array.size(); i++) {
6047        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject(), owner));
6048      }
6049    };
6050  }
6051
6052  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
6053    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
6054    parseClaimSubDetailComponentProperties(json, owner, res);
6055    return res;
6056  }
6057
6058  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim owner, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
6059    parseBackboneElementProperties(json, res);
6060    if (json.has("sequence"))
6061      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6062    if (json.has("_sequence"))
6063      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
6064    if (json.has("revenue"))
6065      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
6066    if (json.has("category"))
6067      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
6068    if (json.has("productOrService"))
6069      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
6070    if (json.has("modifier")) {
6071      JsonArray array = json.getAsJsonArray("modifier");
6072      for (int i = 0; i < array.size(); i++) {
6073        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6074      }
6075    };
6076    if (json.has("programCode")) {
6077      JsonArray array = json.getAsJsonArray("programCode");
6078      for (int i = 0; i < array.size(); i++) {
6079        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6080      }
6081    };
6082    if (json.has("quantity"))
6083      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
6084    if (json.has("unitPrice"))
6085      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
6086    if (json.has("factor"))
6087      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6088    if (json.has("_factor"))
6089      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
6090    if (json.has("net"))
6091      res.setNet(parseMoney(json.getAsJsonObject("net")));
6092    if (json.has("udi")) {
6093      JsonArray array = json.getAsJsonArray("udi");
6094      for (int i = 0; i < array.size(); i++) {
6095        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6096      }
6097    };
6098  }
6099
6100  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
6101    ClaimResponse res = new ClaimResponse();
6102    parseClaimResponseProperties(json, res);
6103    return res;
6104  }
6105
6106  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
6107    parseDomainResourceProperties(json, res);
6108    if (json.has("identifier")) {
6109      JsonArray array = json.getAsJsonArray("identifier");
6110      for (int i = 0; i < array.size(); i++) {
6111        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6112      }
6113    };
6114    if (json.has("status"))
6115      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClaimResponse.ClaimResponseStatus.NULL, new ClaimResponse.ClaimResponseStatusEnumFactory()));
6116    if (json.has("_status"))
6117      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6118    if (json.has("type"))
6119      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6120    if (json.has("subType"))
6121      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
6122    if (json.has("use"))
6123      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ClaimResponse.Use.NULL, new ClaimResponse.UseEnumFactory()));
6124    if (json.has("_use"))
6125      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
6126    if (json.has("patient"))
6127      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6128    if (json.has("created"))
6129      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
6130    if (json.has("_created"))
6131      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
6132    if (json.has("insurer"))
6133      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
6134    if (json.has("requestor"))
6135      res.setRequestor(parseReference(json.getAsJsonObject("requestor")));
6136    if (json.has("request"))
6137      res.setRequest(parseReference(json.getAsJsonObject("request")));
6138    if (json.has("outcome"))
6139      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ClaimResponse.RemittanceOutcome.NULL, new ClaimResponse.RemittanceOutcomeEnumFactory()));
6140    if (json.has("_outcome"))
6141      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
6142    if (json.has("disposition"))
6143      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
6144    if (json.has("_disposition"))
6145      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
6146    if (json.has("preAuthRef"))
6147      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
6148    if (json.has("_preAuthRef"))
6149      parseElementProperties(json.getAsJsonObject("_preAuthRef"), res.getPreAuthRefElement());
6150    if (json.has("preAuthPeriod"))
6151      res.setPreAuthPeriod(parsePeriod(json.getAsJsonObject("preAuthPeriod")));
6152    if (json.has("payeeType"))
6153      res.setPayeeType(parseCodeableConcept(json.getAsJsonObject("payeeType")));
6154    if (json.has("item")) {
6155      JsonArray array = json.getAsJsonArray("item");
6156      for (int i = 0; i < array.size(); i++) {
6157        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject(), res));
6158      }
6159    };
6160    if (json.has("addItem")) {
6161      JsonArray array = json.getAsJsonArray("addItem");
6162      for (int i = 0; i < array.size(); i++) {
6163        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject(), res));
6164      }
6165    };
6166    if (json.has("adjudication")) {
6167      JsonArray array = json.getAsJsonArray("adjudication");
6168      for (int i = 0; i < array.size(); i++) {
6169        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), res));
6170      }
6171    };
6172    if (json.has("total")) {
6173      JsonArray array = json.getAsJsonArray("total");
6174      for (int i = 0; i < array.size(); i++) {
6175        res.getTotal().add(parseClaimResponseTotalComponent(array.get(i).getAsJsonObject(), res));
6176      }
6177    };
6178    if (json.has("payment"))
6179      res.setPayment(parseClaimResponsePaymentComponent(json.getAsJsonObject("payment"), res));
6180    if (json.has("fundsReserve"))
6181      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
6182    if (json.has("formCode"))
6183      res.setFormCode(parseCodeableConcept(json.getAsJsonObject("formCode")));
6184    if (json.has("form"))
6185      res.setForm(parseAttachment(json.getAsJsonObject("form")));
6186    if (json.has("processNote")) {
6187      JsonArray array = json.getAsJsonArray("processNote");
6188      for (int i = 0; i < array.size(); i++) {
6189        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject(), res));
6190      }
6191    };
6192    if (json.has("communicationRequest")) {
6193      JsonArray array = json.getAsJsonArray("communicationRequest");
6194      for (int i = 0; i < array.size(); i++) {
6195        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
6196      }
6197    };
6198    if (json.has("insurance")) {
6199      JsonArray array = json.getAsJsonArray("insurance");
6200      for (int i = 0; i < array.size(); i++) {
6201        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
6202      }
6203    };
6204    if (json.has("error")) {
6205      JsonArray array = json.getAsJsonArray("error");
6206      for (int i = 0; i < array.size(); i++) {
6207        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject(), res));
6208      }
6209    };
6210  }
6211
6212  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6213    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
6214    parseClaimResponseItemComponentProperties(json, owner, res);
6215    return res;
6216  }
6217
6218  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
6219    parseBackboneElementProperties(json, res);
6220    if (json.has("itemSequence"))
6221      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
6222    if (json.has("_itemSequence"))
6223      parseElementProperties(json.getAsJsonObject("_itemSequence"), res.getItemSequenceElement());
6224    if (json.has("noteNumber")) {
6225      JsonArray array = json.getAsJsonArray("noteNumber");
6226      for (int i = 0; i < array.size(); i++) {
6227        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6228      }
6229    };
6230    if (json.has("_noteNumber")) {
6231      JsonArray array = json.getAsJsonArray("_noteNumber");
6232      for (int i = 0; i < array.size(); i++) {
6233        if (i == res.getNoteNumber().size())
6234          res.getNoteNumber().add(parsePositiveInt(null));
6235        if (array.get(i) instanceof JsonObject) 
6236          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6237      }
6238    };
6239    if (json.has("adjudication")) {
6240      JsonArray array = json.getAsJsonArray("adjudication");
6241      for (int i = 0; i < array.size(); i++) {
6242        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
6243      }
6244    };
6245    if (json.has("detail")) {
6246      JsonArray array = json.getAsJsonArray("detail");
6247      for (int i = 0; i < array.size(); i++) {
6248        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject(), owner));
6249      }
6250    };
6251  }
6252
6253  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6254    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
6255    parseClaimResponseAdjudicationComponentProperties(json, owner, res);
6256    return res;
6257  }
6258
6259  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
6260    parseBackboneElementProperties(json, res);
6261    if (json.has("category"))
6262      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
6263    if (json.has("reason"))
6264      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
6265    if (json.has("amount"))
6266      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
6267    if (json.has("value"))
6268      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
6269    if (json.has("_value"))
6270      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
6271  }
6272
6273  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6274    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
6275    parseClaimResponseItemDetailComponentProperties(json, owner, res);
6276    return res;
6277  }
6278
6279  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
6280    parseBackboneElementProperties(json, res);
6281    if (json.has("detailSequence"))
6282      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
6283    if (json.has("_detailSequence"))
6284      parseElementProperties(json.getAsJsonObject("_detailSequence"), res.getDetailSequenceElement());
6285    if (json.has("noteNumber")) {
6286      JsonArray array = json.getAsJsonArray("noteNumber");
6287      for (int i = 0; i < array.size(); i++) {
6288        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6289      }
6290    };
6291    if (json.has("_noteNumber")) {
6292      JsonArray array = json.getAsJsonArray("_noteNumber");
6293      for (int i = 0; i < array.size(); i++) {
6294        if (i == res.getNoteNumber().size())
6295          res.getNoteNumber().add(parsePositiveInt(null));
6296        if (array.get(i) instanceof JsonObject) 
6297          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6298      }
6299    };
6300    if (json.has("adjudication")) {
6301      JsonArray array = json.getAsJsonArray("adjudication");
6302      for (int i = 0; i < array.size(); i++) {
6303        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
6304      }
6305    };
6306    if (json.has("subDetail")) {
6307      JsonArray array = json.getAsJsonArray("subDetail");
6308      for (int i = 0; i < array.size(); i++) {
6309        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject(), owner));
6310      }
6311    };
6312  }
6313
6314  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6315    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
6316    parseClaimResponseSubDetailComponentProperties(json, owner, res);
6317    return res;
6318  }
6319
6320  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
6321    parseBackboneElementProperties(json, res);
6322    if (json.has("subDetailSequence"))
6323      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
6324    if (json.has("_subDetailSequence"))
6325      parseElementProperties(json.getAsJsonObject("_subDetailSequence"), res.getSubDetailSequenceElement());
6326    if (json.has("noteNumber")) {
6327      JsonArray array = json.getAsJsonArray("noteNumber");
6328      for (int i = 0; i < array.size(); i++) {
6329        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6330      }
6331    };
6332    if (json.has("_noteNumber")) {
6333      JsonArray array = json.getAsJsonArray("_noteNumber");
6334      for (int i = 0; i < array.size(); i++) {
6335        if (i == res.getNoteNumber().size())
6336          res.getNoteNumber().add(parsePositiveInt(null));
6337        if (array.get(i) instanceof JsonObject) 
6338          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6339      }
6340    };
6341    if (json.has("adjudication")) {
6342      JsonArray array = json.getAsJsonArray("adjudication");
6343      for (int i = 0; i < array.size(); i++) {
6344        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
6345      }
6346    };
6347  }
6348
6349  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6350    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
6351    parseClaimResponseAddedItemComponentProperties(json, owner, res);
6352    return res;
6353  }
6354
6355  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
6356    parseBackboneElementProperties(json, res);
6357    if (json.has("itemSequence")) {
6358      JsonArray array = json.getAsJsonArray("itemSequence");
6359      for (int i = 0; i < array.size(); i++) {
6360        res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
6361      }
6362    };
6363    if (json.has("_itemSequence")) {
6364      JsonArray array = json.getAsJsonArray("_itemSequence");
6365      for (int i = 0; i < array.size(); i++) {
6366        if (i == res.getItemSequence().size())
6367          res.getItemSequence().add(parsePositiveInt(null));
6368        if (array.get(i) instanceof JsonObject) 
6369          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
6370      }
6371    };
6372    if (json.has("detailSequence")) {
6373      JsonArray array = json.getAsJsonArray("detailSequence");
6374      for (int i = 0; i < array.size(); i++) {
6375        res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
6376      }
6377    };
6378    if (json.has("_detailSequence")) {
6379      JsonArray array = json.getAsJsonArray("_detailSequence");
6380      for (int i = 0; i < array.size(); i++) {
6381        if (i == res.getDetailSequence().size())
6382          res.getDetailSequence().add(parsePositiveInt(null));
6383        if (array.get(i) instanceof JsonObject) 
6384          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
6385      }
6386    };
6387    if (json.has("subdetailSequence")) {
6388      JsonArray array = json.getAsJsonArray("subdetailSequence");
6389      for (int i = 0; i < array.size(); i++) {
6390        res.getSubdetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
6391      }
6392    };
6393    if (json.has("_subdetailSequence")) {
6394      JsonArray array = json.getAsJsonArray("_subdetailSequence");
6395      for (int i = 0; i < array.size(); i++) {
6396        if (i == res.getSubdetailSequence().size())
6397          res.getSubdetailSequence().add(parsePositiveInt(null));
6398        if (array.get(i) instanceof JsonObject) 
6399          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubdetailSequence().get(i));
6400      }
6401    };
6402    if (json.has("provider")) {
6403      JsonArray array = json.getAsJsonArray("provider");
6404      for (int i = 0; i < array.size(); i++) {
6405        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
6406      }
6407    };
6408    if (json.has("productOrService"))
6409      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
6410    if (json.has("modifier")) {
6411      JsonArray array = json.getAsJsonArray("modifier");
6412      for (int i = 0; i < array.size(); i++) {
6413        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6414      }
6415    };
6416    if (json.has("programCode")) {
6417      JsonArray array = json.getAsJsonArray("programCode");
6418      for (int i = 0; i < array.size(); i++) {
6419        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6420      }
6421    };
6422    Type serviced = parseType("serviced", json);
6423    if (serviced != null)
6424      res.setServiced(serviced);
6425    Type location = parseType("location", json);
6426    if (location != null)
6427      res.setLocation(location);
6428    if (json.has("quantity"))
6429      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
6430    if (json.has("unitPrice"))
6431      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
6432    if (json.has("factor"))
6433      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6434    if (json.has("_factor"))
6435      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
6436    if (json.has("net"))
6437      res.setNet(parseMoney(json.getAsJsonObject("net")));
6438    if (json.has("bodySite"))
6439      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
6440    if (json.has("subSite")) {
6441      JsonArray array = json.getAsJsonArray("subSite");
6442      for (int i = 0; i < array.size(); i++) {
6443        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6444      }
6445    };
6446    if (json.has("noteNumber")) {
6447      JsonArray array = json.getAsJsonArray("noteNumber");
6448      for (int i = 0; i < array.size(); i++) {
6449        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6450      }
6451    };
6452    if (json.has("_noteNumber")) {
6453      JsonArray array = json.getAsJsonArray("_noteNumber");
6454      for (int i = 0; i < array.size(); i++) {
6455        if (i == res.getNoteNumber().size())
6456          res.getNoteNumber().add(parsePositiveInt(null));
6457        if (array.get(i) instanceof JsonObject) 
6458          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6459      }
6460    };
6461    if (json.has("adjudication")) {
6462      JsonArray array = json.getAsJsonArray("adjudication");
6463      for (int i = 0; i < array.size(); i++) {
6464        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
6465      }
6466    };
6467    if (json.has("detail")) {
6468      JsonArray array = json.getAsJsonArray("detail");
6469      for (int i = 0; i < array.size(); i++) {
6470        res.getDetail().add(parseClaimResponseAddedItemDetailComponent(array.get(i).getAsJsonObject(), owner));
6471      }
6472    };
6473  }
6474
6475  protected ClaimResponse.AddedItemDetailComponent parseClaimResponseAddedItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6476    ClaimResponse.AddedItemDetailComponent res = new ClaimResponse.AddedItemDetailComponent();
6477    parseClaimResponseAddedItemDetailComponentProperties(json, owner, res);
6478    return res;
6479  }
6480
6481  protected void parseClaimResponseAddedItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
6482    parseBackboneElementProperties(json, res);
6483    if (json.has("productOrService"))
6484      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
6485    if (json.has("modifier")) {
6486      JsonArray array = json.getAsJsonArray("modifier");
6487      for (int i = 0; i < array.size(); i++) {
6488        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6489      }
6490    };
6491    if (json.has("quantity"))
6492      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
6493    if (json.has("unitPrice"))
6494      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
6495    if (json.has("factor"))
6496      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6497    if (json.has("_factor"))
6498      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
6499    if (json.has("net"))
6500      res.setNet(parseMoney(json.getAsJsonObject("net")));
6501    if (json.has("noteNumber")) {
6502      JsonArray array = json.getAsJsonArray("noteNumber");
6503      for (int i = 0; i < array.size(); i++) {
6504        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6505      }
6506    };
6507    if (json.has("_noteNumber")) {
6508      JsonArray array = json.getAsJsonArray("_noteNumber");
6509      for (int i = 0; i < array.size(); i++) {
6510        if (i == res.getNoteNumber().size())
6511          res.getNoteNumber().add(parsePositiveInt(null));
6512        if (array.get(i) instanceof JsonObject) 
6513          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6514      }
6515    };
6516    if (json.has("adjudication")) {
6517      JsonArray array = json.getAsJsonArray("adjudication");
6518      for (int i = 0; i < array.size(); i++) {
6519        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
6520      }
6521    };
6522    if (json.has("subDetail")) {
6523      JsonArray array = json.getAsJsonArray("subDetail");
6524      for (int i = 0; i < array.size(); i++) {
6525        res.getSubDetail().add(parseClaimResponseAddedItemSubDetailComponent(array.get(i).getAsJsonObject(), owner));
6526      }
6527    };
6528  }
6529
6530  protected ClaimResponse.AddedItemSubDetailComponent parseClaimResponseAddedItemSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6531    ClaimResponse.AddedItemSubDetailComponent res = new ClaimResponse.AddedItemSubDetailComponent();
6532    parseClaimResponseAddedItemSubDetailComponentProperties(json, owner, res);
6533    return res;
6534  }
6535
6536  protected void parseClaimResponseAddedItemSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemSubDetailComponent res) throws IOException, FHIRFormatError {
6537    parseBackboneElementProperties(json, res);
6538    if (json.has("productOrService"))
6539      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
6540    if (json.has("modifier")) {
6541      JsonArray array = json.getAsJsonArray("modifier");
6542      for (int i = 0; i < array.size(); i++) {
6543        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6544      }
6545    };
6546    if (json.has("quantity"))
6547      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
6548    if (json.has("unitPrice"))
6549      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
6550    if (json.has("factor"))
6551      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6552    if (json.has("_factor"))
6553      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
6554    if (json.has("net"))
6555      res.setNet(parseMoney(json.getAsJsonObject("net")));
6556    if (json.has("noteNumber")) {
6557      JsonArray array = json.getAsJsonArray("noteNumber");
6558      for (int i = 0; i < array.size(); i++) {
6559        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6560      }
6561    };
6562    if (json.has("_noteNumber")) {
6563      JsonArray array = json.getAsJsonArray("_noteNumber");
6564      for (int i = 0; i < array.size(); i++) {
6565        if (i == res.getNoteNumber().size())
6566          res.getNoteNumber().add(parsePositiveInt(null));
6567        if (array.get(i) instanceof JsonObject) 
6568          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6569      }
6570    };
6571    if (json.has("adjudication")) {
6572      JsonArray array = json.getAsJsonArray("adjudication");
6573      for (int i = 0; i < array.size(); i++) {
6574        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
6575      }
6576    };
6577  }
6578
6579  protected ClaimResponse.TotalComponent parseClaimResponseTotalComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6580    ClaimResponse.TotalComponent res = new ClaimResponse.TotalComponent();
6581    parseClaimResponseTotalComponentProperties(json, owner, res);
6582    return res;
6583  }
6584
6585  protected void parseClaimResponseTotalComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.TotalComponent res) throws IOException, FHIRFormatError {
6586    parseBackboneElementProperties(json, res);
6587    if (json.has("category"))
6588      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
6589    if (json.has("amount"))
6590      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
6591  }
6592
6593  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6594    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
6595    parseClaimResponsePaymentComponentProperties(json, owner, res);
6596    return res;
6597  }
6598
6599  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
6600    parseBackboneElementProperties(json, res);
6601    if (json.has("type"))
6602      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6603    if (json.has("adjustment"))
6604      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
6605    if (json.has("adjustmentReason"))
6606      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
6607    if (json.has("date"))
6608      res.setDateElement(parseDate(json.get("date").getAsString()));
6609    if (json.has("_date"))
6610      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6611    if (json.has("amount"))
6612      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
6613    if (json.has("identifier"))
6614      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6615  }
6616
6617  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6618    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
6619    parseClaimResponseNoteComponentProperties(json, owner, res);
6620    return res;
6621  }
6622
6623  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
6624    parseBackboneElementProperties(json, res);
6625    if (json.has("number"))
6626      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
6627    if (json.has("_number"))
6628      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
6629    if (json.has("type"))
6630      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
6631    if (json.has("_type"))
6632      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6633    if (json.has("text"))
6634      res.setTextElement(parseString(json.get("text").getAsString()));
6635    if (json.has("_text"))
6636      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
6637    if (json.has("language"))
6638      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
6639  }
6640
6641  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6642    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
6643    parseClaimResponseInsuranceComponentProperties(json, owner, res);
6644    return res;
6645  }
6646
6647  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
6648    parseBackboneElementProperties(json, res);
6649    if (json.has("sequence"))
6650      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6651    if (json.has("_sequence"))
6652      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
6653    if (json.has("focal"))
6654      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
6655    if (json.has("_focal"))
6656      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
6657    if (json.has("coverage"))
6658      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
6659    if (json.has("businessArrangement"))
6660      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
6661    if (json.has("_businessArrangement"))
6662      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
6663    if (json.has("claimResponse"))
6664      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
6665  }
6666
6667  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6668    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
6669    parseClaimResponseErrorComponentProperties(json, owner, res);
6670    return res;
6671  }
6672
6673  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
6674    parseBackboneElementProperties(json, res);
6675    if (json.has("itemSequence"))
6676      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
6677    if (json.has("_itemSequence"))
6678      parseElementProperties(json.getAsJsonObject("_itemSequence"), res.getItemSequenceElement());
6679    if (json.has("detailSequence"))
6680      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
6681    if (json.has("_detailSequence"))
6682      parseElementProperties(json.getAsJsonObject("_detailSequence"), res.getDetailSequenceElement());
6683    if (json.has("subDetailSequence"))
6684      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
6685    if (json.has("_subDetailSequence"))
6686      parseElementProperties(json.getAsJsonObject("_subDetailSequence"), res.getSubDetailSequenceElement());
6687    if (json.has("code"))
6688      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6689  }
6690
6691  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
6692    ClinicalImpression res = new ClinicalImpression();
6693    parseClinicalImpressionProperties(json, res);
6694    return res;
6695  }
6696
6697  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
6698    parseDomainResourceProperties(json, res);
6699    if (json.has("identifier")) {
6700      JsonArray array = json.getAsJsonArray("identifier");
6701      for (int i = 0; i < array.size(); i++) {
6702        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6703      }
6704    };
6705    if (json.has("status"))
6706      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
6707    if (json.has("_status"))
6708      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6709    if (json.has("statusReason"))
6710      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
6711    if (json.has("code"))
6712      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6713    if (json.has("description"))
6714      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6715    if (json.has("_description"))
6716      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6717    if (json.has("subject"))
6718      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6719    if (json.has("encounter"))
6720      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6721    Type effective = parseType("effective", json);
6722    if (effective != null)
6723      res.setEffective(effective);
6724    if (json.has("date"))
6725      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6726    if (json.has("_date"))
6727      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6728    if (json.has("performer"))
6729      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
6730    if (json.has("previous"))
6731      res.setPrevious(parseReference(json.getAsJsonObject("previous")));
6732    if (json.has("problem")) {
6733      JsonArray array = json.getAsJsonArray("problem");
6734      for (int i = 0; i < array.size(); i++) {
6735        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
6736      }
6737    };
6738    if (json.has("protocol")) {
6739      JsonArray array = json.getAsJsonArray("protocol");
6740      for (int i = 0; i < array.size(); i++) {
6741        res.getProtocol().add(parseUri(array.get(i).getAsString()));
6742      }
6743    };
6744    if (json.has("_protocol")) {
6745      JsonArray array = json.getAsJsonArray("_protocol");
6746      for (int i = 0; i < array.size(); i++) {
6747        if (i == res.getProtocol().size())
6748          res.getProtocol().add(parseUri(null));
6749        if (array.get(i) instanceof JsonObject) 
6750          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
6751      }
6752    };
6753    if (json.has("summary"))
6754      res.setSummaryElement(parseString(json.get("summary").getAsString()));
6755    if (json.has("_summary"))
6756      parseElementProperties(json.getAsJsonObject("_summary"), res.getSummaryElement());
6757    if (json.has("finding")) {
6758      JsonArray array = json.getAsJsonArray("finding");
6759      for (int i = 0; i < array.size(); i++) {
6760        res.getFinding().add(parseClinicalImpressionClinicalImpressionFindingComponent(array.get(i).getAsJsonObject(), res));
6761      }
6762    };
6763    if (json.has("prognosisCodeableConcept")) {
6764      JsonArray array = json.getAsJsonArray("prognosisCodeableConcept");
6765      for (int i = 0; i < array.size(); i++) {
6766        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6767      }
6768    };
6769    if (json.has("prognosisReference")) {
6770      JsonArray array = json.getAsJsonArray("prognosisReference");
6771      for (int i = 0; i < array.size(); i++) {
6772        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
6773      }
6774    };
6775    if (json.has("supportingInfo")) {
6776      JsonArray array = json.getAsJsonArray("supportingInfo");
6777      for (int i = 0; i < array.size(); i++) {
6778        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
6779      }
6780    };
6781    if (json.has("note")) {
6782      JsonArray array = json.getAsJsonArray("note");
6783      for (int i = 0; i < array.size(); i++) {
6784        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6785      }
6786    };
6787  }
6788
6789  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
6790    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
6791    parseClinicalImpressionClinicalImpressionFindingComponentProperties(json, owner, res);
6792    return res;
6793  }
6794
6795  protected void parseClinicalImpressionClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
6796    parseBackboneElementProperties(json, res);
6797    if (json.has("itemCodeableConcept"))
6798      res.setItemCodeableConcept(parseCodeableConcept(json.getAsJsonObject("itemCodeableConcept")));
6799    if (json.has("itemReference"))
6800      res.setItemReference(parseReference(json.getAsJsonObject("itemReference")));
6801    if (json.has("basis"))
6802      res.setBasisElement(parseString(json.get("basis").getAsString()));
6803    if (json.has("_basis"))
6804      parseElementProperties(json.getAsJsonObject("_basis"), res.getBasisElement());
6805  }
6806
6807  protected ClinicalUseIssue parseClinicalUseIssue(JsonObject json) throws IOException, FHIRFormatError {
6808    ClinicalUseIssue res = new ClinicalUseIssue();
6809    parseClinicalUseIssueProperties(json, res);
6810    return res;
6811  }
6812
6813  protected void parseClinicalUseIssueProperties(JsonObject json, ClinicalUseIssue res) throws IOException, FHIRFormatError {
6814    parseDomainResourceProperties(json, res);
6815    if (json.has("identifier")) {
6816      JsonArray array = json.getAsJsonArray("identifier");
6817      for (int i = 0; i < array.size(); i++) {
6818        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6819      }
6820    };
6821    if (json.has("type"))
6822      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ClinicalUseIssue.ClinicalUseIssueType.NULL, new ClinicalUseIssue.ClinicalUseIssueTypeEnumFactory()));
6823    if (json.has("_type"))
6824      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6825    if (json.has("subject")) {
6826      JsonArray array = json.getAsJsonArray("subject");
6827      for (int i = 0; i < array.size(); i++) {
6828        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
6829      }
6830    };
6831    if (json.has("status"))
6832      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
6833    if (json.has("description"))
6834      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6835    if (json.has("_description"))
6836      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6837    if (json.has("contraindication"))
6838      res.setContraindication(parseClinicalUseIssueClinicalUseIssueContraindicationComponent(json.getAsJsonObject("contraindication"), res));
6839    if (json.has("indication"))
6840      res.setIndication(parseClinicalUseIssueClinicalUseIssueIndicationComponent(json.getAsJsonObject("indication"), res));
6841    if (json.has("interaction"))
6842      res.setInteraction(parseClinicalUseIssueClinicalUseIssueInteractionComponent(json.getAsJsonObject("interaction"), res));
6843    if (json.has("population")) {
6844      JsonArray array = json.getAsJsonArray("population");
6845      for (int i = 0; i < array.size(); i++) {
6846        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
6847      }
6848    };
6849    if (json.has("undesirableEffect"))
6850      res.setUndesirableEffect(parseClinicalUseIssueClinicalUseIssueUndesirableEffectComponent(json.getAsJsonObject("undesirableEffect"), res));
6851  }
6852
6853  protected ClinicalUseIssue.ClinicalUseIssueContraindicationComponent parseClinicalUseIssueClinicalUseIssueContraindicationComponent(JsonObject json, ClinicalUseIssue owner) throws IOException, FHIRFormatError {
6854    ClinicalUseIssue.ClinicalUseIssueContraindicationComponent res = new ClinicalUseIssue.ClinicalUseIssueContraindicationComponent();
6855    parseClinicalUseIssueClinicalUseIssueContraindicationComponentProperties(json, owner, res);
6856    return res;
6857  }
6858
6859  protected void parseClinicalUseIssueClinicalUseIssueContraindicationComponentProperties(JsonObject json, ClinicalUseIssue owner, ClinicalUseIssue.ClinicalUseIssueContraindicationComponent res) throws IOException, FHIRFormatError {
6860    parseBackboneElementProperties(json, res);
6861    if (json.has("diseaseSymptomProcedure"))
6862      res.setDiseaseSymptomProcedure(parseCodeableConcept(json.getAsJsonObject("diseaseSymptomProcedure")));
6863    if (json.has("diseaseStatus"))
6864      res.setDiseaseStatus(parseCodeableConcept(json.getAsJsonObject("diseaseStatus")));
6865    if (json.has("comorbidity")) {
6866      JsonArray array = json.getAsJsonArray("comorbidity");
6867      for (int i = 0; i < array.size(); i++) {
6868        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6869      }
6870    };
6871    if (json.has("indication")) {
6872      JsonArray array = json.getAsJsonArray("indication");
6873      for (int i = 0; i < array.size(); i++) {
6874        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
6875      }
6876    };
6877    if (json.has("otherTherapy")) {
6878      JsonArray array = json.getAsJsonArray("otherTherapy");
6879      for (int i = 0; i < array.size(); i++) {
6880        res.getOtherTherapy().add(parseClinicalUseIssueClinicalUseIssueContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject(), owner));
6881      }
6882    };
6883  }
6884
6885  protected ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent parseClinicalUseIssueClinicalUseIssueContraindicationOtherTherapyComponent(JsonObject json, ClinicalUseIssue owner) throws IOException, FHIRFormatError {
6886    ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent res = new ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent();
6887    parseClinicalUseIssueClinicalUseIssueContraindicationOtherTherapyComponentProperties(json, owner, res);
6888    return res;
6889  }
6890
6891  protected void parseClinicalUseIssueClinicalUseIssueContraindicationOtherTherapyComponentProperties(JsonObject json, ClinicalUseIssue owner, ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
6892    parseBackboneElementProperties(json, res);
6893    if (json.has("therapyRelationshipType"))
6894      res.setTherapyRelationshipType(parseCodeableConcept(json.getAsJsonObject("therapyRelationshipType")));
6895    Type medication = parseType("medication", json);
6896    if (medication != null)
6897      res.setMedication(medication);
6898  }
6899
6900  protected ClinicalUseIssue.ClinicalUseIssueIndicationComponent parseClinicalUseIssueClinicalUseIssueIndicationComponent(JsonObject json, ClinicalUseIssue owner) throws IOException, FHIRFormatError {
6901    ClinicalUseIssue.ClinicalUseIssueIndicationComponent res = new ClinicalUseIssue.ClinicalUseIssueIndicationComponent();
6902    parseClinicalUseIssueClinicalUseIssueIndicationComponentProperties(json, owner, res);
6903    return res;
6904  }
6905
6906  protected void parseClinicalUseIssueClinicalUseIssueIndicationComponentProperties(JsonObject json, ClinicalUseIssue owner, ClinicalUseIssue.ClinicalUseIssueIndicationComponent res) throws IOException, FHIRFormatError {
6907    parseBackboneElementProperties(json, res);
6908    if (json.has("diseaseSymptomProcedure"))
6909      res.setDiseaseSymptomProcedure(parseCodeableConcept(json.getAsJsonObject("diseaseSymptomProcedure")));
6910    if (json.has("diseaseStatus"))
6911      res.setDiseaseStatus(parseCodeableConcept(json.getAsJsonObject("diseaseStatus")));
6912    if (json.has("comorbidity")) {
6913      JsonArray array = json.getAsJsonArray("comorbidity");
6914      for (int i = 0; i < array.size(); i++) {
6915        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6916      }
6917    };
6918    if (json.has("intendedEffect"))
6919      res.setIntendedEffect(parseCodeableConcept(json.getAsJsonObject("intendedEffect")));
6920    if (json.has("duration"))
6921      res.setDuration(parseQuantity(json.getAsJsonObject("duration")));
6922    if (json.has("undesirableEffect")) {
6923      JsonArray array = json.getAsJsonArray("undesirableEffect");
6924      for (int i = 0; i < array.size(); i++) {
6925        res.getUndesirableEffect().add(parseReference(array.get(i).getAsJsonObject()));
6926      }
6927    };
6928    if (json.has("otherTherapy")) {
6929      JsonArray array = json.getAsJsonArray("otherTherapy");
6930      for (int i = 0; i < array.size(); i++) {
6931        res.getOtherTherapy().add(parseClinicalUseIssueClinicalUseIssueContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject(), owner));
6932      }
6933    };
6934  }
6935
6936  protected ClinicalUseIssue.ClinicalUseIssueInteractionComponent parseClinicalUseIssueClinicalUseIssueInteractionComponent(JsonObject json, ClinicalUseIssue owner) throws IOException, FHIRFormatError {
6937    ClinicalUseIssue.ClinicalUseIssueInteractionComponent res = new ClinicalUseIssue.ClinicalUseIssueInteractionComponent();
6938    parseClinicalUseIssueClinicalUseIssueInteractionComponentProperties(json, owner, res);
6939    return res;
6940  }
6941
6942  protected void parseClinicalUseIssueClinicalUseIssueInteractionComponentProperties(JsonObject json, ClinicalUseIssue owner, ClinicalUseIssue.ClinicalUseIssueInteractionComponent res) throws IOException, FHIRFormatError {
6943    parseBackboneElementProperties(json, res);
6944    if (json.has("interactant")) {
6945      JsonArray array = json.getAsJsonArray("interactant");
6946      for (int i = 0; i < array.size(); i++) {
6947        res.getInteractant().add(parseClinicalUseIssueClinicalUseIssueInteractionInteractantComponent(array.get(i).getAsJsonObject(), owner));
6948      }
6949    };
6950    if (json.has("type"))
6951      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6952    if (json.has("effect"))
6953      res.setEffect(parseCodeableConcept(json.getAsJsonObject("effect")));
6954    if (json.has("incidence"))
6955      res.setIncidence(parseCodeableConcept(json.getAsJsonObject("incidence")));
6956    if (json.has("management"))
6957      res.setManagement(parseCodeableConcept(json.getAsJsonObject("management")));
6958  }
6959
6960  protected ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent parseClinicalUseIssueClinicalUseIssueInteractionInteractantComponent(JsonObject json, ClinicalUseIssue owner) throws IOException, FHIRFormatError {
6961    ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent res = new ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent();
6962    parseClinicalUseIssueClinicalUseIssueInteractionInteractantComponentProperties(json, owner, res);
6963    return res;
6964  }
6965
6966  protected void parseClinicalUseIssueClinicalUseIssueInteractionInteractantComponentProperties(JsonObject json, ClinicalUseIssue owner, ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent res) throws IOException, FHIRFormatError {
6967    parseBackboneElementProperties(json, res);
6968    Type item = parseType("item", json);
6969    if (item != null)
6970      res.setItem(item);
6971  }
6972
6973  protected ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent parseClinicalUseIssueClinicalUseIssueUndesirableEffectComponent(JsonObject json, ClinicalUseIssue owner) throws IOException, FHIRFormatError {
6974    ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent res = new ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent();
6975    parseClinicalUseIssueClinicalUseIssueUndesirableEffectComponentProperties(json, owner, res);
6976    return res;
6977  }
6978
6979  protected void parseClinicalUseIssueClinicalUseIssueUndesirableEffectComponentProperties(JsonObject json, ClinicalUseIssue owner, ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent res) throws IOException, FHIRFormatError {
6980    parseBackboneElementProperties(json, res);
6981    if (json.has("symptomConditionEffect"))
6982      res.setSymptomConditionEffect(parseCodeableConcept(json.getAsJsonObject("symptomConditionEffect")));
6983    if (json.has("classification"))
6984      res.setClassification(parseCodeableConcept(json.getAsJsonObject("classification")));
6985    if (json.has("frequencyOfOccurrence"))
6986      res.setFrequencyOfOccurrence(parseCodeableConcept(json.getAsJsonObject("frequencyOfOccurrence")));
6987  }
6988
6989  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
6990    CodeSystem res = new CodeSystem();
6991    parseCodeSystemProperties(json, res);
6992    return res;
6993  }
6994
6995  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
6996    parseDomainResourceProperties(json, res);
6997    if (json.has("url"))
6998      res.setUrlElement(parseUri(json.get("url").getAsString()));
6999    if (json.has("_url"))
7000      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7001    if (json.has("identifier")) {
7002      JsonArray array = json.getAsJsonArray("identifier");
7003      for (int i = 0; i < array.size(); i++) {
7004        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7005      }
7006    };
7007    if (json.has("version"))
7008      res.setVersionElement(parseString(json.get("version").getAsString()));
7009    if (json.has("_version"))
7010      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
7011    if (json.has("name"))
7012      res.setNameElement(parseString(json.get("name").getAsString()));
7013    if (json.has("_name"))
7014      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7015    if (json.has("title"))
7016      res.setTitleElement(parseString(json.get("title").getAsString()));
7017    if (json.has("_title"))
7018      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
7019    if (json.has("status"))
7020      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
7021    if (json.has("_status"))
7022      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7023    if (json.has("experimental"))
7024      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
7025    if (json.has("_experimental"))
7026      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
7027    if (json.has("date"))
7028      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7029    if (json.has("_date"))
7030      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7031    if (json.has("publisher"))
7032      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7033    if (json.has("_publisher"))
7034      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
7035    if (json.has("contact")) {
7036      JsonArray array = json.getAsJsonArray("contact");
7037      for (int i = 0; i < array.size(); i++) {
7038        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
7039      }
7040    };
7041    if (json.has("description"))
7042      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
7043    if (json.has("_description"))
7044      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7045    if (json.has("useContext")) {
7046      JsonArray array = json.getAsJsonArray("useContext");
7047      for (int i = 0; i < array.size(); i++) {
7048        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
7049      }
7050    };
7051    if (json.has("jurisdiction")) {
7052      JsonArray array = json.getAsJsonArray("jurisdiction");
7053      for (int i = 0; i < array.size(); i++) {
7054        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7055      }
7056    };
7057    if (json.has("purpose"))
7058      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
7059    if (json.has("_purpose"))
7060      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
7061    if (json.has("copyright"))
7062      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
7063    if (json.has("_copyright"))
7064      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
7065    if (json.has("caseSensitive"))
7066      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
7067    if (json.has("_caseSensitive"))
7068      parseElementProperties(json.getAsJsonObject("_caseSensitive"), res.getCaseSensitiveElement());
7069    if (json.has("valueSet"))
7070      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
7071    if (json.has("_valueSet"))
7072      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
7073    if (json.has("hierarchyMeaning"))
7074      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
7075    if (json.has("_hierarchyMeaning"))
7076      parseElementProperties(json.getAsJsonObject("_hierarchyMeaning"), res.getHierarchyMeaningElement());
7077    if (json.has("compositional"))
7078      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
7079    if (json.has("_compositional"))
7080      parseElementProperties(json.getAsJsonObject("_compositional"), res.getCompositionalElement());
7081    if (json.has("versionNeeded"))
7082      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
7083    if (json.has("_versionNeeded"))
7084      parseElementProperties(json.getAsJsonObject("_versionNeeded"), res.getVersionNeededElement());
7085    if (json.has("content"))
7086      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
7087    if (json.has("_content"))
7088      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
7089    if (json.has("supplements"))
7090      res.setSupplementsElement(parseCanonical(json.get("supplements").getAsString()));
7091    if (json.has("_supplements"))
7092      parseElementProperties(json.getAsJsonObject("_supplements"), res.getSupplementsElement());
7093    if (json.has("count"))
7094      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
7095    if (json.has("_count"))
7096      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
7097    if (json.has("filter")) {
7098      JsonArray array = json.getAsJsonArray("filter");
7099      for (int i = 0; i < array.size(); i++) {
7100        res.getFilter().add(parseCodeSystemCodeSystemFilterComponent(array.get(i).getAsJsonObject(), res));
7101      }
7102    };
7103    if (json.has("property")) {
7104      JsonArray array = json.getAsJsonArray("property");
7105      for (int i = 0; i < array.size(); i++) {
7106        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject(), res));
7107      }
7108    };
7109    if (json.has("concept")) {
7110      JsonArray array = json.getAsJsonArray("concept");
7111      for (int i = 0; i < array.size(); i++) {
7112        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), res));
7113      }
7114    };
7115  }
7116
7117  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemCodeSystemFilterComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
7118    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
7119    parseCodeSystemCodeSystemFilterComponentProperties(json, owner, res);
7120    return res;
7121  }
7122
7123  protected void parseCodeSystemCodeSystemFilterComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
7124    parseBackboneElementProperties(json, res);
7125    if (json.has("code"))
7126      res.setCodeElement(parseCode(json.get("code").getAsString()));
7127    if (json.has("_code"))
7128      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7129    if (json.has("description"))
7130      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7131    if (json.has("_description"))
7132      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7133    if (json.has("operator")) {
7134      JsonArray array = json.getAsJsonArray("operator");
7135      for (int i = 0; i < array.size(); i++) {
7136        res.getOperator().add(parseEnumeration(array.get(i).getAsString(), CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
7137      }
7138    };
7139    if (json.has("_operator")) {
7140      JsonArray array = json.getAsJsonArray("_operator");
7141      for (int i = 0; i < array.size(); i++) {
7142        if (i == res.getOperator().size())
7143          res.getOperator().add(parseEnumeration(null, CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
7144        if (array.get(i) instanceof JsonObject) 
7145          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
7146      }
7147    };
7148    if (json.has("value"))
7149      res.setValueElement(parseString(json.get("value").getAsString()));
7150    if (json.has("_value"))
7151      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
7152  }
7153
7154  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
7155    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
7156    parseCodeSystemPropertyComponentProperties(json, owner, res);
7157    return res;
7158  }
7159
7160  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
7161    parseBackboneElementProperties(json, res);
7162    if (json.has("code"))
7163      res.setCodeElement(parseCode(json.get("code").getAsString()));
7164    if (json.has("_code"))
7165      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7166    if (json.has("uri"))
7167      res.setUriElement(parseUri(json.get("uri").getAsString()));
7168    if (json.has("_uri"))
7169      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
7170    if (json.has("description"))
7171      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7172    if (json.has("_description"))
7173      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7174    if (json.has("type"))
7175      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
7176    if (json.has("_type"))
7177      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
7178  }
7179
7180  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
7181    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
7182    parseCodeSystemConceptDefinitionComponentProperties(json, owner, res);
7183    return res;
7184  }
7185
7186  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
7187    parseBackboneElementProperties(json, res);
7188    if (json.has("code"))
7189      res.setCodeElement(parseCode(json.get("code").getAsString()));
7190    if (json.has("_code"))
7191      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7192    if (json.has("display"))
7193      res.setDisplayElement(parseString(json.get("display").getAsString()));
7194    if (json.has("_display"))
7195      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
7196    if (json.has("definition"))
7197      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
7198    if (json.has("_definition"))
7199      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
7200    if (json.has("designation")) {
7201      JsonArray array = json.getAsJsonArray("designation");
7202      for (int i = 0; i < array.size(); i++) {
7203        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
7204      }
7205    };
7206    if (json.has("property")) {
7207      JsonArray array = json.getAsJsonArray("property");
7208      for (int i = 0; i < array.size(); i++) {
7209        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject(), owner));
7210      }
7211    };
7212    if (json.has("concept")) {
7213      JsonArray array = json.getAsJsonArray("concept");
7214      for (int i = 0; i < array.size(); i++) {
7215        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
7216      }
7217    };
7218  }
7219
7220  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
7221    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
7222    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, owner, res);
7223    return res;
7224  }
7225
7226  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
7227    parseBackboneElementProperties(json, res);
7228    if (json.has("language"))
7229      res.setLanguageElement(parseCode(json.get("language").getAsString()));
7230    if (json.has("_language"))
7231      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
7232    if (json.has("use"))
7233      res.setUse(parseCoding(json.getAsJsonObject("use")));
7234    if (json.has("value"))
7235      res.setValueElement(parseString(json.get("value").getAsString()));
7236    if (json.has("_value"))
7237      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
7238  }
7239
7240  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
7241    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
7242    parseCodeSystemConceptPropertyComponentProperties(json, owner, res);
7243    return res;
7244  }
7245
7246  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
7247    parseBackboneElementProperties(json, res);
7248    if (json.has("code"))
7249      res.setCodeElement(parseCode(json.get("code").getAsString()));
7250    if (json.has("_code"))
7251      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7252    Type value = parseType("value", json);
7253    if (value != null)
7254      res.setValue(value);
7255  }
7256
7257  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
7258    Communication res = new Communication();
7259    parseCommunicationProperties(json, res);
7260    return res;
7261  }
7262
7263  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
7264    parseDomainResourceProperties(json, res);
7265    if (json.has("identifier")) {
7266      JsonArray array = json.getAsJsonArray("identifier");
7267      for (int i = 0; i < array.size(); i++) {
7268        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7269      }
7270    };
7271    if (json.has("instantiatesCanonical")) {
7272      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
7273      for (int i = 0; i < array.size(); i++) {
7274        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
7275      }
7276    };
7277    if (json.has("_instantiatesCanonical")) {
7278      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
7279      for (int i = 0; i < array.size(); i++) {
7280        if (i == res.getInstantiatesCanonical().size())
7281          res.getInstantiatesCanonical().add(parseCanonical(null));
7282        if (array.get(i) instanceof JsonObject) 
7283          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
7284      }
7285    };
7286    if (json.has("instantiatesUri")) {
7287      JsonArray array = json.getAsJsonArray("instantiatesUri");
7288      for (int i = 0; i < array.size(); i++) {
7289        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
7290      }
7291    };
7292    if (json.has("_instantiatesUri")) {
7293      JsonArray array = json.getAsJsonArray("_instantiatesUri");
7294      for (int i = 0; i < array.size(); i++) {
7295        if (i == res.getInstantiatesUri().size())
7296          res.getInstantiatesUri().add(parseUri(null));
7297        if (array.get(i) instanceof JsonObject) 
7298          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
7299      }
7300    };
7301    if (json.has("basedOn")) {
7302      JsonArray array = json.getAsJsonArray("basedOn");
7303      for (int i = 0; i < array.size(); i++) {
7304        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7305      }
7306    };
7307    if (json.has("partOf")) {
7308      JsonArray array = json.getAsJsonArray("partOf");
7309      for (int i = 0; i < array.size(); i++) {
7310        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
7311      }
7312    };
7313    if (json.has("inResponseTo")) {
7314      JsonArray array = json.getAsJsonArray("inResponseTo");
7315      for (int i = 0; i < array.size(); i++) {
7316        res.getInResponseTo().add(parseReference(array.get(i).getAsJsonObject()));
7317      }
7318    };
7319    if (json.has("status"))
7320      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Communication.CommunicationStatus.NULL, new Communication.CommunicationStatusEnumFactory()));
7321    if (json.has("_status"))
7322      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7323    if (json.has("statusReason"))
7324      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
7325    if (json.has("category")) {
7326      JsonArray array = json.getAsJsonArray("category");
7327      for (int i = 0; i < array.size(); i++) {
7328        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7329      }
7330    };
7331    if (json.has("priority"))
7332      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Communication.CommunicationPriority.NULL, new Communication.CommunicationPriorityEnumFactory()));
7333    if (json.has("_priority"))
7334      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
7335    if (json.has("medium")) {
7336      JsonArray array = json.getAsJsonArray("medium");
7337      for (int i = 0; i < array.size(); i++) {
7338        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7339      }
7340    };
7341    if (json.has("subject"))
7342      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7343    if (json.has("topic"))
7344      res.setTopic(parseCodeableConcept(json.getAsJsonObject("topic")));
7345    if (json.has("about")) {
7346      JsonArray array = json.getAsJsonArray("about");
7347      for (int i = 0; i < array.size(); i++) {
7348        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
7349      }
7350    };
7351    if (json.has("encounter"))
7352      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7353    if (json.has("sent"))
7354      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
7355    if (json.has("_sent"))
7356      parseElementProperties(json.getAsJsonObject("_sent"), res.getSentElement());
7357    if (json.has("received"))
7358      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
7359    if (json.has("_received"))
7360      parseElementProperties(json.getAsJsonObject("_received"), res.getReceivedElement());
7361    if (json.has("recipient")) {
7362      JsonArray array = json.getAsJsonArray("recipient");
7363      for (int i = 0; i < array.size(); i++) {
7364        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
7365      }
7366    };
7367    if (json.has("sender"))
7368      res.setSender(parseReference(json.getAsJsonObject("sender")));
7369    if (json.has("reasonCode")) {
7370      JsonArray array = json.getAsJsonArray("reasonCode");
7371      for (int i = 0; i < array.size(); i++) {
7372        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7373      }
7374    };
7375    if (json.has("reasonReference")) {
7376      JsonArray array = json.getAsJsonArray("reasonReference");
7377      for (int i = 0; i < array.size(); i++) {
7378        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
7379      }
7380    };
7381    if (json.has("payload")) {
7382      JsonArray array = json.getAsJsonArray("payload");
7383      for (int i = 0; i < array.size(); i++) {
7384        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(array.get(i).getAsJsonObject(), res));
7385      }
7386    };
7387    if (json.has("note")) {
7388      JsonArray array = json.getAsJsonArray("note");
7389      for (int i = 0; i < array.size(); i++) {
7390        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7391      }
7392    };
7393  }
7394
7395  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(JsonObject json, Communication owner) throws IOException, FHIRFormatError {
7396    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
7397    parseCommunicationCommunicationPayloadComponentProperties(json, owner, res);
7398    return res;
7399  }
7400
7401  protected void parseCommunicationCommunicationPayloadComponentProperties(JsonObject json, Communication owner, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
7402    parseBackboneElementProperties(json, res);
7403    Type content = parseType("content", json);
7404    if (content != null)
7405      res.setContent(content);
7406  }
7407
7408  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
7409    CommunicationRequest res = new CommunicationRequest();
7410    parseCommunicationRequestProperties(json, res);
7411    return res;
7412  }
7413
7414  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
7415    parseDomainResourceProperties(json, res);
7416    if (json.has("identifier")) {
7417      JsonArray array = json.getAsJsonArray("identifier");
7418      for (int i = 0; i < array.size(); i++) {
7419        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7420      }
7421    };
7422    if (json.has("basedOn")) {
7423      JsonArray array = json.getAsJsonArray("basedOn");
7424      for (int i = 0; i < array.size(); i++) {
7425        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7426      }
7427    };
7428    if (json.has("replaces")) {
7429      JsonArray array = json.getAsJsonArray("replaces");
7430      for (int i = 0; i < array.size(); i++) {
7431        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
7432      }
7433    };
7434    if (json.has("groupIdentifier"))
7435      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
7436    if (json.has("status"))
7437      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CommunicationRequest.CommunicationRequestStatus.NULL, new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
7438    if (json.has("_status"))
7439      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7440    if (json.has("statusReason"))
7441      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
7442    if (json.has("category")) {
7443      JsonArray array = json.getAsJsonArray("category");
7444      for (int i = 0; i < array.size(); i++) {
7445        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7446      }
7447    };
7448    if (json.has("priority"))
7449      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), CommunicationRequest.CommunicationPriority.NULL, new CommunicationRequest.CommunicationPriorityEnumFactory()));
7450    if (json.has("_priority"))
7451      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
7452    if (json.has("doNotPerform"))
7453      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
7454    if (json.has("_doNotPerform"))
7455      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
7456    if (json.has("medium")) {
7457      JsonArray array = json.getAsJsonArray("medium");
7458      for (int i = 0; i < array.size(); i++) {
7459        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7460      }
7461    };
7462    if (json.has("subject"))
7463      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7464    if (json.has("about")) {
7465      JsonArray array = json.getAsJsonArray("about");
7466      for (int i = 0; i < array.size(); i++) {
7467        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
7468      }
7469    };
7470    if (json.has("encounter"))
7471      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7472    if (json.has("payload")) {
7473      JsonArray array = json.getAsJsonArray("payload");
7474      for (int i = 0; i < array.size(); i++) {
7475        res.getPayload().add(parseCommunicationRequestCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject(), res));
7476      }
7477    };
7478    Type occurrence = parseType("occurrence", json);
7479    if (occurrence != null)
7480      res.setOccurrence(occurrence);
7481    if (json.has("authoredOn"))
7482      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
7483    if (json.has("_authoredOn"))
7484      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
7485    if (json.has("requester"))
7486      res.setRequester(parseReference(json.getAsJsonObject("requester")));
7487    if (json.has("recipient")) {
7488      JsonArray array = json.getAsJsonArray("recipient");
7489      for (int i = 0; i < array.size(); i++) {
7490        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
7491      }
7492    };
7493    if (json.has("informationProvider")) {
7494      JsonArray array = json.getAsJsonArray("informationProvider");
7495      for (int i = 0; i < array.size(); i++) {
7496        res.getInformationProvider().add(parseReference(array.get(i).getAsJsonObject()));
7497      }
7498    };
7499    if (json.has("reasonCode")) {
7500      JsonArray array = json.getAsJsonArray("reasonCode");
7501      for (int i = 0; i < array.size(); i++) {
7502        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7503      }
7504    };
7505    if (json.has("reasonReference")) {
7506      JsonArray array = json.getAsJsonArray("reasonReference");
7507      for (int i = 0; i < array.size(); i++) {
7508        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
7509      }
7510    };
7511    if (json.has("note")) {
7512      JsonArray array = json.getAsJsonArray("note");
7513      for (int i = 0; i < array.size(); i++) {
7514        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7515      }
7516    };
7517  }
7518
7519  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
7520    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
7521    parseCommunicationRequestCommunicationRequestPayloadComponentProperties(json, owner, res);
7522    return res;
7523  }
7524
7525  protected void parseCommunicationRequestCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest owner, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
7526    parseBackboneElementProperties(json, res);
7527    Type content = parseType("content", json);
7528    if (content != null)
7529      res.setContent(content);
7530  }
7531
7532  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
7533    CompartmentDefinition res = new CompartmentDefinition();
7534    parseCompartmentDefinitionProperties(json, res);
7535    return res;
7536  }
7537
7538  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
7539    parseDomainResourceProperties(json, res);
7540    if (json.has("url"))
7541      res.setUrlElement(parseUri(json.get("url").getAsString()));
7542    if (json.has("_url"))
7543      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7544    if (json.has("version"))
7545      res.setVersionElement(parseString(json.get("version").getAsString()));
7546    if (json.has("_version"))
7547      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
7548    if (json.has("name"))
7549      res.setNameElement(parseString(json.get("name").getAsString()));
7550    if (json.has("_name"))
7551      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7552    if (json.has("status"))
7553      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
7554    if (json.has("_status"))
7555      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7556    if (json.has("experimental"))
7557      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
7558    if (json.has("_experimental"))
7559      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
7560    if (json.has("date"))
7561      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7562    if (json.has("_date"))
7563      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7564    if (json.has("publisher"))
7565      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7566    if (json.has("_publisher"))
7567      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
7568    if (json.has("contact")) {
7569      JsonArray array = json.getAsJsonArray("contact");
7570      for (int i = 0; i < array.size(); i++) {
7571        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
7572      }
7573    };
7574    if (json.has("description"))
7575      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
7576    if (json.has("_description"))
7577      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7578    if (json.has("useContext")) {
7579      JsonArray array = json.getAsJsonArray("useContext");
7580      for (int i = 0; i < array.size(); i++) {
7581        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
7582      }
7583    };
7584    if (json.has("purpose"))
7585      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
7586    if (json.has("_purpose"))
7587      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
7588    if (json.has("code"))
7589      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CompartmentDefinition.CompartmentType.NULL, new CompartmentDefinition.CompartmentTypeEnumFactory()));
7590    if (json.has("_code"))
7591      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7592    if (json.has("search"))
7593      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
7594    if (json.has("_search"))
7595      parseElementProperties(json.getAsJsonObject("_search"), res.getSearchElement());
7596    if (json.has("resource")) {
7597      JsonArray array = json.getAsJsonArray("resource");
7598      for (int i = 0; i < array.size(); i++) {
7599        res.getResource().add(parseCompartmentDefinitionCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject(), res));
7600      }
7601    };
7602  }
7603
7604  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionCompartmentDefinitionResourceComponent(JsonObject json, CompartmentDefinition owner) throws IOException, FHIRFormatError {
7605    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
7606    parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(json, owner, res);
7607    return res;
7608  }
7609
7610  protected void parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition owner, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
7611    parseBackboneElementProperties(json, res);
7612    if (json.has("code"))
7613      res.setCodeElement(parseCode(json.get("code").getAsString()));
7614    if (json.has("_code"))
7615      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7616    if (json.has("param")) {
7617      JsonArray array = json.getAsJsonArray("param");
7618      for (int i = 0; i < array.size(); i++) {
7619        res.getParam().add(parseString(array.get(i).getAsString()));
7620      }
7621    };
7622    if (json.has("_param")) {
7623      JsonArray array = json.getAsJsonArray("_param");
7624      for (int i = 0; i < array.size(); i++) {
7625        if (i == res.getParam().size())
7626          res.getParam().add(parseString(null));
7627        if (array.get(i) instanceof JsonObject) 
7628          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
7629      }
7630    };
7631    if (json.has("documentation"))
7632      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
7633    if (json.has("_documentation"))
7634      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
7635  }
7636
7637  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
7638    Composition res = new Composition();
7639    parseCompositionProperties(json, res);
7640    return res;
7641  }
7642
7643  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
7644    parseDomainResourceProperties(json, res);
7645    if (json.has("identifier"))
7646      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7647    if (json.has("status"))
7648      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Composition.CompositionStatus.NULL, new Composition.CompositionStatusEnumFactory()));
7649    if (json.has("_status"))
7650      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7651    if (json.has("type"))
7652      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7653    if (json.has("category")) {
7654      JsonArray array = json.getAsJsonArray("category");
7655      for (int i = 0; i < array.size(); i++) {
7656        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7657      }
7658    };
7659    if (json.has("subject"))
7660      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7661    if (json.has("encounter"))
7662      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7663    if (json.has("date"))
7664      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7665    if (json.has("_date"))
7666      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7667    if (json.has("author")) {
7668      JsonArray array = json.getAsJsonArray("author");
7669      for (int i = 0; i < array.size(); i++) {
7670        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
7671      }
7672    };
7673    if (json.has("title"))
7674      res.setTitleElement(parseString(json.get("title").getAsString()));
7675    if (json.has("_title"))
7676      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
7677    if (json.has("confidentiality"))
7678      res.setConfidentialityElement(parseEnumeration(json.get("confidentiality").getAsString(), Composition.DocumentConfidentiality.NULL, new Composition.DocumentConfidentialityEnumFactory()));
7679    if (json.has("_confidentiality"))
7680      parseElementProperties(json.getAsJsonObject("_confidentiality"), res.getConfidentialityElement());
7681    if (json.has("attester")) {
7682      JsonArray array = json.getAsJsonArray("attester");
7683      for (int i = 0; i < array.size(); i++) {
7684        res.getAttester().add(parseCompositionCompositionAttesterComponent(array.get(i).getAsJsonObject(), res));
7685      }
7686    };
7687    if (json.has("custodian"))
7688      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
7689    if (json.has("relatesTo")) {
7690      JsonArray array = json.getAsJsonArray("relatesTo");
7691      for (int i = 0; i < array.size(); i++) {
7692        res.getRelatesTo().add(parseCompositionCompositionRelatesToComponent(array.get(i).getAsJsonObject(), res));
7693      }
7694    };
7695    if (json.has("event")) {
7696      JsonArray array = json.getAsJsonArray("event");
7697      for (int i = 0; i < array.size(); i++) {
7698        res.getEvent().add(parseCompositionCompositionEventComponent(array.get(i).getAsJsonObject(), res));
7699      }
7700    };
7701    if (json.has("section")) {
7702      JsonArray array = json.getAsJsonArray("section");
7703      for (int i = 0; i < array.size(); i++) {
7704        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), res));
7705      }
7706    };
7707  }
7708
7709  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
7710    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
7711    parseCompositionCompositionAttesterComponentProperties(json, owner, res);
7712    return res;
7713  }
7714
7715  protected void parseCompositionCompositionAttesterComponentProperties(JsonObject json, Composition owner, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
7716    parseBackboneElementProperties(json, res);
7717    if (json.has("mode"))
7718      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
7719    if (json.has("_mode"))
7720      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
7721    if (json.has("time"))
7722      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
7723    if (json.has("_time"))
7724      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
7725    if (json.has("party"))
7726      res.setParty(parseReference(json.getAsJsonObject("party")));
7727  }
7728
7729  protected Composition.CompositionRelatesToComponent parseCompositionCompositionRelatesToComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
7730    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
7731    parseCompositionCompositionRelatesToComponentProperties(json, owner, res);
7732    return res;
7733  }
7734
7735  protected void parseCompositionCompositionRelatesToComponentProperties(JsonObject json, Composition owner, Composition.CompositionRelatesToComponent res) throws IOException, FHIRFormatError {
7736    parseBackboneElementProperties(json, res);
7737    if (json.has("code"))
7738      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Composition.DocumentRelationshipType.NULL, new Composition.DocumentRelationshipTypeEnumFactory()));
7739    if (json.has("_code"))
7740      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7741    Type target = parseType("target", json);
7742    if (target != null)
7743      res.setTarget(target);
7744  }
7745
7746  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
7747    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
7748    parseCompositionCompositionEventComponentProperties(json, owner, res);
7749    return res;
7750  }
7751
7752  protected void parseCompositionCompositionEventComponentProperties(JsonObject json, Composition owner, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
7753    parseBackboneElementProperties(json, res);
7754    if (json.has("code")) {
7755      JsonArray array = json.getAsJsonArray("code");
7756      for (int i = 0; i < array.size(); i++) {
7757        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7758      }
7759    };
7760    if (json.has("period"))
7761      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
7762    if (json.has("detail")) {
7763      JsonArray array = json.getAsJsonArray("detail");
7764      for (int i = 0; i < array.size(); i++) {
7765        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
7766      }
7767    };
7768  }
7769
7770  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
7771    Composition.SectionComponent res = new Composition.SectionComponent();
7772    parseCompositionSectionComponentProperties(json, owner, res);
7773    return res;
7774  }
7775
7776  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition owner, Composition.SectionComponent res) throws IOException, FHIRFormatError {
7777    parseBackboneElementProperties(json, res);
7778    if (json.has("title"))
7779      res.setTitleElement(parseString(json.get("title").getAsString()));
7780    if (json.has("_title"))
7781      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
7782    if (json.has("code"))
7783      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7784    if (json.has("author")) {
7785      JsonArray array = json.getAsJsonArray("author");
7786      for (int i = 0; i < array.size(); i++) {
7787        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
7788      }
7789    };
7790    if (json.has("focus"))
7791      res.setFocus(parseReference(json.getAsJsonObject("focus")));
7792    if (json.has("text"))
7793      res.setText(parseNarrative(json.getAsJsonObject("text")));
7794    if (json.has("mode"))
7795      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.SectionMode.NULL, new Composition.SectionModeEnumFactory()));
7796    if (json.has("_mode"))
7797      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
7798    if (json.has("orderedBy"))
7799      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
7800    if (json.has("entry")) {
7801      JsonArray array = json.getAsJsonArray("entry");
7802      for (int i = 0; i < array.size(); i++) {
7803        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
7804      }
7805    };
7806    if (json.has("emptyReason"))
7807      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
7808    if (json.has("section")) {
7809      JsonArray array = json.getAsJsonArray("section");
7810      for (int i = 0; i < array.size(); i++) {
7811        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), owner));
7812      }
7813    };
7814  }
7815
7816  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
7817    ConceptMap res = new ConceptMap();
7818    parseConceptMapProperties(json, res);
7819    return res;
7820  }
7821
7822  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
7823    parseDomainResourceProperties(json, res);
7824    if (json.has("url"))
7825      res.setUrlElement(parseUri(json.get("url").getAsString()));
7826    if (json.has("_url"))
7827      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7828    if (json.has("identifier"))
7829      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7830    if (json.has("version"))
7831      res.setVersionElement(parseString(json.get("version").getAsString()));
7832    if (json.has("_version"))
7833      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
7834    if (json.has("name"))
7835      res.setNameElement(parseString(json.get("name").getAsString()));
7836    if (json.has("_name"))
7837      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7838    if (json.has("title"))
7839      res.setTitleElement(parseString(json.get("title").getAsString()));
7840    if (json.has("_title"))
7841      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
7842    if (json.has("status"))
7843      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
7844    if (json.has("_status"))
7845      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7846    if (json.has("experimental"))
7847      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
7848    if (json.has("_experimental"))
7849      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
7850    if (json.has("date"))
7851      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7852    if (json.has("_date"))
7853      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7854    if (json.has("publisher"))
7855      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7856    if (json.has("_publisher"))
7857      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
7858    if (json.has("contact")) {
7859      JsonArray array = json.getAsJsonArray("contact");
7860      for (int i = 0; i < array.size(); i++) {
7861        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
7862      }
7863    };
7864    if (json.has("description"))
7865      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
7866    if (json.has("_description"))
7867      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7868    if (json.has("useContext")) {
7869      JsonArray array = json.getAsJsonArray("useContext");
7870      for (int i = 0; i < array.size(); i++) {
7871        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
7872      }
7873    };
7874    if (json.has("jurisdiction")) {
7875      JsonArray array = json.getAsJsonArray("jurisdiction");
7876      for (int i = 0; i < array.size(); i++) {
7877        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7878      }
7879    };
7880    if (json.has("purpose"))
7881      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
7882    if (json.has("_purpose"))
7883      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
7884    if (json.has("copyright"))
7885      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
7886    if (json.has("_copyright"))
7887      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
7888    Type source = parseType("source", json);
7889    if (source != null)
7890      res.setSource(source);
7891    Type target = parseType("target", json);
7892    if (target != null)
7893      res.setTarget(target);
7894    if (json.has("group")) {
7895      JsonArray array = json.getAsJsonArray("group");
7896      for (int i = 0; i < array.size(); i++) {
7897        res.getGroup().add(parseConceptMapConceptMapGroupComponent(array.get(i).getAsJsonObject(), res));
7898      }
7899    };
7900  }
7901
7902  protected ConceptMap.ConceptMapGroupComponent parseConceptMapConceptMapGroupComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7903    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
7904    parseConceptMapConceptMapGroupComponentProperties(json, owner, res);
7905    return res;
7906  }
7907
7908  protected void parseConceptMapConceptMapGroupComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupComponent res) throws IOException, FHIRFormatError {
7909    parseBackboneElementProperties(json, res);
7910    if (json.has("source"))
7911      res.setSourceElement(parseUri(json.get("source").getAsString()));
7912    if (json.has("_source"))
7913      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
7914    if (json.has("sourceVersion"))
7915      res.setSourceVersionElement(parseString(json.get("sourceVersion").getAsString()));
7916    if (json.has("_sourceVersion"))
7917      parseElementProperties(json.getAsJsonObject("_sourceVersion"), res.getSourceVersionElement());
7918    if (json.has("target"))
7919      res.setTargetElement(parseUri(json.get("target").getAsString()));
7920    if (json.has("_target"))
7921      parseElementProperties(json.getAsJsonObject("_target"), res.getTargetElement());
7922    if (json.has("targetVersion"))
7923      res.setTargetVersionElement(parseString(json.get("targetVersion").getAsString()));
7924    if (json.has("_targetVersion"))
7925      parseElementProperties(json.getAsJsonObject("_targetVersion"), res.getTargetVersionElement());
7926    if (json.has("element")) {
7927      JsonArray array = json.getAsJsonArray("element");
7928      for (int i = 0; i < array.size(); i++) {
7929        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject(), owner));
7930      }
7931    };
7932    if (json.has("unmapped"))
7933      res.setUnmapped(parseConceptMapConceptMapGroupUnmappedComponent(json.getAsJsonObject("unmapped"), owner));
7934  }
7935
7936  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7937    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
7938    parseConceptMapSourceElementComponentProperties(json, owner, res);
7939    return res;
7940  }
7941
7942  protected void parseConceptMapSourceElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.SourceElementComponent res) throws IOException, FHIRFormatError {
7943    parseBackboneElementProperties(json, res);
7944    if (json.has("code"))
7945      res.setCodeElement(parseCode(json.get("code").getAsString()));
7946    if (json.has("_code"))
7947      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7948    if (json.has("display"))
7949      res.setDisplayElement(parseString(json.get("display").getAsString()));
7950    if (json.has("_display"))
7951      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
7952    if (json.has("noMap"))
7953      res.setNoMapElement(parseBoolean(json.get("noMap").getAsBoolean()));
7954    if (json.has("_noMap"))
7955      parseElementProperties(json.getAsJsonObject("_noMap"), res.getNoMapElement());
7956    if (json.has("target")) {
7957      JsonArray array = json.getAsJsonArray("target");
7958      for (int i = 0; i < array.size(); i++) {
7959        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject(), owner));
7960      }
7961    };
7962  }
7963
7964  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7965    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
7966    parseConceptMapTargetElementComponentProperties(json, owner, res);
7967    return res;
7968  }
7969
7970  protected void parseConceptMapTargetElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.TargetElementComponent res) throws IOException, FHIRFormatError {
7971    parseBackboneElementProperties(json, res);
7972    if (json.has("code"))
7973      res.setCodeElement(parseCode(json.get("code").getAsString()));
7974    if (json.has("_code"))
7975      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7976    if (json.has("display"))
7977      res.setDisplayElement(parseString(json.get("display").getAsString()));
7978    if (json.has("_display"))
7979      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
7980    if (json.has("relationship"))
7981      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), Enumerations.ConceptMapRelationship.NULL, new Enumerations.ConceptMapRelationshipEnumFactory()));
7982    if (json.has("_relationship"))
7983      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
7984    if (json.has("comment"))
7985      res.setCommentElement(parseString(json.get("comment").getAsString()));
7986    if (json.has("_comment"))
7987      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
7988    if (json.has("dependsOn")) {
7989      JsonArray array = json.getAsJsonArray("dependsOn");
7990      for (int i = 0; i < array.size(); i++) {
7991        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
7992      }
7993    };
7994    if (json.has("product")) {
7995      JsonArray array = json.getAsJsonArray("product");
7996      for (int i = 0; i < array.size(); i++) {
7997        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
7998      }
7999    };
8000  }
8001
8002  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
8003    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
8004    parseConceptMapOtherElementComponentProperties(json, owner, res);
8005    return res;
8006  }
8007
8008  protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
8009    parseBackboneElementProperties(json, res);
8010    if (json.has("property"))
8011      res.setPropertyElement(parseUri(json.get("property").getAsString()));
8012    if (json.has("_property"))
8013      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
8014    if (json.has("system"))
8015      res.setSystemElement(parseCanonical(json.get("system").getAsString()));
8016    if (json.has("_system"))
8017      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
8018    if (json.has("value"))
8019      res.setValueElement(parseString(json.get("value").getAsString()));
8020    if (json.has("_value"))
8021      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
8022    if (json.has("display"))
8023      res.setDisplayElement(parseString(json.get("display").getAsString()));
8024    if (json.has("_display"))
8025      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
8026  }
8027
8028  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapConceptMapGroupUnmappedComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
8029    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
8030    parseConceptMapConceptMapGroupUnmappedComponentProperties(json, owner, res);
8031    return res;
8032  }
8033
8034  protected void parseConceptMapConceptMapGroupUnmappedComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupUnmappedComponent res) throws IOException, FHIRFormatError {
8035    parseBackboneElementProperties(json, res);
8036    if (json.has("mode"))
8037      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
8038    if (json.has("_mode"))
8039      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
8040    if (json.has("code"))
8041      res.setCodeElement(parseCode(json.get("code").getAsString()));
8042    if (json.has("_code"))
8043      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
8044    if (json.has("display"))
8045      res.setDisplayElement(parseString(json.get("display").getAsString()));
8046    if (json.has("_display"))
8047      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
8048    if (json.has("url"))
8049      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
8050    if (json.has("_url"))
8051      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8052  }
8053
8054  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
8055    Condition res = new Condition();
8056    parseConditionProperties(json, res);
8057    return res;
8058  }
8059
8060  protected void parseConditionProperties(JsonObject json, Condition res) throws IOException, FHIRFormatError {
8061    parseDomainResourceProperties(json, res);
8062    if (json.has("identifier")) {
8063      JsonArray array = json.getAsJsonArray("identifier");
8064      for (int i = 0; i < array.size(); i++) {
8065        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8066      }
8067    };
8068    if (json.has("clinicalStatus"))
8069      res.setClinicalStatus(parseCodeableConcept(json.getAsJsonObject("clinicalStatus")));
8070    if (json.has("verificationStatus"))
8071      res.setVerificationStatus(parseCodeableConcept(json.getAsJsonObject("verificationStatus")));
8072    if (json.has("category")) {
8073      JsonArray array = json.getAsJsonArray("category");
8074      for (int i = 0; i < array.size(); i++) {
8075        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8076      }
8077    };
8078    if (json.has("severity"))
8079      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
8080    if (json.has("code"))
8081      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8082    if (json.has("bodySite")) {
8083      JsonArray array = json.getAsJsonArray("bodySite");
8084      for (int i = 0; i < array.size(); i++) {
8085        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8086      }
8087    };
8088    if (json.has("subject"))
8089      res.setSubject(parseReference(json.getAsJsonObject("subject")));
8090    if (json.has("encounter"))
8091      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
8092    Type onset = parseType("onset", json);
8093    if (onset != null)
8094      res.setOnset(onset);
8095    Type abatement = parseType("abatement", json);
8096    if (abatement != null)
8097      res.setAbatement(abatement);
8098    if (json.has("recordedDate"))
8099      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
8100    if (json.has("_recordedDate"))
8101      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
8102    if (json.has("recorder"))
8103      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
8104    if (json.has("asserter"))
8105      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
8106    if (json.has("stage")) {
8107      JsonArray array = json.getAsJsonArray("stage");
8108      for (int i = 0; i < array.size(); i++) {
8109        res.getStage().add(parseConditionConditionStageComponent(array.get(i).getAsJsonObject(), res));
8110      }
8111    };
8112    if (json.has("evidence")) {
8113      JsonArray array = json.getAsJsonArray("evidence");
8114      for (int i = 0; i < array.size(); i++) {
8115        res.getEvidence().add(parseConditionConditionEvidenceComponent(array.get(i).getAsJsonObject(), res));
8116      }
8117    };
8118    if (json.has("note")) {
8119      JsonArray array = json.getAsJsonArray("note");
8120      for (int i = 0; i < array.size(); i++) {
8121        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8122      }
8123    };
8124  }
8125
8126  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
8127    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
8128    parseConditionConditionStageComponentProperties(json, owner, res);
8129    return res;
8130  }
8131
8132  protected void parseConditionConditionStageComponentProperties(JsonObject json, Condition owner, Condition.ConditionStageComponent res) throws IOException, FHIRFormatError {
8133    parseBackboneElementProperties(json, res);
8134    if (json.has("summary"))
8135      res.setSummary(parseCodeableConcept(json.getAsJsonObject("summary")));
8136    if (json.has("assessment")) {
8137      JsonArray array = json.getAsJsonArray("assessment");
8138      for (int i = 0; i < array.size(); i++) {
8139        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
8140      }
8141    };
8142    if (json.has("type"))
8143      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8144  }
8145
8146  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
8147    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
8148    parseConditionConditionEvidenceComponentProperties(json, owner, res);
8149    return res;
8150  }
8151
8152  protected void parseConditionConditionEvidenceComponentProperties(JsonObject json, Condition owner, Condition.ConditionEvidenceComponent res) throws IOException, FHIRFormatError {
8153    parseBackboneElementProperties(json, res);
8154    if (json.has("code")) {
8155      JsonArray array = json.getAsJsonArray("code");
8156      for (int i = 0; i < array.size(); i++) {
8157        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8158      }
8159    };
8160    if (json.has("detail")) {
8161      JsonArray array = json.getAsJsonArray("detail");
8162      for (int i = 0; i < array.size(); i++) {
8163        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8164      }
8165    };
8166  }
8167
8168  protected ConditionDefinition parseConditionDefinition(JsonObject json) throws IOException, FHIRFormatError {
8169    ConditionDefinition res = new ConditionDefinition();
8170    parseConditionDefinitionProperties(json, res);
8171    return res;
8172  }
8173
8174  protected void parseConditionDefinitionProperties(JsonObject json, ConditionDefinition res) throws IOException, FHIRFormatError {
8175    parseDomainResourceProperties(json, res);
8176    if (json.has("url"))
8177      res.setUrlElement(parseUri(json.get("url").getAsString()));
8178    if (json.has("_url"))
8179      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8180    if (json.has("identifier")) {
8181      JsonArray array = json.getAsJsonArray("identifier");
8182      for (int i = 0; i < array.size(); i++) {
8183        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8184      }
8185    };
8186    if (json.has("version"))
8187      res.setVersionElement(parseString(json.get("version").getAsString()));
8188    if (json.has("_version"))
8189      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
8190    if (json.has("name"))
8191      res.setNameElement(parseString(json.get("name").getAsString()));
8192    if (json.has("_name"))
8193      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8194    if (json.has("title"))
8195      res.setTitleElement(parseString(json.get("title").getAsString()));
8196    if (json.has("_title"))
8197      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
8198    if (json.has("subtitle"))
8199      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
8200    if (json.has("_subtitle"))
8201      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
8202    if (json.has("status"))
8203      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
8204    if (json.has("_status"))
8205      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8206    if (json.has("experimental"))
8207      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
8208    if (json.has("_experimental"))
8209      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
8210    if (json.has("date"))
8211      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8212    if (json.has("_date"))
8213      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8214    if (json.has("publisher"))
8215      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
8216    if (json.has("_publisher"))
8217      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
8218    if (json.has("contact")) {
8219      JsonArray array = json.getAsJsonArray("contact");
8220      for (int i = 0; i < array.size(); i++) {
8221        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
8222      }
8223    };
8224    if (json.has("description"))
8225      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
8226    if (json.has("_description"))
8227      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8228    if (json.has("useContext")) {
8229      JsonArray array = json.getAsJsonArray("useContext");
8230      for (int i = 0; i < array.size(); i++) {
8231        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
8232      }
8233    };
8234    if (json.has("jurisdiction")) {
8235      JsonArray array = json.getAsJsonArray("jurisdiction");
8236      for (int i = 0; i < array.size(); i++) {
8237        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8238      }
8239    };
8240    if (json.has("code"))
8241      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8242    if (json.has("severity"))
8243      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
8244    if (json.has("bodySite"))
8245      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
8246    if (json.has("stage"))
8247      res.setStage(parseCodeableConcept(json.getAsJsonObject("stage")));
8248    if (json.has("hasSeverity"))
8249      res.setHasSeverityElement(parseBoolean(json.get("hasSeverity").getAsBoolean()));
8250    if (json.has("_hasSeverity"))
8251      parseElementProperties(json.getAsJsonObject("_hasSeverity"), res.getHasSeverityElement());
8252    if (json.has("hasBodySite"))
8253      res.setHasBodySiteElement(parseBoolean(json.get("hasBodySite").getAsBoolean()));
8254    if (json.has("_hasBodySite"))
8255      parseElementProperties(json.getAsJsonObject("_hasBodySite"), res.getHasBodySiteElement());
8256    if (json.has("hasStage"))
8257      res.setHasStageElement(parseBoolean(json.get("hasStage").getAsBoolean()));
8258    if (json.has("_hasStage"))
8259      parseElementProperties(json.getAsJsonObject("_hasStage"), res.getHasStageElement());
8260    if (json.has("definition")) {
8261      JsonArray array = json.getAsJsonArray("definition");
8262      for (int i = 0; i < array.size(); i++) {
8263        res.getDefinition().add(parseUri(array.get(i).getAsString()));
8264      }
8265    };
8266    if (json.has("_definition")) {
8267      JsonArray array = json.getAsJsonArray("_definition");
8268      for (int i = 0; i < array.size(); i++) {
8269        if (i == res.getDefinition().size())
8270          res.getDefinition().add(parseUri(null));
8271        if (array.get(i) instanceof JsonObject) 
8272          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
8273      }
8274    };
8275    if (json.has("observation")) {
8276      JsonArray array = json.getAsJsonArray("observation");
8277      for (int i = 0; i < array.size(); i++) {
8278        res.getObservation().add(parseConditionDefinitionConditionDefinitionObservationComponent(array.get(i).getAsJsonObject(), res));
8279      }
8280    };
8281    if (json.has("medication")) {
8282      JsonArray array = json.getAsJsonArray("medication");
8283      for (int i = 0; i < array.size(); i++) {
8284        res.getMedication().add(parseConditionDefinitionConditionDefinitionMedicationComponent(array.get(i).getAsJsonObject(), res));
8285      }
8286    };
8287    if (json.has("precondition")) {
8288      JsonArray array = json.getAsJsonArray("precondition");
8289      for (int i = 0; i < array.size(); i++) {
8290        res.getPrecondition().add(parseConditionDefinitionConditionDefinitionPreconditionComponent(array.get(i).getAsJsonObject(), res));
8291      }
8292    };
8293    if (json.has("team")) {
8294      JsonArray array = json.getAsJsonArray("team");
8295      for (int i = 0; i < array.size(); i++) {
8296        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
8297      }
8298    };
8299    if (json.has("questionnaire")) {
8300      JsonArray array = json.getAsJsonArray("questionnaire");
8301      for (int i = 0; i < array.size(); i++) {
8302        res.getQuestionnaire().add(parseConditionDefinitionConditionDefinitionQuestionnaireComponent(array.get(i).getAsJsonObject(), res));
8303      }
8304    };
8305    if (json.has("plan")) {
8306      JsonArray array = json.getAsJsonArray("plan");
8307      for (int i = 0; i < array.size(); i++) {
8308        res.getPlan().add(parseConditionDefinitionConditionDefinitionPlanComponent(array.get(i).getAsJsonObject(), res));
8309      }
8310    };
8311  }
8312
8313  protected ConditionDefinition.ConditionDefinitionObservationComponent parseConditionDefinitionConditionDefinitionObservationComponent(JsonObject json, ConditionDefinition owner) throws IOException, FHIRFormatError {
8314    ConditionDefinition.ConditionDefinitionObservationComponent res = new ConditionDefinition.ConditionDefinitionObservationComponent();
8315    parseConditionDefinitionConditionDefinitionObservationComponentProperties(json, owner, res);
8316    return res;
8317  }
8318
8319  protected void parseConditionDefinitionConditionDefinitionObservationComponentProperties(JsonObject json, ConditionDefinition owner, ConditionDefinition.ConditionDefinitionObservationComponent res) throws IOException, FHIRFormatError {
8320    parseBackboneElementProperties(json, res);
8321    if (json.has("category"))
8322      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8323    if (json.has("code"))
8324      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8325  }
8326
8327  protected ConditionDefinition.ConditionDefinitionMedicationComponent parseConditionDefinitionConditionDefinitionMedicationComponent(JsonObject json, ConditionDefinition owner) throws IOException, FHIRFormatError {
8328    ConditionDefinition.ConditionDefinitionMedicationComponent res = new ConditionDefinition.ConditionDefinitionMedicationComponent();
8329    parseConditionDefinitionConditionDefinitionMedicationComponentProperties(json, owner, res);
8330    return res;
8331  }
8332
8333  protected void parseConditionDefinitionConditionDefinitionMedicationComponentProperties(JsonObject json, ConditionDefinition owner, ConditionDefinition.ConditionDefinitionMedicationComponent res) throws IOException, FHIRFormatError {
8334    parseBackboneElementProperties(json, res);
8335    if (json.has("category"))
8336      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8337    if (json.has("code"))
8338      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8339  }
8340
8341  protected ConditionDefinition.ConditionDefinitionPreconditionComponent parseConditionDefinitionConditionDefinitionPreconditionComponent(JsonObject json, ConditionDefinition owner) throws IOException, FHIRFormatError {
8342    ConditionDefinition.ConditionDefinitionPreconditionComponent res = new ConditionDefinition.ConditionDefinitionPreconditionComponent();
8343    parseConditionDefinitionConditionDefinitionPreconditionComponentProperties(json, owner, res);
8344    return res;
8345  }
8346
8347  protected void parseConditionDefinitionConditionDefinitionPreconditionComponentProperties(JsonObject json, ConditionDefinition owner, ConditionDefinition.ConditionDefinitionPreconditionComponent res) throws IOException, FHIRFormatError {
8348    parseBackboneElementProperties(json, res);
8349    if (json.has("type"))
8350      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ConditionDefinition.ConditionPreconditionType.NULL, new ConditionDefinition.ConditionPreconditionTypeEnumFactory()));
8351    if (json.has("_type"))
8352      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
8353    if (json.has("code"))
8354      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8355    Type value = parseType("value", json);
8356    if (value != null)
8357      res.setValue(value);
8358  }
8359
8360  protected ConditionDefinition.ConditionDefinitionQuestionnaireComponent parseConditionDefinitionConditionDefinitionQuestionnaireComponent(JsonObject json, ConditionDefinition owner) throws IOException, FHIRFormatError {
8361    ConditionDefinition.ConditionDefinitionQuestionnaireComponent res = new ConditionDefinition.ConditionDefinitionQuestionnaireComponent();
8362    parseConditionDefinitionConditionDefinitionQuestionnaireComponentProperties(json, owner, res);
8363    return res;
8364  }
8365
8366  protected void parseConditionDefinitionConditionDefinitionQuestionnaireComponentProperties(JsonObject json, ConditionDefinition owner, ConditionDefinition.ConditionDefinitionQuestionnaireComponent res) throws IOException, FHIRFormatError {
8367    parseBackboneElementProperties(json, res);
8368    if (json.has("purpose"))
8369      res.setPurposeElement(parseEnumeration(json.get("purpose").getAsString(), ConditionDefinition.ConditionQuestionnairePurpose.NULL, new ConditionDefinition.ConditionQuestionnairePurposeEnumFactory()));
8370    if (json.has("_purpose"))
8371      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
8372    if (json.has("reference"))
8373      res.setReference(parseReference(json.getAsJsonObject("reference")));
8374  }
8375
8376  protected ConditionDefinition.ConditionDefinitionPlanComponent parseConditionDefinitionConditionDefinitionPlanComponent(JsonObject json, ConditionDefinition owner) throws IOException, FHIRFormatError {
8377    ConditionDefinition.ConditionDefinitionPlanComponent res = new ConditionDefinition.ConditionDefinitionPlanComponent();
8378    parseConditionDefinitionConditionDefinitionPlanComponentProperties(json, owner, res);
8379    return res;
8380  }
8381
8382  protected void parseConditionDefinitionConditionDefinitionPlanComponentProperties(JsonObject json, ConditionDefinition owner, ConditionDefinition.ConditionDefinitionPlanComponent res) throws IOException, FHIRFormatError {
8383    parseBackboneElementProperties(json, res);
8384    if (json.has("role"))
8385      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8386    if (json.has("reference"))
8387      res.setReference(parseReference(json.getAsJsonObject("reference")));
8388  }
8389
8390  protected Consent parseConsent(JsonObject json) throws IOException, FHIRFormatError {
8391    Consent res = new Consent();
8392    parseConsentProperties(json, res);
8393    return res;
8394  }
8395
8396  protected void parseConsentProperties(JsonObject json, Consent res) throws IOException, FHIRFormatError {
8397    parseDomainResourceProperties(json, res);
8398    if (json.has("identifier")) {
8399      JsonArray array = json.getAsJsonArray("identifier");
8400      for (int i = 0; i < array.size(); i++) {
8401        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8402      }
8403    };
8404    if (json.has("status"))
8405      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
8406    if (json.has("_status"))
8407      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8408    if (json.has("scope"))
8409      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
8410    if (json.has("category")) {
8411      JsonArray array = json.getAsJsonArray("category");
8412      for (int i = 0; i < array.size(); i++) {
8413        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8414      }
8415    };
8416    if (json.has("patient"))
8417      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8418    if (json.has("dateTime"))
8419      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
8420    if (json.has("_dateTime"))
8421      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
8422    if (json.has("performer")) {
8423      JsonArray array = json.getAsJsonArray("performer");
8424      for (int i = 0; i < array.size(); i++) {
8425        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
8426      }
8427    };
8428    if (json.has("organization")) {
8429      JsonArray array = json.getAsJsonArray("organization");
8430      for (int i = 0; i < array.size(); i++) {
8431        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
8432      }
8433    };
8434    if (json.has("sourceAttachment")) {
8435      JsonArray array = json.getAsJsonArray("sourceAttachment");
8436      for (int i = 0; i < array.size(); i++) {
8437        res.getSourceAttachment().add(parseAttachment(array.get(i).getAsJsonObject()));
8438      }
8439    };
8440    if (json.has("sourceReference")) {
8441      JsonArray array = json.getAsJsonArray("sourceReference");
8442      for (int i = 0; i < array.size(); i++) {
8443        res.getSourceReference().add(parseReference(array.get(i).getAsJsonObject()));
8444      }
8445    };
8446    if (json.has("policy")) {
8447      JsonArray array = json.getAsJsonArray("policy");
8448      for (int i = 0; i < array.size(); i++) {
8449        res.getPolicy().add(parseConsentConsentPolicyComponent(array.get(i).getAsJsonObject(), res));
8450      }
8451    };
8452    if (json.has("policyRule"))
8453      res.setPolicyRule(parseCodeableConcept(json.getAsJsonObject("policyRule")));
8454    if (json.has("verification")) {
8455      JsonArray array = json.getAsJsonArray("verification");
8456      for (int i = 0; i < array.size(); i++) {
8457        res.getVerification().add(parseConsentConsentVerificationComponent(array.get(i).getAsJsonObject(), res));
8458      }
8459    };
8460    if (json.has("provision"))
8461      res.setProvision(parseConsentprovisionComponent(json.getAsJsonObject("provision"), res));
8462  }
8463
8464  protected Consent.ConsentPolicyComponent parseConsentConsentPolicyComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
8465    Consent.ConsentPolicyComponent res = new Consent.ConsentPolicyComponent();
8466    parseConsentConsentPolicyComponentProperties(json, owner, res);
8467    return res;
8468  }
8469
8470  protected void parseConsentConsentPolicyComponentProperties(JsonObject json, Consent owner, Consent.ConsentPolicyComponent res) throws IOException, FHIRFormatError {
8471    parseBackboneElementProperties(json, res);
8472    if (json.has("authority"))
8473      res.setAuthorityElement(parseUri(json.get("authority").getAsString()));
8474    if (json.has("_authority"))
8475      parseElementProperties(json.getAsJsonObject("_authority"), res.getAuthorityElement());
8476    if (json.has("uri"))
8477      res.setUriElement(parseUri(json.get("uri").getAsString()));
8478    if (json.has("_uri"))
8479      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
8480  }
8481
8482  protected Consent.ConsentVerificationComponent parseConsentConsentVerificationComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
8483    Consent.ConsentVerificationComponent res = new Consent.ConsentVerificationComponent();
8484    parseConsentConsentVerificationComponentProperties(json, owner, res);
8485    return res;
8486  }
8487
8488  protected void parseConsentConsentVerificationComponentProperties(JsonObject json, Consent owner, Consent.ConsentVerificationComponent res) throws IOException, FHIRFormatError {
8489    parseBackboneElementProperties(json, res);
8490    if (json.has("verified"))
8491      res.setVerifiedElement(parseBoolean(json.get("verified").getAsBoolean()));
8492    if (json.has("_verified"))
8493      parseElementProperties(json.getAsJsonObject("_verified"), res.getVerifiedElement());
8494    if (json.has("verifiedWith"))
8495      res.setVerifiedWith(parseReference(json.getAsJsonObject("verifiedWith")));
8496    if (json.has("verificationDate"))
8497      res.setVerificationDateElement(parseDateTime(json.get("verificationDate").getAsString()));
8498    if (json.has("_verificationDate"))
8499      parseElementProperties(json.getAsJsonObject("_verificationDate"), res.getVerificationDateElement());
8500  }
8501
8502  protected Consent.provisionComponent parseConsentprovisionComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
8503    Consent.provisionComponent res = new Consent.provisionComponent();
8504    parseConsentprovisionComponentProperties(json, owner, res);
8505    return res;
8506  }
8507
8508  protected void parseConsentprovisionComponentProperties(JsonObject json, Consent owner, Consent.provisionComponent res) throws IOException, FHIRFormatError {
8509    parseBackboneElementProperties(json, res);
8510    if (json.has("type"))
8511      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Consent.ConsentProvisionType.NULL, new Consent.ConsentProvisionTypeEnumFactory()));
8512    if (json.has("_type"))
8513      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
8514    if (json.has("period"))
8515      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8516    if (json.has("actor")) {
8517      JsonArray array = json.getAsJsonArray("actor");
8518      for (int i = 0; i < array.size(); i++) {
8519        res.getActor().add(parseConsentprovisionActorComponent(array.get(i).getAsJsonObject(), owner));
8520      }
8521    };
8522    if (json.has("action")) {
8523      JsonArray array = json.getAsJsonArray("action");
8524      for (int i = 0; i < array.size(); i++) {
8525        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8526      }
8527    };
8528    if (json.has("securityLabel")) {
8529      JsonArray array = json.getAsJsonArray("securityLabel");
8530      for (int i = 0; i < array.size(); i++) {
8531        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
8532      }
8533    };
8534    if (json.has("purpose")) {
8535      JsonArray array = json.getAsJsonArray("purpose");
8536      for (int i = 0; i < array.size(); i++) {
8537        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
8538      }
8539    };
8540    if (json.has("class")) {
8541      JsonArray array = json.getAsJsonArray("class");
8542      for (int i = 0; i < array.size(); i++) {
8543        res.getClass_().add(parseCoding(array.get(i).getAsJsonObject()));
8544      }
8545    };
8546    if (json.has("code")) {
8547      JsonArray array = json.getAsJsonArray("code");
8548      for (int i = 0; i < array.size(); i++) {
8549        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8550      }
8551    };
8552    if (json.has("dataPeriod"))
8553      res.setDataPeriod(parsePeriod(json.getAsJsonObject("dataPeriod")));
8554    if (json.has("data")) {
8555      JsonArray array = json.getAsJsonArray("data");
8556      for (int i = 0; i < array.size(); i++) {
8557        res.getData().add(parseConsentprovisionDataComponent(array.get(i).getAsJsonObject(), owner));
8558      }
8559    };
8560    if (json.has("provision")) {
8561      JsonArray array = json.getAsJsonArray("provision");
8562      for (int i = 0; i < array.size(); i++) {
8563        res.getProvision().add(parseConsentprovisionComponent(array.get(i).getAsJsonObject(), owner));
8564      }
8565    };
8566  }
8567
8568  protected Consent.provisionActorComponent parseConsentprovisionActorComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
8569    Consent.provisionActorComponent res = new Consent.provisionActorComponent();
8570    parseConsentprovisionActorComponentProperties(json, owner, res);
8571    return res;
8572  }
8573
8574  protected void parseConsentprovisionActorComponentProperties(JsonObject json, Consent owner, Consent.provisionActorComponent res) throws IOException, FHIRFormatError {
8575    parseBackboneElementProperties(json, res);
8576    if (json.has("role"))
8577      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8578    if (json.has("reference"))
8579      res.setReference(parseReference(json.getAsJsonObject("reference")));
8580  }
8581
8582  protected Consent.provisionDataComponent parseConsentprovisionDataComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
8583    Consent.provisionDataComponent res = new Consent.provisionDataComponent();
8584    parseConsentprovisionDataComponentProperties(json, owner, res);
8585    return res;
8586  }
8587
8588  protected void parseConsentprovisionDataComponentProperties(JsonObject json, Consent owner, Consent.provisionDataComponent res) throws IOException, FHIRFormatError {
8589    parseBackboneElementProperties(json, res);
8590    if (json.has("meaning"))
8591      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
8592    if (json.has("_meaning"))
8593      parseElementProperties(json.getAsJsonObject("_meaning"), res.getMeaningElement());
8594    if (json.has("reference"))
8595      res.setReference(parseReference(json.getAsJsonObject("reference")));
8596  }
8597
8598  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
8599    Contract res = new Contract();
8600    parseContractProperties(json, res);
8601    return res;
8602  }
8603
8604  protected void parseContractProperties(JsonObject json, Contract res) throws IOException, FHIRFormatError {
8605    parseDomainResourceProperties(json, res);
8606    if (json.has("identifier")) {
8607      JsonArray array = json.getAsJsonArray("identifier");
8608      for (int i = 0; i < array.size(); i++) {
8609        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8610      }
8611    };
8612    if (json.has("url"))
8613      res.setUrlElement(parseUri(json.get("url").getAsString()));
8614    if (json.has("_url"))
8615      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8616    if (json.has("version"))
8617      res.setVersionElement(parseString(json.get("version").getAsString()));
8618    if (json.has("_version"))
8619      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
8620    if (json.has("status"))
8621      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Contract.ContractStatus.NULL, new Contract.ContractStatusEnumFactory()));
8622    if (json.has("_status"))
8623      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8624    if (json.has("legalState"))
8625      res.setLegalState(parseCodeableConcept(json.getAsJsonObject("legalState")));
8626    if (json.has("instantiatesCanonical"))
8627      res.setInstantiatesCanonical(parseReference(json.getAsJsonObject("instantiatesCanonical")));
8628    if (json.has("instantiatesUri"))
8629      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
8630    if (json.has("_instantiatesUri"))
8631      parseElementProperties(json.getAsJsonObject("_instantiatesUri"), res.getInstantiatesUriElement());
8632    if (json.has("contentDerivative"))
8633      res.setContentDerivative(parseCodeableConcept(json.getAsJsonObject("contentDerivative")));
8634    if (json.has("issued"))
8635      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
8636    if (json.has("_issued"))
8637      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
8638    if (json.has("applies"))
8639      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
8640    if (json.has("expirationType"))
8641      res.setExpirationType(parseCodeableConcept(json.getAsJsonObject("expirationType")));
8642    if (json.has("subject")) {
8643      JsonArray array = json.getAsJsonArray("subject");
8644      for (int i = 0; i < array.size(); i++) {
8645        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
8646      }
8647    };
8648    if (json.has("authority")) {
8649      JsonArray array = json.getAsJsonArray("authority");
8650      for (int i = 0; i < array.size(); i++) {
8651        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
8652      }
8653    };
8654    if (json.has("domain")) {
8655      JsonArray array = json.getAsJsonArray("domain");
8656      for (int i = 0; i < array.size(); i++) {
8657        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
8658      }
8659    };
8660    if (json.has("site")) {
8661      JsonArray array = json.getAsJsonArray("site");
8662      for (int i = 0; i < array.size(); i++) {
8663        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
8664      }
8665    };
8666    if (json.has("name"))
8667      res.setNameElement(parseString(json.get("name").getAsString()));
8668    if (json.has("_name"))
8669      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8670    if (json.has("title"))
8671      res.setTitleElement(parseString(json.get("title").getAsString()));
8672    if (json.has("_title"))
8673      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
8674    if (json.has("subtitle"))
8675      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
8676    if (json.has("_subtitle"))
8677      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
8678    if (json.has("alias")) {
8679      JsonArray array = json.getAsJsonArray("alias");
8680      for (int i = 0; i < array.size(); i++) {
8681        res.getAlias().add(parseString(array.get(i).getAsString()));
8682      }
8683    };
8684    if (json.has("_alias")) {
8685      JsonArray array = json.getAsJsonArray("_alias");
8686      for (int i = 0; i < array.size(); i++) {
8687        if (i == res.getAlias().size())
8688          res.getAlias().add(parseString(null));
8689        if (array.get(i) instanceof JsonObject) 
8690          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
8691      }
8692    };
8693    if (json.has("author"))
8694      res.setAuthor(parseReference(json.getAsJsonObject("author")));
8695    if (json.has("scope"))
8696      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
8697    Type topic = parseType("topic", json);
8698    if (topic != null)
8699      res.setTopic(topic);
8700    if (json.has("type"))
8701      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8702    if (json.has("subType")) {
8703      JsonArray array = json.getAsJsonArray("subType");
8704      for (int i = 0; i < array.size(); i++) {
8705        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8706      }
8707    };
8708    if (json.has("contentDefinition"))
8709      res.setContentDefinition(parseContractContentDefinitionComponent(json.getAsJsonObject("contentDefinition"), res));
8710    if (json.has("term")) {
8711      JsonArray array = json.getAsJsonArray("term");
8712      for (int i = 0; i < array.size(); i++) {
8713        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject(), res));
8714      }
8715    };
8716    if (json.has("supportingInfo")) {
8717      JsonArray array = json.getAsJsonArray("supportingInfo");
8718      for (int i = 0; i < array.size(); i++) {
8719        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
8720      }
8721    };
8722    if (json.has("relevantHistory")) {
8723      JsonArray array = json.getAsJsonArray("relevantHistory");
8724      for (int i = 0; i < array.size(); i++) {
8725        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
8726      }
8727    };
8728    if (json.has("signer")) {
8729      JsonArray array = json.getAsJsonArray("signer");
8730      for (int i = 0; i < array.size(); i++) {
8731        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject(), res));
8732      }
8733    };
8734    if (json.has("friendly")) {
8735      JsonArray array = json.getAsJsonArray("friendly");
8736      for (int i = 0; i < array.size(); i++) {
8737        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject(), res));
8738      }
8739    };
8740    if (json.has("legal")) {
8741      JsonArray array = json.getAsJsonArray("legal");
8742      for (int i = 0; i < array.size(); i++) {
8743        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject(), res));
8744      }
8745    };
8746    if (json.has("rule")) {
8747      JsonArray array = json.getAsJsonArray("rule");
8748      for (int i = 0; i < array.size(); i++) {
8749        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject(), res));
8750      }
8751    };
8752    Type legallyBinding = parseType("legallyBinding", json);
8753    if (legallyBinding != null)
8754      res.setLegallyBinding(legallyBinding);
8755  }
8756
8757  protected Contract.ContentDefinitionComponent parseContractContentDefinitionComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8758    Contract.ContentDefinitionComponent res = new Contract.ContentDefinitionComponent();
8759    parseContractContentDefinitionComponentProperties(json, owner, res);
8760    return res;
8761  }
8762
8763  protected void parseContractContentDefinitionComponentProperties(JsonObject json, Contract owner, Contract.ContentDefinitionComponent res) throws IOException, FHIRFormatError {
8764    parseBackboneElementProperties(json, res);
8765    if (json.has("type"))
8766      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8767    if (json.has("subType"))
8768      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
8769    if (json.has("publisher"))
8770      res.setPublisher(parseReference(json.getAsJsonObject("publisher")));
8771    if (json.has("publicationDate"))
8772      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
8773    if (json.has("_publicationDate"))
8774      parseElementProperties(json.getAsJsonObject("_publicationDate"), res.getPublicationDateElement());
8775    if (json.has("publicationStatus"))
8776      res.setPublicationStatusElement(parseEnumeration(json.get("publicationStatus").getAsString(), Contract.ContractPublicationStatus.NULL, new Contract.ContractPublicationStatusEnumFactory()));
8777    if (json.has("_publicationStatus"))
8778      parseElementProperties(json.getAsJsonObject("_publicationStatus"), res.getPublicationStatusElement());
8779    if (json.has("copyright"))
8780      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
8781    if (json.has("_copyright"))
8782      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
8783  }
8784
8785  protected Contract.TermComponent parseContractTermComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8786    Contract.TermComponent res = new Contract.TermComponent();
8787    parseContractTermComponentProperties(json, owner, res);
8788    return res;
8789  }
8790
8791  protected void parseContractTermComponentProperties(JsonObject json, Contract owner, Contract.TermComponent res) throws IOException, FHIRFormatError {
8792    parseBackboneElementProperties(json, res);
8793    if (json.has("identifier"))
8794      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
8795    if (json.has("issued"))
8796      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
8797    if (json.has("_issued"))
8798      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
8799    if (json.has("applies"))
8800      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
8801    Type topic = parseType("topic", json);
8802    if (topic != null)
8803      res.setTopic(topic);
8804    if (json.has("type"))
8805      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8806    if (json.has("subType"))
8807      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
8808    if (json.has("text"))
8809      res.setTextElement(parseString(json.get("text").getAsString()));
8810    if (json.has("_text"))
8811      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
8812    if (json.has("securityLabel")) {
8813      JsonArray array = json.getAsJsonArray("securityLabel");
8814      for (int i = 0; i < array.size(); i++) {
8815        res.getSecurityLabel().add(parseContractSecurityLabelComponent(array.get(i).getAsJsonObject(), owner));
8816      }
8817    };
8818    if (json.has("offer"))
8819      res.setOffer(parseContractContractOfferComponent(json.getAsJsonObject("offer"), owner));
8820    if (json.has("asset")) {
8821      JsonArray array = json.getAsJsonArray("asset");
8822      for (int i = 0; i < array.size(); i++) {
8823        res.getAsset().add(parseContractContractAssetComponent(array.get(i).getAsJsonObject(), owner));
8824      }
8825    };
8826    if (json.has("action")) {
8827      JsonArray array = json.getAsJsonArray("action");
8828      for (int i = 0; i < array.size(); i++) {
8829        res.getAction().add(parseContractActionComponent(array.get(i).getAsJsonObject(), owner));
8830      }
8831    };
8832    if (json.has("group")) {
8833      JsonArray array = json.getAsJsonArray("group");
8834      for (int i = 0; i < array.size(); i++) {
8835        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject(), owner));
8836      }
8837    };
8838  }
8839
8840  protected Contract.SecurityLabelComponent parseContractSecurityLabelComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8841    Contract.SecurityLabelComponent res = new Contract.SecurityLabelComponent();
8842    parseContractSecurityLabelComponentProperties(json, owner, res);
8843    return res;
8844  }
8845
8846  protected void parseContractSecurityLabelComponentProperties(JsonObject json, Contract owner, Contract.SecurityLabelComponent res) throws IOException, FHIRFormatError {
8847    parseBackboneElementProperties(json, res);
8848    if (json.has("number")) {
8849      JsonArray array = json.getAsJsonArray("number");
8850      for (int i = 0; i < array.size(); i++) {
8851        res.getNumber().add(parseUnsignedInt(array.get(i).getAsString()));
8852      }
8853    };
8854    if (json.has("_number")) {
8855      JsonArray array = json.getAsJsonArray("_number");
8856      for (int i = 0; i < array.size(); i++) {
8857        if (i == res.getNumber().size())
8858          res.getNumber().add(parseUnsignedInt(null));
8859        if (array.get(i) instanceof JsonObject) 
8860          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumber().get(i));
8861      }
8862    };
8863    if (json.has("classification"))
8864      res.setClassification(parseCoding(json.getAsJsonObject("classification")));
8865    if (json.has("category")) {
8866      JsonArray array = json.getAsJsonArray("category");
8867      for (int i = 0; i < array.size(); i++) {
8868        res.getCategory().add(parseCoding(array.get(i).getAsJsonObject()));
8869      }
8870    };
8871    if (json.has("control")) {
8872      JsonArray array = json.getAsJsonArray("control");
8873      for (int i = 0; i < array.size(); i++) {
8874        res.getControl().add(parseCoding(array.get(i).getAsJsonObject()));
8875      }
8876    };
8877  }
8878
8879  protected Contract.ContractOfferComponent parseContractContractOfferComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8880    Contract.ContractOfferComponent res = new Contract.ContractOfferComponent();
8881    parseContractContractOfferComponentProperties(json, owner, res);
8882    return res;
8883  }
8884
8885  protected void parseContractContractOfferComponentProperties(JsonObject json, Contract owner, Contract.ContractOfferComponent res) throws IOException, FHIRFormatError {
8886    parseBackboneElementProperties(json, res);
8887    if (json.has("identifier")) {
8888      JsonArray array = json.getAsJsonArray("identifier");
8889      for (int i = 0; i < array.size(); i++) {
8890        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8891      }
8892    };
8893    if (json.has("party")) {
8894      JsonArray array = json.getAsJsonArray("party");
8895      for (int i = 0; i < array.size(); i++) {
8896        res.getParty().add(parseContractContractPartyComponent(array.get(i).getAsJsonObject(), owner));
8897      }
8898    };
8899    if (json.has("topic"))
8900      res.setTopic(parseReference(json.getAsJsonObject("topic")));
8901    if (json.has("type"))
8902      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8903    if (json.has("decision"))
8904      res.setDecision(parseCodeableConcept(json.getAsJsonObject("decision")));
8905    if (json.has("decisionMode")) {
8906      JsonArray array = json.getAsJsonArray("decisionMode");
8907      for (int i = 0; i < array.size(); i++) {
8908        res.getDecisionMode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8909      }
8910    };
8911    if (json.has("answer")) {
8912      JsonArray array = json.getAsJsonArray("answer");
8913      for (int i = 0; i < array.size(); i++) {
8914        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject(), owner));
8915      }
8916    };
8917    if (json.has("text"))
8918      res.setTextElement(parseString(json.get("text").getAsString()));
8919    if (json.has("_text"))
8920      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
8921    if (json.has("linkId")) {
8922      JsonArray array = json.getAsJsonArray("linkId");
8923      for (int i = 0; i < array.size(); i++) {
8924        res.getLinkId().add(parseString(array.get(i).getAsString()));
8925      }
8926    };
8927    if (json.has("_linkId")) {
8928      JsonArray array = json.getAsJsonArray("_linkId");
8929      for (int i = 0; i < array.size(); i++) {
8930        if (i == res.getLinkId().size())
8931          res.getLinkId().add(parseString(null));
8932        if (array.get(i) instanceof JsonObject) 
8933          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
8934      }
8935    };
8936    if (json.has("securityLabelNumber")) {
8937      JsonArray array = json.getAsJsonArray("securityLabelNumber");
8938      for (int i = 0; i < array.size(); i++) {
8939        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
8940      }
8941    };
8942    if (json.has("_securityLabelNumber")) {
8943      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
8944      for (int i = 0; i < array.size(); i++) {
8945        if (i == res.getSecurityLabelNumber().size())
8946          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
8947        if (array.get(i) instanceof JsonObject) 
8948          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
8949      }
8950    };
8951  }
8952
8953  protected Contract.ContractPartyComponent parseContractContractPartyComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8954    Contract.ContractPartyComponent res = new Contract.ContractPartyComponent();
8955    parseContractContractPartyComponentProperties(json, owner, res);
8956    return res;
8957  }
8958
8959  protected void parseContractContractPartyComponentProperties(JsonObject json, Contract owner, Contract.ContractPartyComponent res) throws IOException, FHIRFormatError {
8960    parseBackboneElementProperties(json, res);
8961    if (json.has("reference")) {
8962      JsonArray array = json.getAsJsonArray("reference");
8963      for (int i = 0; i < array.size(); i++) {
8964        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
8965      }
8966    };
8967    if (json.has("role"))
8968      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8969  }
8970
8971  protected Contract.AnswerComponent parseContractAnswerComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8972    Contract.AnswerComponent res = new Contract.AnswerComponent();
8973    parseContractAnswerComponentProperties(json, owner, res);
8974    return res;
8975  }
8976
8977  protected void parseContractAnswerComponentProperties(JsonObject json, Contract owner, Contract.AnswerComponent res) throws IOException, FHIRFormatError {
8978    parseBackboneElementProperties(json, res);
8979    Type value = parseType("value", json);
8980    if (value != null)
8981      res.setValue(value);
8982  }
8983
8984  protected Contract.ContractAssetComponent parseContractContractAssetComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8985    Contract.ContractAssetComponent res = new Contract.ContractAssetComponent();
8986    parseContractContractAssetComponentProperties(json, owner, res);
8987    return res;
8988  }
8989
8990  protected void parseContractContractAssetComponentProperties(JsonObject json, Contract owner, Contract.ContractAssetComponent res) throws IOException, FHIRFormatError {
8991    parseBackboneElementProperties(json, res);
8992    if (json.has("scope"))
8993      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
8994    if (json.has("type")) {
8995      JsonArray array = json.getAsJsonArray("type");
8996      for (int i = 0; i < array.size(); i++) {
8997        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8998      }
8999    };
9000    if (json.has("typeReference")) {
9001      JsonArray array = json.getAsJsonArray("typeReference");
9002      for (int i = 0; i < array.size(); i++) {
9003        res.getTypeReference().add(parseReference(array.get(i).getAsJsonObject()));
9004      }
9005    };
9006    if (json.has("subtype")) {
9007      JsonArray array = json.getAsJsonArray("subtype");
9008      for (int i = 0; i < array.size(); i++) {
9009        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9010      }
9011    };
9012    if (json.has("relationship"))
9013      res.setRelationship(parseCoding(json.getAsJsonObject("relationship")));
9014    if (json.has("context")) {
9015      JsonArray array = json.getAsJsonArray("context");
9016      for (int i = 0; i < array.size(); i++) {
9017        res.getContext().add(parseContractAssetContextComponent(array.get(i).getAsJsonObject(), owner));
9018      }
9019    };
9020    if (json.has("condition"))
9021      res.setConditionElement(parseString(json.get("condition").getAsString()));
9022    if (json.has("_condition"))
9023      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
9024    if (json.has("periodType")) {
9025      JsonArray array = json.getAsJsonArray("periodType");
9026      for (int i = 0; i < array.size(); i++) {
9027        res.getPeriodType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9028      }
9029    };
9030    if (json.has("period")) {
9031      JsonArray array = json.getAsJsonArray("period");
9032      for (int i = 0; i < array.size(); i++) {
9033        res.getPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
9034      }
9035    };
9036    if (json.has("usePeriod")) {
9037      JsonArray array = json.getAsJsonArray("usePeriod");
9038      for (int i = 0; i < array.size(); i++) {
9039        res.getUsePeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
9040      }
9041    };
9042    if (json.has("text"))
9043      res.setTextElement(parseString(json.get("text").getAsString()));
9044    if (json.has("_text"))
9045      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9046    if (json.has("linkId")) {
9047      JsonArray array = json.getAsJsonArray("linkId");
9048      for (int i = 0; i < array.size(); i++) {
9049        res.getLinkId().add(parseString(array.get(i).getAsString()));
9050      }
9051    };
9052    if (json.has("_linkId")) {
9053      JsonArray array = json.getAsJsonArray("_linkId");
9054      for (int i = 0; i < array.size(); i++) {
9055        if (i == res.getLinkId().size())
9056          res.getLinkId().add(parseString(null));
9057        if (array.get(i) instanceof JsonObject) 
9058          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
9059      }
9060    };
9061    if (json.has("answer")) {
9062      JsonArray array = json.getAsJsonArray("answer");
9063      for (int i = 0; i < array.size(); i++) {
9064        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject(), owner));
9065      }
9066    };
9067    if (json.has("securityLabelNumber")) {
9068      JsonArray array = json.getAsJsonArray("securityLabelNumber");
9069      for (int i = 0; i < array.size(); i++) {
9070        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
9071      }
9072    };
9073    if (json.has("_securityLabelNumber")) {
9074      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
9075      for (int i = 0; i < array.size(); i++) {
9076        if (i == res.getSecurityLabelNumber().size())
9077          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
9078        if (array.get(i) instanceof JsonObject) 
9079          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
9080      }
9081    };
9082    if (json.has("valuedItem")) {
9083      JsonArray array = json.getAsJsonArray("valuedItem");
9084      for (int i = 0; i < array.size(); i++) {
9085        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject(), owner));
9086      }
9087    };
9088  }
9089
9090  protected Contract.AssetContextComponent parseContractAssetContextComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
9091    Contract.AssetContextComponent res = new Contract.AssetContextComponent();
9092    parseContractAssetContextComponentProperties(json, owner, res);
9093    return res;
9094  }
9095
9096  protected void parseContractAssetContextComponentProperties(JsonObject json, Contract owner, Contract.AssetContextComponent res) throws IOException, FHIRFormatError {
9097    parseBackboneElementProperties(json, res);
9098    if (json.has("reference"))
9099      res.setReference(parseReference(json.getAsJsonObject("reference")));
9100    if (json.has("code")) {
9101      JsonArray array = json.getAsJsonArray("code");
9102      for (int i = 0; i < array.size(); i++) {
9103        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9104      }
9105    };
9106    if (json.has("text"))
9107      res.setTextElement(parseString(json.get("text").getAsString()));
9108    if (json.has("_text"))
9109      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9110  }
9111
9112  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
9113    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
9114    parseContractValuedItemComponentProperties(json, owner, res);
9115    return res;
9116  }
9117
9118  protected void parseContractValuedItemComponentProperties(JsonObject json, Contract owner, Contract.ValuedItemComponent res) throws IOException, FHIRFormatError {
9119    parseBackboneElementProperties(json, res);
9120    Type entity = parseType("entity", json);
9121    if (entity != null)
9122      res.setEntity(entity);
9123    if (json.has("identifier"))
9124      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9125    if (json.has("effectiveTime"))
9126      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
9127    if (json.has("_effectiveTime"))
9128      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
9129    if (json.has("quantity"))
9130      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
9131    if (json.has("unitPrice"))
9132      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
9133    if (json.has("factor"))
9134      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
9135    if (json.has("_factor"))
9136      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
9137    if (json.has("points"))
9138      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
9139    if (json.has("_points"))
9140      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
9141    if (json.has("net"))
9142      res.setNet(parseMoney(json.getAsJsonObject("net")));
9143    if (json.has("payment"))
9144      res.setPaymentElement(parseString(json.get("payment").getAsString()));
9145    if (json.has("_payment"))
9146      parseElementProperties(json.getAsJsonObject("_payment"), res.getPaymentElement());
9147    if (json.has("paymentDate"))
9148      res.setPaymentDateElement(parseDateTime(json.get("paymentDate").getAsString()));
9149    if (json.has("_paymentDate"))
9150      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
9151    if (json.has("responsible"))
9152      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
9153    if (json.has("recipient"))
9154      res.setRecipient(parseReference(json.getAsJsonObject("recipient")));
9155    if (json.has("linkId")) {
9156      JsonArray array = json.getAsJsonArray("linkId");
9157      for (int i = 0; i < array.size(); i++) {
9158        res.getLinkId().add(parseString(array.get(i).getAsString()));
9159      }
9160    };
9161    if (json.has("_linkId")) {
9162      JsonArray array = json.getAsJsonArray("_linkId");
9163      for (int i = 0; i < array.size(); i++) {
9164        if (i == res.getLinkId().size())
9165          res.getLinkId().add(parseString(null));
9166        if (array.get(i) instanceof JsonObject) 
9167          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
9168      }
9169    };
9170    if (json.has("securityLabelNumber")) {
9171      JsonArray array = json.getAsJsonArray("securityLabelNumber");
9172      for (int i = 0; i < array.size(); i++) {
9173        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
9174      }
9175    };
9176    if (json.has("_securityLabelNumber")) {
9177      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
9178      for (int i = 0; i < array.size(); i++) {
9179        if (i == res.getSecurityLabelNumber().size())
9180          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
9181        if (array.get(i) instanceof JsonObject) 
9182          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
9183      }
9184    };
9185  }
9186
9187  protected Contract.ActionComponent parseContractActionComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
9188    Contract.ActionComponent res = new Contract.ActionComponent();
9189    parseContractActionComponentProperties(json, owner, res);
9190    return res;
9191  }
9192
9193  protected void parseContractActionComponentProperties(JsonObject json, Contract owner, Contract.ActionComponent res) throws IOException, FHIRFormatError {
9194    parseBackboneElementProperties(json, res);
9195    if (json.has("doNotPerform"))
9196      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
9197    if (json.has("_doNotPerform"))
9198      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
9199    if (json.has("type"))
9200      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9201    if (json.has("subject")) {
9202      JsonArray array = json.getAsJsonArray("subject");
9203      for (int i = 0; i < array.size(); i++) {
9204        res.getSubject().add(parseContractActionSubjectComponent(array.get(i).getAsJsonObject(), owner));
9205      }
9206    };
9207    if (json.has("intent"))
9208      res.setIntent(parseCodeableConcept(json.getAsJsonObject("intent")));
9209    if (json.has("linkId")) {
9210      JsonArray array = json.getAsJsonArray("linkId");
9211      for (int i = 0; i < array.size(); i++) {
9212        res.getLinkId().add(parseString(array.get(i).getAsString()));
9213      }
9214    };
9215    if (json.has("_linkId")) {
9216      JsonArray array = json.getAsJsonArray("_linkId");
9217      for (int i = 0; i < array.size(); i++) {
9218        if (i == res.getLinkId().size())
9219          res.getLinkId().add(parseString(null));
9220        if (array.get(i) instanceof JsonObject) 
9221          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
9222      }
9223    };
9224    if (json.has("status"))
9225      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
9226    if (json.has("context"))
9227      res.setContext(parseReference(json.getAsJsonObject("context")));
9228    if (json.has("contextLinkId")) {
9229      JsonArray array = json.getAsJsonArray("contextLinkId");
9230      for (int i = 0; i < array.size(); i++) {
9231        res.getContextLinkId().add(parseString(array.get(i).getAsString()));
9232      }
9233    };
9234    if (json.has("_contextLinkId")) {
9235      JsonArray array = json.getAsJsonArray("_contextLinkId");
9236      for (int i = 0; i < array.size(); i++) {
9237        if (i == res.getContextLinkId().size())
9238          res.getContextLinkId().add(parseString(null));
9239        if (array.get(i) instanceof JsonObject) 
9240          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextLinkId().get(i));
9241      }
9242    };
9243    Type occurrence = parseType("occurrence", json);
9244    if (occurrence != null)
9245      res.setOccurrence(occurrence);
9246    if (json.has("requester")) {
9247      JsonArray array = json.getAsJsonArray("requester");
9248      for (int i = 0; i < array.size(); i++) {
9249        res.getRequester().add(parseReference(array.get(i).getAsJsonObject()));
9250      }
9251    };
9252    if (json.has("requesterLinkId")) {
9253      JsonArray array = json.getAsJsonArray("requesterLinkId");
9254      for (int i = 0; i < array.size(); i++) {
9255        res.getRequesterLinkId().add(parseString(array.get(i).getAsString()));
9256      }
9257    };
9258    if (json.has("_requesterLinkId")) {
9259      JsonArray array = json.getAsJsonArray("_requesterLinkId");
9260      for (int i = 0; i < array.size(); i++) {
9261        if (i == res.getRequesterLinkId().size())
9262          res.getRequesterLinkId().add(parseString(null));
9263        if (array.get(i) instanceof JsonObject) 
9264          parseElementProperties(array.get(i).getAsJsonObject(), res.getRequesterLinkId().get(i));
9265      }
9266    };
9267    if (json.has("performerType")) {
9268      JsonArray array = json.getAsJsonArray("performerType");
9269      for (int i = 0; i < array.size(); i++) {
9270        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9271      }
9272    };
9273    if (json.has("performerRole"))
9274      res.setPerformerRole(parseCodeableConcept(json.getAsJsonObject("performerRole")));
9275    if (json.has("performer"))
9276      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
9277    if (json.has("performerLinkId")) {
9278      JsonArray array = json.getAsJsonArray("performerLinkId");
9279      for (int i = 0; i < array.size(); i++) {
9280        res.getPerformerLinkId().add(parseString(array.get(i).getAsString()));
9281      }
9282    };
9283    if (json.has("_performerLinkId")) {
9284      JsonArray array = json.getAsJsonArray("_performerLinkId");
9285      for (int i = 0; i < array.size(); i++) {
9286        if (i == res.getPerformerLinkId().size())
9287          res.getPerformerLinkId().add(parseString(null));
9288        if (array.get(i) instanceof JsonObject) 
9289          parseElementProperties(array.get(i).getAsJsonObject(), res.getPerformerLinkId().get(i));
9290      }
9291    };
9292    if (json.has("reasonCode")) {
9293      JsonArray array = json.getAsJsonArray("reasonCode");
9294      for (int i = 0; i < array.size(); i++) {
9295        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9296      }
9297    };
9298    if (json.has("reasonReference")) {
9299      JsonArray array = json.getAsJsonArray("reasonReference");
9300      for (int i = 0; i < array.size(); i++) {
9301        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9302      }
9303    };
9304    if (json.has("reason")) {
9305      JsonArray array = json.getAsJsonArray("reason");
9306      for (int i = 0; i < array.size(); i++) {
9307        res.getReason().add(parseString(array.get(i).getAsString()));
9308      }
9309    };
9310    if (json.has("_reason")) {
9311      JsonArray array = json.getAsJsonArray("_reason");
9312      for (int i = 0; i < array.size(); i++) {
9313        if (i == res.getReason().size())
9314          res.getReason().add(parseString(null));
9315        if (array.get(i) instanceof JsonObject) 
9316          parseElementProperties(array.get(i).getAsJsonObject(), res.getReason().get(i));
9317      }
9318    };
9319    if (json.has("reasonLinkId")) {
9320      JsonArray array = json.getAsJsonArray("reasonLinkId");
9321      for (int i = 0; i < array.size(); i++) {
9322        res.getReasonLinkId().add(parseString(array.get(i).getAsString()));
9323      }
9324    };
9325    if (json.has("_reasonLinkId")) {
9326      JsonArray array = json.getAsJsonArray("_reasonLinkId");
9327      for (int i = 0; i < array.size(); i++) {
9328        if (i == res.getReasonLinkId().size())
9329          res.getReasonLinkId().add(parseString(null));
9330        if (array.get(i) instanceof JsonObject) 
9331          parseElementProperties(array.get(i).getAsJsonObject(), res.getReasonLinkId().get(i));
9332      }
9333    };
9334    if (json.has("note")) {
9335      JsonArray array = json.getAsJsonArray("note");
9336      for (int i = 0; i < array.size(); i++) {
9337        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9338      }
9339    };
9340    if (json.has("securityLabelNumber")) {
9341      JsonArray array = json.getAsJsonArray("securityLabelNumber");
9342      for (int i = 0; i < array.size(); i++) {
9343        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
9344      }
9345    };
9346    if (json.has("_securityLabelNumber")) {
9347      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
9348      for (int i = 0; i < array.size(); i++) {
9349        if (i == res.getSecurityLabelNumber().size())
9350          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
9351        if (array.get(i) instanceof JsonObject) 
9352          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
9353      }
9354    };
9355  }
9356
9357  protected Contract.ActionSubjectComponent parseContractActionSubjectComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
9358    Contract.ActionSubjectComponent res = new Contract.ActionSubjectComponent();
9359    parseContractActionSubjectComponentProperties(json, owner, res);
9360    return res;
9361  }
9362
9363  protected void parseContractActionSubjectComponentProperties(JsonObject json, Contract owner, Contract.ActionSubjectComponent res) throws IOException, FHIRFormatError {
9364    parseBackboneElementProperties(json, res);
9365    if (json.has("reference")) {
9366      JsonArray array = json.getAsJsonArray("reference");
9367      for (int i = 0; i < array.size(); i++) {
9368        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
9369      }
9370    };
9371    if (json.has("role"))
9372      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
9373  }
9374
9375  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
9376    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
9377    parseContractSignatoryComponentProperties(json, owner, res);
9378    return res;
9379  }
9380
9381  protected void parseContractSignatoryComponentProperties(JsonObject json, Contract owner, Contract.SignatoryComponent res) throws IOException, FHIRFormatError {
9382    parseBackboneElementProperties(json, res);
9383    if (json.has("type"))
9384      res.setType(parseCoding(json.getAsJsonObject("type")));
9385    if (json.has("party"))
9386      res.setParty(parseReference(json.getAsJsonObject("party")));
9387    if (json.has("signature")) {
9388      JsonArray array = json.getAsJsonArray("signature");
9389      for (int i = 0; i < array.size(); i++) {
9390        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
9391      }
9392    };
9393  }
9394
9395  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
9396    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
9397    parseContractFriendlyLanguageComponentProperties(json, owner, res);
9398    return res;
9399  }
9400
9401  protected void parseContractFriendlyLanguageComponentProperties(JsonObject json, Contract owner, Contract.FriendlyLanguageComponent res) throws IOException, FHIRFormatError {
9402    parseBackboneElementProperties(json, res);
9403    Type content = parseType("content", json);
9404    if (content != null)
9405      res.setContent(content);
9406  }
9407
9408  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
9409    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
9410    parseContractLegalLanguageComponentProperties(json, owner, res);
9411    return res;
9412  }
9413
9414  protected void parseContractLegalLanguageComponentProperties(JsonObject json, Contract owner, Contract.LegalLanguageComponent res) throws IOException, FHIRFormatError {
9415    parseBackboneElementProperties(json, res);
9416    Type content = parseType("content", json);
9417    if (content != null)
9418      res.setContent(content);
9419  }
9420
9421  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
9422    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
9423    parseContractComputableLanguageComponentProperties(json, owner, res);
9424    return res;
9425  }
9426
9427  protected void parseContractComputableLanguageComponentProperties(JsonObject json, Contract owner, Contract.ComputableLanguageComponent res) throws IOException, FHIRFormatError {
9428    parseBackboneElementProperties(json, res);
9429    Type content = parseType("content", json);
9430    if (content != null)
9431      res.setContent(content);
9432  }
9433
9434  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
9435    Coverage res = new Coverage();
9436    parseCoverageProperties(json, res);
9437    return res;
9438  }
9439
9440  protected void parseCoverageProperties(JsonObject json, Coverage res) throws IOException, FHIRFormatError {
9441    parseDomainResourceProperties(json, res);
9442    if (json.has("identifier")) {
9443      JsonArray array = json.getAsJsonArray("identifier");
9444      for (int i = 0; i < array.size(); i++) {
9445        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9446      }
9447    };
9448    if (json.has("status"))
9449      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Coverage.CoverageStatus.NULL, new Coverage.CoverageStatusEnumFactory()));
9450    if (json.has("_status"))
9451      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9452    if (json.has("type"))
9453      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9454    if (json.has("policyHolder"))
9455      res.setPolicyHolder(parseReference(json.getAsJsonObject("policyHolder")));
9456    if (json.has("subscriber"))
9457      res.setSubscriber(parseReference(json.getAsJsonObject("subscriber")));
9458    if (json.has("subscriberId"))
9459      res.setSubscriberId(parseIdentifier(json.getAsJsonObject("subscriberId")));
9460    if (json.has("beneficiary"))
9461      res.setBeneficiary(parseReference(json.getAsJsonObject("beneficiary")));
9462    if (json.has("dependent"))
9463      res.setDependentElement(parseString(json.get("dependent").getAsString()));
9464    if (json.has("_dependent"))
9465      parseElementProperties(json.getAsJsonObject("_dependent"), res.getDependentElement());
9466    if (json.has("relationship"))
9467      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
9468    if (json.has("period"))
9469      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9470    if (json.has("payor")) {
9471      JsonArray array = json.getAsJsonArray("payor");
9472      for (int i = 0; i < array.size(); i++) {
9473        res.getPayor().add(parseReference(array.get(i).getAsJsonObject()));
9474      }
9475    };
9476    if (json.has("class")) {
9477      JsonArray array = json.getAsJsonArray("class");
9478      for (int i = 0; i < array.size(); i++) {
9479        res.getClass_().add(parseCoverageClassComponent(array.get(i).getAsJsonObject(), res));
9480      }
9481    };
9482    if (json.has("order"))
9483      res.setOrderElement(parsePositiveInt(json.get("order").getAsString()));
9484    if (json.has("_order"))
9485      parseElementProperties(json.getAsJsonObject("_order"), res.getOrderElement());
9486    if (json.has("network"))
9487      res.setNetworkElement(parseString(json.get("network").getAsString()));
9488    if (json.has("_network"))
9489      parseElementProperties(json.getAsJsonObject("_network"), res.getNetworkElement());
9490    if (json.has("costToBeneficiary")) {
9491      JsonArray array = json.getAsJsonArray("costToBeneficiary");
9492      for (int i = 0; i < array.size(); i++) {
9493        res.getCostToBeneficiary().add(parseCoverageCostToBeneficiaryComponent(array.get(i).getAsJsonObject(), res));
9494      }
9495    };
9496    if (json.has("subrogation"))
9497      res.setSubrogationElement(parseBoolean(json.get("subrogation").getAsBoolean()));
9498    if (json.has("_subrogation"))
9499      parseElementProperties(json.getAsJsonObject("_subrogation"), res.getSubrogationElement());
9500    if (json.has("contract")) {
9501      JsonArray array = json.getAsJsonArray("contract");
9502      for (int i = 0; i < array.size(); i++) {
9503        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
9504      }
9505    };
9506  }
9507
9508  protected Coverage.ClassComponent parseCoverageClassComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
9509    Coverage.ClassComponent res = new Coverage.ClassComponent();
9510    parseCoverageClassComponentProperties(json, owner, res);
9511    return res;
9512  }
9513
9514  protected void parseCoverageClassComponentProperties(JsonObject json, Coverage owner, Coverage.ClassComponent res) throws IOException, FHIRFormatError {
9515    parseBackboneElementProperties(json, res);
9516    if (json.has("type"))
9517      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9518    if (json.has("value"))
9519      res.setValueElement(parseString(json.get("value").getAsString()));
9520    if (json.has("_value"))
9521      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
9522    if (json.has("name"))
9523      res.setNameElement(parseString(json.get("name").getAsString()));
9524    if (json.has("_name"))
9525      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9526  }
9527
9528  protected Coverage.CostToBeneficiaryComponent parseCoverageCostToBeneficiaryComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
9529    Coverage.CostToBeneficiaryComponent res = new Coverage.CostToBeneficiaryComponent();
9530    parseCoverageCostToBeneficiaryComponentProperties(json, owner, res);
9531    return res;
9532  }
9533
9534  protected void parseCoverageCostToBeneficiaryComponentProperties(JsonObject json, Coverage owner, Coverage.CostToBeneficiaryComponent res) throws IOException, FHIRFormatError {
9535    parseBackboneElementProperties(json, res);
9536    if (json.has("type"))
9537      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9538    Type value = parseType("value", json);
9539    if (value != null)
9540      res.setValue(value);
9541    if (json.has("exception")) {
9542      JsonArray array = json.getAsJsonArray("exception");
9543      for (int i = 0; i < array.size(); i++) {
9544        res.getException().add(parseCoverageExemptionComponent(array.get(i).getAsJsonObject(), owner));
9545      }
9546    };
9547  }
9548
9549  protected Coverage.ExemptionComponent parseCoverageExemptionComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
9550    Coverage.ExemptionComponent res = new Coverage.ExemptionComponent();
9551    parseCoverageExemptionComponentProperties(json, owner, res);
9552    return res;
9553  }
9554
9555  protected void parseCoverageExemptionComponentProperties(JsonObject json, Coverage owner, Coverage.ExemptionComponent res) throws IOException, FHIRFormatError {
9556    parseBackboneElementProperties(json, res);
9557    if (json.has("type"))
9558      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9559    if (json.has("period"))
9560      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9561  }
9562
9563  protected CoverageEligibilityRequest parseCoverageEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
9564    CoverageEligibilityRequest res = new CoverageEligibilityRequest();
9565    parseCoverageEligibilityRequestProperties(json, res);
9566    return res;
9567  }
9568
9569  protected void parseCoverageEligibilityRequestProperties(JsonObject json, CoverageEligibilityRequest res) throws IOException, FHIRFormatError {
9570    parseDomainResourceProperties(json, res);
9571    if (json.has("identifier")) {
9572      JsonArray array = json.getAsJsonArray("identifier");
9573      for (int i = 0; i < array.size(); i++) {
9574        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9575      }
9576    };
9577    if (json.has("status"))
9578      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CoverageEligibilityRequest.EligibilityRequestStatus.NULL, new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory()));
9579    if (json.has("_status"))
9580      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9581    if (json.has("priority"))
9582      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
9583    if (json.has("purpose")) {
9584      JsonArray array = json.getAsJsonArray("purpose");
9585      for (int i = 0; i < array.size(); i++) {
9586        res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
9587      }
9588    };
9589    if (json.has("_purpose")) {
9590      JsonArray array = json.getAsJsonArray("_purpose");
9591      for (int i = 0; i < array.size(); i++) {
9592        if (i == res.getPurpose().size())
9593          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
9594        if (array.get(i) instanceof JsonObject) 
9595          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
9596      }
9597    };
9598    if (json.has("patient"))
9599      res.setPatient(parseReference(json.getAsJsonObject("patient")));
9600    Type serviced = parseType("serviced", json);
9601    if (serviced != null)
9602      res.setServiced(serviced);
9603    if (json.has("created"))
9604      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
9605    if (json.has("_created"))
9606      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
9607    if (json.has("enterer"))
9608      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
9609    if (json.has("provider"))
9610      res.setProvider(parseReference(json.getAsJsonObject("provider")));
9611    if (json.has("insurer"))
9612      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
9613    if (json.has("facility"))
9614      res.setFacility(parseReference(json.getAsJsonObject("facility")));
9615    if (json.has("supportingInfo")) {
9616      JsonArray array = json.getAsJsonArray("supportingInfo");
9617      for (int i = 0; i < array.size(); i++) {
9618        res.getSupportingInfo().add(parseCoverageEligibilityRequestSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
9619      }
9620    };
9621    if (json.has("insurance")) {
9622      JsonArray array = json.getAsJsonArray("insurance");
9623      for (int i = 0; i < array.size(); i++) {
9624        res.getInsurance().add(parseCoverageEligibilityRequestInsuranceComponent(array.get(i).getAsJsonObject(), res));
9625      }
9626    };
9627    if (json.has("item")) {
9628      JsonArray array = json.getAsJsonArray("item");
9629      for (int i = 0; i < array.size(); i++) {
9630        res.getItem().add(parseCoverageEligibilityRequestDetailsComponent(array.get(i).getAsJsonObject(), res));
9631      }
9632    };
9633  }
9634
9635  protected CoverageEligibilityRequest.SupportingInformationComponent parseCoverageEligibilityRequestSupportingInformationComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
9636    CoverageEligibilityRequest.SupportingInformationComponent res = new CoverageEligibilityRequest.SupportingInformationComponent();
9637    parseCoverageEligibilityRequestSupportingInformationComponentProperties(json, owner, res);
9638    return res;
9639  }
9640
9641  protected void parseCoverageEligibilityRequestSupportingInformationComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.SupportingInformationComponent res) throws IOException, FHIRFormatError {
9642    parseBackboneElementProperties(json, res);
9643    if (json.has("sequence"))
9644      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9645    if (json.has("_sequence"))
9646      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
9647    if (json.has("information"))
9648      res.setInformation(parseReference(json.getAsJsonObject("information")));
9649    if (json.has("appliesToAll"))
9650      res.setAppliesToAllElement(parseBoolean(json.get("appliesToAll").getAsBoolean()));
9651    if (json.has("_appliesToAll"))
9652      parseElementProperties(json.getAsJsonObject("_appliesToAll"), res.getAppliesToAllElement());
9653  }
9654
9655  protected CoverageEligibilityRequest.InsuranceComponent parseCoverageEligibilityRequestInsuranceComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
9656    CoverageEligibilityRequest.InsuranceComponent res = new CoverageEligibilityRequest.InsuranceComponent();
9657    parseCoverageEligibilityRequestInsuranceComponentProperties(json, owner, res);
9658    return res;
9659  }
9660
9661  protected void parseCoverageEligibilityRequestInsuranceComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.InsuranceComponent res) throws IOException, FHIRFormatError {
9662    parseBackboneElementProperties(json, res);
9663    if (json.has("focal"))
9664      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
9665    if (json.has("_focal"))
9666      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
9667    if (json.has("coverage"))
9668      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
9669    if (json.has("businessArrangement"))
9670      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
9671    if (json.has("_businessArrangement"))
9672      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
9673  }
9674
9675  protected CoverageEligibilityRequest.DetailsComponent parseCoverageEligibilityRequestDetailsComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
9676    CoverageEligibilityRequest.DetailsComponent res = new CoverageEligibilityRequest.DetailsComponent();
9677    parseCoverageEligibilityRequestDetailsComponentProperties(json, owner, res);
9678    return res;
9679  }
9680
9681  protected void parseCoverageEligibilityRequestDetailsComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.DetailsComponent res) throws IOException, FHIRFormatError {
9682    parseBackboneElementProperties(json, res);
9683    if (json.has("supportingInfoSequence")) {
9684      JsonArray array = json.getAsJsonArray("supportingInfoSequence");
9685      for (int i = 0; i < array.size(); i++) {
9686        res.getSupportingInfoSequence().add(parsePositiveInt(array.get(i).getAsString()));
9687      }
9688    };
9689    if (json.has("_supportingInfoSequence")) {
9690      JsonArray array = json.getAsJsonArray("_supportingInfoSequence");
9691      for (int i = 0; i < array.size(); i++) {
9692        if (i == res.getSupportingInfoSequence().size())
9693          res.getSupportingInfoSequence().add(parsePositiveInt(null));
9694        if (array.get(i) instanceof JsonObject) 
9695          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportingInfoSequence().get(i));
9696      }
9697    };
9698    if (json.has("category"))
9699      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9700    if (json.has("productOrService"))
9701      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
9702    if (json.has("modifier")) {
9703      JsonArray array = json.getAsJsonArray("modifier");
9704      for (int i = 0; i < array.size(); i++) {
9705        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9706      }
9707    };
9708    if (json.has("provider"))
9709      res.setProvider(parseReference(json.getAsJsonObject("provider")));
9710    if (json.has("quantity"))
9711      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
9712    if (json.has("unitPrice"))
9713      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
9714    if (json.has("facility"))
9715      res.setFacility(parseReference(json.getAsJsonObject("facility")));
9716    if (json.has("diagnosis")) {
9717      JsonArray array = json.getAsJsonArray("diagnosis");
9718      for (int i = 0; i < array.size(); i++) {
9719        res.getDiagnosis().add(parseCoverageEligibilityRequestDiagnosisComponent(array.get(i).getAsJsonObject(), owner));
9720      }
9721    };
9722    if (json.has("detail")) {
9723      JsonArray array = json.getAsJsonArray("detail");
9724      for (int i = 0; i < array.size(); i++) {
9725        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
9726      }
9727    };
9728  }
9729
9730  protected CoverageEligibilityRequest.DiagnosisComponent parseCoverageEligibilityRequestDiagnosisComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
9731    CoverageEligibilityRequest.DiagnosisComponent res = new CoverageEligibilityRequest.DiagnosisComponent();
9732    parseCoverageEligibilityRequestDiagnosisComponentProperties(json, owner, res);
9733    return res;
9734  }
9735
9736  protected void parseCoverageEligibilityRequestDiagnosisComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.DiagnosisComponent res) throws IOException, FHIRFormatError {
9737    parseBackboneElementProperties(json, res);
9738    Type diagnosis = parseType("diagnosis", json);
9739    if (diagnosis != null)
9740      res.setDiagnosis(diagnosis);
9741  }
9742
9743  protected CoverageEligibilityResponse parseCoverageEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
9744    CoverageEligibilityResponse res = new CoverageEligibilityResponse();
9745    parseCoverageEligibilityResponseProperties(json, res);
9746    return res;
9747  }
9748
9749  protected void parseCoverageEligibilityResponseProperties(JsonObject json, CoverageEligibilityResponse res) throws IOException, FHIRFormatError {
9750    parseDomainResourceProperties(json, res);
9751    if (json.has("identifier")) {
9752      JsonArray array = json.getAsJsonArray("identifier");
9753      for (int i = 0; i < array.size(); i++) {
9754        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9755      }
9756    };
9757    if (json.has("status"))
9758      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CoverageEligibilityResponse.EligibilityResponseStatus.NULL, new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory()));
9759    if (json.has("_status"))
9760      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9761    if (json.has("purpose")) {
9762      JsonArray array = json.getAsJsonArray("purpose");
9763      for (int i = 0; i < array.size(); i++) {
9764        res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
9765      }
9766    };
9767    if (json.has("_purpose")) {
9768      JsonArray array = json.getAsJsonArray("_purpose");
9769      for (int i = 0; i < array.size(); i++) {
9770        if (i == res.getPurpose().size())
9771          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
9772        if (array.get(i) instanceof JsonObject) 
9773          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
9774      }
9775    };
9776    if (json.has("patient"))
9777      res.setPatient(parseReference(json.getAsJsonObject("patient")));
9778    Type serviced = parseType("serviced", json);
9779    if (serviced != null)
9780      res.setServiced(serviced);
9781    if (json.has("created"))
9782      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
9783    if (json.has("_created"))
9784      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
9785    if (json.has("requestor"))
9786      res.setRequestor(parseReference(json.getAsJsonObject("requestor")));
9787    if (json.has("request"))
9788      res.setRequest(parseReference(json.getAsJsonObject("request")));
9789    if (json.has("outcome"))
9790      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
9791    if (json.has("_outcome"))
9792      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
9793    if (json.has("disposition"))
9794      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
9795    if (json.has("_disposition"))
9796      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
9797    if (json.has("insurer"))
9798      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
9799    if (json.has("insurance")) {
9800      JsonArray array = json.getAsJsonArray("insurance");
9801      for (int i = 0; i < array.size(); i++) {
9802        res.getInsurance().add(parseCoverageEligibilityResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
9803      }
9804    };
9805    if (json.has("preAuthRef"))
9806      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
9807    if (json.has("_preAuthRef"))
9808      parseElementProperties(json.getAsJsonObject("_preAuthRef"), res.getPreAuthRefElement());
9809    if (json.has("form"))
9810      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
9811    if (json.has("error")) {
9812      JsonArray array = json.getAsJsonArray("error");
9813      for (int i = 0; i < array.size(); i++) {
9814        res.getError().add(parseCoverageEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
9815      }
9816    };
9817  }
9818
9819  protected CoverageEligibilityResponse.InsuranceComponent parseCoverageEligibilityResponseInsuranceComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
9820    CoverageEligibilityResponse.InsuranceComponent res = new CoverageEligibilityResponse.InsuranceComponent();
9821    parseCoverageEligibilityResponseInsuranceComponentProperties(json, owner, res);
9822    return res;
9823  }
9824
9825  protected void parseCoverageEligibilityResponseInsuranceComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
9826    parseBackboneElementProperties(json, res);
9827    if (json.has("coverage"))
9828      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
9829    if (json.has("inforce"))
9830      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
9831    if (json.has("_inforce"))
9832      parseElementProperties(json.getAsJsonObject("_inforce"), res.getInforceElement());
9833    if (json.has("benefitPeriod"))
9834      res.setBenefitPeriod(parsePeriod(json.getAsJsonObject("benefitPeriod")));
9835    if (json.has("item")) {
9836      JsonArray array = json.getAsJsonArray("item");
9837      for (int i = 0; i < array.size(); i++) {
9838        res.getItem().add(parseCoverageEligibilityResponseItemsComponent(array.get(i).getAsJsonObject(), owner));
9839      }
9840    };
9841  }
9842
9843  protected CoverageEligibilityResponse.ItemsComponent parseCoverageEligibilityResponseItemsComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
9844    CoverageEligibilityResponse.ItemsComponent res = new CoverageEligibilityResponse.ItemsComponent();
9845    parseCoverageEligibilityResponseItemsComponentProperties(json, owner, res);
9846    return res;
9847  }
9848
9849  protected void parseCoverageEligibilityResponseItemsComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.ItemsComponent res) throws IOException, FHIRFormatError {
9850    parseBackboneElementProperties(json, res);
9851    if (json.has("category"))
9852      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9853    if (json.has("productOrService"))
9854      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
9855    if (json.has("modifier")) {
9856      JsonArray array = json.getAsJsonArray("modifier");
9857      for (int i = 0; i < array.size(); i++) {
9858        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9859      }
9860    };
9861    if (json.has("provider"))
9862      res.setProvider(parseReference(json.getAsJsonObject("provider")));
9863    if (json.has("excluded"))
9864      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
9865    if (json.has("_excluded"))
9866      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
9867    if (json.has("name"))
9868      res.setNameElement(parseString(json.get("name").getAsString()));
9869    if (json.has("_name"))
9870      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9871    if (json.has("description"))
9872      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9873    if (json.has("_description"))
9874      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9875    if (json.has("network"))
9876      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
9877    if (json.has("unit"))
9878      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
9879    if (json.has("term"))
9880      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
9881    if (json.has("benefit")) {
9882      JsonArray array = json.getAsJsonArray("benefit");
9883      for (int i = 0; i < array.size(); i++) {
9884        res.getBenefit().add(parseCoverageEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject(), owner));
9885      }
9886    };
9887    if (json.has("authorizationRequired"))
9888      res.setAuthorizationRequiredElement(parseBoolean(json.get("authorizationRequired").getAsBoolean()));
9889    if (json.has("_authorizationRequired"))
9890      parseElementProperties(json.getAsJsonObject("_authorizationRequired"), res.getAuthorizationRequiredElement());
9891    if (json.has("authorizationSupporting")) {
9892      JsonArray array = json.getAsJsonArray("authorizationSupporting");
9893      for (int i = 0; i < array.size(); i++) {
9894        res.getAuthorizationSupporting().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9895      }
9896    };
9897    if (json.has("authorizationUrl"))
9898      res.setAuthorizationUrlElement(parseUri(json.get("authorizationUrl").getAsString()));
9899    if (json.has("_authorizationUrl"))
9900      parseElementProperties(json.getAsJsonObject("_authorizationUrl"), res.getAuthorizationUrlElement());
9901  }
9902
9903  protected CoverageEligibilityResponse.BenefitComponent parseCoverageEligibilityResponseBenefitComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
9904    CoverageEligibilityResponse.BenefitComponent res = new CoverageEligibilityResponse.BenefitComponent();
9905    parseCoverageEligibilityResponseBenefitComponentProperties(json, owner, res);
9906    return res;
9907  }
9908
9909  protected void parseCoverageEligibilityResponseBenefitComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.BenefitComponent res) throws IOException, FHIRFormatError {
9910    parseBackboneElementProperties(json, res);
9911    if (json.has("type"))
9912      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9913    Type allowed = parseType("allowed", json);
9914    if (allowed != null)
9915      res.setAllowed(allowed);
9916    Type used = parseType("used", json);
9917    if (used != null)
9918      res.setUsed(used);
9919  }
9920
9921  protected CoverageEligibilityResponse.ErrorsComponent parseCoverageEligibilityResponseErrorsComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
9922    CoverageEligibilityResponse.ErrorsComponent res = new CoverageEligibilityResponse.ErrorsComponent();
9923    parseCoverageEligibilityResponseErrorsComponentProperties(json, owner, res);
9924    return res;
9925  }
9926
9927  protected void parseCoverageEligibilityResponseErrorsComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.ErrorsComponent res) throws IOException, FHIRFormatError {
9928    parseBackboneElementProperties(json, res);
9929    if (json.has("code"))
9930      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9931  }
9932
9933  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
9934    DetectedIssue res = new DetectedIssue();
9935    parseDetectedIssueProperties(json, res);
9936    return res;
9937  }
9938
9939  protected void parseDetectedIssueProperties(JsonObject json, DetectedIssue res) throws IOException, FHIRFormatError {
9940    parseDomainResourceProperties(json, res);
9941    if (json.has("identifier")) {
9942      JsonArray array = json.getAsJsonArray("identifier");
9943      for (int i = 0; i < array.size(); i++) {
9944        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9945      }
9946    };
9947    if (json.has("status"))
9948      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DetectedIssue.DetectedIssueStatus.NULL, new DetectedIssue.DetectedIssueStatusEnumFactory()));
9949    if (json.has("_status"))
9950      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9951    if (json.has("code"))
9952      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9953    if (json.has("severity"))
9954      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
9955    if (json.has("_severity"))
9956      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
9957    if (json.has("patient"))
9958      res.setPatient(parseReference(json.getAsJsonObject("patient")));
9959    Type identified = parseType("identified", json);
9960    if (identified != null)
9961      res.setIdentified(identified);
9962    if (json.has("author"))
9963      res.setAuthor(parseReference(json.getAsJsonObject("author")));
9964    if (json.has("implicated")) {
9965      JsonArray array = json.getAsJsonArray("implicated");
9966      for (int i = 0; i < array.size(); i++) {
9967        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
9968      }
9969    };
9970    if (json.has("evidence")) {
9971      JsonArray array = json.getAsJsonArray("evidence");
9972      for (int i = 0; i < array.size(); i++) {
9973        res.getEvidence().add(parseDetectedIssueDetectedIssueEvidenceComponent(array.get(i).getAsJsonObject(), res));
9974      }
9975    };
9976    if (json.has("detail"))
9977      res.setDetailElement(parseString(json.get("detail").getAsString()));
9978    if (json.has("_detail"))
9979      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
9980    if (json.has("reference"))
9981      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
9982    if (json.has("_reference"))
9983      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
9984    if (json.has("mitigation")) {
9985      JsonArray array = json.getAsJsonArray("mitigation");
9986      for (int i = 0; i < array.size(); i++) {
9987        res.getMitigation().add(parseDetectedIssueDetectedIssueMitigationComponent(array.get(i).getAsJsonObject(), res));
9988      }
9989    };
9990  }
9991
9992  protected DetectedIssue.DetectedIssueEvidenceComponent parseDetectedIssueDetectedIssueEvidenceComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
9993    DetectedIssue.DetectedIssueEvidenceComponent res = new DetectedIssue.DetectedIssueEvidenceComponent();
9994    parseDetectedIssueDetectedIssueEvidenceComponentProperties(json, owner, res);
9995    return res;
9996  }
9997
9998  protected void parseDetectedIssueDetectedIssueEvidenceComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueEvidenceComponent res) throws IOException, FHIRFormatError {
9999    parseBackboneElementProperties(json, res);
10000    if (json.has("code")) {
10001      JsonArray array = json.getAsJsonArray("code");
10002      for (int i = 0; i < array.size(); i++) {
10003        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10004      }
10005    };
10006    if (json.has("detail")) {
10007      JsonArray array = json.getAsJsonArray("detail");
10008      for (int i = 0; i < array.size(); i++) {
10009        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
10010      }
10011    };
10012  }
10013
10014  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
10015    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
10016    parseDetectedIssueDetectedIssueMitigationComponentProperties(json, owner, res);
10017    return res;
10018  }
10019
10020  protected void parseDetectedIssueDetectedIssueMitigationComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueMitigationComponent res) throws IOException, FHIRFormatError {
10021    parseBackboneElementProperties(json, res);
10022    if (json.has("action"))
10023      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
10024    if (json.has("date"))
10025      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10026    if (json.has("_date"))
10027      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10028    if (json.has("author"))
10029      res.setAuthor(parseReference(json.getAsJsonObject("author")));
10030  }
10031
10032  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
10033    Device res = new Device();
10034    parseDeviceProperties(json, res);
10035    return res;
10036  }
10037
10038  protected void parseDeviceProperties(JsonObject json, Device res) throws IOException, FHIRFormatError {
10039    parseDomainResourceProperties(json, res);
10040    if (json.has("identifier")) {
10041      JsonArray array = json.getAsJsonArray("identifier");
10042      for (int i = 0; i < array.size(); i++) {
10043        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10044      }
10045    };
10046    if (json.has("definition"))
10047      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
10048    if (json.has("udiCarrier")) {
10049      JsonArray array = json.getAsJsonArray("udiCarrier");
10050      for (int i = 0; i < array.size(); i++) {
10051        res.getUdiCarrier().add(parseDeviceDeviceUdiCarrierComponent(array.get(i).getAsJsonObject(), res));
10052      }
10053    };
10054    if (json.has("status"))
10055      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.FHIRDeviceStatus.NULL, new Device.FHIRDeviceStatusEnumFactory()));
10056    if (json.has("_status"))
10057      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10058    if (json.has("statusReason")) {
10059      JsonArray array = json.getAsJsonArray("statusReason");
10060      for (int i = 0; i < array.size(); i++) {
10061        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10062      }
10063    };
10064    if (json.has("distinctIdentifier"))
10065      res.setDistinctIdentifierElement(parseString(json.get("distinctIdentifier").getAsString()));
10066    if (json.has("_distinctIdentifier"))
10067      parseElementProperties(json.getAsJsonObject("_distinctIdentifier"), res.getDistinctIdentifierElement());
10068    if (json.has("manufacturer"))
10069      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
10070    if (json.has("_manufacturer"))
10071      parseElementProperties(json.getAsJsonObject("_manufacturer"), res.getManufacturerElement());
10072    if (json.has("manufactureDate"))
10073      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
10074    if (json.has("_manufactureDate"))
10075      parseElementProperties(json.getAsJsonObject("_manufactureDate"), res.getManufactureDateElement());
10076    if (json.has("expirationDate"))
10077      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
10078    if (json.has("_expirationDate"))
10079      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
10080    if (json.has("lotNumber"))
10081      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
10082    if (json.has("_lotNumber"))
10083      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
10084    if (json.has("serialNumber"))
10085      res.setSerialNumberElement(parseString(json.get("serialNumber").getAsString()));
10086    if (json.has("_serialNumber"))
10087      parseElementProperties(json.getAsJsonObject("_serialNumber"), res.getSerialNumberElement());
10088    if (json.has("deviceName")) {
10089      JsonArray array = json.getAsJsonArray("deviceName");
10090      for (int i = 0; i < array.size(); i++) {
10091        res.getDeviceName().add(parseDeviceDeviceDeviceNameComponent(array.get(i).getAsJsonObject(), res));
10092      }
10093    };
10094    if (json.has("modelNumber"))
10095      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
10096    if (json.has("_modelNumber"))
10097      parseElementProperties(json.getAsJsonObject("_modelNumber"), res.getModelNumberElement());
10098    if (json.has("partNumber"))
10099      res.setPartNumberElement(parseString(json.get("partNumber").getAsString()));
10100    if (json.has("_partNumber"))
10101      parseElementProperties(json.getAsJsonObject("_partNumber"), res.getPartNumberElement());
10102    if (json.has("type"))
10103      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10104    if (json.has("specialization")) {
10105      JsonArray array = json.getAsJsonArray("specialization");
10106      for (int i = 0; i < array.size(); i++) {
10107        res.getSpecialization().add(parseDeviceDeviceSpecializationComponent(array.get(i).getAsJsonObject(), res));
10108      }
10109    };
10110    if (json.has("version")) {
10111      JsonArray array = json.getAsJsonArray("version");
10112      for (int i = 0; i < array.size(); i++) {
10113        res.getVersion().add(parseDeviceDeviceVersionComponent(array.get(i).getAsJsonObject(), res));
10114      }
10115    };
10116    if (json.has("property")) {
10117      JsonArray array = json.getAsJsonArray("property");
10118      for (int i = 0; i < array.size(); i++) {
10119        res.getProperty().add(parseDeviceDevicePropertyComponent(array.get(i).getAsJsonObject(), res));
10120      }
10121    };
10122    if (json.has("patient"))
10123      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10124    if (json.has("owner"))
10125      res.setOwner(parseReference(json.getAsJsonObject("owner")));
10126    if (json.has("contact")) {
10127      JsonArray array = json.getAsJsonArray("contact");
10128      for (int i = 0; i < array.size(); i++) {
10129        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
10130      }
10131    };
10132    if (json.has("location"))
10133      res.setLocation(parseReference(json.getAsJsonObject("location")));
10134    if (json.has("url"))
10135      res.setUrlElement(parseUri(json.get("url").getAsString()));
10136    if (json.has("_url"))
10137      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10138    if (json.has("note")) {
10139      JsonArray array = json.getAsJsonArray("note");
10140      for (int i = 0; i < array.size(); i++) {
10141        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10142      }
10143    };
10144    if (json.has("safety")) {
10145      JsonArray array = json.getAsJsonArray("safety");
10146      for (int i = 0; i < array.size(); i++) {
10147        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10148      }
10149    };
10150    if (json.has("parent"))
10151      res.setParent(parseReference(json.getAsJsonObject("parent")));
10152  }
10153
10154  protected Device.DeviceUdiCarrierComponent parseDeviceDeviceUdiCarrierComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
10155    Device.DeviceUdiCarrierComponent res = new Device.DeviceUdiCarrierComponent();
10156    parseDeviceDeviceUdiCarrierComponentProperties(json, owner, res);
10157    return res;
10158  }
10159
10160  protected void parseDeviceDeviceUdiCarrierComponentProperties(JsonObject json, Device owner, Device.DeviceUdiCarrierComponent res) throws IOException, FHIRFormatError {
10161    parseBackboneElementProperties(json, res);
10162    if (json.has("deviceIdentifier"))
10163      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
10164    if (json.has("_deviceIdentifier"))
10165      parseElementProperties(json.getAsJsonObject("_deviceIdentifier"), res.getDeviceIdentifierElement());
10166    if (json.has("issuer"))
10167      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
10168    if (json.has("_issuer"))
10169      parseElementProperties(json.getAsJsonObject("_issuer"), res.getIssuerElement());
10170    if (json.has("jurisdiction"))
10171      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
10172    if (json.has("_jurisdiction"))
10173      parseElementProperties(json.getAsJsonObject("_jurisdiction"), res.getJurisdictionElement());
10174    if (json.has("carrierAIDC"))
10175      res.setCarrierAIDCElement(parseBase64Binary(json.get("carrierAIDC").getAsString()));
10176    if (json.has("_carrierAIDC"))
10177      parseElementProperties(json.getAsJsonObject("_carrierAIDC"), res.getCarrierAIDCElement());
10178    if (json.has("carrierHRF"))
10179      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
10180    if (json.has("_carrierHRF"))
10181      parseElementProperties(json.getAsJsonObject("_carrierHRF"), res.getCarrierHRFElement());
10182    if (json.has("entryType"))
10183      res.setEntryTypeElement(parseEnumeration(json.get("entryType").getAsString(), Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
10184    if (json.has("_entryType"))
10185      parseElementProperties(json.getAsJsonObject("_entryType"), res.getEntryTypeElement());
10186  }
10187
10188  protected Device.DeviceDeviceNameComponent parseDeviceDeviceDeviceNameComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
10189    Device.DeviceDeviceNameComponent res = new Device.DeviceDeviceNameComponent();
10190    parseDeviceDeviceDeviceNameComponentProperties(json, owner, res);
10191    return res;
10192  }
10193
10194  protected void parseDeviceDeviceDeviceNameComponentProperties(JsonObject json, Device owner, Device.DeviceDeviceNameComponent res) throws IOException, FHIRFormatError {
10195    parseBackboneElementProperties(json, res);
10196    if (json.has("name"))
10197      res.setNameElement(parseString(json.get("name").getAsString()));
10198    if (json.has("_name"))
10199      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10200    if (json.has("type"))
10201      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Device.DeviceNameType.NULL, new Device.DeviceNameTypeEnumFactory()));
10202    if (json.has("_type"))
10203      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10204  }
10205
10206  protected Device.DeviceSpecializationComponent parseDeviceDeviceSpecializationComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
10207    Device.DeviceSpecializationComponent res = new Device.DeviceSpecializationComponent();
10208    parseDeviceDeviceSpecializationComponentProperties(json, owner, res);
10209    return res;
10210  }
10211
10212  protected void parseDeviceDeviceSpecializationComponentProperties(JsonObject json, Device owner, Device.DeviceSpecializationComponent res) throws IOException, FHIRFormatError {
10213    parseBackboneElementProperties(json, res);
10214    if (json.has("systemType"))
10215      res.setSystemType(parseCodeableConcept(json.getAsJsonObject("systemType")));
10216    if (json.has("version"))
10217      res.setVersionElement(parseString(json.get("version").getAsString()));
10218    if (json.has("_version"))
10219      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10220  }
10221
10222  protected Device.DeviceVersionComponent parseDeviceDeviceVersionComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
10223    Device.DeviceVersionComponent res = new Device.DeviceVersionComponent();
10224    parseDeviceDeviceVersionComponentProperties(json, owner, res);
10225    return res;
10226  }
10227
10228  protected void parseDeviceDeviceVersionComponentProperties(JsonObject json, Device owner, Device.DeviceVersionComponent res) throws IOException, FHIRFormatError {
10229    parseBackboneElementProperties(json, res);
10230    if (json.has("type"))
10231      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10232    if (json.has("component"))
10233      res.setComponent(parseIdentifier(json.getAsJsonObject("component")));
10234    if (json.has("value"))
10235      res.setValueElement(parseString(json.get("value").getAsString()));
10236    if (json.has("_value"))
10237      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10238  }
10239
10240  protected Device.DevicePropertyComponent parseDeviceDevicePropertyComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
10241    Device.DevicePropertyComponent res = new Device.DevicePropertyComponent();
10242    parseDeviceDevicePropertyComponentProperties(json, owner, res);
10243    return res;
10244  }
10245
10246  protected void parseDeviceDevicePropertyComponentProperties(JsonObject json, Device owner, Device.DevicePropertyComponent res) throws IOException, FHIRFormatError {
10247    parseBackboneElementProperties(json, res);
10248    if (json.has("type"))
10249      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10250    if (json.has("valueQuantity")) {
10251      JsonArray array = json.getAsJsonArray("valueQuantity");
10252      for (int i = 0; i < array.size(); i++) {
10253        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
10254      }
10255    };
10256    if (json.has("valueCode")) {
10257      JsonArray array = json.getAsJsonArray("valueCode");
10258      for (int i = 0; i < array.size(); i++) {
10259        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10260      }
10261    };
10262  }
10263
10264  protected DeviceDefinition parseDeviceDefinition(JsonObject json) throws IOException, FHIRFormatError {
10265    DeviceDefinition res = new DeviceDefinition();
10266    parseDeviceDefinitionProperties(json, res);
10267    return res;
10268  }
10269
10270  protected void parseDeviceDefinitionProperties(JsonObject json, DeviceDefinition res) throws IOException, FHIRFormatError {
10271    parseDomainResourceProperties(json, res);
10272    if (json.has("identifier")) {
10273      JsonArray array = json.getAsJsonArray("identifier");
10274      for (int i = 0; i < array.size(); i++) {
10275        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10276      }
10277    };
10278    if (json.has("udiDeviceIdentifier")) {
10279      JsonArray array = json.getAsJsonArray("udiDeviceIdentifier");
10280      for (int i = 0; i < array.size(); i++) {
10281        res.getUdiDeviceIdentifier().add(parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(array.get(i).getAsJsonObject(), res));
10282      }
10283    };
10284    Type manufacturer = parseType("manufacturer", json);
10285    if (manufacturer != null)
10286      res.setManufacturer(manufacturer);
10287    if (json.has("deviceName")) {
10288      JsonArray array = json.getAsJsonArray("deviceName");
10289      for (int i = 0; i < array.size(); i++) {
10290        res.getDeviceName().add(parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(array.get(i).getAsJsonObject(), res));
10291      }
10292    };
10293    if (json.has("modelNumber"))
10294      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
10295    if (json.has("_modelNumber"))
10296      parseElementProperties(json.getAsJsonObject("_modelNumber"), res.getModelNumberElement());
10297    if (json.has("type"))
10298      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10299    if (json.has("specialization")) {
10300      JsonArray array = json.getAsJsonArray("specialization");
10301      for (int i = 0; i < array.size(); i++) {
10302        res.getSpecialization().add(parseDeviceDefinitionDeviceDefinitionSpecializationComponent(array.get(i).getAsJsonObject(), res));
10303      }
10304    };
10305    if (json.has("version")) {
10306      JsonArray array = json.getAsJsonArray("version");
10307      for (int i = 0; i < array.size(); i++) {
10308        res.getVersion().add(parseString(array.get(i).getAsString()));
10309      }
10310    };
10311    if (json.has("_version")) {
10312      JsonArray array = json.getAsJsonArray("_version");
10313      for (int i = 0; i < array.size(); i++) {
10314        if (i == res.getVersion().size())
10315          res.getVersion().add(parseString(null));
10316        if (array.get(i) instanceof JsonObject) 
10317          parseElementProperties(array.get(i).getAsJsonObject(), res.getVersion().get(i));
10318      }
10319    };
10320    if (json.has("safety")) {
10321      JsonArray array = json.getAsJsonArray("safety");
10322      for (int i = 0; i < array.size(); i++) {
10323        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10324      }
10325    };
10326    if (json.has("shelfLifeStorage")) {
10327      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
10328      for (int i = 0; i < array.size(); i++) {
10329        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
10330      }
10331    };
10332    if (json.has("physicalCharacteristics"))
10333      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
10334    if (json.has("languageCode")) {
10335      JsonArray array = json.getAsJsonArray("languageCode");
10336      for (int i = 0; i < array.size(); i++) {
10337        res.getLanguageCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10338      }
10339    };
10340    if (json.has("capability")) {
10341      JsonArray array = json.getAsJsonArray("capability");
10342      for (int i = 0; i < array.size(); i++) {
10343        res.getCapability().add(parseDeviceDefinitionDeviceDefinitionCapabilityComponent(array.get(i).getAsJsonObject(), res));
10344      }
10345    };
10346    if (json.has("property")) {
10347      JsonArray array = json.getAsJsonArray("property");
10348      for (int i = 0; i < array.size(); i++) {
10349        res.getProperty().add(parseDeviceDefinitionDeviceDefinitionPropertyComponent(array.get(i).getAsJsonObject(), res));
10350      }
10351    };
10352    if (json.has("owner"))
10353      res.setOwner(parseReference(json.getAsJsonObject("owner")));
10354    if (json.has("contact")) {
10355      JsonArray array = json.getAsJsonArray("contact");
10356      for (int i = 0; i < array.size(); i++) {
10357        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
10358      }
10359    };
10360    if (json.has("url"))
10361      res.setUrlElement(parseUri(json.get("url").getAsString()));
10362    if (json.has("_url"))
10363      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10364    if (json.has("onlineInformation"))
10365      res.setOnlineInformationElement(parseUri(json.get("onlineInformation").getAsString()));
10366    if (json.has("_onlineInformation"))
10367      parseElementProperties(json.getAsJsonObject("_onlineInformation"), res.getOnlineInformationElement());
10368    if (json.has("note")) {
10369      JsonArray array = json.getAsJsonArray("note");
10370      for (int i = 0; i < array.size(); i++) {
10371        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10372      }
10373    };
10374    if (json.has("quantity"))
10375      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
10376    if (json.has("parentDevice"))
10377      res.setParentDevice(parseReference(json.getAsJsonObject("parentDevice")));
10378    if (json.has("material")) {
10379      JsonArray array = json.getAsJsonArray("material");
10380      for (int i = 0; i < array.size(); i++) {
10381        res.getMaterial().add(parseDeviceDefinitionDeviceDefinitionMaterialComponent(array.get(i).getAsJsonObject(), res));
10382      }
10383    };
10384  }
10385
10386  protected DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
10387    DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res = new DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent();
10388    parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentProperties(json, owner, res);
10389    return res;
10390  }
10391
10392  protected void parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res) throws IOException, FHIRFormatError {
10393    parseBackboneElementProperties(json, res);
10394    if (json.has("deviceIdentifier"))
10395      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
10396    if (json.has("_deviceIdentifier"))
10397      parseElementProperties(json.getAsJsonObject("_deviceIdentifier"), res.getDeviceIdentifierElement());
10398    if (json.has("issuer"))
10399      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
10400    if (json.has("_issuer"))
10401      parseElementProperties(json.getAsJsonObject("_issuer"), res.getIssuerElement());
10402    if (json.has("jurisdiction"))
10403      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
10404    if (json.has("_jurisdiction"))
10405      parseElementProperties(json.getAsJsonObject("_jurisdiction"), res.getJurisdictionElement());
10406  }
10407
10408  protected DeviceDefinition.DeviceDefinitionDeviceNameComponent parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
10409    DeviceDefinition.DeviceDefinitionDeviceNameComponent res = new DeviceDefinition.DeviceDefinitionDeviceNameComponent();
10410    parseDeviceDefinitionDeviceDefinitionDeviceNameComponentProperties(json, owner, res);
10411    return res;
10412  }
10413
10414  protected void parseDeviceDefinitionDeviceDefinitionDeviceNameComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionDeviceNameComponent res) throws IOException, FHIRFormatError {
10415    parseBackboneElementProperties(json, res);
10416    if (json.has("name"))
10417      res.setNameElement(parseString(json.get("name").getAsString()));
10418    if (json.has("_name"))
10419      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10420    if (json.has("type"))
10421      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceDefinition.DeviceNameType.NULL, new DeviceDefinition.DeviceNameTypeEnumFactory()));
10422    if (json.has("_type"))
10423      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10424  }
10425
10426  protected DeviceDefinition.DeviceDefinitionSpecializationComponent parseDeviceDefinitionDeviceDefinitionSpecializationComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
10427    DeviceDefinition.DeviceDefinitionSpecializationComponent res = new DeviceDefinition.DeviceDefinitionSpecializationComponent();
10428    parseDeviceDefinitionDeviceDefinitionSpecializationComponentProperties(json, owner, res);
10429    return res;
10430  }
10431
10432  protected void parseDeviceDefinitionDeviceDefinitionSpecializationComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionSpecializationComponent res) throws IOException, FHIRFormatError {
10433    parseBackboneElementProperties(json, res);
10434    if (json.has("systemType"))
10435      res.setSystemTypeElement(parseString(json.get("systemType").getAsString()));
10436    if (json.has("_systemType"))
10437      parseElementProperties(json.getAsJsonObject("_systemType"), res.getSystemTypeElement());
10438    if (json.has("version"))
10439      res.setVersionElement(parseString(json.get("version").getAsString()));
10440    if (json.has("_version"))
10441      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10442  }
10443
10444  protected DeviceDefinition.DeviceDefinitionCapabilityComponent parseDeviceDefinitionDeviceDefinitionCapabilityComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
10445    DeviceDefinition.DeviceDefinitionCapabilityComponent res = new DeviceDefinition.DeviceDefinitionCapabilityComponent();
10446    parseDeviceDefinitionDeviceDefinitionCapabilityComponentProperties(json, owner, res);
10447    return res;
10448  }
10449
10450  protected void parseDeviceDefinitionDeviceDefinitionCapabilityComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionCapabilityComponent res) throws IOException, FHIRFormatError {
10451    parseBackboneElementProperties(json, res);
10452    if (json.has("type"))
10453      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10454    if (json.has("description")) {
10455      JsonArray array = json.getAsJsonArray("description");
10456      for (int i = 0; i < array.size(); i++) {
10457        res.getDescription().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10458      }
10459    };
10460  }
10461
10462  protected DeviceDefinition.DeviceDefinitionPropertyComponent parseDeviceDefinitionDeviceDefinitionPropertyComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
10463    DeviceDefinition.DeviceDefinitionPropertyComponent res = new DeviceDefinition.DeviceDefinitionPropertyComponent();
10464    parseDeviceDefinitionDeviceDefinitionPropertyComponentProperties(json, owner, res);
10465    return res;
10466  }
10467
10468  protected void parseDeviceDefinitionDeviceDefinitionPropertyComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
10469    parseBackboneElementProperties(json, res);
10470    if (json.has("type"))
10471      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10472    if (json.has("valueQuantity")) {
10473      JsonArray array = json.getAsJsonArray("valueQuantity");
10474      for (int i = 0; i < array.size(); i++) {
10475        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
10476      }
10477    };
10478    if (json.has("valueCode")) {
10479      JsonArray array = json.getAsJsonArray("valueCode");
10480      for (int i = 0; i < array.size(); i++) {
10481        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10482      }
10483    };
10484  }
10485
10486  protected DeviceDefinition.DeviceDefinitionMaterialComponent parseDeviceDefinitionDeviceDefinitionMaterialComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
10487    DeviceDefinition.DeviceDefinitionMaterialComponent res = new DeviceDefinition.DeviceDefinitionMaterialComponent();
10488    parseDeviceDefinitionDeviceDefinitionMaterialComponentProperties(json, owner, res);
10489    return res;
10490  }
10491
10492  protected void parseDeviceDefinitionDeviceDefinitionMaterialComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionMaterialComponent res) throws IOException, FHIRFormatError {
10493    parseBackboneElementProperties(json, res);
10494    if (json.has("substance"))
10495      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
10496    if (json.has("alternate"))
10497      res.setAlternateElement(parseBoolean(json.get("alternate").getAsBoolean()));
10498    if (json.has("_alternate"))
10499      parseElementProperties(json.getAsJsonObject("_alternate"), res.getAlternateElement());
10500    if (json.has("allergenicIndicator"))
10501      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
10502    if (json.has("_allergenicIndicator"))
10503      parseElementProperties(json.getAsJsonObject("_allergenicIndicator"), res.getAllergenicIndicatorElement());
10504  }
10505
10506  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
10507    DeviceMetric res = new DeviceMetric();
10508    parseDeviceMetricProperties(json, res);
10509    return res;
10510  }
10511
10512  protected void parseDeviceMetricProperties(JsonObject json, DeviceMetric res) throws IOException, FHIRFormatError {
10513    parseDomainResourceProperties(json, res);
10514    if (json.has("identifier")) {
10515      JsonArray array = json.getAsJsonArray("identifier");
10516      for (int i = 0; i < array.size(); i++) {
10517        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10518      }
10519    };
10520    if (json.has("type"))
10521      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10522    if (json.has("unit"))
10523      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
10524    if (json.has("source"))
10525      res.setSource(parseReference(json.getAsJsonObject("source")));
10526    if (json.has("parent"))
10527      res.setParent(parseReference(json.getAsJsonObject("parent")));
10528    if (json.has("operationalStatus"))
10529      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
10530    if (json.has("_operationalStatus"))
10531      parseElementProperties(json.getAsJsonObject("_operationalStatus"), res.getOperationalStatusElement());
10532    if (json.has("color"))
10533      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
10534    if (json.has("_color"))
10535      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
10536    if (json.has("category"))
10537      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
10538    if (json.has("_category"))
10539      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
10540    if (json.has("measurementPeriod"))
10541      res.setMeasurementPeriod(parseTiming(json.getAsJsonObject("measurementPeriod")));
10542    if (json.has("calibration")) {
10543      JsonArray array = json.getAsJsonArray("calibration");
10544      for (int i = 0; i < array.size(); i++) {
10545        res.getCalibration().add(parseDeviceMetricDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject(), res));
10546      }
10547    };
10548  }
10549
10550  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(JsonObject json, DeviceMetric owner) throws IOException, FHIRFormatError {
10551    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
10552    parseDeviceMetricDeviceMetricCalibrationComponentProperties(json, owner, res);
10553    return res;
10554  }
10555
10556  protected void parseDeviceMetricDeviceMetricCalibrationComponentProperties(JsonObject json, DeviceMetric owner, DeviceMetric.DeviceMetricCalibrationComponent res) throws IOException, FHIRFormatError {
10557    parseBackboneElementProperties(json, res);
10558    if (json.has("type"))
10559      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
10560    if (json.has("_type"))
10561      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10562    if (json.has("state"))
10563      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
10564    if (json.has("_state"))
10565      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
10566    if (json.has("time"))
10567      res.setTimeElement(parseInstant(json.get("time").getAsString()));
10568    if (json.has("_time"))
10569      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
10570  }
10571
10572  protected DeviceRequest parseDeviceRequest(JsonObject json) throws IOException, FHIRFormatError {
10573    DeviceRequest res = new DeviceRequest();
10574    parseDeviceRequestProperties(json, res);
10575    return res;
10576  }
10577
10578  protected void parseDeviceRequestProperties(JsonObject json, DeviceRequest res) throws IOException, FHIRFormatError {
10579    parseDomainResourceProperties(json, res);
10580    if (json.has("identifier")) {
10581      JsonArray array = json.getAsJsonArray("identifier");
10582      for (int i = 0; i < array.size(); i++) {
10583        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10584      }
10585    };
10586    if (json.has("instantiatesCanonical")) {
10587      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
10588      for (int i = 0; i < array.size(); i++) {
10589        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
10590      }
10591    };
10592    if (json.has("_instantiatesCanonical")) {
10593      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
10594      for (int i = 0; i < array.size(); i++) {
10595        if (i == res.getInstantiatesCanonical().size())
10596          res.getInstantiatesCanonical().add(parseCanonical(null));
10597        if (array.get(i) instanceof JsonObject) 
10598          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
10599      }
10600    };
10601    if (json.has("instantiatesUri")) {
10602      JsonArray array = json.getAsJsonArray("instantiatesUri");
10603      for (int i = 0; i < array.size(); i++) {
10604        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
10605      }
10606    };
10607    if (json.has("_instantiatesUri")) {
10608      JsonArray array = json.getAsJsonArray("_instantiatesUri");
10609      for (int i = 0; i < array.size(); i++) {
10610        if (i == res.getInstantiatesUri().size())
10611          res.getInstantiatesUri().add(parseUri(null));
10612        if (array.get(i) instanceof JsonObject) 
10613          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
10614      }
10615    };
10616    if (json.has("basedOn")) {
10617      JsonArray array = json.getAsJsonArray("basedOn");
10618      for (int i = 0; i < array.size(); i++) {
10619        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
10620      }
10621    };
10622    if (json.has("priorRequest")) {
10623      JsonArray array = json.getAsJsonArray("priorRequest");
10624      for (int i = 0; i < array.size(); i++) {
10625        res.getPriorRequest().add(parseReference(array.get(i).getAsJsonObject()));
10626      }
10627    };
10628    if (json.has("groupIdentifier"))
10629      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
10630    if (json.has("status"))
10631      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceRequest.DeviceRequestStatus.NULL, new DeviceRequest.DeviceRequestStatusEnumFactory()));
10632    if (json.has("_status"))
10633      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10634    if (json.has("intent"))
10635      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), DeviceRequest.RequestIntent.NULL, new DeviceRequest.RequestIntentEnumFactory()));
10636    if (json.has("_intent"))
10637      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
10638    if (json.has("priority"))
10639      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DeviceRequest.RequestPriority.NULL, new DeviceRequest.RequestPriorityEnumFactory()));
10640    if (json.has("_priority"))
10641      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
10642    Type code = parseType("code", json);
10643    if (code != null)
10644      res.setCode(code);
10645    if (json.has("parameter")) {
10646      JsonArray array = json.getAsJsonArray("parameter");
10647      for (int i = 0; i < array.size(); i++) {
10648        res.getParameter().add(parseDeviceRequestDeviceRequestParameterComponent(array.get(i).getAsJsonObject(), res));
10649      }
10650    };
10651    if (json.has("subject"))
10652      res.setSubject(parseReference(json.getAsJsonObject("subject")));
10653    if (json.has("encounter"))
10654      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
10655    Type occurrence = parseType("occurrence", json);
10656    if (occurrence != null)
10657      res.setOccurrence(occurrence);
10658    if (json.has("authoredOn"))
10659      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
10660    if (json.has("_authoredOn"))
10661      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
10662    if (json.has("requester"))
10663      res.setRequester(parseReference(json.getAsJsonObject("requester")));
10664    if (json.has("performerType"))
10665      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
10666    if (json.has("performer"))
10667      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
10668    if (json.has("reasonCode")) {
10669      JsonArray array = json.getAsJsonArray("reasonCode");
10670      for (int i = 0; i < array.size(); i++) {
10671        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10672      }
10673    };
10674    if (json.has("reasonReference")) {
10675      JsonArray array = json.getAsJsonArray("reasonReference");
10676      for (int i = 0; i < array.size(); i++) {
10677        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
10678      }
10679    };
10680    if (json.has("insurance")) {
10681      JsonArray array = json.getAsJsonArray("insurance");
10682      for (int i = 0; i < array.size(); i++) {
10683        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
10684      }
10685    };
10686    if (json.has("supportingInfo")) {
10687      JsonArray array = json.getAsJsonArray("supportingInfo");
10688      for (int i = 0; i < array.size(); i++) {
10689        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
10690      }
10691    };
10692    if (json.has("note")) {
10693      JsonArray array = json.getAsJsonArray("note");
10694      for (int i = 0; i < array.size(); i++) {
10695        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10696      }
10697    };
10698    if (json.has("relevantHistory")) {
10699      JsonArray array = json.getAsJsonArray("relevantHistory");
10700      for (int i = 0; i < array.size(); i++) {
10701        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
10702      }
10703    };
10704  }
10705
10706  protected DeviceRequest.DeviceRequestParameterComponent parseDeviceRequestDeviceRequestParameterComponent(JsonObject json, DeviceRequest owner) throws IOException, FHIRFormatError {
10707    DeviceRequest.DeviceRequestParameterComponent res = new DeviceRequest.DeviceRequestParameterComponent();
10708    parseDeviceRequestDeviceRequestParameterComponentProperties(json, owner, res);
10709    return res;
10710  }
10711
10712  protected void parseDeviceRequestDeviceRequestParameterComponentProperties(JsonObject json, DeviceRequest owner, DeviceRequest.DeviceRequestParameterComponent res) throws IOException, FHIRFormatError {
10713    parseBackboneElementProperties(json, res);
10714    if (json.has("code"))
10715      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
10716    Type value = parseType("value", json);
10717    if (value != null)
10718      res.setValue(value);
10719  }
10720
10721  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
10722    DeviceUseStatement res = new DeviceUseStatement();
10723    parseDeviceUseStatementProperties(json, res);
10724    return res;
10725  }
10726
10727  protected void parseDeviceUseStatementProperties(JsonObject json, DeviceUseStatement res) throws IOException, FHIRFormatError {
10728    parseDomainResourceProperties(json, res);
10729    if (json.has("identifier")) {
10730      JsonArray array = json.getAsJsonArray("identifier");
10731      for (int i = 0; i < array.size(); i++) {
10732        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10733      }
10734    };
10735    if (json.has("basedOn")) {
10736      JsonArray array = json.getAsJsonArray("basedOn");
10737      for (int i = 0; i < array.size(); i++) {
10738        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
10739      }
10740    };
10741    if (json.has("status"))
10742      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseStatement.DeviceUseStatementStatus.NULL, new DeviceUseStatement.DeviceUseStatementStatusEnumFactory()));
10743    if (json.has("_status"))
10744      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10745    if (json.has("subject"))
10746      res.setSubject(parseReference(json.getAsJsonObject("subject")));
10747    if (json.has("derivedFrom")) {
10748      JsonArray array = json.getAsJsonArray("derivedFrom");
10749      for (int i = 0; i < array.size(); i++) {
10750        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
10751      }
10752    };
10753    Type timing = parseType("timing", json);
10754    if (timing != null)
10755      res.setTiming(timing);
10756    if (json.has("recordedOn"))
10757      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
10758    if (json.has("_recordedOn"))
10759      parseElementProperties(json.getAsJsonObject("_recordedOn"), res.getRecordedOnElement());
10760    if (json.has("source"))
10761      res.setSource(parseReference(json.getAsJsonObject("source")));
10762    if (json.has("device"))
10763      res.setDevice(parseReference(json.getAsJsonObject("device")));
10764    if (json.has("reasonCode")) {
10765      JsonArray array = json.getAsJsonArray("reasonCode");
10766      for (int i = 0; i < array.size(); i++) {
10767        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10768      }
10769    };
10770    if (json.has("reasonReference")) {
10771      JsonArray array = json.getAsJsonArray("reasonReference");
10772      for (int i = 0; i < array.size(); i++) {
10773        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
10774      }
10775    };
10776    if (json.has("bodySite"))
10777      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
10778    if (json.has("note")) {
10779      JsonArray array = json.getAsJsonArray("note");
10780      for (int i = 0; i < array.size(); i++) {
10781        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10782      }
10783    };
10784  }
10785
10786  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
10787    DiagnosticReport res = new DiagnosticReport();
10788    parseDiagnosticReportProperties(json, res);
10789    return res;
10790  }
10791
10792  protected void parseDiagnosticReportProperties(JsonObject json, DiagnosticReport res) throws IOException, FHIRFormatError {
10793    parseDomainResourceProperties(json, res);
10794    if (json.has("identifier")) {
10795      JsonArray array = json.getAsJsonArray("identifier");
10796      for (int i = 0; i < array.size(); i++) {
10797        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10798      }
10799    };
10800    if (json.has("basedOn")) {
10801      JsonArray array = json.getAsJsonArray("basedOn");
10802      for (int i = 0; i < array.size(); i++) {
10803        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
10804      }
10805    };
10806    if (json.has("status"))
10807      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
10808    if (json.has("_status"))
10809      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10810    if (json.has("category")) {
10811      JsonArray array = json.getAsJsonArray("category");
10812      for (int i = 0; i < array.size(); i++) {
10813        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10814      }
10815    };
10816    if (json.has("code"))
10817      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
10818    if (json.has("subject"))
10819      res.setSubject(parseReference(json.getAsJsonObject("subject")));
10820    if (json.has("encounter"))
10821      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
10822    Type effective = parseType("effective", json);
10823    if (effective != null)
10824      res.setEffective(effective);
10825    if (json.has("issued"))
10826      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
10827    if (json.has("_issued"))
10828      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
10829    if (json.has("performer")) {
10830      JsonArray array = json.getAsJsonArray("performer");
10831      for (int i = 0; i < array.size(); i++) {
10832        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
10833      }
10834    };
10835    if (json.has("resultsInterpreter")) {
10836      JsonArray array = json.getAsJsonArray("resultsInterpreter");
10837      for (int i = 0; i < array.size(); i++) {
10838        res.getResultsInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
10839      }
10840    };
10841    if (json.has("specimen")) {
10842      JsonArray array = json.getAsJsonArray("specimen");
10843      for (int i = 0; i < array.size(); i++) {
10844        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
10845      }
10846    };
10847    if (json.has("result")) {
10848      JsonArray array = json.getAsJsonArray("result");
10849      for (int i = 0; i < array.size(); i++) {
10850        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
10851      }
10852    };
10853    if (json.has("imagingStudy")) {
10854      JsonArray array = json.getAsJsonArray("imagingStudy");
10855      for (int i = 0; i < array.size(); i++) {
10856        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
10857      }
10858    };
10859    if (json.has("media")) {
10860      JsonArray array = json.getAsJsonArray("media");
10861      for (int i = 0; i < array.size(); i++) {
10862        res.getMedia().add(parseDiagnosticReportDiagnosticReportMediaComponent(array.get(i).getAsJsonObject(), res));
10863      }
10864    };
10865    if (json.has("conclusion"))
10866      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
10867    if (json.has("_conclusion"))
10868      parseElementProperties(json.getAsJsonObject("_conclusion"), res.getConclusionElement());
10869    if (json.has("conclusionCode")) {
10870      JsonArray array = json.getAsJsonArray("conclusionCode");
10871      for (int i = 0; i < array.size(); i++) {
10872        res.getConclusionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10873      }
10874    };
10875    if (json.has("presentedForm")) {
10876      JsonArray array = json.getAsJsonArray("presentedForm");
10877      for (int i = 0; i < array.size(); i++) {
10878        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
10879      }
10880    };
10881  }
10882
10883  protected DiagnosticReport.DiagnosticReportMediaComponent parseDiagnosticReportDiagnosticReportMediaComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
10884    DiagnosticReport.DiagnosticReportMediaComponent res = new DiagnosticReport.DiagnosticReportMediaComponent();
10885    parseDiagnosticReportDiagnosticReportMediaComponentProperties(json, owner, res);
10886    return res;
10887  }
10888
10889  protected void parseDiagnosticReportDiagnosticReportMediaComponentProperties(JsonObject json, DiagnosticReport owner, DiagnosticReport.DiagnosticReportMediaComponent res) throws IOException, FHIRFormatError {
10890    parseBackboneElementProperties(json, res);
10891    if (json.has("comment"))
10892      res.setCommentElement(parseString(json.get("comment").getAsString()));
10893    if (json.has("_comment"))
10894      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
10895    if (json.has("link"))
10896      res.setLink(parseReference(json.getAsJsonObject("link")));
10897  }
10898
10899  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
10900    DocumentManifest res = new DocumentManifest();
10901    parseDocumentManifestProperties(json, res);
10902    return res;
10903  }
10904
10905  protected void parseDocumentManifestProperties(JsonObject json, DocumentManifest res) throws IOException, FHIRFormatError {
10906    parseDomainResourceProperties(json, res);
10907    if (json.has("masterIdentifier"))
10908      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
10909    if (json.has("identifier")) {
10910      JsonArray array = json.getAsJsonArray("identifier");
10911      for (int i = 0; i < array.size(); i++) {
10912        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10913      }
10914    };
10915    if (json.has("status"))
10916      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
10917    if (json.has("_status"))
10918      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10919    if (json.has("type"))
10920      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10921    if (json.has("subject"))
10922      res.setSubject(parseReference(json.getAsJsonObject("subject")));
10923    if (json.has("created"))
10924      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
10925    if (json.has("_created"))
10926      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
10927    if (json.has("author")) {
10928      JsonArray array = json.getAsJsonArray("author");
10929      for (int i = 0; i < array.size(); i++) {
10930        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
10931      }
10932    };
10933    if (json.has("recipient")) {
10934      JsonArray array = json.getAsJsonArray("recipient");
10935      for (int i = 0; i < array.size(); i++) {
10936        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
10937      }
10938    };
10939    if (json.has("source"))
10940      res.setSourceElement(parseUri(json.get("source").getAsString()));
10941    if (json.has("_source"))
10942      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
10943    if (json.has("description"))
10944      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10945    if (json.has("_description"))
10946      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10947    if (json.has("content")) {
10948      JsonArray array = json.getAsJsonArray("content");
10949      for (int i = 0; i < array.size(); i++) {
10950        res.getContent().add(parseReference(array.get(i).getAsJsonObject()));
10951      }
10952    };
10953    if (json.has("related")) {
10954      JsonArray array = json.getAsJsonArray("related");
10955      for (int i = 0; i < array.size(); i++) {
10956        res.getRelated().add(parseDocumentManifestDocumentManifestRelatedComponent(array.get(i).getAsJsonObject(), res));
10957      }
10958    };
10959  }
10960
10961  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
10962    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
10963    parseDocumentManifestDocumentManifestRelatedComponentProperties(json, owner, res);
10964    return res;
10965  }
10966
10967  protected void parseDocumentManifestDocumentManifestRelatedComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestRelatedComponent res) throws IOException, FHIRFormatError {
10968    parseBackboneElementProperties(json, res);
10969    if (json.has("identifier"))
10970      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10971    if (json.has("ref"))
10972      res.setRef(parseReference(json.getAsJsonObject("ref")));
10973  }
10974
10975  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
10976    DocumentReference res = new DocumentReference();
10977    parseDocumentReferenceProperties(json, res);
10978    return res;
10979  }
10980
10981  protected void parseDocumentReferenceProperties(JsonObject json, DocumentReference res) throws IOException, FHIRFormatError {
10982    parseDomainResourceProperties(json, res);
10983    if (json.has("masterIdentifier"))
10984      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
10985    if (json.has("identifier")) {
10986      JsonArray array = json.getAsJsonArray("identifier");
10987      for (int i = 0; i < array.size(); i++) {
10988        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10989      }
10990    };
10991    if (json.has("status"))
10992      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
10993    if (json.has("_status"))
10994      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10995    if (json.has("docStatus"))
10996      res.setDocStatusElement(parseEnumeration(json.get("docStatus").getAsString(), DocumentReference.ReferredDocumentStatus.NULL, new DocumentReference.ReferredDocumentStatusEnumFactory()));
10997    if (json.has("_docStatus"))
10998      parseElementProperties(json.getAsJsonObject("_docStatus"), res.getDocStatusElement());
10999    if (json.has("type"))
11000      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11001    if (json.has("category")) {
11002      JsonArray array = json.getAsJsonArray("category");
11003      for (int i = 0; i < array.size(); i++) {
11004        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11005      }
11006    };
11007    if (json.has("subject"))
11008      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11009    if (json.has("date"))
11010      res.setDateElement(parseInstant(json.get("date").getAsString()));
11011    if (json.has("_date"))
11012      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11013    if (json.has("author")) {
11014      JsonArray array = json.getAsJsonArray("author");
11015      for (int i = 0; i < array.size(); i++) {
11016        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
11017      }
11018    };
11019    if (json.has("authenticator"))
11020      res.setAuthenticator(parseReference(json.getAsJsonObject("authenticator")));
11021    if (json.has("custodian"))
11022      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
11023    if (json.has("relatesTo")) {
11024      JsonArray array = json.getAsJsonArray("relatesTo");
11025      for (int i = 0; i < array.size(); i++) {
11026        res.getRelatesTo().add(parseDocumentReferenceDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject(), res));
11027      }
11028    };
11029    if (json.has("description"))
11030      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11031    if (json.has("_description"))
11032      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11033    if (json.has("securityLabel")) {
11034      JsonArray array = json.getAsJsonArray("securityLabel");
11035      for (int i = 0; i < array.size(); i++) {
11036        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11037      }
11038    };
11039    if (json.has("content")) {
11040      JsonArray array = json.getAsJsonArray("content");
11041      for (int i = 0; i < array.size(); i++) {
11042        res.getContent().add(parseDocumentReferenceDocumentReferenceContentComponent(array.get(i).getAsJsonObject(), res));
11043      }
11044    };
11045    if (json.has("context"))
11046      res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(json.getAsJsonObject("context"), res));
11047  }
11048
11049  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
11050    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
11051    parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(json, owner, res);
11052    return res;
11053  }
11054
11055  protected void parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceRelatesToComponent res) throws IOException, FHIRFormatError {
11056    parseBackboneElementProperties(json, res);
11057    if (json.has("code"))
11058      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), DocumentReference.DocumentRelationshipType.NULL, new DocumentReference.DocumentRelationshipTypeEnumFactory()));
11059    if (json.has("_code"))
11060      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
11061    if (json.has("target"))
11062      res.setTarget(parseReference(json.getAsJsonObject("target")));
11063  }
11064
11065  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
11066    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
11067    parseDocumentReferenceDocumentReferenceContentComponentProperties(json, owner, res);
11068    return res;
11069  }
11070
11071  protected void parseDocumentReferenceDocumentReferenceContentComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContentComponent res) throws IOException, FHIRFormatError {
11072    parseBackboneElementProperties(json, res);
11073    if (json.has("attachment"))
11074      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
11075    if (json.has("format"))
11076      res.setFormat(parseCoding(json.getAsJsonObject("format")));
11077  }
11078
11079  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
11080    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
11081    parseDocumentReferenceDocumentReferenceContextComponentProperties(json, owner, res);
11082    return res;
11083  }
11084
11085  protected void parseDocumentReferenceDocumentReferenceContextComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextComponent res) throws IOException, FHIRFormatError {
11086    parseBackboneElementProperties(json, res);
11087    if (json.has("encounter")) {
11088      JsonArray array = json.getAsJsonArray("encounter");
11089      for (int i = 0; i < array.size(); i++) {
11090        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
11091      }
11092    };
11093    if (json.has("event")) {
11094      JsonArray array = json.getAsJsonArray("event");
11095      for (int i = 0; i < array.size(); i++) {
11096        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11097      }
11098    };
11099    if (json.has("period"))
11100      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11101    if (json.has("facilityType"))
11102      res.setFacilityType(parseCodeableConcept(json.getAsJsonObject("facilityType")));
11103    if (json.has("practiceSetting"))
11104      res.setPracticeSetting(parseCodeableConcept(json.getAsJsonObject("practiceSetting")));
11105    if (json.has("sourcePatientInfo"))
11106      res.setSourcePatientInfo(parseReference(json.getAsJsonObject("sourcePatientInfo")));
11107    if (json.has("related")) {
11108      JsonArray array = json.getAsJsonArray("related");
11109      for (int i = 0; i < array.size(); i++) {
11110        res.getRelated().add(parseReference(array.get(i).getAsJsonObject()));
11111      }
11112    };
11113    if (json.has("basedOn")) {
11114      JsonArray array = json.getAsJsonArray("basedOn");
11115      for (int i = 0; i < array.size(); i++) {
11116        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
11117      }
11118    };
11119  }
11120
11121  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
11122    Encounter res = new Encounter();
11123    parseEncounterProperties(json, res);
11124    return res;
11125  }
11126
11127  protected void parseEncounterProperties(JsonObject json, Encounter res) throws IOException, FHIRFormatError {
11128    parseDomainResourceProperties(json, res);
11129    if (json.has("identifier")) {
11130      JsonArray array = json.getAsJsonArray("identifier");
11131      for (int i = 0; i < array.size(); i++) {
11132        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11133      }
11134    };
11135    if (json.has("status"))
11136      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
11137    if (json.has("_status"))
11138      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11139    if (json.has("statusHistory")) {
11140      JsonArray array = json.getAsJsonArray("statusHistory");
11141      for (int i = 0; i < array.size(); i++) {
11142        res.getStatusHistory().add(parseEncounterStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
11143      }
11144    };
11145    if (json.has("class"))
11146      res.setClass_(parseCoding(json.getAsJsonObject("class")));
11147    if (json.has("classHistory")) {
11148      JsonArray array = json.getAsJsonArray("classHistory");
11149      for (int i = 0; i < array.size(); i++) {
11150        res.getClassHistory().add(parseEncounterClassHistoryComponent(array.get(i).getAsJsonObject(), res));
11151      }
11152    };
11153    if (json.has("type")) {
11154      JsonArray array = json.getAsJsonArray("type");
11155      for (int i = 0; i < array.size(); i++) {
11156        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11157      }
11158    };
11159    if (json.has("serviceType"))
11160      res.setServiceType(parseCodeableConcept(json.getAsJsonObject("serviceType")));
11161    if (json.has("priority"))
11162      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
11163    if (json.has("subject"))
11164      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11165    if (json.has("subjectStatus"))
11166      res.setSubjectStatus(parseCodeableConcept(json.getAsJsonObject("subjectStatus")));
11167    if (json.has("episodeOfCare")) {
11168      JsonArray array = json.getAsJsonArray("episodeOfCare");
11169      for (int i = 0; i < array.size(); i++) {
11170        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
11171      }
11172    };
11173    if (json.has("basedOn")) {
11174      JsonArray array = json.getAsJsonArray("basedOn");
11175      for (int i = 0; i < array.size(); i++) {
11176        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
11177      }
11178    };
11179    if (json.has("participant")) {
11180      JsonArray array = json.getAsJsonArray("participant");
11181      for (int i = 0; i < array.size(); i++) {
11182        res.getParticipant().add(parseEncounterEncounterParticipantComponent(array.get(i).getAsJsonObject(), res));
11183      }
11184    };
11185    if (json.has("appointment")) {
11186      JsonArray array = json.getAsJsonArray("appointment");
11187      for (int i = 0; i < array.size(); i++) {
11188        res.getAppointment().add(parseReference(array.get(i).getAsJsonObject()));
11189      }
11190    };
11191    if (json.has("period"))
11192      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11193    if (json.has("length"))
11194      res.setLength(parseDuration(json.getAsJsonObject("length")));
11195    if (json.has("reasonCode")) {
11196      JsonArray array = json.getAsJsonArray("reasonCode");
11197      for (int i = 0; i < array.size(); i++) {
11198        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11199      }
11200    };
11201    if (json.has("reasonReference")) {
11202      JsonArray array = json.getAsJsonArray("reasonReference");
11203      for (int i = 0; i < array.size(); i++) {
11204        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
11205      }
11206    };
11207    if (json.has("diagnosis")) {
11208      JsonArray array = json.getAsJsonArray("diagnosis");
11209      for (int i = 0; i < array.size(); i++) {
11210        res.getDiagnosis().add(parseEncounterDiagnosisComponent(array.get(i).getAsJsonObject(), res));
11211      }
11212    };
11213    if (json.has("account")) {
11214      JsonArray array = json.getAsJsonArray("account");
11215      for (int i = 0; i < array.size(); i++) {
11216        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
11217      }
11218    };
11219    if (json.has("hospitalization"))
11220      res.setHospitalization(parseEncounterEncounterHospitalizationComponent(json.getAsJsonObject("hospitalization"), res));
11221    if (json.has("location")) {
11222      JsonArray array = json.getAsJsonArray("location");
11223      for (int i = 0; i < array.size(); i++) {
11224        res.getLocation().add(parseEncounterEncounterLocationComponent(array.get(i).getAsJsonObject(), res));
11225      }
11226    };
11227    if (json.has("serviceProvider"))
11228      res.setServiceProvider(parseReference(json.getAsJsonObject("serviceProvider")));
11229    if (json.has("partOf"))
11230      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
11231  }
11232
11233  protected Encounter.StatusHistoryComponent parseEncounterStatusHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
11234    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
11235    parseEncounterStatusHistoryComponentProperties(json, owner, res);
11236    return res;
11237  }
11238
11239  protected void parseEncounterStatusHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.StatusHistoryComponent res) throws IOException, FHIRFormatError {
11240    parseBackboneElementProperties(json, res);
11241    if (json.has("status"))
11242      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
11243    if (json.has("_status"))
11244      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11245    if (json.has("period"))
11246      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11247  }
11248
11249  protected Encounter.ClassHistoryComponent parseEncounterClassHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
11250    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
11251    parseEncounterClassHistoryComponentProperties(json, owner, res);
11252    return res;
11253  }
11254
11255  protected void parseEncounterClassHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.ClassHistoryComponent res) throws IOException, FHIRFormatError {
11256    parseBackboneElementProperties(json, res);
11257    if (json.has("class"))
11258      res.setClass_(parseCoding(json.getAsJsonObject("class")));
11259    if (json.has("period"))
11260      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11261  }
11262
11263  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
11264    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
11265    parseEncounterEncounterParticipantComponentProperties(json, owner, res);
11266    return res;
11267  }
11268
11269  protected void parseEncounterEncounterParticipantComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterParticipantComponent res) throws IOException, FHIRFormatError {
11270    parseBackboneElementProperties(json, res);
11271    if (json.has("type")) {
11272      JsonArray array = json.getAsJsonArray("type");
11273      for (int i = 0; i < array.size(); i++) {
11274        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11275      }
11276    };
11277    if (json.has("period"))
11278      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11279    if (json.has("individual"))
11280      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
11281  }
11282
11283  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
11284    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
11285    parseEncounterDiagnosisComponentProperties(json, owner, res);
11286    return res;
11287  }
11288
11289  protected void parseEncounterDiagnosisComponentProperties(JsonObject json, Encounter owner, Encounter.DiagnosisComponent res) throws IOException, FHIRFormatError {
11290    parseBackboneElementProperties(json, res);
11291    if (json.has("condition"))
11292      res.setCondition(parseReference(json.getAsJsonObject("condition")));
11293    if (json.has("use"))
11294      res.setUse(parseCodeableConcept(json.getAsJsonObject("use")));
11295    if (json.has("rank"))
11296      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
11297    if (json.has("_rank"))
11298      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
11299  }
11300
11301  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
11302    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
11303    parseEncounterEncounterHospitalizationComponentProperties(json, owner, res);
11304    return res;
11305  }
11306
11307  protected void parseEncounterEncounterHospitalizationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterHospitalizationComponent res) throws IOException, FHIRFormatError {
11308    parseBackboneElementProperties(json, res);
11309    if (json.has("preAdmissionIdentifier"))
11310      res.setPreAdmissionIdentifier(parseIdentifier(json.getAsJsonObject("preAdmissionIdentifier")));
11311    if (json.has("origin"))
11312      res.setOrigin(parseReference(json.getAsJsonObject("origin")));
11313    if (json.has("admitSource"))
11314      res.setAdmitSource(parseCodeableConcept(json.getAsJsonObject("admitSource")));
11315    if (json.has("reAdmission"))
11316      res.setReAdmission(parseCodeableConcept(json.getAsJsonObject("reAdmission")));
11317    if (json.has("dietPreference")) {
11318      JsonArray array = json.getAsJsonArray("dietPreference");
11319      for (int i = 0; i < array.size(); i++) {
11320        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11321      }
11322    };
11323    if (json.has("specialCourtesy")) {
11324      JsonArray array = json.getAsJsonArray("specialCourtesy");
11325      for (int i = 0; i < array.size(); i++) {
11326        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11327      }
11328    };
11329    if (json.has("specialArrangement")) {
11330      JsonArray array = json.getAsJsonArray("specialArrangement");
11331      for (int i = 0; i < array.size(); i++) {
11332        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11333      }
11334    };
11335    if (json.has("destination"))
11336      res.setDestination(parseReference(json.getAsJsonObject("destination")));
11337    if (json.has("dischargeDisposition"))
11338      res.setDischargeDisposition(parseCodeableConcept(json.getAsJsonObject("dischargeDisposition")));
11339  }
11340
11341  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
11342    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
11343    parseEncounterEncounterLocationComponentProperties(json, owner, res);
11344    return res;
11345  }
11346
11347  protected void parseEncounterEncounterLocationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterLocationComponent res) throws IOException, FHIRFormatError {
11348    parseBackboneElementProperties(json, res);
11349    if (json.has("location"))
11350      res.setLocation(parseReference(json.getAsJsonObject("location")));
11351    if (json.has("status"))
11352      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
11353    if (json.has("_status"))
11354      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11355    if (json.has("physicalType"))
11356      res.setPhysicalType(parseCodeableConcept(json.getAsJsonObject("physicalType")));
11357    if (json.has("period"))
11358      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11359  }
11360
11361  protected Endpoint parseEndpoint(JsonObject json) throws IOException, FHIRFormatError {
11362    Endpoint res = new Endpoint();
11363    parseEndpointProperties(json, res);
11364    return res;
11365  }
11366
11367  protected void parseEndpointProperties(JsonObject json, Endpoint res) throws IOException, FHIRFormatError {
11368    parseDomainResourceProperties(json, res);
11369    if (json.has("identifier")) {
11370      JsonArray array = json.getAsJsonArray("identifier");
11371      for (int i = 0; i < array.size(); i++) {
11372        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11373      }
11374    };
11375    if (json.has("status"))
11376      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Endpoint.EndpointStatus.NULL, new Endpoint.EndpointStatusEnumFactory()));
11377    if (json.has("_status"))
11378      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11379    if (json.has("connectionType"))
11380      res.setConnectionType(parseCoding(json.getAsJsonObject("connectionType")));
11381    if (json.has("name"))
11382      res.setNameElement(parseString(json.get("name").getAsString()));
11383    if (json.has("_name"))
11384      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11385    if (json.has("managingOrganization"))
11386      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
11387    if (json.has("contact")) {
11388      JsonArray array = json.getAsJsonArray("contact");
11389      for (int i = 0; i < array.size(); i++) {
11390        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
11391      }
11392    };
11393    if (json.has("period"))
11394      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11395    if (json.has("payloadType")) {
11396      JsonArray array = json.getAsJsonArray("payloadType");
11397      for (int i = 0; i < array.size(); i++) {
11398        res.getPayloadType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11399      }
11400    };
11401    if (json.has("payloadMimeType")) {
11402      JsonArray array = json.getAsJsonArray("payloadMimeType");
11403      for (int i = 0; i < array.size(); i++) {
11404        res.getPayloadMimeType().add(parseCode(array.get(i).getAsString()));
11405      }
11406    };
11407    if (json.has("_payloadMimeType")) {
11408      JsonArray array = json.getAsJsonArray("_payloadMimeType");
11409      for (int i = 0; i < array.size(); i++) {
11410        if (i == res.getPayloadMimeType().size())
11411          res.getPayloadMimeType().add(parseCode(null));
11412        if (array.get(i) instanceof JsonObject) 
11413          parseElementProperties(array.get(i).getAsJsonObject(), res.getPayloadMimeType().get(i));
11414      }
11415    };
11416    if (json.has("address"))
11417      res.setAddressElement(parseUrl(json.get("address").getAsString()));
11418    if (json.has("_address"))
11419      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
11420    if (json.has("header")) {
11421      JsonArray array = json.getAsJsonArray("header");
11422      for (int i = 0; i < array.size(); i++) {
11423        res.getHeader().add(parseString(array.get(i).getAsString()));
11424      }
11425    };
11426    if (json.has("_header")) {
11427      JsonArray array = json.getAsJsonArray("_header");
11428      for (int i = 0; i < array.size(); i++) {
11429        if (i == res.getHeader().size())
11430          res.getHeader().add(parseString(null));
11431        if (array.get(i) instanceof JsonObject) 
11432          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
11433      }
11434    };
11435  }
11436
11437  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
11438    EnrollmentRequest res = new EnrollmentRequest();
11439    parseEnrollmentRequestProperties(json, res);
11440    return res;
11441  }
11442
11443  protected void parseEnrollmentRequestProperties(JsonObject json, EnrollmentRequest res) throws IOException, FHIRFormatError {
11444    parseDomainResourceProperties(json, res);
11445    if (json.has("identifier")) {
11446      JsonArray array = json.getAsJsonArray("identifier");
11447      for (int i = 0; i < array.size(); i++) {
11448        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11449      }
11450    };
11451    if (json.has("status"))
11452      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentRequest.EnrollmentRequestStatus.NULL, new EnrollmentRequest.EnrollmentRequestStatusEnumFactory()));
11453    if (json.has("_status"))
11454      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11455    if (json.has("created"))
11456      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11457    if (json.has("_created"))
11458      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
11459    if (json.has("insurer"))
11460      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
11461    if (json.has("provider"))
11462      res.setProvider(parseReference(json.getAsJsonObject("provider")));
11463    if (json.has("candidate"))
11464      res.setCandidate(parseReference(json.getAsJsonObject("candidate")));
11465    if (json.has("coverage"))
11466      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
11467  }
11468
11469  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
11470    EnrollmentResponse res = new EnrollmentResponse();
11471    parseEnrollmentResponseProperties(json, res);
11472    return res;
11473  }
11474
11475  protected void parseEnrollmentResponseProperties(JsonObject json, EnrollmentResponse res) throws IOException, FHIRFormatError {
11476    parseDomainResourceProperties(json, res);
11477    if (json.has("identifier")) {
11478      JsonArray array = json.getAsJsonArray("identifier");
11479      for (int i = 0; i < array.size(); i++) {
11480        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11481      }
11482    };
11483    if (json.has("status"))
11484      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentResponse.EnrollmentResponseStatus.NULL, new EnrollmentResponse.EnrollmentResponseStatusEnumFactory()));
11485    if (json.has("_status"))
11486      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11487    if (json.has("request"))
11488      res.setRequest(parseReference(json.getAsJsonObject("request")));
11489    if (json.has("outcome"))
11490      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
11491    if (json.has("_outcome"))
11492      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
11493    if (json.has("disposition"))
11494      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
11495    if (json.has("_disposition"))
11496      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
11497    if (json.has("created"))
11498      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11499    if (json.has("_created"))
11500      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
11501    if (json.has("organization"))
11502      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
11503    if (json.has("requestProvider"))
11504      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
11505  }
11506
11507  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
11508    EpisodeOfCare res = new EpisodeOfCare();
11509    parseEpisodeOfCareProperties(json, res);
11510    return res;
11511  }
11512
11513  protected void parseEpisodeOfCareProperties(JsonObject json, EpisodeOfCare res) throws IOException, FHIRFormatError {
11514    parseDomainResourceProperties(json, res);
11515    if (json.has("identifier")) {
11516      JsonArray array = json.getAsJsonArray("identifier");
11517      for (int i = 0; i < array.size(); i++) {
11518        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11519      }
11520    };
11521    if (json.has("status"))
11522      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
11523    if (json.has("_status"))
11524      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11525    if (json.has("statusHistory")) {
11526      JsonArray array = json.getAsJsonArray("statusHistory");
11527      for (int i = 0; i < array.size(); i++) {
11528        res.getStatusHistory().add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
11529      }
11530    };
11531    if (json.has("type")) {
11532      JsonArray array = json.getAsJsonArray("type");
11533      for (int i = 0; i < array.size(); i++) {
11534        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11535      }
11536    };
11537    if (json.has("diagnosis")) {
11538      JsonArray array = json.getAsJsonArray("diagnosis");
11539      for (int i = 0; i < array.size(); i++) {
11540        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(array.get(i).getAsJsonObject(), res));
11541      }
11542    };
11543    if (json.has("patient"))
11544      res.setPatient(parseReference(json.getAsJsonObject("patient")));
11545    if (json.has("managingOrganization"))
11546      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
11547    if (json.has("period"))
11548      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11549    if (json.has("referralRequest")) {
11550      JsonArray array = json.getAsJsonArray("referralRequest");
11551      for (int i = 0; i < array.size(); i++) {
11552        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
11553      }
11554    };
11555    if (json.has("careManager"))
11556      res.setCareManager(parseReference(json.getAsJsonObject("careManager")));
11557    if (json.has("team")) {
11558      JsonArray array = json.getAsJsonArray("team");
11559      for (int i = 0; i < array.size(); i++) {
11560        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
11561      }
11562    };
11563    if (json.has("account")) {
11564      JsonArray array = json.getAsJsonArray("account");
11565      for (int i = 0; i < array.size(); i++) {
11566        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
11567      }
11568    };
11569  }
11570
11571  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
11572    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
11573    parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(json, owner, res);
11574    return res;
11575  }
11576
11577  protected void parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws IOException, FHIRFormatError {
11578    parseBackboneElementProperties(json, res);
11579    if (json.has("status"))
11580      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
11581    if (json.has("_status"))
11582      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11583    if (json.has("period"))
11584      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11585  }
11586
11587  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
11588    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
11589    parseEpisodeOfCareDiagnosisComponentProperties(json, owner, res);
11590    return res;
11591  }
11592
11593  protected void parseEpisodeOfCareDiagnosisComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.DiagnosisComponent res) throws IOException, FHIRFormatError {
11594    parseBackboneElementProperties(json, res);
11595    if (json.has("condition"))
11596      res.setCondition(parseReference(json.getAsJsonObject("condition")));
11597    if (json.has("role"))
11598      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
11599    if (json.has("rank"))
11600      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
11601    if (json.has("_rank"))
11602      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
11603  }
11604
11605  protected EventDefinition parseEventDefinition(JsonObject json) throws IOException, FHIRFormatError {
11606    EventDefinition res = new EventDefinition();
11607    parseEventDefinitionProperties(json, res);
11608    return res;
11609  }
11610
11611  protected void parseEventDefinitionProperties(JsonObject json, EventDefinition res) throws IOException, FHIRFormatError {
11612    parseDomainResourceProperties(json, res);
11613    if (json.has("url"))
11614      res.setUrlElement(parseUri(json.get("url").getAsString()));
11615    if (json.has("_url"))
11616      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
11617    if (json.has("identifier")) {
11618      JsonArray array = json.getAsJsonArray("identifier");
11619      for (int i = 0; i < array.size(); i++) {
11620        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11621      }
11622    };
11623    if (json.has("version"))
11624      res.setVersionElement(parseString(json.get("version").getAsString()));
11625    if (json.has("_version"))
11626      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
11627    if (json.has("name"))
11628      res.setNameElement(parseString(json.get("name").getAsString()));
11629    if (json.has("_name"))
11630      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11631    if (json.has("title"))
11632      res.setTitleElement(parseString(json.get("title").getAsString()));
11633    if (json.has("_title"))
11634      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11635    if (json.has("subtitle"))
11636      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
11637    if (json.has("_subtitle"))
11638      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
11639    if (json.has("status"))
11640      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11641    if (json.has("_status"))
11642      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11643    if (json.has("experimental"))
11644      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11645    if (json.has("_experimental"))
11646      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
11647    Type subject = parseType("subject", json);
11648    if (subject != null)
11649      res.setSubject(subject);
11650    if (json.has("date"))
11651      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11652    if (json.has("_date"))
11653      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11654    if (json.has("publisher"))
11655      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11656    if (json.has("_publisher"))
11657      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
11658    if (json.has("contact")) {
11659      JsonArray array = json.getAsJsonArray("contact");
11660      for (int i = 0; i < array.size(); i++) {
11661        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11662      }
11663    };
11664    if (json.has("description"))
11665      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11666    if (json.has("_description"))
11667      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11668    if (json.has("useContext")) {
11669      JsonArray array = json.getAsJsonArray("useContext");
11670      for (int i = 0; i < array.size(); i++) {
11671        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11672      }
11673    };
11674    if (json.has("jurisdiction")) {
11675      JsonArray array = json.getAsJsonArray("jurisdiction");
11676      for (int i = 0; i < array.size(); i++) {
11677        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11678      }
11679    };
11680    if (json.has("purpose"))
11681      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
11682    if (json.has("_purpose"))
11683      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
11684    if (json.has("usage"))
11685      res.setUsageElement(parseString(json.get("usage").getAsString()));
11686    if (json.has("_usage"))
11687      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
11688    if (json.has("copyright"))
11689      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11690    if (json.has("_copyright"))
11691      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
11692    if (json.has("approvalDate"))
11693      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11694    if (json.has("_approvalDate"))
11695      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
11696    if (json.has("lastReviewDate"))
11697      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11698    if (json.has("_lastReviewDate"))
11699      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
11700    if (json.has("effectivePeriod"))
11701      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
11702    if (json.has("topic")) {
11703      JsonArray array = json.getAsJsonArray("topic");
11704      for (int i = 0; i < array.size(); i++) {
11705        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11706      }
11707    };
11708    if (json.has("author")) {
11709      JsonArray array = json.getAsJsonArray("author");
11710      for (int i = 0; i < array.size(); i++) {
11711        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11712      }
11713    };
11714    if (json.has("editor")) {
11715      JsonArray array = json.getAsJsonArray("editor");
11716      for (int i = 0; i < array.size(); i++) {
11717        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11718      }
11719    };
11720    if (json.has("reviewer")) {
11721      JsonArray array = json.getAsJsonArray("reviewer");
11722      for (int i = 0; i < array.size(); i++) {
11723        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
11724      }
11725    };
11726    if (json.has("endorser")) {
11727      JsonArray array = json.getAsJsonArray("endorser");
11728      for (int i = 0; i < array.size(); i++) {
11729        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
11730      }
11731    };
11732    if (json.has("relatedArtifact")) {
11733      JsonArray array = json.getAsJsonArray("relatedArtifact");
11734      for (int i = 0; i < array.size(); i++) {
11735        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11736      }
11737    };
11738    if (json.has("trigger")) {
11739      JsonArray array = json.getAsJsonArray("trigger");
11740      for (int i = 0; i < array.size(); i++) {
11741        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
11742      }
11743    };
11744  }
11745
11746  protected Evidence parseEvidence(JsonObject json) throws IOException, FHIRFormatError {
11747    Evidence res = new Evidence();
11748    parseEvidenceProperties(json, res);
11749    return res;
11750  }
11751
11752  protected void parseEvidenceProperties(JsonObject json, Evidence res) throws IOException, FHIRFormatError {
11753    parseDomainResourceProperties(json, res);
11754    if (json.has("url"))
11755      res.setUrlElement(parseUri(json.get("url").getAsString()));
11756    if (json.has("_url"))
11757      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
11758    if (json.has("identifier")) {
11759      JsonArray array = json.getAsJsonArray("identifier");
11760      for (int i = 0; i < array.size(); i++) {
11761        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11762      }
11763    };
11764    if (json.has("version"))
11765      res.setVersionElement(parseString(json.get("version").getAsString()));
11766    if (json.has("_version"))
11767      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
11768    if (json.has("title"))
11769      res.setTitleElement(parseString(json.get("title").getAsString()));
11770    if (json.has("_title"))
11771      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11772    if (json.has("status"))
11773      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11774    if (json.has("_status"))
11775      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11776    if (json.has("useContext")) {
11777      JsonArray array = json.getAsJsonArray("useContext");
11778      for (int i = 0; i < array.size(); i++) {
11779        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11780      }
11781    };
11782    if (json.has("date"))
11783      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11784    if (json.has("_date"))
11785      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11786    if (json.has("approvalDate"))
11787      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11788    if (json.has("_approvalDate"))
11789      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
11790    if (json.has("lastReviewDate"))
11791      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11792    if (json.has("_lastReviewDate"))
11793      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
11794    if (json.has("contributor")) {
11795      JsonArray array = json.getAsJsonArray("contributor");
11796      for (int i = 0; i < array.size(); i++) {
11797        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
11798      }
11799    };
11800    if (json.has("relatedArtifact")) {
11801      JsonArray array = json.getAsJsonArray("relatedArtifact");
11802      for (int i = 0; i < array.size(); i++) {
11803        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11804      }
11805    };
11806    if (json.has("description"))
11807      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11808    if (json.has("_description"))
11809      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11810    if (json.has("assertion"))
11811      res.setAssertionElement(parseMarkdown(json.get("assertion").getAsString()));
11812    if (json.has("_assertion"))
11813      parseElementProperties(json.getAsJsonObject("_assertion"), res.getAssertionElement());
11814    if (json.has("note")) {
11815      JsonArray array = json.getAsJsonArray("note");
11816      for (int i = 0; i < array.size(); i++) {
11817        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11818      }
11819    };
11820    if (json.has("referentGroup"))
11821      res.setReferentGroup(parseEvidenceEvidenceReferentGroupComponent(json.getAsJsonObject("referentGroup"), res));
11822    if (json.has("variableDefinition")) {
11823      JsonArray array = json.getAsJsonArray("variableDefinition");
11824      for (int i = 0; i < array.size(); i++) {
11825        res.getVariableDefinition().add(parseEvidenceEvidenceVariableDefinitionComponent(array.get(i).getAsJsonObject(), res));
11826      }
11827    };
11828    if (json.has("synthesisType"))
11829      res.setSynthesisType(parseCodeableConcept(json.getAsJsonObject("synthesisType")));
11830    if (json.has("studyType"))
11831      res.setStudyType(parseCodeableConcept(json.getAsJsonObject("studyType")));
11832    if (json.has("statistic")) {
11833      JsonArray array = json.getAsJsonArray("statistic");
11834      for (int i = 0; i < array.size(); i++) {
11835        res.getStatistic().add(parseStatistic(array.get(i).getAsJsonObject()));
11836      }
11837    };
11838    if (json.has("distribution")) {
11839      JsonArray array = json.getAsJsonArray("distribution");
11840      for (int i = 0; i < array.size(); i++) {
11841        res.getDistribution().add(parseOrderedDistribution(array.get(i).getAsJsonObject()));
11842      }
11843    };
11844    if (json.has("certainty")) {
11845      JsonArray array = json.getAsJsonArray("certainty");
11846      for (int i = 0; i < array.size(); i++) {
11847        res.getCertainty().add(parseEvidenceEvidenceCertaintyComponent(array.get(i).getAsJsonObject(), res));
11848      }
11849    };
11850  }
11851
11852  protected Evidence.EvidenceReferentGroupComponent parseEvidenceEvidenceReferentGroupComponent(JsonObject json, Evidence owner) throws IOException, FHIRFormatError {
11853    Evidence.EvidenceReferentGroupComponent res = new Evidence.EvidenceReferentGroupComponent();
11854    parseEvidenceEvidenceReferentGroupComponentProperties(json, owner, res);
11855    return res;
11856  }
11857
11858  protected void parseEvidenceEvidenceReferentGroupComponentProperties(JsonObject json, Evidence owner, Evidence.EvidenceReferentGroupComponent res) throws IOException, FHIRFormatError {
11859    parseBackboneElementProperties(json, res);
11860    if (json.has("description"))
11861      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11862    if (json.has("_description"))
11863      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11864    if (json.has("note")) {
11865      JsonArray array = json.getAsJsonArray("note");
11866      for (int i = 0; i < array.size(); i++) {
11867        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11868      }
11869    };
11870    if (json.has("evidenceSource"))
11871      res.setEvidenceSource(parseReference(json.getAsJsonObject("evidenceSource")));
11872    if (json.has("intendedGroup"))
11873      res.setIntendedGroup(parseReference(json.getAsJsonObject("intendedGroup")));
11874    if (json.has("directnessMatch"))
11875      res.setDirectnessMatch(parseCodeableConcept(json.getAsJsonObject("directnessMatch")));
11876  }
11877
11878  protected Evidence.EvidenceVariableDefinitionComponent parseEvidenceEvidenceVariableDefinitionComponent(JsonObject json, Evidence owner) throws IOException, FHIRFormatError {
11879    Evidence.EvidenceVariableDefinitionComponent res = new Evidence.EvidenceVariableDefinitionComponent();
11880    parseEvidenceEvidenceVariableDefinitionComponentProperties(json, owner, res);
11881    return res;
11882  }
11883
11884  protected void parseEvidenceEvidenceVariableDefinitionComponentProperties(JsonObject json, Evidence owner, Evidence.EvidenceVariableDefinitionComponent res) throws IOException, FHIRFormatError {
11885    parseBackboneElementProperties(json, res);
11886    if (json.has("description"))
11887      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11888    if (json.has("_description"))
11889      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11890    if (json.has("note")) {
11891      JsonArray array = json.getAsJsonArray("note");
11892      for (int i = 0; i < array.size(); i++) {
11893        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11894      }
11895    };
11896    if (json.has("variableRole"))
11897      res.setVariableRole(parseCodeableConcept(json.getAsJsonObject("variableRole")));
11898    if (json.has("actualDefinition"))
11899      res.setActualDefinition(parseReference(json.getAsJsonObject("actualDefinition")));
11900    if (json.has("intendedDefinition"))
11901      res.setIntendedDefinition(parseReference(json.getAsJsonObject("intendedDefinition")));
11902    if (json.has("directnessMatch"))
11903      res.setDirectnessMatch(parseCodeableConcept(json.getAsJsonObject("directnessMatch")));
11904  }
11905
11906  protected Evidence.EvidenceCertaintyComponent parseEvidenceEvidenceCertaintyComponent(JsonObject json, Evidence owner) throws IOException, FHIRFormatError {
11907    Evidence.EvidenceCertaintyComponent res = new Evidence.EvidenceCertaintyComponent();
11908    parseEvidenceEvidenceCertaintyComponentProperties(json, owner, res);
11909    return res;
11910  }
11911
11912  protected void parseEvidenceEvidenceCertaintyComponentProperties(JsonObject json, Evidence owner, Evidence.EvidenceCertaintyComponent res) throws IOException, FHIRFormatError {
11913    parseBackboneElementProperties(json, res);
11914    if (json.has("description"))
11915      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11916    if (json.has("_description"))
11917      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11918    if (json.has("note"))
11919      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
11920    if (json.has("rating")) {
11921      JsonArray array = json.getAsJsonArray("rating");
11922      for (int i = 0; i < array.size(); i++) {
11923        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11924      }
11925    };
11926    if (json.has("certaintySubcomponent")) {
11927      JsonArray array = json.getAsJsonArray("certaintySubcomponent");
11928      for (int i = 0; i < array.size(); i++) {
11929        res.getCertaintySubcomponent().add(parseEvidenceEvidenceCertaintyCertaintySubcomponentComponent(array.get(i).getAsJsonObject(), owner));
11930      }
11931    };
11932  }
11933
11934  protected Evidence.EvidenceCertaintyCertaintySubcomponentComponent parseEvidenceEvidenceCertaintyCertaintySubcomponentComponent(JsonObject json, Evidence owner) throws IOException, FHIRFormatError {
11935    Evidence.EvidenceCertaintyCertaintySubcomponentComponent res = new Evidence.EvidenceCertaintyCertaintySubcomponentComponent();
11936    parseEvidenceEvidenceCertaintyCertaintySubcomponentComponentProperties(json, owner, res);
11937    return res;
11938  }
11939
11940  protected void parseEvidenceEvidenceCertaintyCertaintySubcomponentComponentProperties(JsonObject json, Evidence owner, Evidence.EvidenceCertaintyCertaintySubcomponentComponent res) throws IOException, FHIRFormatError {
11941    parseBackboneElementProperties(json, res);
11942    if (json.has("description"))
11943      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11944    if (json.has("_description"))
11945      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11946    if (json.has("note"))
11947      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
11948    if (json.has("type")) {
11949      JsonArray array = json.getAsJsonArray("type");
11950      for (int i = 0; i < array.size(); i++) {
11951        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11952      }
11953    };
11954    if (json.has("rating")) {
11955      JsonArray array = json.getAsJsonArray("rating");
11956      for (int i = 0; i < array.size(); i++) {
11957        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11958      }
11959    };
11960  }
11961
11962  protected EvidenceVariable parseEvidenceVariable(JsonObject json) throws IOException, FHIRFormatError {
11963    EvidenceVariable res = new EvidenceVariable();
11964    parseEvidenceVariableProperties(json, res);
11965    return res;
11966  }
11967
11968  protected void parseEvidenceVariableProperties(JsonObject json, EvidenceVariable res) throws IOException, FHIRFormatError {
11969    parseDomainResourceProperties(json, res);
11970    if (json.has("url"))
11971      res.setUrlElement(parseUri(json.get("url").getAsString()));
11972    if (json.has("_url"))
11973      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
11974    if (json.has("identifier")) {
11975      JsonArray array = json.getAsJsonArray("identifier");
11976      for (int i = 0; i < array.size(); i++) {
11977        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11978      }
11979    };
11980    if (json.has("version"))
11981      res.setVersionElement(parseString(json.get("version").getAsString()));
11982    if (json.has("_version"))
11983      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
11984    if (json.has("name"))
11985      res.setNameElement(parseString(json.get("name").getAsString()));
11986    if (json.has("_name"))
11987      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11988    if (json.has("title"))
11989      res.setTitleElement(parseString(json.get("title").getAsString()));
11990    if (json.has("_title"))
11991      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11992    if (json.has("shortTitle"))
11993      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
11994    if (json.has("_shortTitle"))
11995      parseElementProperties(json.getAsJsonObject("_shortTitle"), res.getShortTitleElement());
11996    if (json.has("subtitle"))
11997      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
11998    if (json.has("_subtitle"))
11999      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
12000    if (json.has("status"))
12001      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12002    if (json.has("_status"))
12003      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12004    if (json.has("date"))
12005      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12006    if (json.has("_date"))
12007      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12008    if (json.has("publisher"))
12009      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12010    if (json.has("_publisher"))
12011      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
12012    if (json.has("contact")) {
12013      JsonArray array = json.getAsJsonArray("contact");
12014      for (int i = 0; i < array.size(); i++) {
12015        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12016      }
12017    };
12018    if (json.has("description"))
12019      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12020    if (json.has("_description"))
12021      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12022    if (json.has("note")) {
12023      JsonArray array = json.getAsJsonArray("note");
12024      for (int i = 0; i < array.size(); i++) {
12025        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12026      }
12027    };
12028    if (json.has("useContext")) {
12029      JsonArray array = json.getAsJsonArray("useContext");
12030      for (int i = 0; i < array.size(); i++) {
12031        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12032      }
12033    };
12034    if (json.has("jurisdiction")) {
12035      JsonArray array = json.getAsJsonArray("jurisdiction");
12036      for (int i = 0; i < array.size(); i++) {
12037        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12038      }
12039    };
12040    if (json.has("copyright"))
12041      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
12042    if (json.has("_copyright"))
12043      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
12044    if (json.has("approvalDate"))
12045      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
12046    if (json.has("_approvalDate"))
12047      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
12048    if (json.has("lastReviewDate"))
12049      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
12050    if (json.has("_lastReviewDate"))
12051      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
12052    if (json.has("effectivePeriod"))
12053      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
12054    if (json.has("topic")) {
12055      JsonArray array = json.getAsJsonArray("topic");
12056      for (int i = 0; i < array.size(); i++) {
12057        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12058      }
12059    };
12060    if (json.has("author")) {
12061      JsonArray array = json.getAsJsonArray("author");
12062      for (int i = 0; i < array.size(); i++) {
12063        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12064      }
12065    };
12066    if (json.has("editor")) {
12067      JsonArray array = json.getAsJsonArray("editor");
12068      for (int i = 0; i < array.size(); i++) {
12069        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12070      }
12071    };
12072    if (json.has("reviewer")) {
12073      JsonArray array = json.getAsJsonArray("reviewer");
12074      for (int i = 0; i < array.size(); i++) {
12075        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
12076      }
12077    };
12078    if (json.has("endorser")) {
12079      JsonArray array = json.getAsJsonArray("endorser");
12080      for (int i = 0; i < array.size(); i++) {
12081        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
12082      }
12083    };
12084    if (json.has("relatedArtifact")) {
12085      JsonArray array = json.getAsJsonArray("relatedArtifact");
12086      for (int i = 0; i < array.size(); i++) {
12087        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
12088      }
12089    };
12090    if (json.has("type"))
12091      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), EvidenceVariable.EvidenceVariableType.NULL, new EvidenceVariable.EvidenceVariableTypeEnumFactory()));
12092    if (json.has("_type"))
12093      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12094    if (json.has("actual"))
12095      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
12096    if (json.has("_actual"))
12097      parseElementProperties(json.getAsJsonObject("_actual"), res.getActualElement());
12098    if (json.has("characteristic")) {
12099      JsonArray array = json.getAsJsonArray("characteristic");
12100      for (int i = 0; i < array.size(); i++) {
12101        res.getCharacteristic().add(parseEvidenceVariableEvidenceVariableCharacteristicComponent(array.get(i).getAsJsonObject(), res));
12102      }
12103    };
12104  }
12105
12106  protected EvidenceVariable.EvidenceVariableCharacteristicComponent parseEvidenceVariableEvidenceVariableCharacteristicComponent(JsonObject json, EvidenceVariable owner) throws IOException, FHIRFormatError {
12107    EvidenceVariable.EvidenceVariableCharacteristicComponent res = new EvidenceVariable.EvidenceVariableCharacteristicComponent();
12108    parseEvidenceVariableEvidenceVariableCharacteristicComponentProperties(json, owner, res);
12109    return res;
12110  }
12111
12112  protected void parseEvidenceVariableEvidenceVariableCharacteristicComponentProperties(JsonObject json, EvidenceVariable owner, EvidenceVariable.EvidenceVariableCharacteristicComponent res) throws IOException, FHIRFormatError {
12113    parseBackboneElementProperties(json, res);
12114    if (json.has("description"))
12115      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12116    if (json.has("_description"))
12117      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12118    Type definition = parseType("definition", json);
12119    if (definition != null)
12120      res.setDefinition(definition);
12121    if (json.has("method"))
12122      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
12123    if (json.has("device"))
12124      res.setDevice(parseReference(json.getAsJsonObject("device")));
12125    if (json.has("booleanSet")) {
12126      JsonArray array = json.getAsJsonArray("booleanSet");
12127      for (int i = 0; i < array.size(); i++) {
12128        res.getBooleanSet().add(parseString(array.get(i).getAsString()));
12129      }
12130    };
12131    if (json.has("_booleanSet")) {
12132      JsonArray array = json.getAsJsonArray("_booleanSet");
12133      for (int i = 0; i < array.size(); i++) {
12134        if (i == res.getBooleanSet().size())
12135          res.getBooleanSet().add(parseString(null));
12136        if (array.get(i) instanceof JsonObject) 
12137          parseElementProperties(array.get(i).getAsJsonObject(), res.getBooleanSet().get(i));
12138      }
12139    };
12140    if (json.has("exclude"))
12141      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
12142    if (json.has("_exclude"))
12143      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
12144    Type participantEffective = parseType("participantEffective", json);
12145    if (participantEffective != null)
12146      res.setParticipantEffective(participantEffective);
12147    if (json.has("timeFromStart"))
12148      res.setTimeFromStart(parseDuration(json.getAsJsonObject("timeFromStart")));
12149    if (json.has("groupMeasure"))
12150      res.setGroupMeasureElement(parseEnumeration(json.get("groupMeasure").getAsString(), EvidenceVariable.GroupMeasure.NULL, new EvidenceVariable.GroupMeasureEnumFactory()));
12151    if (json.has("_groupMeasure"))
12152      parseElementProperties(json.getAsJsonObject("_groupMeasure"), res.getGroupMeasureElement());
12153  }
12154
12155  protected ExampleScenario parseExampleScenario(JsonObject json) throws IOException, FHIRFormatError {
12156    ExampleScenario res = new ExampleScenario();
12157    parseExampleScenarioProperties(json, res);
12158    return res;
12159  }
12160
12161  protected void parseExampleScenarioProperties(JsonObject json, ExampleScenario res) throws IOException, FHIRFormatError {
12162    parseDomainResourceProperties(json, res);
12163    if (json.has("url"))
12164      res.setUrlElement(parseUri(json.get("url").getAsString()));
12165    if (json.has("_url"))
12166      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
12167    if (json.has("identifier")) {
12168      JsonArray array = json.getAsJsonArray("identifier");
12169      for (int i = 0; i < array.size(); i++) {
12170        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12171      }
12172    };
12173    if (json.has("version"))
12174      res.setVersionElement(parseString(json.get("version").getAsString()));
12175    if (json.has("_version"))
12176      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
12177    if (json.has("name"))
12178      res.setNameElement(parseString(json.get("name").getAsString()));
12179    if (json.has("_name"))
12180      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12181    if (json.has("status"))
12182      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12183    if (json.has("_status"))
12184      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12185    if (json.has("experimental"))
12186      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
12187    if (json.has("_experimental"))
12188      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
12189    if (json.has("date"))
12190      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12191    if (json.has("_date"))
12192      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12193    if (json.has("publisher"))
12194      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12195    if (json.has("_publisher"))
12196      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
12197    if (json.has("contact")) {
12198      JsonArray array = json.getAsJsonArray("contact");
12199      for (int i = 0; i < array.size(); i++) {
12200        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12201      }
12202    };
12203    if (json.has("useContext")) {
12204      JsonArray array = json.getAsJsonArray("useContext");
12205      for (int i = 0; i < array.size(); i++) {
12206        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12207      }
12208    };
12209    if (json.has("jurisdiction")) {
12210      JsonArray array = json.getAsJsonArray("jurisdiction");
12211      for (int i = 0; i < array.size(); i++) {
12212        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12213      }
12214    };
12215    if (json.has("copyright"))
12216      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
12217    if (json.has("_copyright"))
12218      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
12219    if (json.has("purpose"))
12220      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
12221    if (json.has("_purpose"))
12222      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
12223    if (json.has("actor")) {
12224      JsonArray array = json.getAsJsonArray("actor");
12225      for (int i = 0; i < array.size(); i++) {
12226        res.getActor().add(parseExampleScenarioExampleScenarioActorComponent(array.get(i).getAsJsonObject(), res));
12227      }
12228    };
12229    if (json.has("instance")) {
12230      JsonArray array = json.getAsJsonArray("instance");
12231      for (int i = 0; i < array.size(); i++) {
12232        res.getInstance().add(parseExampleScenarioExampleScenarioInstanceComponent(array.get(i).getAsJsonObject(), res));
12233      }
12234    };
12235    if (json.has("process")) {
12236      JsonArray array = json.getAsJsonArray("process");
12237      for (int i = 0; i < array.size(); i++) {
12238        res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), res));
12239      }
12240    };
12241    if (json.has("workflow")) {
12242      JsonArray array = json.getAsJsonArray("workflow");
12243      for (int i = 0; i < array.size(); i++) {
12244        res.getWorkflow().add(parseCanonical(array.get(i).getAsString()));
12245      }
12246    };
12247    if (json.has("_workflow")) {
12248      JsonArray array = json.getAsJsonArray("_workflow");
12249      for (int i = 0; i < array.size(); i++) {
12250        if (i == res.getWorkflow().size())
12251          res.getWorkflow().add(parseCanonical(null));
12252        if (array.get(i) instanceof JsonObject) 
12253          parseElementProperties(array.get(i).getAsJsonObject(), res.getWorkflow().get(i));
12254      }
12255    };
12256  }
12257
12258  protected ExampleScenario.ExampleScenarioActorComponent parseExampleScenarioExampleScenarioActorComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
12259    ExampleScenario.ExampleScenarioActorComponent res = new ExampleScenario.ExampleScenarioActorComponent();
12260    parseExampleScenarioExampleScenarioActorComponentProperties(json, owner, res);
12261    return res;
12262  }
12263
12264  protected void parseExampleScenarioExampleScenarioActorComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioActorComponent res) throws IOException, FHIRFormatError {
12265    parseBackboneElementProperties(json, res);
12266    if (json.has("actorId"))
12267      res.setActorIdElement(parseString(json.get("actorId").getAsString()));
12268    if (json.has("_actorId"))
12269      parseElementProperties(json.getAsJsonObject("_actorId"), res.getActorIdElement());
12270    if (json.has("type"))
12271      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ExampleScenario.ExampleScenarioActorType.NULL, new ExampleScenario.ExampleScenarioActorTypeEnumFactory()));
12272    if (json.has("_type"))
12273      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12274    if (json.has("name"))
12275      res.setNameElement(parseString(json.get("name").getAsString()));
12276    if (json.has("_name"))
12277      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12278    if (json.has("description"))
12279      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12280    if (json.has("_description"))
12281      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12282  }
12283
12284  protected ExampleScenario.ExampleScenarioInstanceComponent parseExampleScenarioExampleScenarioInstanceComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
12285    ExampleScenario.ExampleScenarioInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceComponent();
12286    parseExampleScenarioExampleScenarioInstanceComponentProperties(json, owner, res);
12287    return res;
12288  }
12289
12290  protected void parseExampleScenarioExampleScenarioInstanceComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceComponent res) throws IOException, FHIRFormatError {
12291    parseBackboneElementProperties(json, res);
12292    if (json.has("resourceId"))
12293      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
12294    if (json.has("_resourceId"))
12295      parseElementProperties(json.getAsJsonObject("_resourceId"), res.getResourceIdElement());
12296    if (json.has("resourceType"))
12297      res.setResourceTypeElement(parseEnumeration(json.get("resourceType").getAsString(), ExampleScenario.FHIRResourceType.NULL, new ExampleScenario.FHIRResourceTypeEnumFactory()));
12298    if (json.has("_resourceType"))
12299      parseElementProperties(json.getAsJsonObject("_resourceType"), res.getResourceTypeElement());
12300    if (json.has("name"))
12301      res.setNameElement(parseString(json.get("name").getAsString()));
12302    if (json.has("_name"))
12303      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12304    if (json.has("description"))
12305      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12306    if (json.has("_description"))
12307      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12308    if (json.has("version")) {
12309      JsonArray array = json.getAsJsonArray("version");
12310      for (int i = 0; i < array.size(); i++) {
12311        res.getVersion().add(parseExampleScenarioExampleScenarioInstanceVersionComponent(array.get(i).getAsJsonObject(), owner));
12312      }
12313    };
12314    if (json.has("containedInstance")) {
12315      JsonArray array = json.getAsJsonArray("containedInstance");
12316      for (int i = 0; i < array.size(); i++) {
12317        res.getContainedInstance().add(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(array.get(i).getAsJsonObject(), owner));
12318      }
12319    };
12320  }
12321
12322  protected ExampleScenario.ExampleScenarioInstanceVersionComponent parseExampleScenarioExampleScenarioInstanceVersionComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
12323    ExampleScenario.ExampleScenarioInstanceVersionComponent res = new ExampleScenario.ExampleScenarioInstanceVersionComponent();
12324    parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(json, owner, res);
12325    return res;
12326  }
12327
12328  protected void parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceVersionComponent res) throws IOException, FHIRFormatError {
12329    parseBackboneElementProperties(json, res);
12330    if (json.has("versionId"))
12331      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
12332    if (json.has("_versionId"))
12333      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
12334    if (json.has("description"))
12335      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12336    if (json.has("_description"))
12337      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12338  }
12339
12340  protected ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
12341    ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent();
12342    parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(json, owner, res);
12343    return res;
12344  }
12345
12346  protected void parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res) throws IOException, FHIRFormatError {
12347    parseBackboneElementProperties(json, res);
12348    if (json.has("resourceId"))
12349      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
12350    if (json.has("_resourceId"))
12351      parseElementProperties(json.getAsJsonObject("_resourceId"), res.getResourceIdElement());
12352    if (json.has("versionId"))
12353      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
12354    if (json.has("_versionId"))
12355      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
12356  }
12357
12358  protected ExampleScenario.ExampleScenarioProcessComponent parseExampleScenarioExampleScenarioProcessComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
12359    ExampleScenario.ExampleScenarioProcessComponent res = new ExampleScenario.ExampleScenarioProcessComponent();
12360    parseExampleScenarioExampleScenarioProcessComponentProperties(json, owner, res);
12361    return res;
12362  }
12363
12364  protected void parseExampleScenarioExampleScenarioProcessComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessComponent res) throws IOException, FHIRFormatError {
12365    parseBackboneElementProperties(json, res);
12366    if (json.has("title"))
12367      res.setTitleElement(parseString(json.get("title").getAsString()));
12368    if (json.has("_title"))
12369      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12370    if (json.has("description"))
12371      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12372    if (json.has("_description"))
12373      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12374    if (json.has("preConditions"))
12375      res.setPreConditionsElement(parseMarkdown(json.get("preConditions").getAsString()));
12376    if (json.has("_preConditions"))
12377      parseElementProperties(json.getAsJsonObject("_preConditions"), res.getPreConditionsElement());
12378    if (json.has("postConditions"))
12379      res.setPostConditionsElement(parseMarkdown(json.get("postConditions").getAsString()));
12380    if (json.has("_postConditions"))
12381      parseElementProperties(json.getAsJsonObject("_postConditions"), res.getPostConditionsElement());
12382    if (json.has("step")) {
12383      JsonArray array = json.getAsJsonArray("step");
12384      for (int i = 0; i < array.size(); i++) {
12385        res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
12386      }
12387    };
12388  }
12389
12390  protected ExampleScenario.ExampleScenarioProcessStepComponent parseExampleScenarioExampleScenarioProcessStepComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
12391    ExampleScenario.ExampleScenarioProcessStepComponent res = new ExampleScenario.ExampleScenarioProcessStepComponent();
12392    parseExampleScenarioExampleScenarioProcessStepComponentProperties(json, owner, res);
12393    return res;
12394  }
12395
12396  protected void parseExampleScenarioExampleScenarioProcessStepComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepComponent res) throws IOException, FHIRFormatError {
12397    parseBackboneElementProperties(json, res);
12398    if (json.has("process")) {
12399      JsonArray array = json.getAsJsonArray("process");
12400      for (int i = 0; i < array.size(); i++) {
12401        res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), owner));
12402      }
12403    };
12404    if (json.has("pause"))
12405      res.setPauseElement(parseBoolean(json.get("pause").getAsBoolean()));
12406    if (json.has("_pause"))
12407      parseElementProperties(json.getAsJsonObject("_pause"), res.getPauseElement());
12408    if (json.has("operation"))
12409      res.setOperation(parseExampleScenarioExampleScenarioProcessStepOperationComponent(json.getAsJsonObject("operation"), owner));
12410    if (json.has("alternative")) {
12411      JsonArray array = json.getAsJsonArray("alternative");
12412      for (int i = 0; i < array.size(); i++) {
12413        res.getAlternative().add(parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(array.get(i).getAsJsonObject(), owner));
12414      }
12415    };
12416  }
12417
12418  protected ExampleScenario.ExampleScenarioProcessStepOperationComponent parseExampleScenarioExampleScenarioProcessStepOperationComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
12419    ExampleScenario.ExampleScenarioProcessStepOperationComponent res = new ExampleScenario.ExampleScenarioProcessStepOperationComponent();
12420    parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(json, owner, res);
12421    return res;
12422  }
12423
12424  protected void parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepOperationComponent res) throws IOException, FHIRFormatError {
12425    parseBackboneElementProperties(json, res);
12426    if (json.has("number"))
12427      res.setNumberElement(parseString(json.get("number").getAsString()));
12428    if (json.has("_number"))
12429      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
12430    if (json.has("type"))
12431      res.setTypeElement(parseString(json.get("type").getAsString()));
12432    if (json.has("_type"))
12433      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12434    if (json.has("name"))
12435      res.setNameElement(parseString(json.get("name").getAsString()));
12436    if (json.has("_name"))
12437      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12438    if (json.has("initiator"))
12439      res.setInitiatorElement(parseString(json.get("initiator").getAsString()));
12440    if (json.has("_initiator"))
12441      parseElementProperties(json.getAsJsonObject("_initiator"), res.getInitiatorElement());
12442    if (json.has("receiver"))
12443      res.setReceiverElement(parseString(json.get("receiver").getAsString()));
12444    if (json.has("_receiver"))
12445      parseElementProperties(json.getAsJsonObject("_receiver"), res.getReceiverElement());
12446    if (json.has("description"))
12447      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12448    if (json.has("_description"))
12449      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12450    if (json.has("initiatorActive"))
12451      res.setInitiatorActiveElement(parseBoolean(json.get("initiatorActive").getAsBoolean()));
12452    if (json.has("_initiatorActive"))
12453      parseElementProperties(json.getAsJsonObject("_initiatorActive"), res.getInitiatorActiveElement());
12454    if (json.has("receiverActive"))
12455      res.setReceiverActiveElement(parseBoolean(json.get("receiverActive").getAsBoolean()));
12456    if (json.has("_receiverActive"))
12457      parseElementProperties(json.getAsJsonObject("_receiverActive"), res.getReceiverActiveElement());
12458    if (json.has("request"))
12459      res.setRequest(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(json.getAsJsonObject("request"), owner));
12460    if (json.has("response"))
12461      res.setResponse(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(json.getAsJsonObject("response"), owner));
12462  }
12463
12464  protected ExampleScenario.ExampleScenarioProcessStepAlternativeComponent parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
12465    ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res = new ExampleScenario.ExampleScenarioProcessStepAlternativeComponent();
12466    parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(json, owner, res);
12467    return res;
12468  }
12469
12470  protected void parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res) throws IOException, FHIRFormatError {
12471    parseBackboneElementProperties(json, res);
12472    if (json.has("title"))
12473      res.setTitleElement(parseString(json.get("title").getAsString()));
12474    if (json.has("_title"))
12475      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12476    if (json.has("description"))
12477      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12478    if (json.has("_description"))
12479      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12480    if (json.has("step")) {
12481      JsonArray array = json.getAsJsonArray("step");
12482      for (int i = 0; i < array.size(); i++) {
12483        res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
12484      }
12485    };
12486  }
12487
12488  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
12489    ExplanationOfBenefit res = new ExplanationOfBenefit();
12490    parseExplanationOfBenefitProperties(json, res);
12491    return res;
12492  }
12493
12494  protected void parseExplanationOfBenefitProperties(JsonObject json, ExplanationOfBenefit res) throws IOException, FHIRFormatError {
12495    parseDomainResourceProperties(json, res);
12496    if (json.has("identifier")) {
12497      JsonArray array = json.getAsJsonArray("identifier");
12498      for (int i = 0; i < array.size(); i++) {
12499        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12500      }
12501    };
12502    if (json.has("status"))
12503      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL, new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
12504    if (json.has("_status"))
12505      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12506    if (json.has("type"))
12507      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12508    if (json.has("subType"))
12509      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
12510    if (json.has("use"))
12511      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ExplanationOfBenefit.Use.NULL, new ExplanationOfBenefit.UseEnumFactory()));
12512    if (json.has("_use"))
12513      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
12514    if (json.has("patient"))
12515      res.setPatient(parseReference(json.getAsJsonObject("patient")));
12516    if (json.has("billablePeriod"))
12517      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
12518    if (json.has("created"))
12519      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
12520    if (json.has("_created"))
12521      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
12522    if (json.has("enterer"))
12523      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
12524    if (json.has("insurer"))
12525      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
12526    if (json.has("provider"))
12527      res.setProvider(parseReference(json.getAsJsonObject("provider")));
12528    if (json.has("priority"))
12529      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
12530    if (json.has("fundsReserveRequested"))
12531      res.setFundsReserveRequested(parseCodeableConcept(json.getAsJsonObject("fundsReserveRequested")));
12532    if (json.has("fundsReserve"))
12533      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
12534    if (json.has("related")) {
12535      JsonArray array = json.getAsJsonArray("related");
12536      for (int i = 0; i < array.size(); i++) {
12537        res.getRelated().add(parseExplanationOfBenefitRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
12538      }
12539    };
12540    if (json.has("prescription"))
12541      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
12542    if (json.has("originalPrescription"))
12543      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
12544    if (json.has("payee"))
12545      res.setPayee(parseExplanationOfBenefitPayeeComponent(json.getAsJsonObject("payee"), res));
12546    if (json.has("referral"))
12547      res.setReferral(parseReference(json.getAsJsonObject("referral")));
12548    if (json.has("facility"))
12549      res.setFacility(parseReference(json.getAsJsonObject("facility")));
12550    if (json.has("claim"))
12551      res.setClaim(parseReference(json.getAsJsonObject("claim")));
12552    if (json.has("claimResponse"))
12553      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
12554    if (json.has("outcome"))
12555      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ExplanationOfBenefit.RemittanceOutcome.NULL, new ExplanationOfBenefit.RemittanceOutcomeEnumFactory()));
12556    if (json.has("_outcome"))
12557      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
12558    if (json.has("disposition"))
12559      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
12560    if (json.has("_disposition"))
12561      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
12562    if (json.has("preAuthRef")) {
12563      JsonArray array = json.getAsJsonArray("preAuthRef");
12564      for (int i = 0; i < array.size(); i++) {
12565        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
12566      }
12567    };
12568    if (json.has("_preAuthRef")) {
12569      JsonArray array = json.getAsJsonArray("_preAuthRef");
12570      for (int i = 0; i < array.size(); i++) {
12571        if (i == res.getPreAuthRef().size())
12572          res.getPreAuthRef().add(parseString(null));
12573        if (array.get(i) instanceof JsonObject) 
12574          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
12575      }
12576    };
12577    if (json.has("preAuthRefPeriod")) {
12578      JsonArray array = json.getAsJsonArray("preAuthRefPeriod");
12579      for (int i = 0; i < array.size(); i++) {
12580        res.getPreAuthRefPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
12581      }
12582    };
12583    if (json.has("careTeam")) {
12584      JsonArray array = json.getAsJsonArray("careTeam");
12585      for (int i = 0; i < array.size(); i++) {
12586        res.getCareTeam().add(parseExplanationOfBenefitCareTeamComponent(array.get(i).getAsJsonObject(), res));
12587      }
12588    };
12589    if (json.has("supportingInfo")) {
12590      JsonArray array = json.getAsJsonArray("supportingInfo");
12591      for (int i = 0; i < array.size(); i++) {
12592        res.getSupportingInfo().add(parseExplanationOfBenefitSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
12593      }
12594    };
12595    if (json.has("diagnosis")) {
12596      JsonArray array = json.getAsJsonArray("diagnosis");
12597      for (int i = 0; i < array.size(); i++) {
12598        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(array.get(i).getAsJsonObject(), res));
12599      }
12600    };
12601    if (json.has("procedure")) {
12602      JsonArray array = json.getAsJsonArray("procedure");
12603      for (int i = 0; i < array.size(); i++) {
12604        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(array.get(i).getAsJsonObject(), res));
12605      }
12606    };
12607    if (json.has("precedence"))
12608      res.setPrecedenceElement(parsePositiveInt(json.get("precedence").getAsString()));
12609    if (json.has("_precedence"))
12610      parseElementProperties(json.getAsJsonObject("_precedence"), res.getPrecedenceElement());
12611    if (json.has("insurance")) {
12612      JsonArray array = json.getAsJsonArray("insurance");
12613      for (int i = 0; i < array.size(); i++) {
12614        res.getInsurance().add(parseExplanationOfBenefitInsuranceComponent(array.get(i).getAsJsonObject(), res));
12615      }
12616    };
12617    if (json.has("accident"))
12618      res.setAccident(parseExplanationOfBenefitAccidentComponent(json.getAsJsonObject("accident"), res));
12619    if (json.has("item")) {
12620      JsonArray array = json.getAsJsonArray("item");
12621      for (int i = 0; i < array.size(); i++) {
12622        res.getItem().add(parseExplanationOfBenefitItemComponent(array.get(i).getAsJsonObject(), res));
12623      }
12624    };
12625    if (json.has("addItem")) {
12626      JsonArray array = json.getAsJsonArray("addItem");
12627      for (int i = 0; i < array.size(); i++) {
12628        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(array.get(i).getAsJsonObject(), res));
12629      }
12630    };
12631    if (json.has("adjudication")) {
12632      JsonArray array = json.getAsJsonArray("adjudication");
12633      for (int i = 0; i < array.size(); i++) {
12634        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), res));
12635      }
12636    };
12637    if (json.has("total")) {
12638      JsonArray array = json.getAsJsonArray("total");
12639      for (int i = 0; i < array.size(); i++) {
12640        res.getTotal().add(parseExplanationOfBenefitTotalComponent(array.get(i).getAsJsonObject(), res));
12641      }
12642    };
12643    if (json.has("payment"))
12644      res.setPayment(parseExplanationOfBenefitPaymentComponent(json.getAsJsonObject("payment"), res));
12645    if (json.has("formCode"))
12646      res.setFormCode(parseCodeableConcept(json.getAsJsonObject("formCode")));
12647    if (json.has("form"))
12648      res.setForm(parseAttachment(json.getAsJsonObject("form")));
12649    if (json.has("processNote")) {
12650      JsonArray array = json.getAsJsonArray("processNote");
12651      for (int i = 0; i < array.size(); i++) {
12652        res.getProcessNote().add(parseExplanationOfBenefitNoteComponent(array.get(i).getAsJsonObject(), res));
12653      }
12654    };
12655    if (json.has("benefitPeriod"))
12656      res.setBenefitPeriod(parsePeriod(json.getAsJsonObject("benefitPeriod")));
12657    if (json.has("benefitBalance")) {
12658      JsonArray array = json.getAsJsonArray("benefitBalance");
12659      for (int i = 0; i < array.size(); i++) {
12660        res.getBenefitBalance().add(parseExplanationOfBenefitBenefitBalanceComponent(array.get(i).getAsJsonObject(), res));
12661      }
12662    };
12663  }
12664
12665  protected ExplanationOfBenefit.RelatedClaimComponent parseExplanationOfBenefitRelatedClaimComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12666    ExplanationOfBenefit.RelatedClaimComponent res = new ExplanationOfBenefit.RelatedClaimComponent();
12667    parseExplanationOfBenefitRelatedClaimComponentProperties(json, owner, res);
12668    return res;
12669  }
12670
12671  protected void parseExplanationOfBenefitRelatedClaimComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.RelatedClaimComponent res) throws IOException, FHIRFormatError {
12672    parseBackboneElementProperties(json, res);
12673    if (json.has("claim"))
12674      res.setClaim(parseReference(json.getAsJsonObject("claim")));
12675    if (json.has("relationship"))
12676      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
12677    if (json.has("reference"))
12678      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
12679  }
12680
12681  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12682    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
12683    parseExplanationOfBenefitPayeeComponentProperties(json, owner, res);
12684    return res;
12685  }
12686
12687  protected void parseExplanationOfBenefitPayeeComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PayeeComponent res) throws IOException, FHIRFormatError {
12688    parseBackboneElementProperties(json, res);
12689    if (json.has("type"))
12690      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12691    if (json.has("party"))
12692      res.setParty(parseReference(json.getAsJsonObject("party")));
12693  }
12694
12695  protected ExplanationOfBenefit.CareTeamComponent parseExplanationOfBenefitCareTeamComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12696    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
12697    parseExplanationOfBenefitCareTeamComponentProperties(json, owner, res);
12698    return res;
12699  }
12700
12701  protected void parseExplanationOfBenefitCareTeamComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.CareTeamComponent res) throws IOException, FHIRFormatError {
12702    parseBackboneElementProperties(json, res);
12703    if (json.has("sequence"))
12704      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12705    if (json.has("_sequence"))
12706      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
12707    if (json.has("provider"))
12708      res.setProvider(parseReference(json.getAsJsonObject("provider")));
12709    if (json.has("responsible"))
12710      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
12711    if (json.has("_responsible"))
12712      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
12713    if (json.has("role"))
12714      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
12715    if (json.has("qualification"))
12716      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
12717  }
12718
12719  protected ExplanationOfBenefit.SupportingInformationComponent parseExplanationOfBenefitSupportingInformationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12720    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
12721    parseExplanationOfBenefitSupportingInformationComponentProperties(json, owner, res);
12722    return res;
12723  }
12724
12725  protected void parseExplanationOfBenefitSupportingInformationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SupportingInformationComponent res) throws IOException, FHIRFormatError {
12726    parseBackboneElementProperties(json, res);
12727    if (json.has("sequence"))
12728      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12729    if (json.has("_sequence"))
12730      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
12731    if (json.has("category"))
12732      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12733    if (json.has("code"))
12734      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
12735    Type timing = parseType("timing", json);
12736    if (timing != null)
12737      res.setTiming(timing);
12738    Type value = parseType("value", json);
12739    if (value != null)
12740      res.setValue(value);
12741    if (json.has("reason"))
12742      res.setReason(parseCoding(json.getAsJsonObject("reason")));
12743  }
12744
12745  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12746    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
12747    parseExplanationOfBenefitDiagnosisComponentProperties(json, owner, res);
12748    return res;
12749  }
12750
12751  protected void parseExplanationOfBenefitDiagnosisComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DiagnosisComponent res) throws IOException, FHIRFormatError {
12752    parseBackboneElementProperties(json, res);
12753    if (json.has("sequence"))
12754      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12755    if (json.has("_sequence"))
12756      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
12757    Type diagnosis = parseType("diagnosis", json);
12758    if (diagnosis != null)
12759      res.setDiagnosis(diagnosis);
12760    if (json.has("type")) {
12761      JsonArray array = json.getAsJsonArray("type");
12762      for (int i = 0; i < array.size(); i++) {
12763        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12764      }
12765    };
12766    if (json.has("onAdmission"))
12767      res.setOnAdmission(parseCodeableConcept(json.getAsJsonObject("onAdmission")));
12768    if (json.has("packageCode"))
12769      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
12770  }
12771
12772  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12773    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
12774    parseExplanationOfBenefitProcedureComponentProperties(json, owner, res);
12775    return res;
12776  }
12777
12778  protected void parseExplanationOfBenefitProcedureComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ProcedureComponent res) throws IOException, FHIRFormatError {
12779    parseBackboneElementProperties(json, res);
12780    if (json.has("sequence"))
12781      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12782    if (json.has("_sequence"))
12783      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
12784    if (json.has("type")) {
12785      JsonArray array = json.getAsJsonArray("type");
12786      for (int i = 0; i < array.size(); i++) {
12787        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12788      }
12789    };
12790    if (json.has("date"))
12791      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12792    if (json.has("_date"))
12793      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12794    Type procedure = parseType("procedure", json);
12795    if (procedure != null)
12796      res.setProcedure(procedure);
12797    if (json.has("udi")) {
12798      JsonArray array = json.getAsJsonArray("udi");
12799      for (int i = 0; i < array.size(); i++) {
12800        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
12801      }
12802    };
12803  }
12804
12805  protected ExplanationOfBenefit.InsuranceComponent parseExplanationOfBenefitInsuranceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12806    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
12807    parseExplanationOfBenefitInsuranceComponentProperties(json, owner, res);
12808    return res;
12809  }
12810
12811  protected void parseExplanationOfBenefitInsuranceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.InsuranceComponent res) throws IOException, FHIRFormatError {
12812    parseBackboneElementProperties(json, res);
12813    if (json.has("focal"))
12814      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
12815    if (json.has("_focal"))
12816      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
12817    if (json.has("coverage"))
12818      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
12819    if (json.has("preAuthRef")) {
12820      JsonArray array = json.getAsJsonArray("preAuthRef");
12821      for (int i = 0; i < array.size(); i++) {
12822        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
12823      }
12824    };
12825    if (json.has("_preAuthRef")) {
12826      JsonArray array = json.getAsJsonArray("_preAuthRef");
12827      for (int i = 0; i < array.size(); i++) {
12828        if (i == res.getPreAuthRef().size())
12829          res.getPreAuthRef().add(parseString(null));
12830        if (array.get(i) instanceof JsonObject) 
12831          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
12832      }
12833    };
12834  }
12835
12836  protected ExplanationOfBenefit.AccidentComponent parseExplanationOfBenefitAccidentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12837    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
12838    parseExplanationOfBenefitAccidentComponentProperties(json, owner, res);
12839    return res;
12840  }
12841
12842  protected void parseExplanationOfBenefitAccidentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AccidentComponent res) throws IOException, FHIRFormatError {
12843    parseBackboneElementProperties(json, res);
12844    if (json.has("date"))
12845      res.setDateElement(parseDate(json.get("date").getAsString()));
12846    if (json.has("_date"))
12847      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12848    if (json.has("type"))
12849      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12850    Type location = parseType("location", json);
12851    if (location != null)
12852      res.setLocation(location);
12853  }
12854
12855  protected ExplanationOfBenefit.ItemComponent parseExplanationOfBenefitItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12856    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
12857    parseExplanationOfBenefitItemComponentProperties(json, owner, res);
12858    return res;
12859  }
12860
12861  protected void parseExplanationOfBenefitItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ItemComponent res) throws IOException, FHIRFormatError {
12862    parseBackboneElementProperties(json, res);
12863    if (json.has("sequence"))
12864      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12865    if (json.has("_sequence"))
12866      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
12867    if (json.has("careTeamSequence")) {
12868      JsonArray array = json.getAsJsonArray("careTeamSequence");
12869      for (int i = 0; i < array.size(); i++) {
12870        res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
12871      }
12872    };
12873    if (json.has("_careTeamSequence")) {
12874      JsonArray array = json.getAsJsonArray("_careTeamSequence");
12875      for (int i = 0; i < array.size(); i++) {
12876        if (i == res.getCareTeamSequence().size())
12877          res.getCareTeamSequence().add(parsePositiveInt(null));
12878        if (array.get(i) instanceof JsonObject) 
12879          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
12880      }
12881    };
12882    if (json.has("diagnosisSequence")) {
12883      JsonArray array = json.getAsJsonArray("diagnosisSequence");
12884      for (int i = 0; i < array.size(); i++) {
12885        res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
12886      }
12887    };
12888    if (json.has("_diagnosisSequence")) {
12889      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
12890      for (int i = 0; i < array.size(); i++) {
12891        if (i == res.getDiagnosisSequence().size())
12892          res.getDiagnosisSequence().add(parsePositiveInt(null));
12893        if (array.get(i) instanceof JsonObject) 
12894          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
12895      }
12896    };
12897    if (json.has("procedureSequence")) {
12898      JsonArray array = json.getAsJsonArray("procedureSequence");
12899      for (int i = 0; i < array.size(); i++) {
12900        res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
12901      }
12902    };
12903    if (json.has("_procedureSequence")) {
12904      JsonArray array = json.getAsJsonArray("_procedureSequence");
12905      for (int i = 0; i < array.size(); i++) {
12906        if (i == res.getProcedureSequence().size())
12907          res.getProcedureSequence().add(parsePositiveInt(null));
12908        if (array.get(i) instanceof JsonObject) 
12909          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
12910      }
12911    };
12912    if (json.has("informationSequence")) {
12913      JsonArray array = json.getAsJsonArray("informationSequence");
12914      for (int i = 0; i < array.size(); i++) {
12915        res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
12916      }
12917    };
12918    if (json.has("_informationSequence")) {
12919      JsonArray array = json.getAsJsonArray("_informationSequence");
12920      for (int i = 0; i < array.size(); i++) {
12921        if (i == res.getInformationSequence().size())
12922          res.getInformationSequence().add(parsePositiveInt(null));
12923        if (array.get(i) instanceof JsonObject) 
12924          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
12925      }
12926    };
12927    if (json.has("revenue"))
12928      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
12929    if (json.has("category"))
12930      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12931    if (json.has("productOrService"))
12932      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
12933    if (json.has("modifier")) {
12934      JsonArray array = json.getAsJsonArray("modifier");
12935      for (int i = 0; i < array.size(); i++) {
12936        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12937      }
12938    };
12939    if (json.has("programCode")) {
12940      JsonArray array = json.getAsJsonArray("programCode");
12941      for (int i = 0; i < array.size(); i++) {
12942        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12943      }
12944    };
12945    Type serviced = parseType("serviced", json);
12946    if (serviced != null)
12947      res.setServiced(serviced);
12948    Type location = parseType("location", json);
12949    if (location != null)
12950      res.setLocation(location);
12951    if (json.has("quantity"))
12952      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
12953    if (json.has("unitPrice"))
12954      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
12955    if (json.has("factor"))
12956      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12957    if (json.has("_factor"))
12958      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
12959    if (json.has("net"))
12960      res.setNet(parseMoney(json.getAsJsonObject("net")));
12961    if (json.has("udi")) {
12962      JsonArray array = json.getAsJsonArray("udi");
12963      for (int i = 0; i < array.size(); i++) {
12964        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
12965      }
12966    };
12967    if (json.has("bodySite"))
12968      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
12969    if (json.has("subSite")) {
12970      JsonArray array = json.getAsJsonArray("subSite");
12971      for (int i = 0; i < array.size(); i++) {
12972        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12973      }
12974    };
12975    if (json.has("encounter")) {
12976      JsonArray array = json.getAsJsonArray("encounter");
12977      for (int i = 0; i < array.size(); i++) {
12978        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
12979      }
12980    };
12981    if (json.has("noteNumber")) {
12982      JsonArray array = json.getAsJsonArray("noteNumber");
12983      for (int i = 0; i < array.size(); i++) {
12984        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12985      }
12986    };
12987    if (json.has("_noteNumber")) {
12988      JsonArray array = json.getAsJsonArray("_noteNumber");
12989      for (int i = 0; i < array.size(); i++) {
12990        if (i == res.getNoteNumber().size())
12991          res.getNoteNumber().add(parsePositiveInt(null));
12992        if (array.get(i) instanceof JsonObject) 
12993          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12994      }
12995    };
12996    if (json.has("adjudication")) {
12997      JsonArray array = json.getAsJsonArray("adjudication");
12998      for (int i = 0; i < array.size(); i++) {
12999        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
13000      }
13001    };
13002    if (json.has("detail")) {
13003      JsonArray array = json.getAsJsonArray("detail");
13004      for (int i = 0; i < array.size(); i++) {
13005        res.getDetail().add(parseExplanationOfBenefitDetailComponent(array.get(i).getAsJsonObject(), owner));
13006      }
13007    };
13008  }
13009
13010  protected ExplanationOfBenefit.AdjudicationComponent parseExplanationOfBenefitAdjudicationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13011    ExplanationOfBenefit.AdjudicationComponent res = new ExplanationOfBenefit.AdjudicationComponent();
13012    parseExplanationOfBenefitAdjudicationComponentProperties(json, owner, res);
13013    return res;
13014  }
13015
13016  protected void parseExplanationOfBenefitAdjudicationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AdjudicationComponent res) throws IOException, FHIRFormatError {
13017    parseBackboneElementProperties(json, res);
13018    if (json.has("category"))
13019      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
13020    if (json.has("reason"))
13021      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
13022    if (json.has("amount"))
13023      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
13024    if (json.has("value"))
13025      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
13026    if (json.has("_value"))
13027      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
13028  }
13029
13030  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13031    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
13032    parseExplanationOfBenefitDetailComponentProperties(json, owner, res);
13033    return res;
13034  }
13035
13036  protected void parseExplanationOfBenefitDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DetailComponent res) throws IOException, FHIRFormatError {
13037    parseBackboneElementProperties(json, res);
13038    if (json.has("sequence"))
13039      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13040    if (json.has("_sequence"))
13041      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
13042    if (json.has("revenue"))
13043      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
13044    if (json.has("category"))
13045      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
13046    if (json.has("productOrService"))
13047      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
13048    if (json.has("modifier")) {
13049      JsonArray array = json.getAsJsonArray("modifier");
13050      for (int i = 0; i < array.size(); i++) {
13051        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13052      }
13053    };
13054    if (json.has("programCode")) {
13055      JsonArray array = json.getAsJsonArray("programCode");
13056      for (int i = 0; i < array.size(); i++) {
13057        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13058      }
13059    };
13060    if (json.has("quantity"))
13061      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
13062    if (json.has("unitPrice"))
13063      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
13064    if (json.has("factor"))
13065      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13066    if (json.has("_factor"))
13067      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
13068    if (json.has("net"))
13069      res.setNet(parseMoney(json.getAsJsonObject("net")));
13070    if (json.has("udi")) {
13071      JsonArray array = json.getAsJsonArray("udi");
13072      for (int i = 0; i < array.size(); i++) {
13073        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
13074      }
13075    };
13076    if (json.has("noteNumber")) {
13077      JsonArray array = json.getAsJsonArray("noteNumber");
13078      for (int i = 0; i < array.size(); i++) {
13079        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13080      }
13081    };
13082    if (json.has("_noteNumber")) {
13083      JsonArray array = json.getAsJsonArray("_noteNumber");
13084      for (int i = 0; i < array.size(); i++) {
13085        if (i == res.getNoteNumber().size())
13086          res.getNoteNumber().add(parsePositiveInt(null));
13087        if (array.get(i) instanceof JsonObject) 
13088          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13089      }
13090    };
13091    if (json.has("adjudication")) {
13092      JsonArray array = json.getAsJsonArray("adjudication");
13093      for (int i = 0; i < array.size(); i++) {
13094        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
13095      }
13096    };
13097    if (json.has("subDetail")) {
13098      JsonArray array = json.getAsJsonArray("subDetail");
13099      for (int i = 0; i < array.size(); i++) {
13100        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(array.get(i).getAsJsonObject(), owner));
13101      }
13102    };
13103  }
13104
13105  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13106    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
13107    parseExplanationOfBenefitSubDetailComponentProperties(json, owner, res);
13108    return res;
13109  }
13110
13111  protected void parseExplanationOfBenefitSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SubDetailComponent res) throws IOException, FHIRFormatError {
13112    parseBackboneElementProperties(json, res);
13113    if (json.has("sequence"))
13114      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13115    if (json.has("_sequence"))
13116      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
13117    if (json.has("revenue"))
13118      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
13119    if (json.has("category"))
13120      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
13121    if (json.has("productOrService"))
13122      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
13123    if (json.has("modifier")) {
13124      JsonArray array = json.getAsJsonArray("modifier");
13125      for (int i = 0; i < array.size(); i++) {
13126        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13127      }
13128    };
13129    if (json.has("programCode")) {
13130      JsonArray array = json.getAsJsonArray("programCode");
13131      for (int i = 0; i < array.size(); i++) {
13132        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13133      }
13134    };
13135    if (json.has("quantity"))
13136      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
13137    if (json.has("unitPrice"))
13138      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
13139    if (json.has("factor"))
13140      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13141    if (json.has("_factor"))
13142      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
13143    if (json.has("net"))
13144      res.setNet(parseMoney(json.getAsJsonObject("net")));
13145    if (json.has("udi")) {
13146      JsonArray array = json.getAsJsonArray("udi");
13147      for (int i = 0; i < array.size(); i++) {
13148        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
13149      }
13150    };
13151    if (json.has("noteNumber")) {
13152      JsonArray array = json.getAsJsonArray("noteNumber");
13153      for (int i = 0; i < array.size(); i++) {
13154        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13155      }
13156    };
13157    if (json.has("_noteNumber")) {
13158      JsonArray array = json.getAsJsonArray("_noteNumber");
13159      for (int i = 0; i < array.size(); i++) {
13160        if (i == res.getNoteNumber().size())
13161          res.getNoteNumber().add(parsePositiveInt(null));
13162        if (array.get(i) instanceof JsonObject) 
13163          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13164      }
13165    };
13166    if (json.has("adjudication")) {
13167      JsonArray array = json.getAsJsonArray("adjudication");
13168      for (int i = 0; i < array.size(); i++) {
13169        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
13170      }
13171    };
13172  }
13173
13174  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13175    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
13176    parseExplanationOfBenefitAddedItemComponentProperties(json, owner, res);
13177    return res;
13178  }
13179
13180  protected void parseExplanationOfBenefitAddedItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemComponent res) throws IOException, FHIRFormatError {
13181    parseBackboneElementProperties(json, res);
13182    if (json.has("itemSequence")) {
13183      JsonArray array = json.getAsJsonArray("itemSequence");
13184      for (int i = 0; i < array.size(); i++) {
13185        res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
13186      }
13187    };
13188    if (json.has("_itemSequence")) {
13189      JsonArray array = json.getAsJsonArray("_itemSequence");
13190      for (int i = 0; i < array.size(); i++) {
13191        if (i == res.getItemSequence().size())
13192          res.getItemSequence().add(parsePositiveInt(null));
13193        if (array.get(i) instanceof JsonObject) 
13194          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
13195      }
13196    };
13197    if (json.has("detailSequence")) {
13198      JsonArray array = json.getAsJsonArray("detailSequence");
13199      for (int i = 0; i < array.size(); i++) {
13200        res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
13201      }
13202    };
13203    if (json.has("_detailSequence")) {
13204      JsonArray array = json.getAsJsonArray("_detailSequence");
13205      for (int i = 0; i < array.size(); i++) {
13206        if (i == res.getDetailSequence().size())
13207          res.getDetailSequence().add(parsePositiveInt(null));
13208        if (array.get(i) instanceof JsonObject) 
13209          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
13210      }
13211    };
13212    if (json.has("subDetailSequence")) {
13213      JsonArray array = json.getAsJsonArray("subDetailSequence");
13214      for (int i = 0; i < array.size(); i++) {
13215        res.getSubDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
13216      }
13217    };
13218    if (json.has("_subDetailSequence")) {
13219      JsonArray array = json.getAsJsonArray("_subDetailSequence");
13220      for (int i = 0; i < array.size(); i++) {
13221        if (i == res.getSubDetailSequence().size())
13222          res.getSubDetailSequence().add(parsePositiveInt(null));
13223        if (array.get(i) instanceof JsonObject) 
13224          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubDetailSequence().get(i));
13225      }
13226    };
13227    if (json.has("provider")) {
13228      JsonArray array = json.getAsJsonArray("provider");
13229      for (int i = 0; i < array.size(); i++) {
13230        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
13231      }
13232    };
13233    if (json.has("productOrService"))
13234      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
13235    if (json.has("modifier")) {
13236      JsonArray array = json.getAsJsonArray("modifier");
13237      for (int i = 0; i < array.size(); i++) {
13238        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13239      }
13240    };
13241    if (json.has("programCode")) {
13242      JsonArray array = json.getAsJsonArray("programCode");
13243      for (int i = 0; i < array.size(); i++) {
13244        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13245      }
13246    };
13247    Type serviced = parseType("serviced", json);
13248    if (serviced != null)
13249      res.setServiced(serviced);
13250    Type location = parseType("location", json);
13251    if (location != null)
13252      res.setLocation(location);
13253    if (json.has("quantity"))
13254      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
13255    if (json.has("unitPrice"))
13256      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
13257    if (json.has("factor"))
13258      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13259    if (json.has("_factor"))
13260      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
13261    if (json.has("net"))
13262      res.setNet(parseMoney(json.getAsJsonObject("net")));
13263    if (json.has("bodySite"))
13264      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
13265    if (json.has("subSite")) {
13266      JsonArray array = json.getAsJsonArray("subSite");
13267      for (int i = 0; i < array.size(); i++) {
13268        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13269      }
13270    };
13271    if (json.has("noteNumber")) {
13272      JsonArray array = json.getAsJsonArray("noteNumber");
13273      for (int i = 0; i < array.size(); i++) {
13274        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13275      }
13276    };
13277    if (json.has("_noteNumber")) {
13278      JsonArray array = json.getAsJsonArray("_noteNumber");
13279      for (int i = 0; i < array.size(); i++) {
13280        if (i == res.getNoteNumber().size())
13281          res.getNoteNumber().add(parsePositiveInt(null));
13282        if (array.get(i) instanceof JsonObject) 
13283          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13284      }
13285    };
13286    if (json.has("adjudication")) {
13287      JsonArray array = json.getAsJsonArray("adjudication");
13288      for (int i = 0; i < array.size(); i++) {
13289        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
13290      }
13291    };
13292    if (json.has("detail")) {
13293      JsonArray array = json.getAsJsonArray("detail");
13294      for (int i = 0; i < array.size(); i++) {
13295        res.getDetail().add(parseExplanationOfBenefitAddedItemDetailComponent(array.get(i).getAsJsonObject(), owner));
13296      }
13297    };
13298  }
13299
13300  protected ExplanationOfBenefit.AddedItemDetailComponent parseExplanationOfBenefitAddedItemDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13301    ExplanationOfBenefit.AddedItemDetailComponent res = new ExplanationOfBenefit.AddedItemDetailComponent();
13302    parseExplanationOfBenefitAddedItemDetailComponentProperties(json, owner, res);
13303    return res;
13304  }
13305
13306  protected void parseExplanationOfBenefitAddedItemDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
13307    parseBackboneElementProperties(json, res);
13308    if (json.has("productOrService"))
13309      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
13310    if (json.has("modifier")) {
13311      JsonArray array = json.getAsJsonArray("modifier");
13312      for (int i = 0; i < array.size(); i++) {
13313        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13314      }
13315    };
13316    if (json.has("quantity"))
13317      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
13318    if (json.has("unitPrice"))
13319      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
13320    if (json.has("factor"))
13321      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13322    if (json.has("_factor"))
13323      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
13324    if (json.has("net"))
13325      res.setNet(parseMoney(json.getAsJsonObject("net")));
13326    if (json.has("noteNumber")) {
13327      JsonArray array = json.getAsJsonArray("noteNumber");
13328      for (int i = 0; i < array.size(); i++) {
13329        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13330      }
13331    };
13332    if (json.has("_noteNumber")) {
13333      JsonArray array = json.getAsJsonArray("_noteNumber");
13334      for (int i = 0; i < array.size(); i++) {
13335        if (i == res.getNoteNumber().size())
13336          res.getNoteNumber().add(parsePositiveInt(null));
13337        if (array.get(i) instanceof JsonObject) 
13338          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13339      }
13340    };
13341    if (json.has("adjudication")) {
13342      JsonArray array = json.getAsJsonArray("adjudication");
13343      for (int i = 0; i < array.size(); i++) {
13344        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
13345      }
13346    };
13347    if (json.has("subDetail")) {
13348      JsonArray array = json.getAsJsonArray("subDetail");
13349      for (int i = 0; i < array.size(); i++) {
13350        res.getSubDetail().add(parseExplanationOfBenefitAddedItemDetailSubDetailComponent(array.get(i).getAsJsonObject(), owner));
13351      }
13352    };
13353  }
13354
13355  protected ExplanationOfBenefit.AddedItemDetailSubDetailComponent parseExplanationOfBenefitAddedItemDetailSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13356    ExplanationOfBenefit.AddedItemDetailSubDetailComponent res = new ExplanationOfBenefit.AddedItemDetailSubDetailComponent();
13357    parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(json, owner, res);
13358    return res;
13359  }
13360
13361  protected void parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailSubDetailComponent res) throws IOException, FHIRFormatError {
13362    parseBackboneElementProperties(json, res);
13363    if (json.has("productOrService"))
13364      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
13365    if (json.has("modifier")) {
13366      JsonArray array = json.getAsJsonArray("modifier");
13367      for (int i = 0; i < array.size(); i++) {
13368        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13369      }
13370    };
13371    if (json.has("quantity"))
13372      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
13373    if (json.has("unitPrice"))
13374      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
13375    if (json.has("factor"))
13376      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13377    if (json.has("_factor"))
13378      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
13379    if (json.has("net"))
13380      res.setNet(parseMoney(json.getAsJsonObject("net")));
13381    if (json.has("noteNumber")) {
13382      JsonArray array = json.getAsJsonArray("noteNumber");
13383      for (int i = 0; i < array.size(); i++) {
13384        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13385      }
13386    };
13387    if (json.has("_noteNumber")) {
13388      JsonArray array = json.getAsJsonArray("_noteNumber");
13389      for (int i = 0; i < array.size(); i++) {
13390        if (i == res.getNoteNumber().size())
13391          res.getNoteNumber().add(parsePositiveInt(null));
13392        if (array.get(i) instanceof JsonObject) 
13393          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13394      }
13395    };
13396    if (json.has("adjudication")) {
13397      JsonArray array = json.getAsJsonArray("adjudication");
13398      for (int i = 0; i < array.size(); i++) {
13399        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
13400      }
13401    };
13402  }
13403
13404  protected ExplanationOfBenefit.TotalComponent parseExplanationOfBenefitTotalComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13405    ExplanationOfBenefit.TotalComponent res = new ExplanationOfBenefit.TotalComponent();
13406    parseExplanationOfBenefitTotalComponentProperties(json, owner, res);
13407    return res;
13408  }
13409
13410  protected void parseExplanationOfBenefitTotalComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.TotalComponent res) throws IOException, FHIRFormatError {
13411    parseBackboneElementProperties(json, res);
13412    if (json.has("category"))
13413      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
13414    if (json.has("amount"))
13415      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
13416  }
13417
13418  protected ExplanationOfBenefit.PaymentComponent parseExplanationOfBenefitPaymentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13419    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
13420    parseExplanationOfBenefitPaymentComponentProperties(json, owner, res);
13421    return res;
13422  }
13423
13424  protected void parseExplanationOfBenefitPaymentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PaymentComponent res) throws IOException, FHIRFormatError {
13425    parseBackboneElementProperties(json, res);
13426    if (json.has("type"))
13427      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13428    if (json.has("adjustment"))
13429      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
13430    if (json.has("adjustmentReason"))
13431      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
13432    if (json.has("date"))
13433      res.setDateElement(parseDate(json.get("date").getAsString()));
13434    if (json.has("_date"))
13435      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13436    if (json.has("amount"))
13437      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
13438    if (json.has("identifier"))
13439      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
13440  }
13441
13442  protected ExplanationOfBenefit.NoteComponent parseExplanationOfBenefitNoteComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13443    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
13444    parseExplanationOfBenefitNoteComponentProperties(json, owner, res);
13445    return res;
13446  }
13447
13448  protected void parseExplanationOfBenefitNoteComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.NoteComponent res) throws IOException, FHIRFormatError {
13449    parseBackboneElementProperties(json, res);
13450    if (json.has("number"))
13451      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
13452    if (json.has("_number"))
13453      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
13454    if (json.has("type"))
13455      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
13456    if (json.has("_type"))
13457      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13458    if (json.has("text"))
13459      res.setTextElement(parseString(json.get("text").getAsString()));
13460    if (json.has("_text"))
13461      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
13462    if (json.has("language"))
13463      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
13464  }
13465
13466  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13467    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
13468    parseExplanationOfBenefitBenefitBalanceComponentProperties(json, owner, res);
13469    return res;
13470  }
13471
13472  protected void parseExplanationOfBenefitBenefitBalanceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitBalanceComponent res) throws IOException, FHIRFormatError {
13473    parseBackboneElementProperties(json, res);
13474    if (json.has("category"))
13475      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
13476    if (json.has("excluded"))
13477      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
13478    if (json.has("_excluded"))
13479      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
13480    if (json.has("name"))
13481      res.setNameElement(parseString(json.get("name").getAsString()));
13482    if (json.has("_name"))
13483      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13484    if (json.has("description"))
13485      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13486    if (json.has("_description"))
13487      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13488    if (json.has("network"))
13489      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
13490    if (json.has("unit"))
13491      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
13492    if (json.has("term"))
13493      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
13494    if (json.has("financial")) {
13495      JsonArray array = json.getAsJsonArray("financial");
13496      for (int i = 0; i < array.size(); i++) {
13497        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(array.get(i).getAsJsonObject(), owner));
13498      }
13499    };
13500  }
13501
13502  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
13503    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
13504    parseExplanationOfBenefitBenefitComponentProperties(json, owner, res);
13505    return res;
13506  }
13507
13508  protected void parseExplanationOfBenefitBenefitComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitComponent res) throws IOException, FHIRFormatError {
13509    parseBackboneElementProperties(json, res);
13510    if (json.has("type"))
13511      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13512    Type allowed = parseType("allowed", json);
13513    if (allowed != null)
13514      res.setAllowed(allowed);
13515    Type used = parseType("used", json);
13516    if (used != null)
13517      res.setUsed(used);
13518  }
13519
13520  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
13521    FamilyMemberHistory res = new FamilyMemberHistory();
13522    parseFamilyMemberHistoryProperties(json, res);
13523    return res;
13524  }
13525
13526  protected void parseFamilyMemberHistoryProperties(JsonObject json, FamilyMemberHistory res) throws IOException, FHIRFormatError {
13527    parseDomainResourceProperties(json, res);
13528    if (json.has("identifier")) {
13529      JsonArray array = json.getAsJsonArray("identifier");
13530      for (int i = 0; i < array.size(); i++) {
13531        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13532      }
13533    };
13534    if (json.has("instantiatesCanonical")) {
13535      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
13536      for (int i = 0; i < array.size(); i++) {
13537        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
13538      }
13539    };
13540    if (json.has("_instantiatesCanonical")) {
13541      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
13542      for (int i = 0; i < array.size(); i++) {
13543        if (i == res.getInstantiatesCanonical().size())
13544          res.getInstantiatesCanonical().add(parseCanonical(null));
13545        if (array.get(i) instanceof JsonObject) 
13546          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
13547      }
13548    };
13549    if (json.has("instantiatesUri")) {
13550      JsonArray array = json.getAsJsonArray("instantiatesUri");
13551      for (int i = 0; i < array.size(); i++) {
13552        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
13553      }
13554    };
13555    if (json.has("_instantiatesUri")) {
13556      JsonArray array = json.getAsJsonArray("_instantiatesUri");
13557      for (int i = 0; i < array.size(); i++) {
13558        if (i == res.getInstantiatesUri().size())
13559          res.getInstantiatesUri().add(parseUri(null));
13560        if (array.get(i) instanceof JsonObject) 
13561          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
13562      }
13563    };
13564    if (json.has("status"))
13565      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
13566    if (json.has("_status"))
13567      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13568    if (json.has("dataAbsentReason"))
13569      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
13570    if (json.has("patient"))
13571      res.setPatient(parseReference(json.getAsJsonObject("patient")));
13572    if (json.has("date"))
13573      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13574    if (json.has("_date"))
13575      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13576    if (json.has("name"))
13577      res.setNameElement(parseString(json.get("name").getAsString()));
13578    if (json.has("_name"))
13579      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13580    if (json.has("relationship"))
13581      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
13582    if (json.has("sex"))
13583      res.setSex(parseCodeableConcept(json.getAsJsonObject("sex")));
13584    Type born = parseType("born", json);
13585    if (born != null)
13586      res.setBorn(born);
13587    Type age = parseType("age", json);
13588    if (age != null)
13589      res.setAge(age);
13590    if (json.has("estimatedAge"))
13591      res.setEstimatedAgeElement(parseBoolean(json.get("estimatedAge").getAsBoolean()));
13592    if (json.has("_estimatedAge"))
13593      parseElementProperties(json.getAsJsonObject("_estimatedAge"), res.getEstimatedAgeElement());
13594    Type deceased = parseType("deceased", json);
13595    if (deceased != null)
13596      res.setDeceased(deceased);
13597    if (json.has("reasonCode")) {
13598      JsonArray array = json.getAsJsonArray("reasonCode");
13599      for (int i = 0; i < array.size(); i++) {
13600        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13601      }
13602    };
13603    if (json.has("reasonReference")) {
13604      JsonArray array = json.getAsJsonArray("reasonReference");
13605      for (int i = 0; i < array.size(); i++) {
13606        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
13607      }
13608    };
13609    if (json.has("note")) {
13610      JsonArray array = json.getAsJsonArray("note");
13611      for (int i = 0; i < array.size(); i++) {
13612        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13613      }
13614    };
13615    if (json.has("condition")) {
13616      JsonArray array = json.getAsJsonArray("condition");
13617      for (int i = 0; i < array.size(); i++) {
13618        res.getCondition().add(parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject(), res));
13619      }
13620    };
13621    if (json.has("procedure")) {
13622      JsonArray array = json.getAsJsonArray("procedure");
13623      for (int i = 0; i < array.size(); i++) {
13624        res.getProcedure().add(parseFamilyMemberHistoryFamilyMemberHistoryProcedureComponent(array.get(i).getAsJsonObject(), res));
13625      }
13626    };
13627  }
13628
13629  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(JsonObject json, FamilyMemberHistory owner) throws IOException, FHIRFormatError {
13630    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
13631    parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(json, owner, res);
13632    return res;
13633  }
13634
13635  protected void parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(JsonObject json, FamilyMemberHistory owner, FamilyMemberHistory.FamilyMemberHistoryConditionComponent res) throws IOException, FHIRFormatError {
13636    parseBackboneElementProperties(json, res);
13637    if (json.has("code"))
13638      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13639    if (json.has("outcome"))
13640      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
13641    if (json.has("contributedToDeath"))
13642      res.setContributedToDeathElement(parseBoolean(json.get("contributedToDeath").getAsBoolean()));
13643    if (json.has("_contributedToDeath"))
13644      parseElementProperties(json.getAsJsonObject("_contributedToDeath"), res.getContributedToDeathElement());
13645    Type onset = parseType("onset", json);
13646    if (onset != null)
13647      res.setOnset(onset);
13648    if (json.has("note")) {
13649      JsonArray array = json.getAsJsonArray("note");
13650      for (int i = 0; i < array.size(); i++) {
13651        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13652      }
13653    };
13654  }
13655
13656  protected FamilyMemberHistory.FamilyMemberHistoryProcedureComponent parseFamilyMemberHistoryFamilyMemberHistoryProcedureComponent(JsonObject json, FamilyMemberHistory owner) throws IOException, FHIRFormatError {
13657    FamilyMemberHistory.FamilyMemberHistoryProcedureComponent res = new FamilyMemberHistory.FamilyMemberHistoryProcedureComponent();
13658    parseFamilyMemberHistoryFamilyMemberHistoryProcedureComponentProperties(json, owner, res);
13659    return res;
13660  }
13661
13662  protected void parseFamilyMemberHistoryFamilyMemberHistoryProcedureComponentProperties(JsonObject json, FamilyMemberHistory owner, FamilyMemberHistory.FamilyMemberHistoryProcedureComponent res) throws IOException, FHIRFormatError {
13663    parseBackboneElementProperties(json, res);
13664    if (json.has("code"))
13665      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13666    if (json.has("outcome"))
13667      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
13668    if (json.has("contributedToDeath"))
13669      res.setContributedToDeathElement(parseBoolean(json.get("contributedToDeath").getAsBoolean()));
13670    if (json.has("_contributedToDeath"))
13671      parseElementProperties(json.getAsJsonObject("_contributedToDeath"), res.getContributedToDeathElement());
13672    Type performed = parseType("performed", json);
13673    if (performed != null)
13674      res.setPerformed(performed);
13675    if (json.has("note")) {
13676      JsonArray array = json.getAsJsonArray("note");
13677      for (int i = 0; i < array.size(); i++) {
13678        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13679      }
13680    };
13681  }
13682
13683  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
13684    Flag res = new Flag();
13685    parseFlagProperties(json, res);
13686    return res;
13687  }
13688
13689  protected void parseFlagProperties(JsonObject json, Flag res) throws IOException, FHIRFormatError {
13690    parseDomainResourceProperties(json, res);
13691    if (json.has("identifier")) {
13692      JsonArray array = json.getAsJsonArray("identifier");
13693      for (int i = 0; i < array.size(); i++) {
13694        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13695      }
13696    };
13697    if (json.has("status"))
13698      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
13699    if (json.has("_status"))
13700      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13701    if (json.has("category")) {
13702      JsonArray array = json.getAsJsonArray("category");
13703      for (int i = 0; i < array.size(); i++) {
13704        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13705      }
13706    };
13707    if (json.has("code"))
13708      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13709    if (json.has("subject"))
13710      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13711    if (json.has("period"))
13712      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
13713    if (json.has("encounter"))
13714      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
13715    if (json.has("author"))
13716      res.setAuthor(parseReference(json.getAsJsonObject("author")));
13717  }
13718
13719  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
13720    Goal res = new Goal();
13721    parseGoalProperties(json, res);
13722    return res;
13723  }
13724
13725  protected void parseGoalProperties(JsonObject json, Goal res) throws IOException, FHIRFormatError {
13726    parseDomainResourceProperties(json, res);
13727    if (json.has("identifier")) {
13728      JsonArray array = json.getAsJsonArray("identifier");
13729      for (int i = 0; i < array.size(); i++) {
13730        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13731      }
13732    };
13733    if (json.has("lifecycleStatus"))
13734      res.setLifecycleStatusElement(parseEnumeration(json.get("lifecycleStatus").getAsString(), Goal.GoalLifecycleStatus.NULL, new Goal.GoalLifecycleStatusEnumFactory()));
13735    if (json.has("_lifecycleStatus"))
13736      parseElementProperties(json.getAsJsonObject("_lifecycleStatus"), res.getLifecycleStatusElement());
13737    if (json.has("achievementStatus"))
13738      res.setAchievementStatus(parseCodeableConcept(json.getAsJsonObject("achievementStatus")));
13739    if (json.has("category")) {
13740      JsonArray array = json.getAsJsonArray("category");
13741      for (int i = 0; i < array.size(); i++) {
13742        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13743      }
13744    };
13745    if (json.has("continuous"))
13746      res.setContinuousElement(parseBoolean(json.get("continuous").getAsBoolean()));
13747    if (json.has("_continuous"))
13748      parseElementProperties(json.getAsJsonObject("_continuous"), res.getContinuousElement());
13749    if (json.has("priority"))
13750      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
13751    if (json.has("description"))
13752      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
13753    if (json.has("subject"))
13754      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13755    Type start = parseType("start", json);
13756    if (start != null)
13757      res.setStart(start);
13758    if (json.has("target")) {
13759      JsonArray array = json.getAsJsonArray("target");
13760      for (int i = 0; i < array.size(); i++) {
13761        res.getTarget().add(parseGoalGoalTargetComponent(array.get(i).getAsJsonObject(), res));
13762      }
13763    };
13764    if (json.has("statusDate"))
13765      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
13766    if (json.has("_statusDate"))
13767      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
13768    if (json.has("statusReason"))
13769      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
13770    if (json.has("_statusReason"))
13771      parseElementProperties(json.getAsJsonObject("_statusReason"), res.getStatusReasonElement());
13772    if (json.has("expressedBy"))
13773      res.setExpressedBy(parseReference(json.getAsJsonObject("expressedBy")));
13774    if (json.has("addresses")) {
13775      JsonArray array = json.getAsJsonArray("addresses");
13776      for (int i = 0; i < array.size(); i++) {
13777        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
13778      }
13779    };
13780    if (json.has("note")) {
13781      JsonArray array = json.getAsJsonArray("note");
13782      for (int i = 0; i < array.size(); i++) {
13783        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13784      }
13785    };
13786    if (json.has("outcomeCode")) {
13787      JsonArray array = json.getAsJsonArray("outcomeCode");
13788      for (int i = 0; i < array.size(); i++) {
13789        res.getOutcomeCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13790      }
13791    };
13792    if (json.has("outcomeReference")) {
13793      JsonArray array = json.getAsJsonArray("outcomeReference");
13794      for (int i = 0; i < array.size(); i++) {
13795        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
13796      }
13797    };
13798  }
13799
13800  protected Goal.GoalTargetComponent parseGoalGoalTargetComponent(JsonObject json, Goal owner) throws IOException, FHIRFormatError {
13801    Goal.GoalTargetComponent res = new Goal.GoalTargetComponent();
13802    parseGoalGoalTargetComponentProperties(json, owner, res);
13803    return res;
13804  }
13805
13806  protected void parseGoalGoalTargetComponentProperties(JsonObject json, Goal owner, Goal.GoalTargetComponent res) throws IOException, FHIRFormatError {
13807    parseBackboneElementProperties(json, res);
13808    if (json.has("measure"))
13809      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
13810    Type detail = parseType("detail", json);
13811    if (detail != null)
13812      res.setDetail(detail);
13813    Type due = parseType("due", json);
13814    if (due != null)
13815      res.setDue(due);
13816  }
13817
13818  protected GraphDefinition parseGraphDefinition(JsonObject json) throws IOException, FHIRFormatError {
13819    GraphDefinition res = new GraphDefinition();
13820    parseGraphDefinitionProperties(json, res);
13821    return res;
13822  }
13823
13824  protected void parseGraphDefinitionProperties(JsonObject json, GraphDefinition res) throws IOException, FHIRFormatError {
13825    parseDomainResourceProperties(json, res);
13826    if (json.has("url"))
13827      res.setUrlElement(parseUri(json.get("url").getAsString()));
13828    if (json.has("_url"))
13829      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
13830    if (json.has("version"))
13831      res.setVersionElement(parseString(json.get("version").getAsString()));
13832    if (json.has("_version"))
13833      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
13834    if (json.has("name"))
13835      res.setNameElement(parseString(json.get("name").getAsString()));
13836    if (json.has("_name"))
13837      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13838    if (json.has("status"))
13839      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
13840    if (json.has("_status"))
13841      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13842    if (json.has("experimental"))
13843      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
13844    if (json.has("_experimental"))
13845      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
13846    if (json.has("date"))
13847      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13848    if (json.has("_date"))
13849      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13850    if (json.has("publisher"))
13851      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
13852    if (json.has("_publisher"))
13853      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
13854    if (json.has("contact")) {
13855      JsonArray array = json.getAsJsonArray("contact");
13856      for (int i = 0; i < array.size(); i++) {
13857        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
13858      }
13859    };
13860    if (json.has("description"))
13861      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13862    if (json.has("_description"))
13863      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13864    if (json.has("useContext")) {
13865      JsonArray array = json.getAsJsonArray("useContext");
13866      for (int i = 0; i < array.size(); i++) {
13867        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
13868      }
13869    };
13870    if (json.has("jurisdiction")) {
13871      JsonArray array = json.getAsJsonArray("jurisdiction");
13872      for (int i = 0; i < array.size(); i++) {
13873        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13874      }
13875    };
13876    if (json.has("purpose"))
13877      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
13878    if (json.has("_purpose"))
13879      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
13880    if (json.has("start"))
13881      res.setStartElement(parseCode(json.get("start").getAsString()));
13882    if (json.has("_start"))
13883      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
13884    if (json.has("profile"))
13885      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
13886    if (json.has("_profile"))
13887      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
13888    if (json.has("link")) {
13889      JsonArray array = json.getAsJsonArray("link");
13890      for (int i = 0; i < array.size(); i++) {
13891        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), res));
13892      }
13893    };
13894  }
13895
13896  protected GraphDefinition.GraphDefinitionLinkComponent parseGraphDefinitionGraphDefinitionLinkComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
13897    GraphDefinition.GraphDefinitionLinkComponent res = new GraphDefinition.GraphDefinitionLinkComponent();
13898    parseGraphDefinitionGraphDefinitionLinkComponentProperties(json, owner, res);
13899    return res;
13900  }
13901
13902  protected void parseGraphDefinitionGraphDefinitionLinkComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkComponent res) throws IOException, FHIRFormatError {
13903    parseBackboneElementProperties(json, res);
13904    if (json.has("path"))
13905      res.setPathElement(parseString(json.get("path").getAsString()));
13906    if (json.has("_path"))
13907      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
13908    if (json.has("sliceName"))
13909      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
13910    if (json.has("_sliceName"))
13911      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
13912    if (json.has("min"))
13913      res.setMinElement(parseInteger(json.get("min").getAsLong()));
13914    if (json.has("_min"))
13915      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
13916    if (json.has("max"))
13917      res.setMaxElement(parseString(json.get("max").getAsString()));
13918    if (json.has("_max"))
13919      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
13920    if (json.has("description"))
13921      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13922    if (json.has("_description"))
13923      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13924    if (json.has("target")) {
13925      JsonArray array = json.getAsJsonArray("target");
13926      for (int i = 0; i < array.size(); i++) {
13927        res.getTarget().add(parseGraphDefinitionGraphDefinitionLinkTargetComponent(array.get(i).getAsJsonObject(), owner));
13928      }
13929    };
13930  }
13931
13932  protected GraphDefinition.GraphDefinitionLinkTargetComponent parseGraphDefinitionGraphDefinitionLinkTargetComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
13933    GraphDefinition.GraphDefinitionLinkTargetComponent res = new GraphDefinition.GraphDefinitionLinkTargetComponent();
13934    parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(json, owner, res);
13935    return res;
13936  }
13937
13938  protected void parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetComponent res) throws IOException, FHIRFormatError {
13939    parseBackboneElementProperties(json, res);
13940    if (json.has("type"))
13941      res.setTypeElement(parseCode(json.get("type").getAsString()));
13942    if (json.has("_type"))
13943      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13944    if (json.has("params"))
13945      res.setParamsElement(parseString(json.get("params").getAsString()));
13946    if (json.has("_params"))
13947      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
13948    if (json.has("profile"))
13949      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
13950    if (json.has("_profile"))
13951      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
13952    if (json.has("compartment")) {
13953      JsonArray array = json.getAsJsonArray("compartment");
13954      for (int i = 0; i < array.size(); i++) {
13955        res.getCompartment().add(parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(array.get(i).getAsJsonObject(), owner));
13956      }
13957    };
13958    if (json.has("link")) {
13959      JsonArray array = json.getAsJsonArray("link");
13960      for (int i = 0; i < array.size(); i++) {
13961        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), owner));
13962      }
13963    };
13964  }
13965
13966  protected GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
13967    GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res = new GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent();
13968    parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(json, owner, res);
13969    return res;
13970  }
13971
13972  protected void parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res) throws IOException, FHIRFormatError {
13973    parseBackboneElementProperties(json, res);
13974    if (json.has("use"))
13975      res.setUseElement(parseEnumeration(json.get("use").getAsString(), GraphDefinition.GraphCompartmentUse.NULL, new GraphDefinition.GraphCompartmentUseEnumFactory()));
13976    if (json.has("_use"))
13977      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
13978    if (json.has("code"))
13979      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), GraphDefinition.CompartmentCode.NULL, new GraphDefinition.CompartmentCodeEnumFactory()));
13980    if (json.has("_code"))
13981      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
13982    if (json.has("rule"))
13983      res.setRuleElement(parseEnumeration(json.get("rule").getAsString(), GraphDefinition.GraphCompartmentRule.NULL, new GraphDefinition.GraphCompartmentRuleEnumFactory()));
13984    if (json.has("_rule"))
13985      parseElementProperties(json.getAsJsonObject("_rule"), res.getRuleElement());
13986    if (json.has("expression"))
13987      res.setExpressionElement(parseString(json.get("expression").getAsString()));
13988    if (json.has("_expression"))
13989      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
13990    if (json.has("description"))
13991      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13992    if (json.has("_description"))
13993      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13994  }
13995
13996  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
13997    Group res = new Group();
13998    parseGroupProperties(json, res);
13999    return res;
14000  }
14001
14002  protected void parseGroupProperties(JsonObject json, Group res) throws IOException, FHIRFormatError {
14003    parseDomainResourceProperties(json, res);
14004    if (json.has("identifier")) {
14005      JsonArray array = json.getAsJsonArray("identifier");
14006      for (int i = 0; i < array.size(); i++) {
14007        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14008      }
14009    };
14010    if (json.has("active"))
14011      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14012    if (json.has("_active"))
14013      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
14014    if (json.has("type"))
14015      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
14016    if (json.has("_type"))
14017      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
14018    if (json.has("actual"))
14019      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
14020    if (json.has("_actual"))
14021      parseElementProperties(json.getAsJsonObject("_actual"), res.getActualElement());
14022    if (json.has("code"))
14023      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14024    if (json.has("name"))
14025      res.setNameElement(parseString(json.get("name").getAsString()));
14026    if (json.has("_name"))
14027      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14028    if (json.has("quantity"))
14029      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
14030    if (json.has("_quantity"))
14031      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
14032    if (json.has("managingEntity"))
14033      res.setManagingEntity(parseReference(json.getAsJsonObject("managingEntity")));
14034    if (json.has("characteristic")) {
14035      JsonArray array = json.getAsJsonArray("characteristic");
14036      for (int i = 0; i < array.size(); i++) {
14037        res.getCharacteristic().add(parseGroupGroupCharacteristicComponent(array.get(i).getAsJsonObject(), res));
14038      }
14039    };
14040    if (json.has("member")) {
14041      JsonArray array = json.getAsJsonArray("member");
14042      for (int i = 0; i < array.size(); i++) {
14043        res.getMember().add(parseGroupGroupMemberComponent(array.get(i).getAsJsonObject(), res));
14044      }
14045    };
14046  }
14047
14048  protected Group.GroupCharacteristicComponent parseGroupGroupCharacteristicComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
14049    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
14050    parseGroupGroupCharacteristicComponentProperties(json, owner, res);
14051    return res;
14052  }
14053
14054  protected void parseGroupGroupCharacteristicComponentProperties(JsonObject json, Group owner, Group.GroupCharacteristicComponent res) throws IOException, FHIRFormatError {
14055    parseBackboneElementProperties(json, res);
14056    if (json.has("code"))
14057      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14058    Type value = parseType("value", json);
14059    if (value != null)
14060      res.setValue(value);
14061    if (json.has("exclude"))
14062      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
14063    if (json.has("_exclude"))
14064      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
14065    if (json.has("period"))
14066      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
14067  }
14068
14069  protected Group.GroupMemberComponent parseGroupGroupMemberComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
14070    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
14071    parseGroupGroupMemberComponentProperties(json, owner, res);
14072    return res;
14073  }
14074
14075  protected void parseGroupGroupMemberComponentProperties(JsonObject json, Group owner, Group.GroupMemberComponent res) throws IOException, FHIRFormatError {
14076    parseBackboneElementProperties(json, res);
14077    if (json.has("entity"))
14078      res.setEntity(parseReference(json.getAsJsonObject("entity")));
14079    if (json.has("period"))
14080      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
14081    if (json.has("inactive"))
14082      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
14083    if (json.has("_inactive"))
14084      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
14085  }
14086
14087  protected GuidanceResponse parseGuidanceResponse(JsonObject json) throws IOException, FHIRFormatError {
14088    GuidanceResponse res = new GuidanceResponse();
14089    parseGuidanceResponseProperties(json, res);
14090    return res;
14091  }
14092
14093  protected void parseGuidanceResponseProperties(JsonObject json, GuidanceResponse res) throws IOException, FHIRFormatError {
14094    parseDomainResourceProperties(json, res);
14095    if (json.has("requestIdentifier"))
14096      res.setRequestIdentifier(parseIdentifier(json.getAsJsonObject("requestIdentifier")));
14097    if (json.has("identifier")) {
14098      JsonArray array = json.getAsJsonArray("identifier");
14099      for (int i = 0; i < array.size(); i++) {
14100        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14101      }
14102    };
14103    Type module = parseType("module", json);
14104    if (module != null)
14105      res.setModule(module);
14106    if (json.has("status"))
14107      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
14108    if (json.has("_status"))
14109      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14110    if (json.has("subject"))
14111      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14112    if (json.has("encounter"))
14113      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
14114    if (json.has("occurrenceDateTime"))
14115      res.setOccurrenceDateTimeElement(parseDateTime(json.get("occurrenceDateTime").getAsString()));
14116    if (json.has("_occurrenceDateTime"))
14117      parseElementProperties(json.getAsJsonObject("_occurrenceDateTime"), res.getOccurrenceDateTimeElement());
14118    if (json.has("performer"))
14119      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
14120    if (json.has("reasonCode")) {
14121      JsonArray array = json.getAsJsonArray("reasonCode");
14122      for (int i = 0; i < array.size(); i++) {
14123        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14124      }
14125    };
14126    if (json.has("reasonReference")) {
14127      JsonArray array = json.getAsJsonArray("reasonReference");
14128      for (int i = 0; i < array.size(); i++) {
14129        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
14130      }
14131    };
14132    if (json.has("note")) {
14133      JsonArray array = json.getAsJsonArray("note");
14134      for (int i = 0; i < array.size(); i++) {
14135        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14136      }
14137    };
14138    if (json.has("evaluationMessage")) {
14139      JsonArray array = json.getAsJsonArray("evaluationMessage");
14140      for (int i = 0; i < array.size(); i++) {
14141        res.getEvaluationMessage().add(parseReference(array.get(i).getAsJsonObject()));
14142      }
14143    };
14144    if (json.has("outputParameters"))
14145      res.setOutputParameters(parseReference(json.getAsJsonObject("outputParameters")));
14146    if (json.has("result"))
14147      res.setResult(parseReference(json.getAsJsonObject("result")));
14148    if (json.has("dataRequirement")) {
14149      JsonArray array = json.getAsJsonArray("dataRequirement");
14150      for (int i = 0; i < array.size(); i++) {
14151        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
14152      }
14153    };
14154  }
14155
14156  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
14157    HealthcareService res = new HealthcareService();
14158    parseHealthcareServiceProperties(json, res);
14159    return res;
14160  }
14161
14162  protected void parseHealthcareServiceProperties(JsonObject json, HealthcareService res) throws IOException, FHIRFormatError {
14163    parseDomainResourceProperties(json, res);
14164    if (json.has("identifier")) {
14165      JsonArray array = json.getAsJsonArray("identifier");
14166      for (int i = 0; i < array.size(); i++) {
14167        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14168      }
14169    };
14170    if (json.has("active"))
14171      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14172    if (json.has("_active"))
14173      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
14174    if (json.has("providedBy"))
14175      res.setProvidedBy(parseReference(json.getAsJsonObject("providedBy")));
14176    if (json.has("category")) {
14177      JsonArray array = json.getAsJsonArray("category");
14178      for (int i = 0; i < array.size(); i++) {
14179        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14180      }
14181    };
14182    if (json.has("type")) {
14183      JsonArray array = json.getAsJsonArray("type");
14184      for (int i = 0; i < array.size(); i++) {
14185        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14186      }
14187    };
14188    if (json.has("specialty")) {
14189      JsonArray array = json.getAsJsonArray("specialty");
14190      for (int i = 0; i < array.size(); i++) {
14191        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14192      }
14193    };
14194    if (json.has("location")) {
14195      JsonArray array = json.getAsJsonArray("location");
14196      for (int i = 0; i < array.size(); i++) {
14197        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
14198      }
14199    };
14200    if (json.has("name"))
14201      res.setNameElement(parseString(json.get("name").getAsString()));
14202    if (json.has("_name"))
14203      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14204    if (json.has("comment"))
14205      res.setCommentElement(parseString(json.get("comment").getAsString()));
14206    if (json.has("_comment"))
14207      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
14208    if (json.has("extraDetails"))
14209      res.setExtraDetailsElement(parseMarkdown(json.get("extraDetails").getAsString()));
14210    if (json.has("_extraDetails"))
14211      parseElementProperties(json.getAsJsonObject("_extraDetails"), res.getExtraDetailsElement());
14212    if (json.has("photo"))
14213      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
14214    if (json.has("telecom")) {
14215      JsonArray array = json.getAsJsonArray("telecom");
14216      for (int i = 0; i < array.size(); i++) {
14217        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14218      }
14219    };
14220    if (json.has("coverageArea")) {
14221      JsonArray array = json.getAsJsonArray("coverageArea");
14222      for (int i = 0; i < array.size(); i++) {
14223        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
14224      }
14225    };
14226    if (json.has("serviceProvisionCode")) {
14227      JsonArray array = json.getAsJsonArray("serviceProvisionCode");
14228      for (int i = 0; i < array.size(); i++) {
14229        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14230      }
14231    };
14232    if (json.has("eligibility")) {
14233      JsonArray array = json.getAsJsonArray("eligibility");
14234      for (int i = 0; i < array.size(); i++) {
14235        res.getEligibility().add(parseHealthcareServiceHealthcareServiceEligibilityComponent(array.get(i).getAsJsonObject(), res));
14236      }
14237    };
14238    if (json.has("program")) {
14239      JsonArray array = json.getAsJsonArray("program");
14240      for (int i = 0; i < array.size(); i++) {
14241        res.getProgram().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14242      }
14243    };
14244    if (json.has("characteristic")) {
14245      JsonArray array = json.getAsJsonArray("characteristic");
14246      for (int i = 0; i < array.size(); i++) {
14247        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14248      }
14249    };
14250    if (json.has("communication")) {
14251      JsonArray array = json.getAsJsonArray("communication");
14252      for (int i = 0; i < array.size(); i++) {
14253        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14254      }
14255    };
14256    if (json.has("referralMethod")) {
14257      JsonArray array = json.getAsJsonArray("referralMethod");
14258      for (int i = 0; i < array.size(); i++) {
14259        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14260      }
14261    };
14262    if (json.has("appointmentRequired"))
14263      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
14264    if (json.has("_appointmentRequired"))
14265      parseElementProperties(json.getAsJsonObject("_appointmentRequired"), res.getAppointmentRequiredElement());
14266    if (json.has("availableTime")) {
14267      JsonArray array = json.getAsJsonArray("availableTime");
14268      for (int i = 0; i < array.size(); i++) {
14269        res.getAvailableTime().add(parseHealthcareServiceHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
14270      }
14271    };
14272    if (json.has("notAvailable")) {
14273      JsonArray array = json.getAsJsonArray("notAvailable");
14274      for (int i = 0; i < array.size(); i++) {
14275        res.getNotAvailable().add(parseHealthcareServiceHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject(), res));
14276      }
14277    };
14278    if (json.has("availabilityExceptions"))
14279      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
14280    if (json.has("_availabilityExceptions"))
14281      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
14282    if (json.has("endpoint")) {
14283      JsonArray array = json.getAsJsonArray("endpoint");
14284      for (int i = 0; i < array.size(); i++) {
14285        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
14286      }
14287    };
14288  }
14289
14290  protected HealthcareService.HealthcareServiceEligibilityComponent parseHealthcareServiceHealthcareServiceEligibilityComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
14291    HealthcareService.HealthcareServiceEligibilityComponent res = new HealthcareService.HealthcareServiceEligibilityComponent();
14292    parseHealthcareServiceHealthcareServiceEligibilityComponentProperties(json, owner, res);
14293    return res;
14294  }
14295
14296  protected void parseHealthcareServiceHealthcareServiceEligibilityComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceEligibilityComponent res) throws IOException, FHIRFormatError {
14297    parseBackboneElementProperties(json, res);
14298    if (json.has("code"))
14299      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14300    if (json.has("comment"))
14301      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
14302    if (json.has("_comment"))
14303      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
14304  }
14305
14306  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceHealthcareServiceAvailableTimeComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
14307    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
14308    parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(json, owner, res);
14309    return res;
14310  }
14311
14312  protected void parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceAvailableTimeComponent res) throws IOException, FHIRFormatError {
14313    parseBackboneElementProperties(json, res);
14314    if (json.has("daysOfWeek")) {
14315      JsonArray array = json.getAsJsonArray("daysOfWeek");
14316      for (int i = 0; i < array.size(); i++) {
14317        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
14318      }
14319    };
14320    if (json.has("_daysOfWeek")) {
14321      JsonArray array = json.getAsJsonArray("_daysOfWeek");
14322      for (int i = 0; i < array.size(); i++) {
14323        if (i == res.getDaysOfWeek().size())
14324          res.getDaysOfWeek().add(parseEnumeration(null, HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
14325        if (array.get(i) instanceof JsonObject) 
14326          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
14327      }
14328    };
14329    if (json.has("allDay"))
14330      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
14331    if (json.has("_allDay"))
14332      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
14333    if (json.has("availableStartTime"))
14334      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
14335    if (json.has("_availableStartTime"))
14336      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
14337    if (json.has("availableEndTime"))
14338      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
14339    if (json.has("_availableEndTime"))
14340      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
14341  }
14342
14343  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceHealthcareServiceNotAvailableComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
14344    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
14345    parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(json, owner, res);
14346    return res;
14347  }
14348
14349  protected void parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceNotAvailableComponent res) throws IOException, FHIRFormatError {
14350    parseBackboneElementProperties(json, res);
14351    if (json.has("description"))
14352      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14353    if (json.has("_description"))
14354      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14355    if (json.has("during"))
14356      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
14357  }
14358
14359  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
14360    ImagingStudy res = new ImagingStudy();
14361    parseImagingStudyProperties(json, res);
14362    return res;
14363  }
14364
14365  protected void parseImagingStudyProperties(JsonObject json, ImagingStudy res) throws IOException, FHIRFormatError {
14366    parseDomainResourceProperties(json, res);
14367    if (json.has("identifier")) {
14368      JsonArray array = json.getAsJsonArray("identifier");
14369      for (int i = 0; i < array.size(); i++) {
14370        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14371      }
14372    };
14373    if (json.has("status"))
14374      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImagingStudy.ImagingStudyStatus.NULL, new ImagingStudy.ImagingStudyStatusEnumFactory()));
14375    if (json.has("_status"))
14376      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14377    if (json.has("modality")) {
14378      JsonArray array = json.getAsJsonArray("modality");
14379      for (int i = 0; i < array.size(); i++) {
14380        res.getModality().add(parseCoding(array.get(i).getAsJsonObject()));
14381      }
14382    };
14383    if (json.has("subject"))
14384      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14385    if (json.has("encounter"))
14386      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
14387    if (json.has("started"))
14388      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
14389    if (json.has("_started"))
14390      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
14391    if (json.has("basedOn")) {
14392      JsonArray array = json.getAsJsonArray("basedOn");
14393      for (int i = 0; i < array.size(); i++) {
14394        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
14395      }
14396    };
14397    if (json.has("referrer"))
14398      res.setReferrer(parseReference(json.getAsJsonObject("referrer")));
14399    if (json.has("interpreter")) {
14400      JsonArray array = json.getAsJsonArray("interpreter");
14401      for (int i = 0; i < array.size(); i++) {
14402        res.getInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
14403      }
14404    };
14405    if (json.has("endpoint")) {
14406      JsonArray array = json.getAsJsonArray("endpoint");
14407      for (int i = 0; i < array.size(); i++) {
14408        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
14409      }
14410    };
14411    if (json.has("numberOfSeries"))
14412      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
14413    if (json.has("_numberOfSeries"))
14414      parseElementProperties(json.getAsJsonObject("_numberOfSeries"), res.getNumberOfSeriesElement());
14415    if (json.has("numberOfInstances"))
14416      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
14417    if (json.has("_numberOfInstances"))
14418      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
14419    if (json.has("procedureReference"))
14420      res.setProcedureReference(parseReference(json.getAsJsonObject("procedureReference")));
14421    if (json.has("procedureCode")) {
14422      JsonArray array = json.getAsJsonArray("procedureCode");
14423      for (int i = 0; i < array.size(); i++) {
14424        res.getProcedureCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14425      }
14426    };
14427    if (json.has("location"))
14428      res.setLocation(parseReference(json.getAsJsonObject("location")));
14429    if (json.has("reasonCode")) {
14430      JsonArray array = json.getAsJsonArray("reasonCode");
14431      for (int i = 0; i < array.size(); i++) {
14432        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14433      }
14434    };
14435    if (json.has("reasonReference")) {
14436      JsonArray array = json.getAsJsonArray("reasonReference");
14437      for (int i = 0; i < array.size(); i++) {
14438        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
14439      }
14440    };
14441    if (json.has("note")) {
14442      JsonArray array = json.getAsJsonArray("note");
14443      for (int i = 0; i < array.size(); i++) {
14444        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14445      }
14446    };
14447    if (json.has("description"))
14448      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14449    if (json.has("_description"))
14450      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14451    if (json.has("series")) {
14452      JsonArray array = json.getAsJsonArray("series");
14453      for (int i = 0; i < array.size(); i++) {
14454        res.getSeries().add(parseImagingStudyImagingStudySeriesComponent(array.get(i).getAsJsonObject(), res));
14455      }
14456    };
14457  }
14458
14459  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudyImagingStudySeriesComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
14460    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
14461    parseImagingStudyImagingStudySeriesComponentProperties(json, owner, res);
14462    return res;
14463  }
14464
14465  protected void parseImagingStudyImagingStudySeriesComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesComponent res) throws IOException, FHIRFormatError {
14466    parseBackboneElementProperties(json, res);
14467    if (json.has("uid"))
14468      res.setUidElement(parseId(json.get("uid").getAsString()));
14469    if (json.has("_uid"))
14470      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
14471    if (json.has("number"))
14472      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
14473    if (json.has("_number"))
14474      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
14475    if (json.has("modality"))
14476      res.setModality(parseCoding(json.getAsJsonObject("modality")));
14477    if (json.has("description"))
14478      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14479    if (json.has("_description"))
14480      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14481    if (json.has("numberOfInstances"))
14482      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
14483    if (json.has("_numberOfInstances"))
14484      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
14485    if (json.has("endpoint")) {
14486      JsonArray array = json.getAsJsonArray("endpoint");
14487      for (int i = 0; i < array.size(); i++) {
14488        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
14489      }
14490    };
14491    if (json.has("bodySite"))
14492      res.setBodySite(parseCoding(json.getAsJsonObject("bodySite")));
14493    if (json.has("laterality"))
14494      res.setLaterality(parseCoding(json.getAsJsonObject("laterality")));
14495    if (json.has("specimen")) {
14496      JsonArray array = json.getAsJsonArray("specimen");
14497      for (int i = 0; i < array.size(); i++) {
14498        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
14499      }
14500    };
14501    if (json.has("started"))
14502      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
14503    if (json.has("_started"))
14504      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
14505    if (json.has("performer")) {
14506      JsonArray array = json.getAsJsonArray("performer");
14507      for (int i = 0; i < array.size(); i++) {
14508        res.getPerformer().add(parseImagingStudyImagingStudySeriesPerformerComponent(array.get(i).getAsJsonObject(), owner));
14509      }
14510    };
14511    if (json.has("instance")) {
14512      JsonArray array = json.getAsJsonArray("instance");
14513      for (int i = 0; i < array.size(); i++) {
14514        res.getInstance().add(parseImagingStudyImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject(), owner));
14515      }
14516    };
14517  }
14518
14519  protected ImagingStudy.ImagingStudySeriesPerformerComponent parseImagingStudyImagingStudySeriesPerformerComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
14520    ImagingStudy.ImagingStudySeriesPerformerComponent res = new ImagingStudy.ImagingStudySeriesPerformerComponent();
14521    parseImagingStudyImagingStudySeriesPerformerComponentProperties(json, owner, res);
14522    return res;
14523  }
14524
14525  protected void parseImagingStudyImagingStudySeriesPerformerComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesPerformerComponent res) throws IOException, FHIRFormatError {
14526    parseBackboneElementProperties(json, res);
14527    if (json.has("function"))
14528      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
14529    if (json.has("actor"))
14530      res.setActor(parseReference(json.getAsJsonObject("actor")));
14531  }
14532
14533  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudyImagingStudySeriesInstanceComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
14534    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
14535    parseImagingStudyImagingStudySeriesInstanceComponentProperties(json, owner, res);
14536    return res;
14537  }
14538
14539  protected void parseImagingStudyImagingStudySeriesInstanceComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesInstanceComponent res) throws IOException, FHIRFormatError {
14540    parseBackboneElementProperties(json, res);
14541    if (json.has("uid"))
14542      res.setUidElement(parseId(json.get("uid").getAsString()));
14543    if (json.has("_uid"))
14544      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
14545    if (json.has("sopClass"))
14546      res.setSopClass(parseCoding(json.getAsJsonObject("sopClass")));
14547    if (json.has("number"))
14548      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
14549    if (json.has("_number"))
14550      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
14551    if (json.has("title"))
14552      res.setTitleElement(parseString(json.get("title").getAsString()));
14553    if (json.has("_title"))
14554      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14555  }
14556
14557  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
14558    Immunization res = new Immunization();
14559    parseImmunizationProperties(json, res);
14560    return res;
14561  }
14562
14563  protected void parseImmunizationProperties(JsonObject json, Immunization res) throws IOException, FHIRFormatError {
14564    parseDomainResourceProperties(json, res);
14565    if (json.has("identifier")) {
14566      JsonArray array = json.getAsJsonArray("identifier");
14567      for (int i = 0; i < array.size(); i++) {
14568        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14569      }
14570    };
14571    if (json.has("status"))
14572      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Immunization.ImmunizationStatus.NULL, new Immunization.ImmunizationStatusEnumFactory()));
14573    if (json.has("_status"))
14574      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14575    if (json.has("statusReason"))
14576      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
14577    if (json.has("vaccineCode"))
14578      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
14579    if (json.has("patient"))
14580      res.setPatient(parseReference(json.getAsJsonObject("patient")));
14581    if (json.has("encounter"))
14582      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
14583    Type occurrence = parseType("occurrence", json);
14584    if (occurrence != null)
14585      res.setOccurrence(occurrence);
14586    if (json.has("recorded"))
14587      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
14588    if (json.has("_recorded"))
14589      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
14590    if (json.has("primarySource"))
14591      res.setPrimarySourceElement(parseBoolean(json.get("primarySource").getAsBoolean()));
14592    if (json.has("_primarySource"))
14593      parseElementProperties(json.getAsJsonObject("_primarySource"), res.getPrimarySourceElement());
14594    Type informationSource = parseType("informationSource", json);
14595    if (informationSource != null)
14596      res.setInformationSource(informationSource);
14597    if (json.has("location"))
14598      res.setLocation(parseReference(json.getAsJsonObject("location")));
14599    if (json.has("manufacturer"))
14600      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
14601    if (json.has("lotNumber"))
14602      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
14603    if (json.has("_lotNumber"))
14604      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
14605    if (json.has("expirationDate"))
14606      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
14607    if (json.has("_expirationDate"))
14608      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
14609    if (json.has("site"))
14610      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
14611    if (json.has("route"))
14612      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
14613    if (json.has("doseQuantity"))
14614      res.setDoseQuantity(parseQuantity(json.getAsJsonObject("doseQuantity")));
14615    if (json.has("performer")) {
14616      JsonArray array = json.getAsJsonArray("performer");
14617      for (int i = 0; i < array.size(); i++) {
14618        res.getPerformer().add(parseImmunizationImmunizationPerformerComponent(array.get(i).getAsJsonObject(), res));
14619      }
14620    };
14621    if (json.has("note")) {
14622      JsonArray array = json.getAsJsonArray("note");
14623      for (int i = 0; i < array.size(); i++) {
14624        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14625      }
14626    };
14627    if (json.has("reasonCode")) {
14628      JsonArray array = json.getAsJsonArray("reasonCode");
14629      for (int i = 0; i < array.size(); i++) {
14630        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14631      }
14632    };
14633    if (json.has("reasonReference")) {
14634      JsonArray array = json.getAsJsonArray("reasonReference");
14635      for (int i = 0; i < array.size(); i++) {
14636        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
14637      }
14638    };
14639    if (json.has("isSubpotent"))
14640      res.setIsSubpotentElement(parseBoolean(json.get("isSubpotent").getAsBoolean()));
14641    if (json.has("_isSubpotent"))
14642      parseElementProperties(json.getAsJsonObject("_isSubpotent"), res.getIsSubpotentElement());
14643    if (json.has("subpotentReason")) {
14644      JsonArray array = json.getAsJsonArray("subpotentReason");
14645      for (int i = 0; i < array.size(); i++) {
14646        res.getSubpotentReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14647      }
14648    };
14649    if (json.has("education")) {
14650      JsonArray array = json.getAsJsonArray("education");
14651      for (int i = 0; i < array.size(); i++) {
14652        res.getEducation().add(parseImmunizationImmunizationEducationComponent(array.get(i).getAsJsonObject(), res));
14653      }
14654    };
14655    if (json.has("programEligibility")) {
14656      JsonArray array = json.getAsJsonArray("programEligibility");
14657      for (int i = 0; i < array.size(); i++) {
14658        res.getProgramEligibility().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14659      }
14660    };
14661    if (json.has("fundingSource"))
14662      res.setFundingSource(parseCodeableConcept(json.getAsJsonObject("fundingSource")));
14663    if (json.has("reaction")) {
14664      JsonArray array = json.getAsJsonArray("reaction");
14665      for (int i = 0; i < array.size(); i++) {
14666        res.getReaction().add(parseImmunizationImmunizationReactionComponent(array.get(i).getAsJsonObject(), res));
14667      }
14668    };
14669    if (json.has("protocolApplied")) {
14670      JsonArray array = json.getAsJsonArray("protocolApplied");
14671      for (int i = 0; i < array.size(); i++) {
14672        res.getProtocolApplied().add(parseImmunizationImmunizationProtocolAppliedComponent(array.get(i).getAsJsonObject(), res));
14673      }
14674    };
14675  }
14676
14677  protected Immunization.ImmunizationPerformerComponent parseImmunizationImmunizationPerformerComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
14678    Immunization.ImmunizationPerformerComponent res = new Immunization.ImmunizationPerformerComponent();
14679    parseImmunizationImmunizationPerformerComponentProperties(json, owner, res);
14680    return res;
14681  }
14682
14683  protected void parseImmunizationImmunizationPerformerComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationPerformerComponent res) throws IOException, FHIRFormatError {
14684    parseBackboneElementProperties(json, res);
14685    if (json.has("function"))
14686      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
14687    if (json.has("actor"))
14688      res.setActor(parseReference(json.getAsJsonObject("actor")));
14689  }
14690
14691  protected Immunization.ImmunizationEducationComponent parseImmunizationImmunizationEducationComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
14692    Immunization.ImmunizationEducationComponent res = new Immunization.ImmunizationEducationComponent();
14693    parseImmunizationImmunizationEducationComponentProperties(json, owner, res);
14694    return res;
14695  }
14696
14697  protected void parseImmunizationImmunizationEducationComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationEducationComponent res) throws IOException, FHIRFormatError {
14698    parseBackboneElementProperties(json, res);
14699    if (json.has("documentType"))
14700      res.setDocumentTypeElement(parseString(json.get("documentType").getAsString()));
14701    if (json.has("_documentType"))
14702      parseElementProperties(json.getAsJsonObject("_documentType"), res.getDocumentTypeElement());
14703    if (json.has("reference"))
14704      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
14705    if (json.has("_reference"))
14706      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
14707    if (json.has("publicationDate"))
14708      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
14709    if (json.has("_publicationDate"))
14710      parseElementProperties(json.getAsJsonObject("_publicationDate"), res.getPublicationDateElement());
14711    if (json.has("presentationDate"))
14712      res.setPresentationDateElement(parseDateTime(json.get("presentationDate").getAsString()));
14713    if (json.has("_presentationDate"))
14714      parseElementProperties(json.getAsJsonObject("_presentationDate"), res.getPresentationDateElement());
14715  }
14716
14717  protected Immunization.ImmunizationReactionComponent parseImmunizationImmunizationReactionComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
14718    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
14719    parseImmunizationImmunizationReactionComponentProperties(json, owner, res);
14720    return res;
14721  }
14722
14723  protected void parseImmunizationImmunizationReactionComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationReactionComponent res) throws IOException, FHIRFormatError {
14724    parseBackboneElementProperties(json, res);
14725    if (json.has("date"))
14726      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14727    if (json.has("_date"))
14728      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14729    if (json.has("detail"))
14730      res.setDetail(parseReference(json.getAsJsonObject("detail")));
14731    if (json.has("reported"))
14732      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
14733    if (json.has("_reported"))
14734      parseElementProperties(json.getAsJsonObject("_reported"), res.getReportedElement());
14735  }
14736
14737  protected Immunization.ImmunizationProtocolAppliedComponent parseImmunizationImmunizationProtocolAppliedComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
14738    Immunization.ImmunizationProtocolAppliedComponent res = new Immunization.ImmunizationProtocolAppliedComponent();
14739    parseImmunizationImmunizationProtocolAppliedComponentProperties(json, owner, res);
14740    return res;
14741  }
14742
14743  protected void parseImmunizationImmunizationProtocolAppliedComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationProtocolAppliedComponent res) throws IOException, FHIRFormatError {
14744    parseBackboneElementProperties(json, res);
14745    if (json.has("series"))
14746      res.setSeriesElement(parseString(json.get("series").getAsString()));
14747    if (json.has("_series"))
14748      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
14749    if (json.has("authority"))
14750      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
14751    if (json.has("targetDisease")) {
14752      JsonArray array = json.getAsJsonArray("targetDisease");
14753      for (int i = 0; i < array.size(); i++) {
14754        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14755      }
14756    };
14757    Type doseNumber = parseType("doseNumber", json);
14758    if (doseNumber != null)
14759      res.setDoseNumber(doseNumber);
14760    Type seriesDoses = parseType("seriesDoses", json);
14761    if (seriesDoses != null)
14762      res.setSeriesDoses(seriesDoses);
14763  }
14764
14765  protected ImmunizationEvaluation parseImmunizationEvaluation(JsonObject json) throws IOException, FHIRFormatError {
14766    ImmunizationEvaluation res = new ImmunizationEvaluation();
14767    parseImmunizationEvaluationProperties(json, res);
14768    return res;
14769  }
14770
14771  protected void parseImmunizationEvaluationProperties(JsonObject json, ImmunizationEvaluation res) throws IOException, FHIRFormatError {
14772    parseDomainResourceProperties(json, res);
14773    if (json.has("identifier")) {
14774      JsonArray array = json.getAsJsonArray("identifier");
14775      for (int i = 0; i < array.size(); i++) {
14776        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14777      }
14778    };
14779    if (json.has("status"))
14780      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImmunizationEvaluation.ImmunizationEvaluationStatus.NULL, new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory()));
14781    if (json.has("_status"))
14782      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14783    if (json.has("patient"))
14784      res.setPatient(parseReference(json.getAsJsonObject("patient")));
14785    if (json.has("date"))
14786      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14787    if (json.has("_date"))
14788      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14789    if (json.has("authority"))
14790      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
14791    if (json.has("targetDisease"))
14792      res.setTargetDisease(parseCodeableConcept(json.getAsJsonObject("targetDisease")));
14793    if (json.has("immunizationEvent"))
14794      res.setImmunizationEvent(parseReference(json.getAsJsonObject("immunizationEvent")));
14795    if (json.has("doseStatus"))
14796      res.setDoseStatus(parseCodeableConcept(json.getAsJsonObject("doseStatus")));
14797    if (json.has("doseStatusReason")) {
14798      JsonArray array = json.getAsJsonArray("doseStatusReason");
14799      for (int i = 0; i < array.size(); i++) {
14800        res.getDoseStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14801      }
14802    };
14803    if (json.has("description"))
14804      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14805    if (json.has("_description"))
14806      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14807    if (json.has("series"))
14808      res.setSeriesElement(parseString(json.get("series").getAsString()));
14809    if (json.has("_series"))
14810      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
14811    Type doseNumber = parseType("doseNumber", json);
14812    if (doseNumber != null)
14813      res.setDoseNumber(doseNumber);
14814    Type seriesDoses = parseType("seriesDoses", json);
14815    if (seriesDoses != null)
14816      res.setSeriesDoses(seriesDoses);
14817  }
14818
14819  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
14820    ImmunizationRecommendation res = new ImmunizationRecommendation();
14821    parseImmunizationRecommendationProperties(json, res);
14822    return res;
14823  }
14824
14825  protected void parseImmunizationRecommendationProperties(JsonObject json, ImmunizationRecommendation res) throws IOException, FHIRFormatError {
14826    parseDomainResourceProperties(json, res);
14827    if (json.has("identifier")) {
14828      JsonArray array = json.getAsJsonArray("identifier");
14829      for (int i = 0; i < array.size(); i++) {
14830        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14831      }
14832    };
14833    if (json.has("patient"))
14834      res.setPatient(parseReference(json.getAsJsonObject("patient")));
14835    if (json.has("date"))
14836      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14837    if (json.has("_date"))
14838      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14839    if (json.has("authority"))
14840      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
14841    if (json.has("recommendation")) {
14842      JsonArray array = json.getAsJsonArray("recommendation");
14843      for (int i = 0; i < array.size(); i++) {
14844        res.getRecommendation().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject(), res));
14845      }
14846    };
14847  }
14848
14849  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
14850    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
14851    parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(json, owner, res);
14852    return res;
14853  }
14854
14855  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res) throws IOException, FHIRFormatError {
14856    parseBackboneElementProperties(json, res);
14857    if (json.has("vaccineCode")) {
14858      JsonArray array = json.getAsJsonArray("vaccineCode");
14859      for (int i = 0; i < array.size(); i++) {
14860        res.getVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14861      }
14862    };
14863    if (json.has("targetDisease")) {
14864      JsonArray array = json.getAsJsonArray("targetDisease");
14865      for (int i = 0; i < array.size(); i++) {
14866        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14867      }
14868    };
14869    if (json.has("contraindicatedVaccineCode")) {
14870      JsonArray array = json.getAsJsonArray("contraindicatedVaccineCode");
14871      for (int i = 0; i < array.size(); i++) {
14872        res.getContraindicatedVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14873      }
14874    };
14875    if (json.has("forecastStatus"))
14876      res.setForecastStatus(parseCodeableConcept(json.getAsJsonObject("forecastStatus")));
14877    if (json.has("forecastReason")) {
14878      JsonArray array = json.getAsJsonArray("forecastReason");
14879      for (int i = 0; i < array.size(); i++) {
14880        res.getForecastReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14881      }
14882    };
14883    if (json.has("dateCriterion")) {
14884      JsonArray array = json.getAsJsonArray("dateCriterion");
14885      for (int i = 0; i < array.size(); i++) {
14886        res.getDateCriterion().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject(), owner));
14887      }
14888    };
14889    if (json.has("description"))
14890      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14891    if (json.has("_description"))
14892      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14893    if (json.has("series"))
14894      res.setSeriesElement(parseString(json.get("series").getAsString()));
14895    if (json.has("_series"))
14896      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
14897    Type doseNumber = parseType("doseNumber", json);
14898    if (doseNumber != null)
14899      res.setDoseNumber(doseNumber);
14900    Type seriesDoses = parseType("seriesDoses", json);
14901    if (seriesDoses != null)
14902      res.setSeriesDoses(seriesDoses);
14903    if (json.has("supportingImmunization")) {
14904      JsonArray array = json.getAsJsonArray("supportingImmunization");
14905      for (int i = 0; i < array.size(); i++) {
14906        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
14907      }
14908    };
14909    if (json.has("supportingPatientInformation")) {
14910      JsonArray array = json.getAsJsonArray("supportingPatientInformation");
14911      for (int i = 0; i < array.size(); i++) {
14912        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
14913      }
14914    };
14915  }
14916
14917  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
14918    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
14919    parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(json, owner, res);
14920    return res;
14921  }
14922
14923  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res) throws IOException, FHIRFormatError {
14924    parseBackboneElementProperties(json, res);
14925    if (json.has("code"))
14926      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14927    if (json.has("value"))
14928      res.setValueElement(parseDateTime(json.get("value").getAsString()));
14929    if (json.has("_value"))
14930      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
14931  }
14932
14933  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
14934    ImplementationGuide res = new ImplementationGuide();
14935    parseImplementationGuideProperties(json, res);
14936    return res;
14937  }
14938
14939  protected void parseImplementationGuideProperties(JsonObject json, ImplementationGuide res) throws IOException, FHIRFormatError {
14940    parseDomainResourceProperties(json, res);
14941    if (json.has("url"))
14942      res.setUrlElement(parseUri(json.get("url").getAsString()));
14943    if (json.has("_url"))
14944      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
14945    if (json.has("version"))
14946      res.setVersionElement(parseString(json.get("version").getAsString()));
14947    if (json.has("_version"))
14948      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
14949    if (json.has("name"))
14950      res.setNameElement(parseString(json.get("name").getAsString()));
14951    if (json.has("_name"))
14952      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14953    if (json.has("title"))
14954      res.setTitleElement(parseString(json.get("title").getAsString()));
14955    if (json.has("_title"))
14956      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14957    if (json.has("status"))
14958      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14959    if (json.has("_status"))
14960      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14961    if (json.has("experimental"))
14962      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14963    if (json.has("_experimental"))
14964      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
14965    if (json.has("date"))
14966      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14967    if (json.has("_date"))
14968      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14969    if (json.has("publisher"))
14970      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14971    if (json.has("_publisher"))
14972      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
14973    if (json.has("contact")) {
14974      JsonArray array = json.getAsJsonArray("contact");
14975      for (int i = 0; i < array.size(); i++) {
14976        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14977      }
14978    };
14979    if (json.has("description"))
14980      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14981    if (json.has("_description"))
14982      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14983    if (json.has("useContext")) {
14984      JsonArray array = json.getAsJsonArray("useContext");
14985      for (int i = 0; i < array.size(); i++) {
14986        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14987      }
14988    };
14989    if (json.has("jurisdiction")) {
14990      JsonArray array = json.getAsJsonArray("jurisdiction");
14991      for (int i = 0; i < array.size(); i++) {
14992        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14993      }
14994    };
14995    if (json.has("copyright"))
14996      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
14997    if (json.has("_copyright"))
14998      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
14999    if (json.has("packageId"))
15000      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
15001    if (json.has("_packageId"))
15002      parseElementProperties(json.getAsJsonObject("_packageId"), res.getPackageIdElement());
15003    if (json.has("license"))
15004      res.setLicenseElement(parseEnumeration(json.get("license").getAsString(), ImplementationGuide.SPDXLicense.NULL, new ImplementationGuide.SPDXLicenseEnumFactory()));
15005    if (json.has("_license"))
15006      parseElementProperties(json.getAsJsonObject("_license"), res.getLicenseElement());
15007    if (json.has("fhirVersion")) {
15008      JsonArray array = json.getAsJsonArray("fhirVersion");
15009      for (int i = 0; i < array.size(); i++) {
15010        res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
15011      }
15012    };
15013    if (json.has("_fhirVersion")) {
15014      JsonArray array = json.getAsJsonArray("_fhirVersion");
15015      for (int i = 0; i < array.size(); i++) {
15016        if (i == res.getFhirVersion().size())
15017          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
15018        if (array.get(i) instanceof JsonObject) 
15019          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
15020      }
15021    };
15022    if (json.has("dependsOn")) {
15023      JsonArray array = json.getAsJsonArray("dependsOn");
15024      for (int i = 0; i < array.size(); i++) {
15025        res.getDependsOn().add(parseImplementationGuideImplementationGuideDependsOnComponent(array.get(i).getAsJsonObject(), res));
15026      }
15027    };
15028    if (json.has("global")) {
15029      JsonArray array = json.getAsJsonArray("global");
15030      for (int i = 0; i < array.size(); i++) {
15031        res.getGlobal().add(parseImplementationGuideImplementationGuideGlobalComponent(array.get(i).getAsJsonObject(), res));
15032      }
15033    };
15034    if (json.has("definition"))
15035      res.setDefinition(parseImplementationGuideImplementationGuideDefinitionComponent(json.getAsJsonObject("definition"), res));
15036    if (json.has("manifest"))
15037      res.setManifest(parseImplementationGuideImplementationGuideManifestComponent(json.getAsJsonObject("manifest"), res));
15038  }
15039
15040  protected ImplementationGuide.ImplementationGuideDependsOnComponent parseImplementationGuideImplementationGuideDependsOnComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
15041    ImplementationGuide.ImplementationGuideDependsOnComponent res = new ImplementationGuide.ImplementationGuideDependsOnComponent();
15042    parseImplementationGuideImplementationGuideDependsOnComponentProperties(json, owner, res);
15043    return res;
15044  }
15045
15046  protected void parseImplementationGuideImplementationGuideDependsOnComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDependsOnComponent res) throws IOException, FHIRFormatError {
15047    parseBackboneElementProperties(json, res);
15048    if (json.has("uri"))
15049      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
15050    if (json.has("_uri"))
15051      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
15052    if (json.has("packageId"))
15053      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
15054    if (json.has("_packageId"))
15055      parseElementProperties(json.getAsJsonObject("_packageId"), res.getPackageIdElement());
15056    if (json.has("version"))
15057      res.setVersionElement(parseString(json.get("version").getAsString()));
15058    if (json.has("_version"))
15059      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
15060  }
15061
15062  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideImplementationGuideGlobalComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
15063    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
15064    parseImplementationGuideImplementationGuideGlobalComponentProperties(json, owner, res);
15065    return res;
15066  }
15067
15068  protected void parseImplementationGuideImplementationGuideGlobalComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideGlobalComponent res) throws IOException, FHIRFormatError {
15069    parseBackboneElementProperties(json, res);
15070    if (json.has("type"))
15071      res.setTypeElement(parseCode(json.get("type").getAsString()));
15072    if (json.has("_type"))
15073      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
15074    if (json.has("profile"))
15075      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
15076    if (json.has("_profile"))
15077      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
15078  }
15079
15080  protected ImplementationGuide.ImplementationGuideDefinitionComponent parseImplementationGuideImplementationGuideDefinitionComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
15081    ImplementationGuide.ImplementationGuideDefinitionComponent res = new ImplementationGuide.ImplementationGuideDefinitionComponent();
15082    parseImplementationGuideImplementationGuideDefinitionComponentProperties(json, owner, res);
15083    return res;
15084  }
15085
15086  protected void parseImplementationGuideImplementationGuideDefinitionComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionComponent res) throws IOException, FHIRFormatError {
15087    parseBackboneElementProperties(json, res);
15088    if (json.has("grouping")) {
15089      JsonArray array = json.getAsJsonArray("grouping");
15090      for (int i = 0; i < array.size(); i++) {
15091        res.getGrouping().add(parseImplementationGuideImplementationGuideDefinitionGroupingComponent(array.get(i).getAsJsonObject(), owner));
15092      }
15093    };
15094    if (json.has("resource")) {
15095      JsonArray array = json.getAsJsonArray("resource");
15096      for (int i = 0; i < array.size(); i++) {
15097        res.getResource().add(parseImplementationGuideImplementationGuideDefinitionResourceComponent(array.get(i).getAsJsonObject(), owner));
15098      }
15099    };
15100    if (json.has("page"))
15101      res.setPage(parseImplementationGuideImplementationGuideDefinitionPageComponent(json.getAsJsonObject("page"), owner));
15102    if (json.has("parameter")) {
15103      JsonArray array = json.getAsJsonArray("parameter");
15104      for (int i = 0; i < array.size(); i++) {
15105        res.getParameter().add(parseImplementationGuideImplementationGuideDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
15106      }
15107    };
15108    if (json.has("template")) {
15109      JsonArray array = json.getAsJsonArray("template");
15110      for (int i = 0; i < array.size(); i++) {
15111        res.getTemplate().add(parseImplementationGuideImplementationGuideDefinitionTemplateComponent(array.get(i).getAsJsonObject(), owner));
15112      }
15113    };
15114  }
15115
15116  protected ImplementationGuide.ImplementationGuideDefinitionGroupingComponent parseImplementationGuideImplementationGuideDefinitionGroupingComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
15117    ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res = new ImplementationGuide.ImplementationGuideDefinitionGroupingComponent();
15118    parseImplementationGuideImplementationGuideDefinitionGroupingComponentProperties(json, owner, res);
15119    return res;
15120  }
15121
15122  protected void parseImplementationGuideImplementationGuideDefinitionGroupingComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res) throws IOException, FHIRFormatError {
15123    parseBackboneElementProperties(json, res);
15124    if (json.has("name"))
15125      res.setNameElement(parseString(json.get("name").getAsString()));
15126    if (json.has("_name"))
15127      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15128    if (json.has("description"))
15129      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15130    if (json.has("_description"))
15131      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15132  }
15133
15134  protected ImplementationGuide.ImplementationGuideDefinitionResourceComponent parseImplementationGuideImplementationGuideDefinitionResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
15135    ImplementationGuide.ImplementationGuideDefinitionResourceComponent res = new ImplementationGuide.ImplementationGuideDefinitionResourceComponent();
15136    parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(json, owner, res);
15137    return res;
15138  }
15139
15140  protected void parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionResourceComponent res) throws IOException, FHIRFormatError {
15141    parseBackboneElementProperties(json, res);
15142    if (json.has("reference"))
15143      res.setReference(parseReference(json.getAsJsonObject("reference")));
15144    if (json.has("fhirVersion")) {
15145      JsonArray array = json.getAsJsonArray("fhirVersion");
15146      for (int i = 0; i < array.size(); i++) {
15147        res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
15148      }
15149    };
15150    if (json.has("_fhirVersion")) {
15151      JsonArray array = json.getAsJsonArray("_fhirVersion");
15152      for (int i = 0; i < array.size(); i++) {
15153        if (i == res.getFhirVersion().size())
15154          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
15155        if (array.get(i) instanceof JsonObject) 
15156          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
15157      }
15158    };
15159    if (json.has("name"))
15160      res.setNameElement(parseString(json.get("name").getAsString()));
15161    if (json.has("_name"))
15162      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15163    if (json.has("description"))
15164      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15165    if (json.has("_description"))
15166      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15167    Type example = parseType("example", json);
15168    if (example != null)
15169      res.setExample(example);
15170    if (json.has("groupingId"))
15171      res.setGroupingIdElement(parseId(json.get("groupingId").getAsString()));
15172    if (json.has("_groupingId"))
15173      parseElementProperties(json.getAsJsonObject("_groupingId"), res.getGroupingIdElement());
15174  }
15175
15176  protected ImplementationGuide.ImplementationGuideDefinitionPageComponent parseImplementationGuideImplementationGuideDefinitionPageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
15177    ImplementationGuide.ImplementationGuideDefinitionPageComponent res = new ImplementationGuide.ImplementationGuideDefinitionPageComponent();
15178    parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(json, owner, res);
15179    return res;
15180  }
15181
15182  protected void parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionPageComponent res) throws IOException, FHIRFormatError {
15183    parseBackboneElementProperties(json, res);
15184    Type name = parseType("name", json);
15185    if (name != null)
15186      res.setName(name);
15187    if (json.has("title"))
15188      res.setTitleElement(parseString(json.get("title").getAsString()));
15189    if (json.has("_title"))
15190      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
15191    if (json.has("generation"))
15192      res.setGenerationElement(parseEnumeration(json.get("generation").getAsString(), ImplementationGuide.GuidePageGeneration.NULL, new ImplementationGuide.GuidePageGenerationEnumFactory()));
15193    if (json.has("_generation"))
15194      parseElementProperties(json.getAsJsonObject("_generation"), res.getGenerationElement());
15195    if (json.has("page")) {
15196      JsonArray array = json.getAsJsonArray("page");
15197      for (int i = 0; i < array.size(); i++) {
15198        res.getPage().add(parseImplementationGuideImplementationGuideDefinitionPageComponent(array.get(i).getAsJsonObject(), owner));
15199      }
15200    };
15201  }
15202
15203  protected ImplementationGuide.ImplementationGuideDefinitionParameterComponent parseImplementationGuideImplementationGuideDefinitionParameterComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
15204    ImplementationGuide.ImplementationGuideDefinitionParameterComponent res = new ImplementationGuide.ImplementationGuideDefinitionParameterComponent();
15205    parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(json, owner, res);
15206    return res;
15207  }
15208
15209  protected void parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws IOException, FHIRFormatError {
15210    parseBackboneElementProperties(json, res);
15211    if (json.has("code"))
15212      res.setCodeElement(parseString(json.get("code").getAsString()));
15213    if (json.has("_code"))
15214      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
15215    if (json.has("value"))
15216      res.setValueElement(parseString(json.get("value").getAsString()));
15217    if (json.has("_value"))
15218      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
15219  }
15220
15221  protected ImplementationGuide.ImplementationGuideDefinitionTemplateComponent parseImplementationGuideImplementationGuideDefinitionTemplateComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
15222    ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res = new ImplementationGuide.ImplementationGuideDefinitionTemplateComponent();
15223    parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(json, owner, res);
15224    return res;
15225  }
15226
15227  protected void parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res) throws IOException, FHIRFormatError {
15228    parseBackboneElementProperties(json, res);
15229    if (json.has("code"))
15230      res.setCodeElement(parseCode(json.get("code").getAsString()));
15231    if (json.has("_code"))
15232      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
15233    if (json.has("source"))
15234      res.setSourceElement(parseString(json.get("source").getAsString()));
15235    if (json.has("_source"))
15236      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
15237    if (json.has("scope"))
15238      res.setScopeElement(parseString(json.get("scope").getAsString()));
15239    if (json.has("_scope"))
15240      parseElementProperties(json.getAsJsonObject("_scope"), res.getScopeElement());
15241  }
15242
15243  protected ImplementationGuide.ImplementationGuideManifestComponent parseImplementationGuideImplementationGuideManifestComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
15244    ImplementationGuide.ImplementationGuideManifestComponent res = new ImplementationGuide.ImplementationGuideManifestComponent();
15245    parseImplementationGuideImplementationGuideManifestComponentProperties(json, owner, res);
15246    return res;
15247  }
15248
15249  protected void parseImplementationGuideImplementationGuideManifestComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideManifestComponent res) throws IOException, FHIRFormatError {
15250    parseBackboneElementProperties(json, res);
15251    if (json.has("rendering"))
15252      res.setRenderingElement(parseUrl(json.get("rendering").getAsString()));
15253    if (json.has("_rendering"))
15254      parseElementProperties(json.getAsJsonObject("_rendering"), res.getRenderingElement());
15255    if (json.has("resource")) {
15256      JsonArray array = json.getAsJsonArray("resource");
15257      for (int i = 0; i < array.size(); i++) {
15258        res.getResource().add(parseImplementationGuideManifestResourceComponent(array.get(i).getAsJsonObject(), owner));
15259      }
15260    };
15261    if (json.has("page")) {
15262      JsonArray array = json.getAsJsonArray("page");
15263      for (int i = 0; i < array.size(); i++) {
15264        res.getPage().add(parseImplementationGuideManifestPageComponent(array.get(i).getAsJsonObject(), owner));
15265      }
15266    };
15267    if (json.has("image")) {
15268      JsonArray array = json.getAsJsonArray("image");
15269      for (int i = 0; i < array.size(); i++) {
15270        res.getImage().add(parseString(array.get(i).getAsString()));
15271      }
15272    };
15273    if (json.has("_image")) {
15274      JsonArray array = json.getAsJsonArray("_image");
15275      for (int i = 0; i < array.size(); i++) {
15276        if (i == res.getImage().size())
15277          res.getImage().add(parseString(null));
15278        if (array.get(i) instanceof JsonObject) 
15279          parseElementProperties(array.get(i).getAsJsonObject(), res.getImage().get(i));
15280      }
15281    };
15282    if (json.has("other")) {
15283      JsonArray array = json.getAsJsonArray("other");
15284      for (int i = 0; i < array.size(); i++) {
15285        res.getOther().add(parseString(array.get(i).getAsString()));
15286      }
15287    };
15288    if (json.has("_other")) {
15289      JsonArray array = json.getAsJsonArray("_other");
15290      for (int i = 0; i < array.size(); i++) {
15291        if (i == res.getOther().size())
15292          res.getOther().add(parseString(null));
15293        if (array.get(i) instanceof JsonObject) 
15294          parseElementProperties(array.get(i).getAsJsonObject(), res.getOther().get(i));
15295      }
15296    };
15297  }
15298
15299  protected ImplementationGuide.ManifestResourceComponent parseImplementationGuideManifestResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
15300    ImplementationGuide.ManifestResourceComponent res = new ImplementationGuide.ManifestResourceComponent();
15301    parseImplementationGuideManifestResourceComponentProperties(json, owner, res);
15302    return res;
15303  }
15304
15305  protected void parseImplementationGuideManifestResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ManifestResourceComponent res) throws IOException, FHIRFormatError {
15306    parseBackboneElementProperties(json, res);
15307    if (json.has("reference"))
15308      res.setReference(parseReference(json.getAsJsonObject("reference")));
15309    Type example = parseType("example", json);
15310    if (example != null)
15311      res.setExample(example);
15312    if (json.has("relativePath"))
15313      res.setRelativePathElement(parseUrl(json.get("relativePath").getAsString()));
15314    if (json.has("_relativePath"))
15315      parseElementProperties(json.getAsJsonObject("_relativePath"), res.getRelativePathElement());
15316  }
15317
15318  protected ImplementationGuide.ManifestPageComponent parseImplementationGuideManifestPageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
15319    ImplementationGuide.ManifestPageComponent res = new ImplementationGuide.ManifestPageComponent();
15320    parseImplementationGuideManifestPageComponentProperties(json, owner, res);
15321    return res;
15322  }
15323
15324  protected void parseImplementationGuideManifestPageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ManifestPageComponent res) throws IOException, FHIRFormatError {
15325    parseBackboneElementProperties(json, res);
15326    if (json.has("name"))
15327      res.setNameElement(parseString(json.get("name").getAsString()));
15328    if (json.has("_name"))
15329      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15330    if (json.has("title"))
15331      res.setTitleElement(parseString(json.get("title").getAsString()));
15332    if (json.has("_title"))
15333      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
15334    if (json.has("anchor")) {
15335      JsonArray array = json.getAsJsonArray("anchor");
15336      for (int i = 0; i < array.size(); i++) {
15337        res.getAnchor().add(parseString(array.get(i).getAsString()));
15338      }
15339    };
15340    if (json.has("_anchor")) {
15341      JsonArray array = json.getAsJsonArray("_anchor");
15342      for (int i = 0; i < array.size(); i++) {
15343        if (i == res.getAnchor().size())
15344          res.getAnchor().add(parseString(null));
15345        if (array.get(i) instanceof JsonObject) 
15346          parseElementProperties(array.get(i).getAsJsonObject(), res.getAnchor().get(i));
15347      }
15348    };
15349  }
15350
15351  protected Ingredient parseIngredient(JsonObject json) throws IOException, FHIRFormatError {
15352    Ingredient res = new Ingredient();
15353    parseIngredientProperties(json, res);
15354    return res;
15355  }
15356
15357  protected void parseIngredientProperties(JsonObject json, Ingredient res) throws IOException, FHIRFormatError {
15358    parseDomainResourceProperties(json, res);
15359    if (json.has("identifier"))
15360      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
15361    if (json.has("role"))
15362      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
15363    if (json.has("allergenicIndicator"))
15364      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
15365    if (json.has("_allergenicIndicator"))
15366      parseElementProperties(json.getAsJsonObject("_allergenicIndicator"), res.getAllergenicIndicatorElement());
15367    if (json.has("manufacturer")) {
15368      JsonArray array = json.getAsJsonArray("manufacturer");
15369      for (int i = 0; i < array.size(); i++) {
15370        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
15371      }
15372    };
15373    if (json.has("specifiedSubstance")) {
15374      JsonArray array = json.getAsJsonArray("specifiedSubstance");
15375      for (int i = 0; i < array.size(); i++) {
15376        res.getSpecifiedSubstance().add(parseIngredientIngredientSpecifiedSubstanceComponent(array.get(i).getAsJsonObject(), res));
15377      }
15378    };
15379    if (json.has("substance"))
15380      res.setSubstance(parseIngredientIngredientSubstanceComponent(json.getAsJsonObject("substance"), res));
15381  }
15382
15383  protected Ingredient.IngredientSpecifiedSubstanceComponent parseIngredientIngredientSpecifiedSubstanceComponent(JsonObject json, Ingredient owner) throws IOException, FHIRFormatError {
15384    Ingredient.IngredientSpecifiedSubstanceComponent res = new Ingredient.IngredientSpecifiedSubstanceComponent();
15385    parseIngredientIngredientSpecifiedSubstanceComponentProperties(json, owner, res);
15386    return res;
15387  }
15388
15389  protected void parseIngredientIngredientSpecifiedSubstanceComponentProperties(JsonObject json, Ingredient owner, Ingredient.IngredientSpecifiedSubstanceComponent res) throws IOException, FHIRFormatError {
15390    parseBackboneElementProperties(json, res);
15391    Type code = parseType("code", json);
15392    if (code != null)
15393      res.setCode(code);
15394    if (json.has("group"))
15395      res.setGroup(parseCodeableConcept(json.getAsJsonObject("group")));
15396    if (json.has("confidentiality"))
15397      res.setConfidentiality(parseCodeableConcept(json.getAsJsonObject("confidentiality")));
15398    if (json.has("strength")) {
15399      JsonArray array = json.getAsJsonArray("strength");
15400      for (int i = 0; i < array.size(); i++) {
15401        res.getStrength().add(parseIngredientIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject(), owner));
15402      }
15403    };
15404  }
15405
15406  protected Ingredient.IngredientSpecifiedSubstanceStrengthComponent parseIngredientIngredientSpecifiedSubstanceStrengthComponent(JsonObject json, Ingredient owner) throws IOException, FHIRFormatError {
15407    Ingredient.IngredientSpecifiedSubstanceStrengthComponent res = new Ingredient.IngredientSpecifiedSubstanceStrengthComponent();
15408    parseIngredientIngredientSpecifiedSubstanceStrengthComponentProperties(json, owner, res);
15409    return res;
15410  }
15411
15412  protected void parseIngredientIngredientSpecifiedSubstanceStrengthComponentProperties(JsonObject json, Ingredient owner, Ingredient.IngredientSpecifiedSubstanceStrengthComponent res) throws IOException, FHIRFormatError {
15413    parseBackboneElementProperties(json, res);
15414    if (json.has("presentation"))
15415      res.setPresentation(parseRatio(json.getAsJsonObject("presentation")));
15416    if (json.has("presentationHighLimit"))
15417      res.setPresentationHighLimit(parseRatio(json.getAsJsonObject("presentationHighLimit")));
15418    if (json.has("concentration"))
15419      res.setConcentration(parseRatio(json.getAsJsonObject("concentration")));
15420    if (json.has("concentrationHighLimit"))
15421      res.setConcentrationHighLimit(parseRatio(json.getAsJsonObject("concentrationHighLimit")));
15422    if (json.has("measurementPoint"))
15423      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
15424    if (json.has("_measurementPoint"))
15425      parseElementProperties(json.getAsJsonObject("_measurementPoint"), res.getMeasurementPointElement());
15426    if (json.has("country")) {
15427      JsonArray array = json.getAsJsonArray("country");
15428      for (int i = 0; i < array.size(); i++) {
15429        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15430      }
15431    };
15432    if (json.has("referenceStrength")) {
15433      JsonArray array = json.getAsJsonArray("referenceStrength");
15434      for (int i = 0; i < array.size(); i++) {
15435        res.getReferenceStrength().add(parseIngredientIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(array.get(i).getAsJsonObject(), owner));
15436      }
15437    };
15438  }
15439
15440  protected Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent parseIngredientIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(JsonObject json, Ingredient owner) throws IOException, FHIRFormatError {
15441    Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res = new Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent();
15442    parseIngredientIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(json, owner, res);
15443    return res;
15444  }
15445
15446  protected void parseIngredientIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(JsonObject json, Ingredient owner, Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res) throws IOException, FHIRFormatError {
15447    parseBackboneElementProperties(json, res);
15448    Type substance = parseType("substance", json);
15449    if (substance != null)
15450      res.setSubstance(substance);
15451    if (json.has("strength"))
15452      res.setStrength(parseRatio(json.getAsJsonObject("strength")));
15453    if (json.has("strengthHighLimit"))
15454      res.setStrengthHighLimit(parseRatio(json.getAsJsonObject("strengthHighLimit")));
15455    if (json.has("measurementPoint"))
15456      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
15457    if (json.has("_measurementPoint"))
15458      parseElementProperties(json.getAsJsonObject("_measurementPoint"), res.getMeasurementPointElement());
15459    if (json.has("country")) {
15460      JsonArray array = json.getAsJsonArray("country");
15461      for (int i = 0; i < array.size(); i++) {
15462        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15463      }
15464    };
15465  }
15466
15467  protected Ingredient.IngredientSubstanceComponent parseIngredientIngredientSubstanceComponent(JsonObject json, Ingredient owner) throws IOException, FHIRFormatError {
15468    Ingredient.IngredientSubstanceComponent res = new Ingredient.IngredientSubstanceComponent();
15469    parseIngredientIngredientSubstanceComponentProperties(json, owner, res);
15470    return res;
15471  }
15472
15473  protected void parseIngredientIngredientSubstanceComponentProperties(JsonObject json, Ingredient owner, Ingredient.IngredientSubstanceComponent res) throws IOException, FHIRFormatError {
15474    parseBackboneElementProperties(json, res);
15475    Type code = parseType("code", json);
15476    if (code != null)
15477      res.setCode(code);
15478    if (json.has("strength")) {
15479      JsonArray array = json.getAsJsonArray("strength");
15480      for (int i = 0; i < array.size(); i++) {
15481        res.getStrength().add(parseIngredientIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject(), owner));
15482      }
15483    };
15484  }
15485
15486  protected InsurancePlan parseInsurancePlan(JsonObject json) throws IOException, FHIRFormatError {
15487    InsurancePlan res = new InsurancePlan();
15488    parseInsurancePlanProperties(json, res);
15489    return res;
15490  }
15491
15492  protected void parseInsurancePlanProperties(JsonObject json, InsurancePlan res) throws IOException, FHIRFormatError {
15493    parseDomainResourceProperties(json, res);
15494    if (json.has("identifier")) {
15495      JsonArray array = json.getAsJsonArray("identifier");
15496      for (int i = 0; i < array.size(); i++) {
15497        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15498      }
15499    };
15500    if (json.has("status"))
15501      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15502    if (json.has("_status"))
15503      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15504    if (json.has("type")) {
15505      JsonArray array = json.getAsJsonArray("type");
15506      for (int i = 0; i < array.size(); i++) {
15507        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15508      }
15509    };
15510    if (json.has("name"))
15511      res.setNameElement(parseString(json.get("name").getAsString()));
15512    if (json.has("_name"))
15513      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15514    if (json.has("alias")) {
15515      JsonArray array = json.getAsJsonArray("alias");
15516      for (int i = 0; i < array.size(); i++) {
15517        res.getAlias().add(parseString(array.get(i).getAsString()));
15518      }
15519    };
15520    if (json.has("_alias")) {
15521      JsonArray array = json.getAsJsonArray("_alias");
15522      for (int i = 0; i < array.size(); i++) {
15523        if (i == res.getAlias().size())
15524          res.getAlias().add(parseString(null));
15525        if (array.get(i) instanceof JsonObject) 
15526          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
15527      }
15528    };
15529    if (json.has("period"))
15530      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
15531    if (json.has("ownedBy"))
15532      res.setOwnedBy(parseReference(json.getAsJsonObject("ownedBy")));
15533    if (json.has("administeredBy"))
15534      res.setAdministeredBy(parseReference(json.getAsJsonObject("administeredBy")));
15535    if (json.has("coverageArea")) {
15536      JsonArray array = json.getAsJsonArray("coverageArea");
15537      for (int i = 0; i < array.size(); i++) {
15538        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
15539      }
15540    };
15541    if (json.has("contact")) {
15542      JsonArray array = json.getAsJsonArray("contact");
15543      for (int i = 0; i < array.size(); i++) {
15544        res.getContact().add(parseInsurancePlanInsurancePlanContactComponent(array.get(i).getAsJsonObject(), res));
15545      }
15546    };
15547    if (json.has("endpoint")) {
15548      JsonArray array = json.getAsJsonArray("endpoint");
15549      for (int i = 0; i < array.size(); i++) {
15550        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
15551      }
15552    };
15553    if (json.has("network")) {
15554      JsonArray array = json.getAsJsonArray("network");
15555      for (int i = 0; i < array.size(); i++) {
15556        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
15557      }
15558    };
15559    if (json.has("coverage")) {
15560      JsonArray array = json.getAsJsonArray("coverage");
15561      for (int i = 0; i < array.size(); i++) {
15562        res.getCoverage().add(parseInsurancePlanInsurancePlanCoverageComponent(array.get(i).getAsJsonObject(), res));
15563      }
15564    };
15565    if (json.has("plan")) {
15566      JsonArray array = json.getAsJsonArray("plan");
15567      for (int i = 0; i < array.size(); i++) {
15568        res.getPlan().add(parseInsurancePlanInsurancePlanPlanComponent(array.get(i).getAsJsonObject(), res));
15569      }
15570    };
15571  }
15572
15573  protected InsurancePlan.InsurancePlanContactComponent parseInsurancePlanInsurancePlanContactComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
15574    InsurancePlan.InsurancePlanContactComponent res = new InsurancePlan.InsurancePlanContactComponent();
15575    parseInsurancePlanInsurancePlanContactComponentProperties(json, owner, res);
15576    return res;
15577  }
15578
15579  protected void parseInsurancePlanInsurancePlanContactComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanContactComponent res) throws IOException, FHIRFormatError {
15580    parseBackboneElementProperties(json, res);
15581    if (json.has("purpose"))
15582      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
15583    if (json.has("name"))
15584      res.setName(parseHumanName(json.getAsJsonObject("name")));
15585    if (json.has("telecom")) {
15586      JsonArray array = json.getAsJsonArray("telecom");
15587      for (int i = 0; i < array.size(); i++) {
15588        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
15589      }
15590    };
15591    if (json.has("address"))
15592      res.setAddress(parseAddress(json.getAsJsonObject("address")));
15593  }
15594
15595  protected InsurancePlan.InsurancePlanCoverageComponent parseInsurancePlanInsurancePlanCoverageComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
15596    InsurancePlan.InsurancePlanCoverageComponent res = new InsurancePlan.InsurancePlanCoverageComponent();
15597    parseInsurancePlanInsurancePlanCoverageComponentProperties(json, owner, res);
15598    return res;
15599  }
15600
15601  protected void parseInsurancePlanInsurancePlanCoverageComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanCoverageComponent res) throws IOException, FHIRFormatError {
15602    parseBackboneElementProperties(json, res);
15603    if (json.has("type"))
15604      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15605    if (json.has("network")) {
15606      JsonArray array = json.getAsJsonArray("network");
15607      for (int i = 0; i < array.size(); i++) {
15608        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
15609      }
15610    };
15611    if (json.has("benefit")) {
15612      JsonArray array = json.getAsJsonArray("benefit");
15613      for (int i = 0; i < array.size(); i++) {
15614        res.getBenefit().add(parseInsurancePlanCoverageBenefitComponent(array.get(i).getAsJsonObject(), owner));
15615      }
15616    };
15617  }
15618
15619  protected InsurancePlan.CoverageBenefitComponent parseInsurancePlanCoverageBenefitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
15620    InsurancePlan.CoverageBenefitComponent res = new InsurancePlan.CoverageBenefitComponent();
15621    parseInsurancePlanCoverageBenefitComponentProperties(json, owner, res);
15622    return res;
15623  }
15624
15625  protected void parseInsurancePlanCoverageBenefitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.CoverageBenefitComponent res) throws IOException, FHIRFormatError {
15626    parseBackboneElementProperties(json, res);
15627    if (json.has("type"))
15628      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15629    if (json.has("requirement"))
15630      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
15631    if (json.has("_requirement"))
15632      parseElementProperties(json.getAsJsonObject("_requirement"), res.getRequirementElement());
15633    if (json.has("limit")) {
15634      JsonArray array = json.getAsJsonArray("limit");
15635      for (int i = 0; i < array.size(); i++) {
15636        res.getLimit().add(parseInsurancePlanCoverageBenefitLimitComponent(array.get(i).getAsJsonObject(), owner));
15637      }
15638    };
15639  }
15640
15641  protected InsurancePlan.CoverageBenefitLimitComponent parseInsurancePlanCoverageBenefitLimitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
15642    InsurancePlan.CoverageBenefitLimitComponent res = new InsurancePlan.CoverageBenefitLimitComponent();
15643    parseInsurancePlanCoverageBenefitLimitComponentProperties(json, owner, res);
15644    return res;
15645  }
15646
15647  protected void parseInsurancePlanCoverageBenefitLimitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.CoverageBenefitLimitComponent res) throws IOException, FHIRFormatError {
15648    parseBackboneElementProperties(json, res);
15649    if (json.has("value"))
15650      res.setValue(parseQuantity(json.getAsJsonObject("value")));
15651    if (json.has("code"))
15652      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15653  }
15654
15655  protected InsurancePlan.InsurancePlanPlanComponent parseInsurancePlanInsurancePlanPlanComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
15656    InsurancePlan.InsurancePlanPlanComponent res = new InsurancePlan.InsurancePlanPlanComponent();
15657    parseInsurancePlanInsurancePlanPlanComponentProperties(json, owner, res);
15658    return res;
15659  }
15660
15661  protected void parseInsurancePlanInsurancePlanPlanComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanComponent res) throws IOException, FHIRFormatError {
15662    parseBackboneElementProperties(json, res);
15663    if (json.has("identifier")) {
15664      JsonArray array = json.getAsJsonArray("identifier");
15665      for (int i = 0; i < array.size(); i++) {
15666        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15667      }
15668    };
15669    if (json.has("type"))
15670      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15671    if (json.has("coverageArea")) {
15672      JsonArray array = json.getAsJsonArray("coverageArea");
15673      for (int i = 0; i < array.size(); i++) {
15674        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
15675      }
15676    };
15677    if (json.has("network")) {
15678      JsonArray array = json.getAsJsonArray("network");
15679      for (int i = 0; i < array.size(); i++) {
15680        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
15681      }
15682    };
15683    if (json.has("generalCost")) {
15684      JsonArray array = json.getAsJsonArray("generalCost");
15685      for (int i = 0; i < array.size(); i++) {
15686        res.getGeneralCost().add(parseInsurancePlanInsurancePlanPlanGeneralCostComponent(array.get(i).getAsJsonObject(), owner));
15687      }
15688    };
15689    if (json.has("specificCost")) {
15690      JsonArray array = json.getAsJsonArray("specificCost");
15691      for (int i = 0; i < array.size(); i++) {
15692        res.getSpecificCost().add(parseInsurancePlanInsurancePlanPlanSpecificCostComponent(array.get(i).getAsJsonObject(), owner));
15693      }
15694    };
15695  }
15696
15697  protected InsurancePlan.InsurancePlanPlanGeneralCostComponent parseInsurancePlanInsurancePlanPlanGeneralCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
15698    InsurancePlan.InsurancePlanPlanGeneralCostComponent res = new InsurancePlan.InsurancePlanPlanGeneralCostComponent();
15699    parseInsurancePlanInsurancePlanPlanGeneralCostComponentProperties(json, owner, res);
15700    return res;
15701  }
15702
15703  protected void parseInsurancePlanInsurancePlanPlanGeneralCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanGeneralCostComponent res) throws IOException, FHIRFormatError {
15704    parseBackboneElementProperties(json, res);
15705    if (json.has("type"))
15706      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15707    if (json.has("groupSize"))
15708      res.setGroupSizeElement(parsePositiveInt(json.get("groupSize").getAsString()));
15709    if (json.has("_groupSize"))
15710      parseElementProperties(json.getAsJsonObject("_groupSize"), res.getGroupSizeElement());
15711    if (json.has("cost"))
15712      res.setCost(parseMoney(json.getAsJsonObject("cost")));
15713    if (json.has("comment"))
15714      res.setCommentElement(parseString(json.get("comment").getAsString()));
15715    if (json.has("_comment"))
15716      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
15717  }
15718
15719  protected InsurancePlan.InsurancePlanPlanSpecificCostComponent parseInsurancePlanInsurancePlanPlanSpecificCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
15720    InsurancePlan.InsurancePlanPlanSpecificCostComponent res = new InsurancePlan.InsurancePlanPlanSpecificCostComponent();
15721    parseInsurancePlanInsurancePlanPlanSpecificCostComponentProperties(json, owner, res);
15722    return res;
15723  }
15724
15725  protected void parseInsurancePlanInsurancePlanPlanSpecificCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanSpecificCostComponent res) throws IOException, FHIRFormatError {
15726    parseBackboneElementProperties(json, res);
15727    if (json.has("category"))
15728      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
15729    if (json.has("benefit")) {
15730      JsonArray array = json.getAsJsonArray("benefit");
15731      for (int i = 0; i < array.size(); i++) {
15732        res.getBenefit().add(parseInsurancePlanPlanBenefitComponent(array.get(i).getAsJsonObject(), owner));
15733      }
15734    };
15735  }
15736
15737  protected InsurancePlan.PlanBenefitComponent parseInsurancePlanPlanBenefitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
15738    InsurancePlan.PlanBenefitComponent res = new InsurancePlan.PlanBenefitComponent();
15739    parseInsurancePlanPlanBenefitComponentProperties(json, owner, res);
15740    return res;
15741  }
15742
15743  protected void parseInsurancePlanPlanBenefitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.PlanBenefitComponent res) throws IOException, FHIRFormatError {
15744    parseBackboneElementProperties(json, res);
15745    if (json.has("type"))
15746      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15747    if (json.has("cost")) {
15748      JsonArray array = json.getAsJsonArray("cost");
15749      for (int i = 0; i < array.size(); i++) {
15750        res.getCost().add(parseInsurancePlanPlanBenefitCostComponent(array.get(i).getAsJsonObject(), owner));
15751      }
15752    };
15753  }
15754
15755  protected InsurancePlan.PlanBenefitCostComponent parseInsurancePlanPlanBenefitCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
15756    InsurancePlan.PlanBenefitCostComponent res = new InsurancePlan.PlanBenefitCostComponent();
15757    parseInsurancePlanPlanBenefitCostComponentProperties(json, owner, res);
15758    return res;
15759  }
15760
15761  protected void parseInsurancePlanPlanBenefitCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.PlanBenefitCostComponent res) throws IOException, FHIRFormatError {
15762    parseBackboneElementProperties(json, res);
15763    if (json.has("type"))
15764      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15765    if (json.has("applicability"))
15766      res.setApplicability(parseCodeableConcept(json.getAsJsonObject("applicability")));
15767    if (json.has("qualifiers")) {
15768      JsonArray array = json.getAsJsonArray("qualifiers");
15769      for (int i = 0; i < array.size(); i++) {
15770        res.getQualifiers().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15771      }
15772    };
15773    if (json.has("value"))
15774      res.setValue(parseQuantity(json.getAsJsonObject("value")));
15775  }
15776
15777  protected Invoice parseInvoice(JsonObject json) throws IOException, FHIRFormatError {
15778    Invoice res = new Invoice();
15779    parseInvoiceProperties(json, res);
15780    return res;
15781  }
15782
15783  protected void parseInvoiceProperties(JsonObject json, Invoice 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("status"))
15792      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Invoice.InvoiceStatus.NULL, new Invoice.InvoiceStatusEnumFactory()));
15793    if (json.has("_status"))
15794      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15795    if (json.has("cancelledReason"))
15796      res.setCancelledReasonElement(parseString(json.get("cancelledReason").getAsString()));
15797    if (json.has("_cancelledReason"))
15798      parseElementProperties(json.getAsJsonObject("_cancelledReason"), res.getCancelledReasonElement());
15799    if (json.has("type"))
15800      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15801    if (json.has("subject"))
15802      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15803    if (json.has("recipient"))
15804      res.setRecipient(parseReference(json.getAsJsonObject("recipient")));
15805    if (json.has("date"))
15806      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15807    if (json.has("_date"))
15808      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15809    if (json.has("participant")) {
15810      JsonArray array = json.getAsJsonArray("participant");
15811      for (int i = 0; i < array.size(); i++) {
15812        res.getParticipant().add(parseInvoiceInvoiceParticipantComponent(array.get(i).getAsJsonObject(), res));
15813      }
15814    };
15815    if (json.has("issuer"))
15816      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
15817    if (json.has("account"))
15818      res.setAccount(parseReference(json.getAsJsonObject("account")));
15819    if (json.has("lineItem")) {
15820      JsonArray array = json.getAsJsonArray("lineItem");
15821      for (int i = 0; i < array.size(); i++) {
15822        res.getLineItem().add(parseInvoiceInvoiceLineItemComponent(array.get(i).getAsJsonObject(), res));
15823      }
15824    };
15825    if (json.has("totalPriceComponent")) {
15826      JsonArray array = json.getAsJsonArray("totalPriceComponent");
15827      for (int i = 0; i < array.size(); i++) {
15828        res.getTotalPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), res));
15829      }
15830    };
15831    if (json.has("totalNet"))
15832      res.setTotalNet(parseMoney(json.getAsJsonObject("totalNet")));
15833    if (json.has("totalGross"))
15834      res.setTotalGross(parseMoney(json.getAsJsonObject("totalGross")));
15835    if (json.has("paymentTerms"))
15836      res.setPaymentTermsElement(parseMarkdown(json.get("paymentTerms").getAsString()));
15837    if (json.has("_paymentTerms"))
15838      parseElementProperties(json.getAsJsonObject("_paymentTerms"), res.getPaymentTermsElement());
15839    if (json.has("note")) {
15840      JsonArray array = json.getAsJsonArray("note");
15841      for (int i = 0; i < array.size(); i++) {
15842        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15843      }
15844    };
15845  }
15846
15847  protected Invoice.InvoiceParticipantComponent parseInvoiceInvoiceParticipantComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
15848    Invoice.InvoiceParticipantComponent res = new Invoice.InvoiceParticipantComponent();
15849    parseInvoiceInvoiceParticipantComponentProperties(json, owner, res);
15850    return res;
15851  }
15852
15853  protected void parseInvoiceInvoiceParticipantComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceParticipantComponent res) throws IOException, FHIRFormatError {
15854    parseBackboneElementProperties(json, res);
15855    if (json.has("role"))
15856      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
15857    if (json.has("actor"))
15858      res.setActor(parseReference(json.getAsJsonObject("actor")));
15859  }
15860
15861  protected Invoice.InvoiceLineItemComponent parseInvoiceInvoiceLineItemComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
15862    Invoice.InvoiceLineItemComponent res = new Invoice.InvoiceLineItemComponent();
15863    parseInvoiceInvoiceLineItemComponentProperties(json, owner, res);
15864    return res;
15865  }
15866
15867  protected void parseInvoiceInvoiceLineItemComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceLineItemComponent res) throws IOException, FHIRFormatError {
15868    parseBackboneElementProperties(json, res);
15869    if (json.has("sequence"))
15870      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
15871    if (json.has("_sequence"))
15872      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
15873    Type chargeItem = parseType("chargeItem", json);
15874    if (chargeItem != null)
15875      res.setChargeItem(chargeItem);
15876    if (json.has("priceComponent")) {
15877      JsonArray array = json.getAsJsonArray("priceComponent");
15878      for (int i = 0; i < array.size(); i++) {
15879        res.getPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), owner));
15880      }
15881    };
15882  }
15883
15884  protected Invoice.InvoiceLineItemPriceComponentComponent parseInvoiceInvoiceLineItemPriceComponentComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
15885    Invoice.InvoiceLineItemPriceComponentComponent res = new Invoice.InvoiceLineItemPriceComponentComponent();
15886    parseInvoiceInvoiceLineItemPriceComponentComponentProperties(json, owner, res);
15887    return res;
15888  }
15889
15890  protected void parseInvoiceInvoiceLineItemPriceComponentComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceLineItemPriceComponentComponent res) throws IOException, FHIRFormatError {
15891    parseBackboneElementProperties(json, res);
15892    if (json.has("type"))
15893      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Invoice.InvoicePriceComponentType.NULL, new Invoice.InvoicePriceComponentTypeEnumFactory()));
15894    if (json.has("_type"))
15895      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
15896    if (json.has("code"))
15897      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15898    if (json.has("factor"))
15899      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
15900    if (json.has("_factor"))
15901      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
15902    if (json.has("amount"))
15903      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
15904  }
15905
15906  protected Library parseLibrary(JsonObject json) throws IOException, FHIRFormatError {
15907    Library res = new Library();
15908    parseLibraryProperties(json, res);
15909    return res;
15910  }
15911
15912  protected void parseLibraryProperties(JsonObject json, Library res) throws IOException, FHIRFormatError {
15913    parseDomainResourceProperties(json, res);
15914    if (json.has("url"))
15915      res.setUrlElement(parseUri(json.get("url").getAsString()));
15916    if (json.has("_url"))
15917      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
15918    if (json.has("identifier")) {
15919      JsonArray array = json.getAsJsonArray("identifier");
15920      for (int i = 0; i < array.size(); i++) {
15921        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15922      }
15923    };
15924    if (json.has("version"))
15925      res.setVersionElement(parseString(json.get("version").getAsString()));
15926    if (json.has("_version"))
15927      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
15928    if (json.has("name"))
15929      res.setNameElement(parseString(json.get("name").getAsString()));
15930    if (json.has("_name"))
15931      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15932    if (json.has("title"))
15933      res.setTitleElement(parseString(json.get("title").getAsString()));
15934    if (json.has("_title"))
15935      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
15936    if (json.has("subtitle"))
15937      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
15938    if (json.has("_subtitle"))
15939      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
15940    if (json.has("status"))
15941      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15942    if (json.has("_status"))
15943      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15944    if (json.has("experimental"))
15945      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
15946    if (json.has("_experimental"))
15947      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
15948    if (json.has("type"))
15949      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15950    Type subject = parseType("subject", json);
15951    if (subject != null)
15952      res.setSubject(subject);
15953    if (json.has("date"))
15954      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15955    if (json.has("_date"))
15956      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15957    if (json.has("publisher"))
15958      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15959    if (json.has("_publisher"))
15960      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
15961    if (json.has("contact")) {
15962      JsonArray array = json.getAsJsonArray("contact");
15963      for (int i = 0; i < array.size(); i++) {
15964        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
15965      }
15966    };
15967    if (json.has("description"))
15968      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15969    if (json.has("_description"))
15970      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15971    if (json.has("useContext")) {
15972      JsonArray array = json.getAsJsonArray("useContext");
15973      for (int i = 0; i < array.size(); i++) {
15974        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
15975      }
15976    };
15977    if (json.has("jurisdiction")) {
15978      JsonArray array = json.getAsJsonArray("jurisdiction");
15979      for (int i = 0; i < array.size(); i++) {
15980        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15981      }
15982    };
15983    if (json.has("purpose"))
15984      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
15985    if (json.has("_purpose"))
15986      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
15987    if (json.has("usage"))
15988      res.setUsageElement(parseString(json.get("usage").getAsString()));
15989    if (json.has("_usage"))
15990      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
15991    if (json.has("copyright"))
15992      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
15993    if (json.has("_copyright"))
15994      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
15995    if (json.has("approvalDate"))
15996      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
15997    if (json.has("_approvalDate"))
15998      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
15999    if (json.has("lastReviewDate"))
16000      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
16001    if (json.has("_lastReviewDate"))
16002      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
16003    if (json.has("effectivePeriod"))
16004      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
16005    if (json.has("topic")) {
16006      JsonArray array = json.getAsJsonArray("topic");
16007      for (int i = 0; i < array.size(); i++) {
16008        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16009      }
16010    };
16011    if (json.has("author")) {
16012      JsonArray array = json.getAsJsonArray("author");
16013      for (int i = 0; i < array.size(); i++) {
16014        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
16015      }
16016    };
16017    if (json.has("editor")) {
16018      JsonArray array = json.getAsJsonArray("editor");
16019      for (int i = 0; i < array.size(); i++) {
16020        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
16021      }
16022    };
16023    if (json.has("reviewer")) {
16024      JsonArray array = json.getAsJsonArray("reviewer");
16025      for (int i = 0; i < array.size(); i++) {
16026        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
16027      }
16028    };
16029    if (json.has("endorser")) {
16030      JsonArray array = json.getAsJsonArray("endorser");
16031      for (int i = 0; i < array.size(); i++) {
16032        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
16033      }
16034    };
16035    if (json.has("relatedArtifact")) {
16036      JsonArray array = json.getAsJsonArray("relatedArtifact");
16037      for (int i = 0; i < array.size(); i++) {
16038        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
16039      }
16040    };
16041    if (json.has("parameter")) {
16042      JsonArray array = json.getAsJsonArray("parameter");
16043      for (int i = 0; i < array.size(); i++) {
16044        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
16045      }
16046    };
16047    if (json.has("dataRequirement")) {
16048      JsonArray array = json.getAsJsonArray("dataRequirement");
16049      for (int i = 0; i < array.size(); i++) {
16050        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
16051      }
16052    };
16053    if (json.has("content")) {
16054      JsonArray array = json.getAsJsonArray("content");
16055      for (int i = 0; i < array.size(); i++) {
16056        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
16057      }
16058    };
16059  }
16060
16061  protected Linkage parseLinkage(JsonObject json) throws IOException, FHIRFormatError {
16062    Linkage res = new Linkage();
16063    parseLinkageProperties(json, res);
16064    return res;
16065  }
16066
16067  protected void parseLinkageProperties(JsonObject json, Linkage res) throws IOException, FHIRFormatError {
16068    parseDomainResourceProperties(json, res);
16069    if (json.has("active"))
16070      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
16071    if (json.has("_active"))
16072      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
16073    if (json.has("author"))
16074      res.setAuthor(parseReference(json.getAsJsonObject("author")));
16075    if (json.has("item")) {
16076      JsonArray array = json.getAsJsonArray("item");
16077      for (int i = 0; i < array.size(); i++) {
16078        res.getItem().add(parseLinkageLinkageItemComponent(array.get(i).getAsJsonObject(), res));
16079      }
16080    };
16081  }
16082
16083  protected Linkage.LinkageItemComponent parseLinkageLinkageItemComponent(JsonObject json, Linkage owner) throws IOException, FHIRFormatError {
16084    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
16085    parseLinkageLinkageItemComponentProperties(json, owner, res);
16086    return res;
16087  }
16088
16089  protected void parseLinkageLinkageItemComponentProperties(JsonObject json, Linkage owner, Linkage.LinkageItemComponent res) throws IOException, FHIRFormatError {
16090    parseBackboneElementProperties(json, res);
16091    if (json.has("type"))
16092      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Linkage.LinkageType.NULL, new Linkage.LinkageTypeEnumFactory()));
16093    if (json.has("_type"))
16094      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16095    if (json.has("resource"))
16096      res.setResource(parseReference(json.getAsJsonObject("resource")));
16097  }
16098
16099  protected ListResource parseListResource(JsonObject json) throws IOException, FHIRFormatError {
16100    ListResource res = new ListResource();
16101    parseListResourceProperties(json, res);
16102    return res;
16103  }
16104
16105  protected void parseListResourceProperties(JsonObject json, ListResource res) throws IOException, FHIRFormatError {
16106    parseDomainResourceProperties(json, res);
16107    if (json.has("identifier")) {
16108      JsonArray array = json.getAsJsonArray("identifier");
16109      for (int i = 0; i < array.size(); i++) {
16110        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16111      }
16112    };
16113    if (json.has("status"))
16114      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ListResource.ListStatus.NULL, new ListResource.ListStatusEnumFactory()));
16115    if (json.has("_status"))
16116      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16117    if (json.has("mode"))
16118      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ListResource.ListMode.NULL, new ListResource.ListModeEnumFactory()));
16119    if (json.has("_mode"))
16120      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
16121    if (json.has("title"))
16122      res.setTitleElement(parseString(json.get("title").getAsString()));
16123    if (json.has("_title"))
16124      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
16125    if (json.has("code"))
16126      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16127    if (json.has("subject"))
16128      res.setSubject(parseReference(json.getAsJsonObject("subject")));
16129    if (json.has("encounter"))
16130      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
16131    if (json.has("date"))
16132      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16133    if (json.has("_date"))
16134      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16135    if (json.has("source"))
16136      res.setSource(parseReference(json.getAsJsonObject("source")));
16137    if (json.has("orderedBy"))
16138      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
16139    if (json.has("note")) {
16140      JsonArray array = json.getAsJsonArray("note");
16141      for (int i = 0; i < array.size(); i++) {
16142        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16143      }
16144    };
16145    if (json.has("entry")) {
16146      JsonArray array = json.getAsJsonArray("entry");
16147      for (int i = 0; i < array.size(); i++) {
16148        res.getEntry().add(parseListResourceListEntryComponent(array.get(i).getAsJsonObject(), res));
16149      }
16150    };
16151    if (json.has("emptyReason"))
16152      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
16153  }
16154
16155  protected ListResource.ListEntryComponent parseListResourceListEntryComponent(JsonObject json, ListResource owner) throws IOException, FHIRFormatError {
16156    ListResource.ListEntryComponent res = new ListResource.ListEntryComponent();
16157    parseListResourceListEntryComponentProperties(json, owner, res);
16158    return res;
16159  }
16160
16161  protected void parseListResourceListEntryComponentProperties(JsonObject json, ListResource owner, ListResource.ListEntryComponent res) throws IOException, FHIRFormatError {
16162    parseBackboneElementProperties(json, res);
16163    if (json.has("flag"))
16164      res.setFlag(parseCodeableConcept(json.getAsJsonObject("flag")));
16165    if (json.has("deleted"))
16166      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
16167    if (json.has("_deleted"))
16168      parseElementProperties(json.getAsJsonObject("_deleted"), res.getDeletedElement());
16169    if (json.has("date"))
16170      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16171    if (json.has("_date"))
16172      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16173    if (json.has("item"))
16174      res.setItem(parseReference(json.getAsJsonObject("item")));
16175  }
16176
16177  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
16178    Location res = new Location();
16179    parseLocationProperties(json, res);
16180    return res;
16181  }
16182
16183  protected void parseLocationProperties(JsonObject json, Location res) throws IOException, FHIRFormatError {
16184    parseDomainResourceProperties(json, res);
16185    if (json.has("identifier")) {
16186      JsonArray array = json.getAsJsonArray("identifier");
16187      for (int i = 0; i < array.size(); i++) {
16188        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16189      }
16190    };
16191    if (json.has("status"))
16192      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
16193    if (json.has("_status"))
16194      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16195    if (json.has("operationalStatus"))
16196      res.setOperationalStatus(parseCoding(json.getAsJsonObject("operationalStatus")));
16197    if (json.has("name"))
16198      res.setNameElement(parseString(json.get("name").getAsString()));
16199    if (json.has("_name"))
16200      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16201    if (json.has("alias")) {
16202      JsonArray array = json.getAsJsonArray("alias");
16203      for (int i = 0; i < array.size(); i++) {
16204        res.getAlias().add(parseString(array.get(i).getAsString()));
16205      }
16206    };
16207    if (json.has("_alias")) {
16208      JsonArray array = json.getAsJsonArray("_alias");
16209      for (int i = 0; i < array.size(); i++) {
16210        if (i == res.getAlias().size())
16211          res.getAlias().add(parseString(null));
16212        if (array.get(i) instanceof JsonObject) 
16213          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
16214      }
16215    };
16216    if (json.has("description"))
16217      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16218    if (json.has("_description"))
16219      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16220    if (json.has("mode"))
16221      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
16222    if (json.has("_mode"))
16223      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
16224    if (json.has("type")) {
16225      JsonArray array = json.getAsJsonArray("type");
16226      for (int i = 0; i < array.size(); i++) {
16227        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16228      }
16229    };
16230    if (json.has("telecom")) {
16231      JsonArray array = json.getAsJsonArray("telecom");
16232      for (int i = 0; i < array.size(); i++) {
16233        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
16234      }
16235    };
16236    if (json.has("address"))
16237      res.setAddress(parseAddress(json.getAsJsonObject("address")));
16238    if (json.has("physicalType"))
16239      res.setPhysicalType(parseCodeableConcept(json.getAsJsonObject("physicalType")));
16240    if (json.has("position"))
16241      res.setPosition(parseLocationLocationPositionComponent(json.getAsJsonObject("position"), res));
16242    if (json.has("managingOrganization"))
16243      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
16244    if (json.has("partOf"))
16245      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
16246    if (json.has("hoursOfOperation")) {
16247      JsonArray array = json.getAsJsonArray("hoursOfOperation");
16248      for (int i = 0; i < array.size(); i++) {
16249        res.getHoursOfOperation().add(parseLocationLocationHoursOfOperationComponent(array.get(i).getAsJsonObject(), res));
16250      }
16251    };
16252    if (json.has("availabilityExceptions"))
16253      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
16254    if (json.has("_availabilityExceptions"))
16255      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
16256    if (json.has("endpoint")) {
16257      JsonArray array = json.getAsJsonArray("endpoint");
16258      for (int i = 0; i < array.size(); i++) {
16259        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
16260      }
16261    };
16262  }
16263
16264  protected Location.LocationPositionComponent parseLocationLocationPositionComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
16265    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
16266    parseLocationLocationPositionComponentProperties(json, owner, res);
16267    return res;
16268  }
16269
16270  protected void parseLocationLocationPositionComponentProperties(JsonObject json, Location owner, Location.LocationPositionComponent res) throws IOException, FHIRFormatError {
16271    parseBackboneElementProperties(json, res);
16272    if (json.has("longitude"))
16273      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
16274    if (json.has("_longitude"))
16275      parseElementProperties(json.getAsJsonObject("_longitude"), res.getLongitudeElement());
16276    if (json.has("latitude"))
16277      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
16278    if (json.has("_latitude"))
16279      parseElementProperties(json.getAsJsonObject("_latitude"), res.getLatitudeElement());
16280    if (json.has("altitude"))
16281      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
16282    if (json.has("_altitude"))
16283      parseElementProperties(json.getAsJsonObject("_altitude"), res.getAltitudeElement());
16284  }
16285
16286  protected Location.LocationHoursOfOperationComponent parseLocationLocationHoursOfOperationComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
16287    Location.LocationHoursOfOperationComponent res = new Location.LocationHoursOfOperationComponent();
16288    parseLocationLocationHoursOfOperationComponentProperties(json, owner, res);
16289    return res;
16290  }
16291
16292  protected void parseLocationLocationHoursOfOperationComponentProperties(JsonObject json, Location owner, Location.LocationHoursOfOperationComponent res) throws IOException, FHIRFormatError {
16293    parseBackboneElementProperties(json, res);
16294    if (json.has("daysOfWeek")) {
16295      JsonArray array = json.getAsJsonArray("daysOfWeek");
16296      for (int i = 0; i < array.size(); i++) {
16297        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
16298      }
16299    };
16300    if (json.has("_daysOfWeek")) {
16301      JsonArray array = json.getAsJsonArray("_daysOfWeek");
16302      for (int i = 0; i < array.size(); i++) {
16303        if (i == res.getDaysOfWeek().size())
16304          res.getDaysOfWeek().add(parseEnumeration(null, Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
16305        if (array.get(i) instanceof JsonObject) 
16306          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
16307      }
16308    };
16309    if (json.has("allDay"))
16310      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
16311    if (json.has("_allDay"))
16312      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
16313    if (json.has("openingTime"))
16314      res.setOpeningTimeElement(parseTime(json.get("openingTime").getAsString()));
16315    if (json.has("_openingTime"))
16316      parseElementProperties(json.getAsJsonObject("_openingTime"), res.getOpeningTimeElement());
16317    if (json.has("closingTime"))
16318      res.setClosingTimeElement(parseTime(json.get("closingTime").getAsString()));
16319    if (json.has("_closingTime"))
16320      parseElementProperties(json.getAsJsonObject("_closingTime"), res.getClosingTimeElement());
16321  }
16322
16323  protected ManufacturedItemDefinition parseManufacturedItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
16324    ManufacturedItemDefinition res = new ManufacturedItemDefinition();
16325    parseManufacturedItemDefinitionProperties(json, res);
16326    return res;
16327  }
16328
16329  protected void parseManufacturedItemDefinitionProperties(JsonObject json, ManufacturedItemDefinition res) throws IOException, FHIRFormatError {
16330    parseDomainResourceProperties(json, res);
16331    if (json.has("manufacturedDoseForm"))
16332      res.setManufacturedDoseForm(parseCodeableConcept(json.getAsJsonObject("manufacturedDoseForm")));
16333    if (json.has("unitOfPresentation"))
16334      res.setUnitOfPresentation(parseCodeableConcept(json.getAsJsonObject("unitOfPresentation")));
16335    if (json.has("manufacturer")) {
16336      JsonArray array = json.getAsJsonArray("manufacturer");
16337      for (int i = 0; i < array.size(); i++) {
16338        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
16339      }
16340    };
16341    if (json.has("ingredient")) {
16342      JsonArray array = json.getAsJsonArray("ingredient");
16343      for (int i = 0; i < array.size(); i++) {
16344        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
16345      }
16346    };
16347    if (json.has("physicalCharacteristics"))
16348      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
16349    if (json.has("otherCharacteristics")) {
16350      JsonArray array = json.getAsJsonArray("otherCharacteristics");
16351      for (int i = 0; i < array.size(); i++) {
16352        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16353      }
16354    };
16355  }
16356
16357  protected Measure parseMeasure(JsonObject json) throws IOException, FHIRFormatError {
16358    Measure res = new Measure();
16359    parseMeasureProperties(json, res);
16360    return res;
16361  }
16362
16363  protected void parseMeasureProperties(JsonObject json, Measure res) throws IOException, FHIRFormatError {
16364    parseDomainResourceProperties(json, res);
16365    if (json.has("url"))
16366      res.setUrlElement(parseUri(json.get("url").getAsString()));
16367    if (json.has("_url"))
16368      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
16369    if (json.has("identifier")) {
16370      JsonArray array = json.getAsJsonArray("identifier");
16371      for (int i = 0; i < array.size(); i++) {
16372        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16373      }
16374    };
16375    if (json.has("version"))
16376      res.setVersionElement(parseString(json.get("version").getAsString()));
16377    if (json.has("_version"))
16378      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
16379    if (json.has("name"))
16380      res.setNameElement(parseString(json.get("name").getAsString()));
16381    if (json.has("_name"))
16382      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16383    if (json.has("title"))
16384      res.setTitleElement(parseString(json.get("title").getAsString()));
16385    if (json.has("_title"))
16386      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
16387    if (json.has("subtitle"))
16388      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
16389    if (json.has("_subtitle"))
16390      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
16391    if (json.has("status"))
16392      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
16393    if (json.has("_status"))
16394      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16395    if (json.has("experimental"))
16396      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
16397    if (json.has("_experimental"))
16398      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
16399    Type subject = parseType("subject", json);
16400    if (subject != null)
16401      res.setSubject(subject);
16402    if (json.has("date"))
16403      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16404    if (json.has("_date"))
16405      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16406    if (json.has("publisher"))
16407      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
16408    if (json.has("_publisher"))
16409      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
16410    if (json.has("contact")) {
16411      JsonArray array = json.getAsJsonArray("contact");
16412      for (int i = 0; i < array.size(); i++) {
16413        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
16414      }
16415    };
16416    if (json.has("description"))
16417      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
16418    if (json.has("_description"))
16419      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16420    if (json.has("useContext")) {
16421      JsonArray array = json.getAsJsonArray("useContext");
16422      for (int i = 0; i < array.size(); i++) {
16423        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
16424      }
16425    };
16426    if (json.has("jurisdiction")) {
16427      JsonArray array = json.getAsJsonArray("jurisdiction");
16428      for (int i = 0; i < array.size(); i++) {
16429        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16430      }
16431    };
16432    if (json.has("purpose"))
16433      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
16434    if (json.has("_purpose"))
16435      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
16436    if (json.has("usage"))
16437      res.setUsageElement(parseString(json.get("usage").getAsString()));
16438    if (json.has("_usage"))
16439      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
16440    if (json.has("copyright"))
16441      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
16442    if (json.has("_copyright"))
16443      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
16444    if (json.has("approvalDate"))
16445      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
16446    if (json.has("_approvalDate"))
16447      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
16448    if (json.has("lastReviewDate"))
16449      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
16450    if (json.has("_lastReviewDate"))
16451      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
16452    if (json.has("effectivePeriod"))
16453      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
16454    if (json.has("topic")) {
16455      JsonArray array = json.getAsJsonArray("topic");
16456      for (int i = 0; i < array.size(); i++) {
16457        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16458      }
16459    };
16460    if (json.has("author")) {
16461      JsonArray array = json.getAsJsonArray("author");
16462      for (int i = 0; i < array.size(); i++) {
16463        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
16464      }
16465    };
16466    if (json.has("editor")) {
16467      JsonArray array = json.getAsJsonArray("editor");
16468      for (int i = 0; i < array.size(); i++) {
16469        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
16470      }
16471    };
16472    if (json.has("reviewer")) {
16473      JsonArray array = json.getAsJsonArray("reviewer");
16474      for (int i = 0; i < array.size(); i++) {
16475        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
16476      }
16477    };
16478    if (json.has("endorser")) {
16479      JsonArray array = json.getAsJsonArray("endorser");
16480      for (int i = 0; i < array.size(); i++) {
16481        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
16482      }
16483    };
16484    if (json.has("relatedArtifact")) {
16485      JsonArray array = json.getAsJsonArray("relatedArtifact");
16486      for (int i = 0; i < array.size(); i++) {
16487        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
16488      }
16489    };
16490    if (json.has("library")) {
16491      JsonArray array = json.getAsJsonArray("library");
16492      for (int i = 0; i < array.size(); i++) {
16493        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
16494      }
16495    };
16496    if (json.has("_library")) {
16497      JsonArray array = json.getAsJsonArray("_library");
16498      for (int i = 0; i < array.size(); i++) {
16499        if (i == res.getLibrary().size())
16500          res.getLibrary().add(parseCanonical(null));
16501        if (array.get(i) instanceof JsonObject) 
16502          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
16503      }
16504    };
16505    if (json.has("disclaimer"))
16506      res.setDisclaimerElement(parseMarkdown(json.get("disclaimer").getAsString()));
16507    if (json.has("_disclaimer"))
16508      parseElementProperties(json.getAsJsonObject("_disclaimer"), res.getDisclaimerElement());
16509    if (json.has("scoring"))
16510      res.setScoring(parseCodeableConcept(json.getAsJsonObject("scoring")));
16511    if (json.has("compositeScoring"))
16512      res.setCompositeScoring(parseCodeableConcept(json.getAsJsonObject("compositeScoring")));
16513    if (json.has("type")) {
16514      JsonArray array = json.getAsJsonArray("type");
16515      for (int i = 0; i < array.size(); i++) {
16516        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16517      }
16518    };
16519    if (json.has("riskAdjustment"))
16520      res.setRiskAdjustmentElement(parseString(json.get("riskAdjustment").getAsString()));
16521    if (json.has("_riskAdjustment"))
16522      parseElementProperties(json.getAsJsonObject("_riskAdjustment"), res.getRiskAdjustmentElement());
16523    if (json.has("rateAggregation"))
16524      res.setRateAggregationElement(parseString(json.get("rateAggregation").getAsString()));
16525    if (json.has("_rateAggregation"))
16526      parseElementProperties(json.getAsJsonObject("_rateAggregation"), res.getRateAggregationElement());
16527    if (json.has("rationale"))
16528      res.setRationaleElement(parseMarkdown(json.get("rationale").getAsString()));
16529    if (json.has("_rationale"))
16530      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
16531    if (json.has("clinicalRecommendationStatement"))
16532      res.setClinicalRecommendationStatementElement(parseMarkdown(json.get("clinicalRecommendationStatement").getAsString()));
16533    if (json.has("_clinicalRecommendationStatement"))
16534      parseElementProperties(json.getAsJsonObject("_clinicalRecommendationStatement"), res.getClinicalRecommendationStatementElement());
16535    if (json.has("improvementNotation"))
16536      res.setImprovementNotation(parseCodeableConcept(json.getAsJsonObject("improvementNotation")));
16537    if (json.has("definition")) {
16538      JsonArray array = json.getAsJsonArray("definition");
16539      for (int i = 0; i < array.size(); i++) {
16540        res.getDefinition().add(parseMarkdown(array.get(i).getAsString()));
16541      }
16542    };
16543    if (json.has("_definition")) {
16544      JsonArray array = json.getAsJsonArray("_definition");
16545      for (int i = 0; i < array.size(); i++) {
16546        if (i == res.getDefinition().size())
16547          res.getDefinition().add(parseMarkdown(null));
16548        if (array.get(i) instanceof JsonObject) 
16549          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
16550      }
16551    };
16552    if (json.has("guidance"))
16553      res.setGuidanceElement(parseMarkdown(json.get("guidance").getAsString()));
16554    if (json.has("_guidance"))
16555      parseElementProperties(json.getAsJsonObject("_guidance"), res.getGuidanceElement());
16556    if (json.has("group")) {
16557      JsonArray array = json.getAsJsonArray("group");
16558      for (int i = 0; i < array.size(); i++) {
16559        res.getGroup().add(parseMeasureMeasureGroupComponent(array.get(i).getAsJsonObject(), res));
16560      }
16561    };
16562    if (json.has("supplementalData")) {
16563      JsonArray array = json.getAsJsonArray("supplementalData");
16564      for (int i = 0; i < array.size(); i++) {
16565        res.getSupplementalData().add(parseMeasureMeasureSupplementalDataComponent(array.get(i).getAsJsonObject(), res));
16566      }
16567    };
16568  }
16569
16570  protected Measure.MeasureGroupComponent parseMeasureMeasureGroupComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
16571    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
16572    parseMeasureMeasureGroupComponentProperties(json, owner, res);
16573    return res;
16574  }
16575
16576  protected void parseMeasureMeasureGroupComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupComponent res) throws IOException, FHIRFormatError {
16577    parseBackboneElementProperties(json, res);
16578    if (json.has("code"))
16579      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16580    if (json.has("description"))
16581      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16582    if (json.has("_description"))
16583      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16584    if (json.has("population")) {
16585      JsonArray array = json.getAsJsonArray("population");
16586      for (int i = 0; i < array.size(); i++) {
16587        res.getPopulation().add(parseMeasureMeasureGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
16588      }
16589    };
16590    if (json.has("stratifier")) {
16591      JsonArray array = json.getAsJsonArray("stratifier");
16592      for (int i = 0; i < array.size(); i++) {
16593        res.getStratifier().add(parseMeasureMeasureGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
16594      }
16595    };
16596  }
16597
16598  protected Measure.MeasureGroupPopulationComponent parseMeasureMeasureGroupPopulationComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
16599    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
16600    parseMeasureMeasureGroupPopulationComponentProperties(json, owner, res);
16601    return res;
16602  }
16603
16604  protected void parseMeasureMeasureGroupPopulationComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupPopulationComponent res) throws IOException, FHIRFormatError {
16605    parseBackboneElementProperties(json, res);
16606    if (json.has("code"))
16607      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16608    if (json.has("description"))
16609      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16610    if (json.has("_description"))
16611      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16612    if (json.has("criteria"))
16613      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
16614  }
16615
16616  protected Measure.MeasureGroupStratifierComponent parseMeasureMeasureGroupStratifierComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
16617    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
16618    parseMeasureMeasureGroupStratifierComponentProperties(json, owner, res);
16619    return res;
16620  }
16621
16622  protected void parseMeasureMeasureGroupStratifierComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupStratifierComponent res) throws IOException, FHIRFormatError {
16623    parseBackboneElementProperties(json, res);
16624    if (json.has("code"))
16625      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16626    if (json.has("description"))
16627      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16628    if (json.has("_description"))
16629      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16630    if (json.has("criteria"))
16631      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
16632    if (json.has("component")) {
16633      JsonArray array = json.getAsJsonArray("component");
16634      for (int i = 0; i < array.size(); i++) {
16635        res.getComponent().add(parseMeasureMeasureGroupStratifierComponentComponent(array.get(i).getAsJsonObject(), owner));
16636      }
16637    };
16638  }
16639
16640  protected Measure.MeasureGroupStratifierComponentComponent parseMeasureMeasureGroupStratifierComponentComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
16641    Measure.MeasureGroupStratifierComponentComponent res = new Measure.MeasureGroupStratifierComponentComponent();
16642    parseMeasureMeasureGroupStratifierComponentComponentProperties(json, owner, res);
16643    return res;
16644  }
16645
16646  protected void parseMeasureMeasureGroupStratifierComponentComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupStratifierComponentComponent res) throws IOException, FHIRFormatError {
16647    parseBackboneElementProperties(json, res);
16648    if (json.has("code"))
16649      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16650    if (json.has("description"))
16651      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16652    if (json.has("_description"))
16653      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16654    if (json.has("criteria"))
16655      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
16656  }
16657
16658  protected Measure.MeasureSupplementalDataComponent parseMeasureMeasureSupplementalDataComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
16659    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
16660    parseMeasureMeasureSupplementalDataComponentProperties(json, owner, res);
16661    return res;
16662  }
16663
16664  protected void parseMeasureMeasureSupplementalDataComponentProperties(JsonObject json, Measure owner, Measure.MeasureSupplementalDataComponent res) throws IOException, FHIRFormatError {
16665    parseBackboneElementProperties(json, res);
16666    if (json.has("code"))
16667      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16668    if (json.has("usage")) {
16669      JsonArray array = json.getAsJsonArray("usage");
16670      for (int i = 0; i < array.size(); i++) {
16671        res.getUsage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16672      }
16673    };
16674    if (json.has("description"))
16675      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16676    if (json.has("_description"))
16677      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16678    if (json.has("criteria"))
16679      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
16680  }
16681
16682  protected MeasureReport parseMeasureReport(JsonObject json) throws IOException, FHIRFormatError {
16683    MeasureReport res = new MeasureReport();
16684    parseMeasureReportProperties(json, res);
16685    return res;
16686  }
16687
16688  protected void parseMeasureReportProperties(JsonObject json, MeasureReport res) throws IOException, FHIRFormatError {
16689    parseDomainResourceProperties(json, res);
16690    if (json.has("identifier")) {
16691      JsonArray array = json.getAsJsonArray("identifier");
16692      for (int i = 0; i < array.size(); i++) {
16693        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16694      }
16695    };
16696    if (json.has("status"))
16697      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MeasureReport.MeasureReportStatus.NULL, new MeasureReport.MeasureReportStatusEnumFactory()));
16698    if (json.has("_status"))
16699      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16700    if (json.has("type"))
16701      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MeasureReport.MeasureReportType.NULL, new MeasureReport.MeasureReportTypeEnumFactory()));
16702    if (json.has("_type"))
16703      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16704    if (json.has("measure"))
16705      res.setMeasureElement(parseCanonical(json.get("measure").getAsString()));
16706    if (json.has("_measure"))
16707      parseElementProperties(json.getAsJsonObject("_measure"), res.getMeasureElement());
16708    if (json.has("subject"))
16709      res.setSubject(parseReference(json.getAsJsonObject("subject")));
16710    if (json.has("date"))
16711      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16712    if (json.has("_date"))
16713      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16714    if (json.has("reporter"))
16715      res.setReporter(parseReference(json.getAsJsonObject("reporter")));
16716    if (json.has("period"))
16717      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
16718    if (json.has("improvementNotation"))
16719      res.setImprovementNotation(parseCodeableConcept(json.getAsJsonObject("improvementNotation")));
16720    if (json.has("group")) {
16721      JsonArray array = json.getAsJsonArray("group");
16722      for (int i = 0; i < array.size(); i++) {
16723        res.getGroup().add(parseMeasureReportMeasureReportGroupComponent(array.get(i).getAsJsonObject(), res));
16724      }
16725    };
16726    if (json.has("evaluatedResource")) {
16727      JsonArray array = json.getAsJsonArray("evaluatedResource");
16728      for (int i = 0; i < array.size(); i++) {
16729        res.getEvaluatedResource().add(parseReference(array.get(i).getAsJsonObject()));
16730      }
16731    };
16732  }
16733
16734  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportMeasureReportGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
16735    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
16736    parseMeasureReportMeasureReportGroupComponentProperties(json, owner, res);
16737    return res;
16738  }
16739
16740  protected void parseMeasureReportMeasureReportGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupComponent res) throws IOException, FHIRFormatError {
16741    parseBackboneElementProperties(json, res);
16742    if (json.has("code"))
16743      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16744    if (json.has("population")) {
16745      JsonArray array = json.getAsJsonArray("population");
16746      for (int i = 0; i < array.size(); i++) {
16747        res.getPopulation().add(parseMeasureReportMeasureReportGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
16748      }
16749    };
16750    if (json.has("measureScore"))
16751      res.setMeasureScore(parseQuantity(json.getAsJsonObject("measureScore")));
16752    if (json.has("stratifier")) {
16753      JsonArray array = json.getAsJsonArray("stratifier");
16754      for (int i = 0; i < array.size(); i++) {
16755        res.getStratifier().add(parseMeasureReportMeasureReportGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
16756      }
16757    };
16758  }
16759
16760  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportMeasureReportGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
16761    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
16762    parseMeasureReportMeasureReportGroupPopulationComponentProperties(json, owner, res);
16763    return res;
16764  }
16765
16766  protected void parseMeasureReportMeasureReportGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupPopulationComponent res) throws IOException, FHIRFormatError {
16767    parseBackboneElementProperties(json, res);
16768    if (json.has("code"))
16769      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16770    if (json.has("count"))
16771      res.setCountElement(parseInteger(json.get("count").getAsLong()));
16772    if (json.has("_count"))
16773      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
16774    if (json.has("subjectResults"))
16775      res.setSubjectResults(parseReference(json.getAsJsonObject("subjectResults")));
16776  }
16777
16778  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportMeasureReportGroupStratifierComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
16779    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
16780    parseMeasureReportMeasureReportGroupStratifierComponentProperties(json, owner, res);
16781    return res;
16782  }
16783
16784  protected void parseMeasureReportMeasureReportGroupStratifierComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupStratifierComponent res) throws IOException, FHIRFormatError {
16785    parseBackboneElementProperties(json, res);
16786    if (json.has("code")) {
16787      JsonArray array = json.getAsJsonArray("code");
16788      for (int i = 0; i < array.size(); i++) {
16789        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16790      }
16791    };
16792    if (json.has("stratum")) {
16793      JsonArray array = json.getAsJsonArray("stratum");
16794      for (int i = 0; i < array.size(); i++) {
16795        res.getStratum().add(parseMeasureReportStratifierGroupComponent(array.get(i).getAsJsonObject(), owner));
16796      }
16797    };
16798  }
16799
16800  protected MeasureReport.StratifierGroupComponent parseMeasureReportStratifierGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
16801    MeasureReport.StratifierGroupComponent res = new MeasureReport.StratifierGroupComponent();
16802    parseMeasureReportStratifierGroupComponentProperties(json, owner, res);
16803    return res;
16804  }
16805
16806  protected void parseMeasureReportStratifierGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupComponent res) throws IOException, FHIRFormatError {
16807    parseBackboneElementProperties(json, res);
16808    if (json.has("value"))
16809      res.setValue(parseCodeableConcept(json.getAsJsonObject("value")));
16810    if (json.has("component")) {
16811      JsonArray array = json.getAsJsonArray("component");
16812      for (int i = 0; i < array.size(); i++) {
16813        res.getComponent().add(parseMeasureReportStratifierGroupComponentComponent(array.get(i).getAsJsonObject(), owner));
16814      }
16815    };
16816    if (json.has("population")) {
16817      JsonArray array = json.getAsJsonArray("population");
16818      for (int i = 0; i < array.size(); i++) {
16819        res.getPopulation().add(parseMeasureReportStratifierGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
16820      }
16821    };
16822    if (json.has("measureScore"))
16823      res.setMeasureScore(parseQuantity(json.getAsJsonObject("measureScore")));
16824  }
16825
16826  protected MeasureReport.StratifierGroupComponentComponent parseMeasureReportStratifierGroupComponentComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
16827    MeasureReport.StratifierGroupComponentComponent res = new MeasureReport.StratifierGroupComponentComponent();
16828    parseMeasureReportStratifierGroupComponentComponentProperties(json, owner, res);
16829    return res;
16830  }
16831
16832  protected void parseMeasureReportStratifierGroupComponentComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupComponentComponent res) throws IOException, FHIRFormatError {
16833    parseBackboneElementProperties(json, res);
16834    if (json.has("code"))
16835      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16836    if (json.has("value"))
16837      res.setValue(parseCodeableConcept(json.getAsJsonObject("value")));
16838  }
16839
16840  protected MeasureReport.StratifierGroupPopulationComponent parseMeasureReportStratifierGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
16841    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
16842    parseMeasureReportStratifierGroupPopulationComponentProperties(json, owner, res);
16843    return res;
16844  }
16845
16846  protected void parseMeasureReportStratifierGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupPopulationComponent res) throws IOException, FHIRFormatError {
16847    parseBackboneElementProperties(json, res);
16848    if (json.has("code"))
16849      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16850    if (json.has("count"))
16851      res.setCountElement(parseInteger(json.get("count").getAsLong()));
16852    if (json.has("_count"))
16853      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
16854    if (json.has("subjectResults"))
16855      res.setSubjectResults(parseReference(json.getAsJsonObject("subjectResults")));
16856  }
16857
16858  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
16859    Medication res = new Medication();
16860    parseMedicationProperties(json, res);
16861    return res;
16862  }
16863
16864  protected void parseMedicationProperties(JsonObject json, Medication res) throws IOException, FHIRFormatError {
16865    parseDomainResourceProperties(json, res);
16866    if (json.has("identifier")) {
16867      JsonArray array = json.getAsJsonArray("identifier");
16868      for (int i = 0; i < array.size(); i++) {
16869        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16870      }
16871    };
16872    if (json.has("code"))
16873      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16874    if (json.has("status"))
16875      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Medication.MedicationStatus.NULL, new Medication.MedicationStatusEnumFactory()));
16876    if (json.has("_status"))
16877      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16878    if (json.has("manufacturer"))
16879      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
16880    if (json.has("doseForm"))
16881      res.setDoseForm(parseCodeableConcept(json.getAsJsonObject("doseForm")));
16882    if (json.has("amount"))
16883      res.setAmount(parseRatio(json.getAsJsonObject("amount")));
16884    if (json.has("ingredient")) {
16885      JsonArray array = json.getAsJsonArray("ingredient");
16886      for (int i = 0; i < array.size(); i++) {
16887        res.getIngredient().add(parseMedicationMedicationIngredientComponent(array.get(i).getAsJsonObject(), res));
16888      }
16889    };
16890    if (json.has("batch"))
16891      res.setBatch(parseMedicationMedicationBatchComponent(json.getAsJsonObject("batch"), res));
16892  }
16893
16894  protected Medication.MedicationIngredientComponent parseMedicationMedicationIngredientComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
16895    Medication.MedicationIngredientComponent res = new Medication.MedicationIngredientComponent();
16896    parseMedicationMedicationIngredientComponentProperties(json, owner, res);
16897    return res;
16898  }
16899
16900  protected void parseMedicationMedicationIngredientComponentProperties(JsonObject json, Medication owner, Medication.MedicationIngredientComponent res) throws IOException, FHIRFormatError {
16901    parseBackboneElementProperties(json, res);
16902    Type item = parseType("item", json);
16903    if (item != null)
16904      res.setItem(item);
16905    if (json.has("isActive"))
16906      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
16907    if (json.has("_isActive"))
16908      parseElementProperties(json.getAsJsonObject("_isActive"), res.getIsActiveElement());
16909    Type strength = parseType("strength", json);
16910    if (strength != null)
16911      res.setStrength(strength);
16912  }
16913
16914  protected Medication.MedicationBatchComponent parseMedicationMedicationBatchComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
16915    Medication.MedicationBatchComponent res = new Medication.MedicationBatchComponent();
16916    parseMedicationMedicationBatchComponentProperties(json, owner, res);
16917    return res;
16918  }
16919
16920  protected void parseMedicationMedicationBatchComponentProperties(JsonObject json, Medication owner, Medication.MedicationBatchComponent res) throws IOException, FHIRFormatError {
16921    parseBackboneElementProperties(json, res);
16922    if (json.has("lotNumber"))
16923      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
16924    if (json.has("_lotNumber"))
16925      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
16926    if (json.has("expirationDate"))
16927      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
16928    if (json.has("_expirationDate"))
16929      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
16930  }
16931
16932  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
16933    MedicationAdministration res = new MedicationAdministration();
16934    parseMedicationAdministrationProperties(json, res);
16935    return res;
16936  }
16937
16938  protected void parseMedicationAdministrationProperties(JsonObject json, MedicationAdministration res) throws IOException, FHIRFormatError {
16939    parseDomainResourceProperties(json, res);
16940    if (json.has("identifier")) {
16941      JsonArray array = json.getAsJsonArray("identifier");
16942      for (int i = 0; i < array.size(); i++) {
16943        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16944      }
16945    };
16946    if (json.has("instantiatesCanonical")) {
16947      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
16948      for (int i = 0; i < array.size(); i++) {
16949        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
16950      }
16951    };
16952    if (json.has("_instantiatesCanonical")) {
16953      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
16954      for (int i = 0; i < array.size(); i++) {
16955        if (i == res.getInstantiatesCanonical().size())
16956          res.getInstantiatesCanonical().add(parseCanonical(null));
16957        if (array.get(i) instanceof JsonObject) 
16958          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
16959      }
16960    };
16961    if (json.has("instantiatesUri")) {
16962      JsonArray array = json.getAsJsonArray("instantiatesUri");
16963      for (int i = 0; i < array.size(); i++) {
16964        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
16965      }
16966    };
16967    if (json.has("_instantiatesUri")) {
16968      JsonArray array = json.getAsJsonArray("_instantiatesUri");
16969      for (int i = 0; i < array.size(); i++) {
16970        if (i == res.getInstantiatesUri().size())
16971          res.getInstantiatesUri().add(parseUri(null));
16972        if (array.get(i) instanceof JsonObject) 
16973          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
16974      }
16975    };
16976    if (json.has("basedOn")) {
16977      JsonArray array = json.getAsJsonArray("basedOn");
16978      for (int i = 0; i < array.size(); i++) {
16979        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
16980      }
16981    };
16982    if (json.has("partOf")) {
16983      JsonArray array = json.getAsJsonArray("partOf");
16984      for (int i = 0; i < array.size(); i++) {
16985        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
16986      }
16987    };
16988    if (json.has("status"))
16989      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationAdministration.MedicationAdministrationStatus.NULL, new MedicationAdministration.MedicationAdministrationStatusEnumFactory()));
16990    if (json.has("_status"))
16991      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16992    if (json.has("statusReason")) {
16993      JsonArray array = json.getAsJsonArray("statusReason");
16994      for (int i = 0; i < array.size(); i++) {
16995        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16996      }
16997    };
16998    if (json.has("category")) {
16999      JsonArray array = json.getAsJsonArray("category");
17000      for (int i = 0; i < array.size(); i++) {
17001        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17002      }
17003    };
17004    Type medication = parseType("medication", json);
17005    if (medication != null)
17006      res.setMedication(medication);
17007    if (json.has("subject"))
17008      res.setSubject(parseReference(json.getAsJsonObject("subject")));
17009    if (json.has("encounter"))
17010      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
17011    if (json.has("supportingInformation")) {
17012      JsonArray array = json.getAsJsonArray("supportingInformation");
17013      for (int i = 0; i < array.size(); i++) {
17014        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
17015      }
17016    };
17017    Type occurence = parseType("occurence", json);
17018    if (occurence != null)
17019      res.setOccurence(occurence);
17020    if (json.has("recorded"))
17021      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
17022    if (json.has("_recorded"))
17023      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
17024    if (json.has("performer")) {
17025      JsonArray array = json.getAsJsonArray("performer");
17026      for (int i = 0; i < array.size(); i++) {
17027        res.getPerformer().add(parseMedicationAdministrationMedicationAdministrationPerformerComponent(array.get(i).getAsJsonObject(), res));
17028      }
17029    };
17030    if (json.has("reasonCode")) {
17031      JsonArray array = json.getAsJsonArray("reasonCode");
17032      for (int i = 0; i < array.size(); i++) {
17033        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17034      }
17035    };
17036    if (json.has("reasonReference")) {
17037      JsonArray array = json.getAsJsonArray("reasonReference");
17038      for (int i = 0; i < array.size(); i++) {
17039        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
17040      }
17041    };
17042    if (json.has("request"))
17043      res.setRequest(parseReference(json.getAsJsonObject("request")));
17044    if (json.has("device")) {
17045      JsonArray array = json.getAsJsonArray("device");
17046      for (int i = 0; i < array.size(); i++) {
17047        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
17048      }
17049    };
17050    if (json.has("note")) {
17051      JsonArray array = json.getAsJsonArray("note");
17052      for (int i = 0; i < array.size(); i++) {
17053        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17054      }
17055    };
17056    if (json.has("dosage"))
17057      res.setDosage(parseMedicationAdministrationMedicationAdministrationDosageComponent(json.getAsJsonObject("dosage"), res));
17058    if (json.has("eventHistory")) {
17059      JsonArray array = json.getAsJsonArray("eventHistory");
17060      for (int i = 0; i < array.size(); i++) {
17061        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
17062      }
17063    };
17064  }
17065
17066  protected MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationMedicationAdministrationPerformerComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
17067    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
17068    parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(json, owner, res);
17069    return res;
17070  }
17071
17072  protected void parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationPerformerComponent res) throws IOException, FHIRFormatError {
17073    parseBackboneElementProperties(json, res);
17074    if (json.has("function"))
17075      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
17076    if (json.has("actor"))
17077      res.setActor(parseReference(json.getAsJsonObject("actor")));
17078  }
17079
17080  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationMedicationAdministrationDosageComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
17081    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
17082    parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(json, owner, res);
17083    return res;
17084  }
17085
17086  protected void parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationDosageComponent res) throws IOException, FHIRFormatError {
17087    parseBackboneElementProperties(json, res);
17088    if (json.has("text"))
17089      res.setTextElement(parseString(json.get("text").getAsString()));
17090    if (json.has("_text"))
17091      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
17092    if (json.has("site"))
17093      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
17094    if (json.has("route"))
17095      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
17096    if (json.has("method"))
17097      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
17098    if (json.has("dose"))
17099      res.setDose(parseQuantity(json.getAsJsonObject("dose")));
17100    Type rate = parseType("rate", json);
17101    if (rate != null)
17102      res.setRate(rate);
17103  }
17104
17105  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
17106    MedicationDispense res = new MedicationDispense();
17107    parseMedicationDispenseProperties(json, res);
17108    return res;
17109  }
17110
17111  protected void parseMedicationDispenseProperties(JsonObject json, MedicationDispense res) throws IOException, FHIRFormatError {
17112    parseDomainResourceProperties(json, res);
17113    if (json.has("identifier")) {
17114      JsonArray array = json.getAsJsonArray("identifier");
17115      for (int i = 0; i < array.size(); i++) {
17116        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17117      }
17118    };
17119    if (json.has("basedOn")) {
17120      JsonArray array = json.getAsJsonArray("basedOn");
17121      for (int i = 0; i < array.size(); i++) {
17122        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
17123      }
17124    };
17125    if (json.has("partOf")) {
17126      JsonArray array = json.getAsJsonArray("partOf");
17127      for (int i = 0; i < array.size(); i++) {
17128        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
17129      }
17130    };
17131    if (json.has("status"))
17132      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationDispense.MedicationDispenseStatus.NULL, new MedicationDispense.MedicationDispenseStatusEnumFactory()));
17133    if (json.has("_status"))
17134      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17135    Type statusReason = parseType("statusReason", json);
17136    if (statusReason != null)
17137      res.setStatusReason(statusReason);
17138    if (json.has("category")) {
17139      JsonArray array = json.getAsJsonArray("category");
17140      for (int i = 0; i < array.size(); i++) {
17141        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17142      }
17143    };
17144    Type medication = parseType("medication", json);
17145    if (medication != null)
17146      res.setMedication(medication);
17147    if (json.has("subject"))
17148      res.setSubject(parseReference(json.getAsJsonObject("subject")));
17149    if (json.has("encounter"))
17150      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
17151    if (json.has("supportingInformation")) {
17152      JsonArray array = json.getAsJsonArray("supportingInformation");
17153      for (int i = 0; i < array.size(); i++) {
17154        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
17155      }
17156    };
17157    if (json.has("performer")) {
17158      JsonArray array = json.getAsJsonArray("performer");
17159      for (int i = 0; i < array.size(); i++) {
17160        res.getPerformer().add(parseMedicationDispenseMedicationDispensePerformerComponent(array.get(i).getAsJsonObject(), res));
17161      }
17162    };
17163    if (json.has("location"))
17164      res.setLocation(parseReference(json.getAsJsonObject("location")));
17165    if (json.has("authorizingPrescription")) {
17166      JsonArray array = json.getAsJsonArray("authorizingPrescription");
17167      for (int i = 0; i < array.size(); i++) {
17168        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
17169      }
17170    };
17171    if (json.has("type"))
17172      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17173    if (json.has("quantity"))
17174      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17175    if (json.has("daysSupply"))
17176      res.setDaysSupply(parseQuantity(json.getAsJsonObject("daysSupply")));
17177    if (json.has("whenPrepared"))
17178      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
17179    if (json.has("_whenPrepared"))
17180      parseElementProperties(json.getAsJsonObject("_whenPrepared"), res.getWhenPreparedElement());
17181    if (json.has("whenHandedOver"))
17182      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
17183    if (json.has("_whenHandedOver"))
17184      parseElementProperties(json.getAsJsonObject("_whenHandedOver"), res.getWhenHandedOverElement());
17185    if (json.has("destination"))
17186      res.setDestination(parseReference(json.getAsJsonObject("destination")));
17187    if (json.has("receiver")) {
17188      JsonArray array = json.getAsJsonArray("receiver");
17189      for (int i = 0; i < array.size(); i++) {
17190        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
17191      }
17192    };
17193    if (json.has("note")) {
17194      JsonArray array = json.getAsJsonArray("note");
17195      for (int i = 0; i < array.size(); i++) {
17196        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17197      }
17198    };
17199    if (json.has("dosageInstruction")) {
17200      JsonArray array = json.getAsJsonArray("dosageInstruction");
17201      for (int i = 0; i < array.size(); i++) {
17202        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
17203      }
17204    };
17205    if (json.has("substitution"))
17206      res.setSubstitution(parseMedicationDispenseMedicationDispenseSubstitutionComponent(json.getAsJsonObject("substitution"), res));
17207    if (json.has("detectedIssue")) {
17208      JsonArray array = json.getAsJsonArray("detectedIssue");
17209      for (int i = 0; i < array.size(); i++) {
17210        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
17211      }
17212    };
17213    if (json.has("eventHistory")) {
17214      JsonArray array = json.getAsJsonArray("eventHistory");
17215      for (int i = 0; i < array.size(); i++) {
17216        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
17217      }
17218    };
17219  }
17220
17221  protected MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispenseMedicationDispensePerformerComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
17222    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
17223    parseMedicationDispenseMedicationDispensePerformerComponentProperties(json, owner, res);
17224    return res;
17225  }
17226
17227  protected void parseMedicationDispenseMedicationDispensePerformerComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispensePerformerComponent res) throws IOException, FHIRFormatError {
17228    parseBackboneElementProperties(json, res);
17229    if (json.has("function"))
17230      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
17231    if (json.has("actor"))
17232      res.setActor(parseReference(json.getAsJsonObject("actor")));
17233  }
17234
17235  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseMedicationDispenseSubstitutionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
17236    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
17237    parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(json, owner, res);
17238    return res;
17239  }
17240
17241  protected void parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispenseSubstitutionComponent res) throws IOException, FHIRFormatError {
17242    parseBackboneElementProperties(json, res);
17243    if (json.has("wasSubstituted"))
17244      res.setWasSubstitutedElement(parseBoolean(json.get("wasSubstituted").getAsBoolean()));
17245    if (json.has("_wasSubstituted"))
17246      parseElementProperties(json.getAsJsonObject("_wasSubstituted"), res.getWasSubstitutedElement());
17247    if (json.has("type"))
17248      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17249    if (json.has("reason")) {
17250      JsonArray array = json.getAsJsonArray("reason");
17251      for (int i = 0; i < array.size(); i++) {
17252        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17253      }
17254    };
17255    if (json.has("responsibleParty"))
17256      res.setResponsibleParty(parseReference(json.getAsJsonObject("responsibleParty")));
17257  }
17258
17259  protected MedicationKnowledge parseMedicationKnowledge(JsonObject json) throws IOException, FHIRFormatError {
17260    MedicationKnowledge res = new MedicationKnowledge();
17261    parseMedicationKnowledgeProperties(json, res);
17262    return res;
17263  }
17264
17265  protected void parseMedicationKnowledgeProperties(JsonObject json, MedicationKnowledge res) throws IOException, FHIRFormatError {
17266    parseDomainResourceProperties(json, res);
17267    if (json.has("identifier")) {
17268      JsonArray array = json.getAsJsonArray("identifier");
17269      for (int i = 0; i < array.size(); i++) {
17270        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17271      }
17272    };
17273    if (json.has("code"))
17274      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17275    if (json.has("status"))
17276      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationKnowledge.MedicationKnowledgeStatus.NULL, new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory()));
17277    if (json.has("_status"))
17278      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17279    if (json.has("manufacturer"))
17280      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
17281    if (json.has("doseForm"))
17282      res.setDoseForm(parseCodeableConcept(json.getAsJsonObject("doseForm")));
17283    if (json.has("amount"))
17284      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
17285    if (json.has("synonym")) {
17286      JsonArray array = json.getAsJsonArray("synonym");
17287      for (int i = 0; i < array.size(); i++) {
17288        res.getSynonym().add(parseString(array.get(i).getAsString()));
17289      }
17290    };
17291    if (json.has("_synonym")) {
17292      JsonArray array = json.getAsJsonArray("_synonym");
17293      for (int i = 0; i < array.size(); i++) {
17294        if (i == res.getSynonym().size())
17295          res.getSynonym().add(parseString(null));
17296        if (array.get(i) instanceof JsonObject) 
17297          parseElementProperties(array.get(i).getAsJsonObject(), res.getSynonym().get(i));
17298      }
17299    };
17300    if (json.has("relatedMedicationKnowledge")) {
17301      JsonArray array = json.getAsJsonArray("relatedMedicationKnowledge");
17302      for (int i = 0; i < array.size(); i++) {
17303        res.getRelatedMedicationKnowledge().add(parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(array.get(i).getAsJsonObject(), res));
17304      }
17305    };
17306    if (json.has("associatedMedication")) {
17307      JsonArray array = json.getAsJsonArray("associatedMedication");
17308      for (int i = 0; i < array.size(); i++) {
17309        res.getAssociatedMedication().add(parseReference(array.get(i).getAsJsonObject()));
17310      }
17311    };
17312    if (json.has("productType")) {
17313      JsonArray array = json.getAsJsonArray("productType");
17314      for (int i = 0; i < array.size(); i++) {
17315        res.getProductType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17316      }
17317    };
17318    if (json.has("monograph")) {
17319      JsonArray array = json.getAsJsonArray("monograph");
17320      for (int i = 0; i < array.size(); i++) {
17321        res.getMonograph().add(parseMedicationKnowledgeMedicationKnowledgeMonographComponent(array.get(i).getAsJsonObject(), res));
17322      }
17323    };
17324    if (json.has("ingredient")) {
17325      JsonArray array = json.getAsJsonArray("ingredient");
17326      for (int i = 0; i < array.size(); i++) {
17327        res.getIngredient().add(parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(array.get(i).getAsJsonObject(), res));
17328      }
17329    };
17330    if (json.has("device")) {
17331      JsonArray array = json.getAsJsonArray("device");
17332      for (int i = 0; i < array.size(); i++) {
17333        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
17334      }
17335    };
17336    if (json.has("preparationInstruction"))
17337      res.setPreparationInstructionElement(parseMarkdown(json.get("preparationInstruction").getAsString()));
17338    if (json.has("_preparationInstruction"))
17339      parseElementProperties(json.getAsJsonObject("_preparationInstruction"), res.getPreparationInstructionElement());
17340    if (json.has("intendedRoute")) {
17341      JsonArray array = json.getAsJsonArray("intendedRoute");
17342      for (int i = 0; i < array.size(); i++) {
17343        res.getIntendedRoute().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17344      }
17345    };
17346    if (json.has("cost")) {
17347      JsonArray array = json.getAsJsonArray("cost");
17348      for (int i = 0; i < array.size(); i++) {
17349        res.getCost().add(parseMedicationKnowledgeMedicationKnowledgeCostComponent(array.get(i).getAsJsonObject(), res));
17350      }
17351    };
17352    if (json.has("monitoringProgram")) {
17353      JsonArray array = json.getAsJsonArray("monitoringProgram");
17354      for (int i = 0; i < array.size(); i++) {
17355        res.getMonitoringProgram().add(parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(array.get(i).getAsJsonObject(), res));
17356      }
17357    };
17358    if (json.has("administrationGuideline")) {
17359      JsonArray array = json.getAsJsonArray("administrationGuideline");
17360      for (int i = 0; i < array.size(); i++) {
17361        res.getAdministrationGuideline().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineComponent(array.get(i).getAsJsonObject(), res));
17362      }
17363    };
17364    if (json.has("medicineClassification")) {
17365      JsonArray array = json.getAsJsonArray("medicineClassification");
17366      for (int i = 0; i < array.size(); i++) {
17367        res.getMedicineClassification().add(parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(array.get(i).getAsJsonObject(), res));
17368      }
17369    };
17370    if (json.has("packaging"))
17371      res.setPackaging(parseMedicationKnowledgeMedicationKnowledgePackagingComponent(json.getAsJsonObject("packaging"), res));
17372    if (json.has("drugCharacteristic")) {
17373      JsonArray array = json.getAsJsonArray("drugCharacteristic");
17374      for (int i = 0; i < array.size(); i++) {
17375        res.getDrugCharacteristic().add(parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(array.get(i).getAsJsonObject(), res));
17376      }
17377    };
17378    if (json.has("clinicalUseIssue")) {
17379      JsonArray array = json.getAsJsonArray("clinicalUseIssue");
17380      for (int i = 0; i < array.size(); i++) {
17381        res.getClinicalUseIssue().add(parseReference(array.get(i).getAsJsonObject()));
17382      }
17383    };
17384    if (json.has("regulatory")) {
17385      JsonArray array = json.getAsJsonArray("regulatory");
17386      for (int i = 0; i < array.size(); i++) {
17387        res.getRegulatory().add(parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(array.get(i).getAsJsonObject(), res));
17388      }
17389    };
17390    if (json.has("kineticCharacteristic")) {
17391      JsonArray array = json.getAsJsonArray("kineticCharacteristic");
17392      for (int i = 0; i < array.size(); i++) {
17393        res.getKineticCharacteristic().add(parseMedicationKnowledgeMedicationKnowledgeKineticCharacteristicComponent(array.get(i).getAsJsonObject(), res));
17394      }
17395    };
17396  }
17397
17398  protected MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
17399    MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res = new MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent();
17400    parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(json, owner, res);
17401    return res;
17402  }
17403
17404  protected void parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res) throws IOException, FHIRFormatError {
17405    parseBackboneElementProperties(json, res);
17406    if (json.has("type"))
17407      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17408    if (json.has("reference")) {
17409      JsonArray array = json.getAsJsonArray("reference");
17410      for (int i = 0; i < array.size(); i++) {
17411        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
17412      }
17413    };
17414  }
17415
17416  protected MedicationKnowledge.MedicationKnowledgeMonographComponent parseMedicationKnowledgeMedicationKnowledgeMonographComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
17417    MedicationKnowledge.MedicationKnowledgeMonographComponent res = new MedicationKnowledge.MedicationKnowledgeMonographComponent();
17418    parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(json, owner, res);
17419    return res;
17420  }
17421
17422  protected void parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonographComponent res) throws IOException, FHIRFormatError {
17423    parseBackboneElementProperties(json, res);
17424    if (json.has("type"))
17425      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17426    if (json.has("source"))
17427      res.setSource(parseReference(json.getAsJsonObject("source")));
17428  }
17429
17430  protected MedicationKnowledge.MedicationKnowledgeIngredientComponent parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
17431    MedicationKnowledge.MedicationKnowledgeIngredientComponent res = new MedicationKnowledge.MedicationKnowledgeIngredientComponent();
17432    parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(json, owner, res);
17433    return res;
17434  }
17435
17436  protected void parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeIngredientComponent res) throws IOException, FHIRFormatError {
17437    parseBackboneElementProperties(json, res);
17438    Type item = parseType("item", json);
17439    if (item != null)
17440      res.setItem(item);
17441    if (json.has("isActive"))
17442      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
17443    if (json.has("_isActive"))
17444      parseElementProperties(json.getAsJsonObject("_isActive"), res.getIsActiveElement());
17445    if (json.has("strength"))
17446      res.setStrength(parseRatio(json.getAsJsonObject("strength")));
17447  }
17448
17449  protected MedicationKnowledge.MedicationKnowledgeCostComponent parseMedicationKnowledgeMedicationKnowledgeCostComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
17450    MedicationKnowledge.MedicationKnowledgeCostComponent res = new MedicationKnowledge.MedicationKnowledgeCostComponent();
17451    parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(json, owner, res);
17452    return res;
17453  }
17454
17455  protected void parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeCostComponent res) throws IOException, FHIRFormatError {
17456    parseBackboneElementProperties(json, res);
17457    if (json.has("type"))
17458      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17459    if (json.has("source"))
17460      res.setSourceElement(parseString(json.get("source").getAsString()));
17461    if (json.has("_source"))
17462      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
17463    if (json.has("cost"))
17464      res.setCost(parseMoney(json.getAsJsonObject("cost")));
17465  }
17466
17467  protected MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
17468    MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res = new MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent();
17469    parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(json, owner, res);
17470    return res;
17471  }
17472
17473  protected void parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res) throws IOException, FHIRFormatError {
17474    parseBackboneElementProperties(json, res);
17475    if (json.has("type"))
17476      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17477    if (json.has("name"))
17478      res.setNameElement(parseString(json.get("name").getAsString()));
17479    if (json.has("_name"))
17480      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17481  }
17482
17483  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
17484    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent();
17485    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineComponentProperties(json, owner, res);
17486    return res;
17487  }
17488
17489  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent res) throws IOException, FHIRFormatError {
17490    parseBackboneElementProperties(json, res);
17491    if (json.has("dosage")) {
17492      JsonArray array = json.getAsJsonArray("dosage");
17493      for (int i = 0; i < array.size(); i++) {
17494        res.getDosage().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineDosageComponent(array.get(i).getAsJsonObject(), owner));
17495      }
17496    };
17497    Type indication = parseType("indication", json);
17498    if (indication != null)
17499      res.setIndication(indication);
17500    if (json.has("patientCharacteristic")) {
17501      JsonArray array = json.getAsJsonArray("patientCharacteristic");
17502      for (int i = 0; i < array.size(); i++) {
17503        res.getPatientCharacteristic().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent(array.get(i).getAsJsonObject(), owner));
17504      }
17505    };
17506  }
17507
17508  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineDosageComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
17509    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent();
17510    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineDosageComponentProperties(json, owner, res);
17511    return res;
17512  }
17513
17514  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineDosageComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent res) throws IOException, FHIRFormatError {
17515    parseBackboneElementProperties(json, res);
17516    if (json.has("type"))
17517      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17518    if (json.has("dosage")) {
17519      JsonArray array = json.getAsJsonArray("dosage");
17520      for (int i = 0; i < array.size(); i++) {
17521        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
17522      }
17523    };
17524  }
17525
17526  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
17527    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent();
17528    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponentProperties(json, owner, res);
17529    return res;
17530  }
17531
17532  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent res) throws IOException, FHIRFormatError {
17533    parseBackboneElementProperties(json, res);
17534    Type characteristic = parseType("characteristic", json);
17535    if (characteristic != null)
17536      res.setCharacteristic(characteristic);
17537    if (json.has("value")) {
17538      JsonArray array = json.getAsJsonArray("value");
17539      for (int i = 0; i < array.size(); i++) {
17540        res.getValue().add(parseString(array.get(i).getAsString()));
17541      }
17542    };
17543    if (json.has("_value")) {
17544      JsonArray array = json.getAsJsonArray("_value");
17545      for (int i = 0; i < array.size(); i++) {
17546        if (i == res.getValue().size())
17547          res.getValue().add(parseString(null));
17548        if (array.get(i) instanceof JsonObject) 
17549          parseElementProperties(array.get(i).getAsJsonObject(), res.getValue().get(i));
17550      }
17551    };
17552  }
17553
17554  protected MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
17555    MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res = new MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent();
17556    parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(json, owner, res);
17557    return res;
17558  }
17559
17560  protected void parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res) throws IOException, FHIRFormatError {
17561    parseBackboneElementProperties(json, res);
17562    if (json.has("type"))
17563      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17564    if (json.has("classification")) {
17565      JsonArray array = json.getAsJsonArray("classification");
17566      for (int i = 0; i < array.size(); i++) {
17567        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17568      }
17569    };
17570  }
17571
17572  protected MedicationKnowledge.MedicationKnowledgePackagingComponent parseMedicationKnowledgeMedicationKnowledgePackagingComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
17573    MedicationKnowledge.MedicationKnowledgePackagingComponent res = new MedicationKnowledge.MedicationKnowledgePackagingComponent();
17574    parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(json, owner, res);
17575    return res;
17576  }
17577
17578  protected void parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgePackagingComponent res) throws IOException, FHIRFormatError {
17579    parseBackboneElementProperties(json, res);
17580    if (json.has("type"))
17581      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17582    if (json.has("quantity"))
17583      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17584    if (json.has("device"))
17585      res.setDevice(parseReference(json.getAsJsonObject("device")));
17586    if (json.has("material"))
17587      res.setMaterial(parseCodeableConcept(json.getAsJsonObject("material")));
17588    if (json.has("packaging")) {
17589      JsonArray array = json.getAsJsonArray("packaging");
17590      for (int i = 0; i < array.size(); i++) {
17591        res.getPackaging().add(parseMedicationKnowledgeMedicationKnowledgePackagingComponent(array.get(i).getAsJsonObject(), owner));
17592      }
17593    };
17594  }
17595
17596  protected MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
17597    MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent();
17598    parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(json, owner, res);
17599    return res;
17600  }
17601
17602  protected void parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res) throws IOException, FHIRFormatError {
17603    parseBackboneElementProperties(json, res);
17604    if (json.has("type"))
17605      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17606    Type value = parseType("value", json);
17607    if (value != null)
17608      res.setValue(value);
17609  }
17610
17611  protected MedicationKnowledge.MedicationKnowledgeRegulatoryComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
17612    MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryComponent();
17613    parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentProperties(json, owner, res);
17614    return res;
17615  }
17616
17617  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res) throws IOException, FHIRFormatError {
17618    parseBackboneElementProperties(json, res);
17619    if (json.has("regulatoryAuthority"))
17620      res.setRegulatoryAuthority(parseReference(json.getAsJsonObject("regulatoryAuthority")));
17621    if (json.has("substitution")) {
17622      JsonArray array = json.getAsJsonArray("substitution");
17623      for (int i = 0; i < array.size(); i++) {
17624        res.getSubstitution().add(parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(array.get(i).getAsJsonObject(), owner));
17625      }
17626    };
17627    if (json.has("schedule")) {
17628      JsonArray array = json.getAsJsonArray("schedule");
17629      for (int i = 0; i < array.size(); i++) {
17630        res.getSchedule().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17631      }
17632    };
17633    if (json.has("maxDispense"))
17634      res.setMaxDispense(parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(json.getAsJsonObject("maxDispense"), owner));
17635  }
17636
17637  protected MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
17638    MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent();
17639    parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentProperties(json, owner, res);
17640    return res;
17641  }
17642
17643  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res) throws IOException, FHIRFormatError {
17644    parseBackboneElementProperties(json, res);
17645    if (json.has("type"))
17646      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17647    if (json.has("allowed"))
17648      res.setAllowedElement(parseBoolean(json.get("allowed").getAsBoolean()));
17649    if (json.has("_allowed"))
17650      parseElementProperties(json.getAsJsonObject("_allowed"), res.getAllowedElement());
17651  }
17652
17653  protected MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
17654    MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent();
17655    parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(json, owner, res);
17656    return res;
17657  }
17658
17659  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res) throws IOException, FHIRFormatError {
17660    parseBackboneElementProperties(json, res);
17661    if (json.has("quantity"))
17662      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17663    if (json.has("period"))
17664      res.setPeriod(parseDuration(json.getAsJsonObject("period")));
17665  }
17666
17667  protected MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent parseMedicationKnowledgeMedicationKnowledgeKineticCharacteristicComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
17668    MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent();
17669    parseMedicationKnowledgeMedicationKnowledgeKineticCharacteristicComponentProperties(json, owner, res);
17670    return res;
17671  }
17672
17673  protected void parseMedicationKnowledgeMedicationKnowledgeKineticCharacteristicComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent res) throws IOException, FHIRFormatError {
17674    parseBackboneElementProperties(json, res);
17675    if (json.has("type"))
17676      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17677    Type value = parseType("value", json);
17678    if (value != null)
17679      res.setValue(value);
17680  }
17681
17682  protected MedicationRequest parseMedicationRequest(JsonObject json) throws IOException, FHIRFormatError {
17683    MedicationRequest res = new MedicationRequest();
17684    parseMedicationRequestProperties(json, res);
17685    return res;
17686  }
17687
17688  protected void parseMedicationRequestProperties(JsonObject json, MedicationRequest res) throws IOException, FHIRFormatError {
17689    parseDomainResourceProperties(json, res);
17690    if (json.has("identifier")) {
17691      JsonArray array = json.getAsJsonArray("identifier");
17692      for (int i = 0; i < array.size(); i++) {
17693        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17694      }
17695    };
17696    if (json.has("status"))
17697      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationRequest.MedicationRequestStatus.NULL, new MedicationRequest.MedicationRequestStatusEnumFactory()));
17698    if (json.has("_status"))
17699      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17700    if (json.has("statusReason"))
17701      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
17702    if (json.has("intent"))
17703      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), MedicationRequest.MedicationRequestIntent.NULL, new MedicationRequest.MedicationRequestIntentEnumFactory()));
17704    if (json.has("_intent"))
17705      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
17706    if (json.has("category")) {
17707      JsonArray array = json.getAsJsonArray("category");
17708      for (int i = 0; i < array.size(); i++) {
17709        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17710      }
17711    };
17712    if (json.has("priority"))
17713      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), MedicationRequest.MedicationRequestPriority.NULL, new MedicationRequest.MedicationRequestPriorityEnumFactory()));
17714    if (json.has("_priority"))
17715      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
17716    if (json.has("doNotPerform"))
17717      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
17718    if (json.has("_doNotPerform"))
17719      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
17720    if (json.has("reported"))
17721      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
17722    if (json.has("_reported"))
17723      parseElementProperties(json.getAsJsonObject("_reported"), res.getReportedElement());
17724    if (json.has("informationSource"))
17725      res.setInformationSource(parseReference(json.getAsJsonObject("informationSource")));
17726    Type medication = parseType("medication", json);
17727    if (medication != null)
17728      res.setMedication(medication);
17729    if (json.has("subject"))
17730      res.setSubject(parseReference(json.getAsJsonObject("subject")));
17731    if (json.has("encounter"))
17732      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
17733    if (json.has("supportingInformation")) {
17734      JsonArray array = json.getAsJsonArray("supportingInformation");
17735      for (int i = 0; i < array.size(); i++) {
17736        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
17737      }
17738    };
17739    if (json.has("authoredOn"))
17740      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
17741    if (json.has("_authoredOn"))
17742      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
17743    if (json.has("requester"))
17744      res.setRequester(parseReference(json.getAsJsonObject("requester")));
17745    if (json.has("performer"))
17746      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
17747    if (json.has("performerType"))
17748      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
17749    if (json.has("recorder"))
17750      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
17751    if (json.has("reasonCode")) {
17752      JsonArray array = json.getAsJsonArray("reasonCode");
17753      for (int i = 0; i < array.size(); i++) {
17754        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17755      }
17756    };
17757    if (json.has("reasonReference")) {
17758      JsonArray array = json.getAsJsonArray("reasonReference");
17759      for (int i = 0; i < array.size(); i++) {
17760        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
17761      }
17762    };
17763    if (json.has("instantiatesCanonical")) {
17764      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
17765      for (int i = 0; i < array.size(); i++) {
17766        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
17767      }
17768    };
17769    if (json.has("_instantiatesCanonical")) {
17770      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
17771      for (int i = 0; i < array.size(); i++) {
17772        if (i == res.getInstantiatesCanonical().size())
17773          res.getInstantiatesCanonical().add(parseCanonical(null));
17774        if (array.get(i) instanceof JsonObject) 
17775          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
17776      }
17777    };
17778    if (json.has("instantiatesUri")) {
17779      JsonArray array = json.getAsJsonArray("instantiatesUri");
17780      for (int i = 0; i < array.size(); i++) {
17781        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
17782      }
17783    };
17784    if (json.has("_instantiatesUri")) {
17785      JsonArray array = json.getAsJsonArray("_instantiatesUri");
17786      for (int i = 0; i < array.size(); i++) {
17787        if (i == res.getInstantiatesUri().size())
17788          res.getInstantiatesUri().add(parseUri(null));
17789        if (array.get(i) instanceof JsonObject) 
17790          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
17791      }
17792    };
17793    if (json.has("basedOn")) {
17794      JsonArray array = json.getAsJsonArray("basedOn");
17795      for (int i = 0; i < array.size(); i++) {
17796        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
17797      }
17798    };
17799    if (json.has("groupIdentifier"))
17800      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
17801    if (json.has("courseOfTherapyType"))
17802      res.setCourseOfTherapyType(parseCodeableConcept(json.getAsJsonObject("courseOfTherapyType")));
17803    if (json.has("insurance")) {
17804      JsonArray array = json.getAsJsonArray("insurance");
17805      for (int i = 0; i < array.size(); i++) {
17806        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
17807      }
17808    };
17809    if (json.has("note")) {
17810      JsonArray array = json.getAsJsonArray("note");
17811      for (int i = 0; i < array.size(); i++) {
17812        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17813      }
17814    };
17815    if (json.has("dosageInstruction")) {
17816      JsonArray array = json.getAsJsonArray("dosageInstruction");
17817      for (int i = 0; i < array.size(); i++) {
17818        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
17819      }
17820    };
17821    if (json.has("dispenseRequest"))
17822      res.setDispenseRequest(parseMedicationRequestMedicationRequestDispenseRequestComponent(json.getAsJsonObject("dispenseRequest"), res));
17823    if (json.has("substitution"))
17824      res.setSubstitution(parseMedicationRequestMedicationRequestSubstitutionComponent(json.getAsJsonObject("substitution"), res));
17825    if (json.has("priorPrescription"))
17826      res.setPriorPrescription(parseReference(json.getAsJsonObject("priorPrescription")));
17827    if (json.has("detectedIssue")) {
17828      JsonArray array = json.getAsJsonArray("detectedIssue");
17829      for (int i = 0; i < array.size(); i++) {
17830        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
17831      }
17832    };
17833    if (json.has("eventHistory")) {
17834      JsonArray array = json.getAsJsonArray("eventHistory");
17835      for (int i = 0; i < array.size(); i++) {
17836        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
17837      }
17838    };
17839  }
17840
17841  protected MedicationRequest.MedicationRequestDispenseRequestComponent parseMedicationRequestMedicationRequestDispenseRequestComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
17842    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
17843    parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(json, owner, res);
17844    return res;
17845  }
17846
17847  protected void parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestComponent res) throws IOException, FHIRFormatError {
17848    parseBackboneElementProperties(json, res);
17849    if (json.has("initialFill"))
17850      res.setInitialFill(parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(json.getAsJsonObject("initialFill"), owner));
17851    if (json.has("dispenseInterval"))
17852      res.setDispenseInterval(parseDuration(json.getAsJsonObject("dispenseInterval")));
17853    if (json.has("validityPeriod"))
17854      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
17855    if (json.has("numberOfRepeatsAllowed"))
17856      res.setNumberOfRepeatsAllowedElement(parseUnsignedInt(json.get("numberOfRepeatsAllowed").getAsString()));
17857    if (json.has("_numberOfRepeatsAllowed"))
17858      parseElementProperties(json.getAsJsonObject("_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
17859    if (json.has("quantity"))
17860      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17861    if (json.has("expectedSupplyDuration"))
17862      res.setExpectedSupplyDuration(parseDuration(json.getAsJsonObject("expectedSupplyDuration")));
17863    if (json.has("performer"))
17864      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
17865  }
17866
17867  protected MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
17868    MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res = new MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent();
17869    parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponentProperties(json, owner, res);
17870    return res;
17871  }
17872
17873  protected void parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res) throws IOException, FHIRFormatError {
17874    parseBackboneElementProperties(json, res);
17875    if (json.has("quantity"))
17876      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17877    if (json.has("duration"))
17878      res.setDuration(parseDuration(json.getAsJsonObject("duration")));
17879  }
17880
17881  protected MedicationRequest.MedicationRequestSubstitutionComponent parseMedicationRequestMedicationRequestSubstitutionComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
17882    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
17883    parseMedicationRequestMedicationRequestSubstitutionComponentProperties(json, owner, res);
17884    return res;
17885  }
17886
17887  protected void parseMedicationRequestMedicationRequestSubstitutionComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestSubstitutionComponent res) throws IOException, FHIRFormatError {
17888    parseBackboneElementProperties(json, res);
17889    Type allowed = parseType("allowed", json);
17890    if (allowed != null)
17891      res.setAllowed(allowed);
17892    if (json.has("reason"))
17893      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
17894  }
17895
17896  protected MedicationUsage parseMedicationUsage(JsonObject json) throws IOException, FHIRFormatError {
17897    MedicationUsage res = new MedicationUsage();
17898    parseMedicationUsageProperties(json, res);
17899    return res;
17900  }
17901
17902  protected void parseMedicationUsageProperties(JsonObject json, MedicationUsage res) throws IOException, FHIRFormatError {
17903    parseDomainResourceProperties(json, res);
17904    if (json.has("identifier")) {
17905      JsonArray array = json.getAsJsonArray("identifier");
17906      for (int i = 0; i < array.size(); i++) {
17907        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17908      }
17909    };
17910    if (json.has("basedOn")) {
17911      JsonArray array = json.getAsJsonArray("basedOn");
17912      for (int i = 0; i < array.size(); i++) {
17913        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
17914      }
17915    };
17916    if (json.has("partOf")) {
17917      JsonArray array = json.getAsJsonArray("partOf");
17918      for (int i = 0; i < array.size(); i++) {
17919        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
17920      }
17921    };
17922    if (json.has("status"))
17923      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationUsage.MedicationUsageStatus.NULL, new MedicationUsage.MedicationUsageStatusEnumFactory()));
17924    if (json.has("_status"))
17925      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17926    if (json.has("statusReason")) {
17927      JsonArray array = json.getAsJsonArray("statusReason");
17928      for (int i = 0; i < array.size(); i++) {
17929        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17930      }
17931    };
17932    if (json.has("category")) {
17933      JsonArray array = json.getAsJsonArray("category");
17934      for (int i = 0; i < array.size(); i++) {
17935        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17936      }
17937    };
17938    Type medication = parseType("medication", json);
17939    if (medication != null)
17940      res.setMedication(medication);
17941    if (json.has("subject"))
17942      res.setSubject(parseReference(json.getAsJsonObject("subject")));
17943    if (json.has("encounter"))
17944      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
17945    Type effective = parseType("effective", json);
17946    if (effective != null)
17947      res.setEffective(effective);
17948    if (json.has("dateAsserted"))
17949      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
17950    if (json.has("_dateAsserted"))
17951      parseElementProperties(json.getAsJsonObject("_dateAsserted"), res.getDateAssertedElement());
17952    if (json.has("informationSource"))
17953      res.setInformationSource(parseReference(json.getAsJsonObject("informationSource")));
17954    if (json.has("derivedFrom")) {
17955      JsonArray array = json.getAsJsonArray("derivedFrom");
17956      for (int i = 0; i < array.size(); i++) {
17957        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
17958      }
17959    };
17960    if (json.has("reasonCode")) {
17961      JsonArray array = json.getAsJsonArray("reasonCode");
17962      for (int i = 0; i < array.size(); i++) {
17963        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17964      }
17965    };
17966    if (json.has("reasonReference")) {
17967      JsonArray array = json.getAsJsonArray("reasonReference");
17968      for (int i = 0; i < array.size(); i++) {
17969        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
17970      }
17971    };
17972    if (json.has("note")) {
17973      JsonArray array = json.getAsJsonArray("note");
17974      for (int i = 0; i < array.size(); i++) {
17975        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17976      }
17977    };
17978    if (json.has("dosage")) {
17979      JsonArray array = json.getAsJsonArray("dosage");
17980      for (int i = 0; i < array.size(); i++) {
17981        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
17982      }
17983    };
17984    if (json.has("takenAsOrdered"))
17985      res.setTakenAsOrderedElement(parseBoolean(json.get("takenAsOrdered").getAsBoolean()));
17986    if (json.has("_takenAsOrdered"))
17987      parseElementProperties(json.getAsJsonObject("_takenAsOrdered"), res.getTakenAsOrderedElement());
17988  }
17989
17990  protected MedicinalProductDefinition parseMedicinalProductDefinition(JsonObject json) throws IOException, FHIRFormatError {
17991    MedicinalProductDefinition res = new MedicinalProductDefinition();
17992    parseMedicinalProductDefinitionProperties(json, res);
17993    return res;
17994  }
17995
17996  protected void parseMedicinalProductDefinitionProperties(JsonObject json, MedicinalProductDefinition res) throws IOException, FHIRFormatError {
17997    parseDomainResourceProperties(json, res);
17998    if (json.has("identifier")) {
17999      JsonArray array = json.getAsJsonArray("identifier");
18000      for (int i = 0; i < array.size(); i++) {
18001        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18002      }
18003    };
18004    if (json.has("type"))
18005      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18006    if (json.has("domain"))
18007      res.setDomain(parseCoding(json.getAsJsonObject("domain")));
18008    if (json.has("description"))
18009      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18010    if (json.has("_description"))
18011      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18012    if (json.has("combinedPharmaceuticalDoseForm"))
18013      res.setCombinedPharmaceuticalDoseForm(parseCodeableConcept(json.getAsJsonObject("combinedPharmaceuticalDoseForm")));
18014    if (json.has("indication"))
18015      res.setIndicationElement(parseMarkdown(json.get("indication").getAsString()));
18016    if (json.has("_indication"))
18017      parseElementProperties(json.getAsJsonObject("_indication"), res.getIndicationElement());
18018    if (json.has("legalStatusOfSupply"))
18019      res.setLegalStatusOfSupply(parseCodeableConcept(json.getAsJsonObject("legalStatusOfSupply")));
18020    if (json.has("additionalMonitoringIndicator"))
18021      res.setAdditionalMonitoringIndicator(parseCodeableConcept(json.getAsJsonObject("additionalMonitoringIndicator")));
18022    if (json.has("specialMeasure")) {
18023      JsonArray array = json.getAsJsonArray("specialMeasure");
18024      for (int i = 0; i < array.size(); i++) {
18025        res.getSpecialMeasure().add(parseString(array.get(i).getAsString()));
18026      }
18027    };
18028    if (json.has("_specialMeasure")) {
18029      JsonArray array = json.getAsJsonArray("_specialMeasure");
18030      for (int i = 0; i < array.size(); i++) {
18031        if (i == res.getSpecialMeasure().size())
18032          res.getSpecialMeasure().add(parseString(null));
18033        if (array.get(i) instanceof JsonObject) 
18034          parseElementProperties(array.get(i).getAsJsonObject(), res.getSpecialMeasure().get(i));
18035      }
18036    };
18037    if (json.has("paediatricUseIndicator"))
18038      res.setPaediatricUseIndicator(parseCodeableConcept(json.getAsJsonObject("paediatricUseIndicator")));
18039    if (json.has("productClassification")) {
18040      JsonArray array = json.getAsJsonArray("productClassification");
18041      for (int i = 0; i < array.size(); i++) {
18042        res.getProductClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18043      }
18044    };
18045    if (json.has("marketingStatus")) {
18046      JsonArray array = json.getAsJsonArray("marketingStatus");
18047      for (int i = 0; i < array.size(); i++) {
18048        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
18049      }
18050    };
18051    if (json.has("pharmaceuticalProduct")) {
18052      JsonArray array = json.getAsJsonArray("pharmaceuticalProduct");
18053      for (int i = 0; i < array.size(); i++) {
18054        res.getPharmaceuticalProduct().add(parseReference(array.get(i).getAsJsonObject()));
18055      }
18056    };
18057    if (json.has("packagedMedicinalProduct")) {
18058      JsonArray array = json.getAsJsonArray("packagedMedicinalProduct");
18059      for (int i = 0; i < array.size(); i++) {
18060        res.getPackagedMedicinalProduct().add(parseReference(array.get(i).getAsJsonObject()));
18061      }
18062    };
18063    if (json.has("ingredient")) {
18064      JsonArray array = json.getAsJsonArray("ingredient");
18065      for (int i = 0; i < array.size(); i++) {
18066        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
18067      }
18068    };
18069    if (json.has("attachedDocument")) {
18070      JsonArray array = json.getAsJsonArray("attachedDocument");
18071      for (int i = 0; i < array.size(); i++) {
18072        res.getAttachedDocument().add(parseReference(array.get(i).getAsJsonObject()));
18073      }
18074    };
18075    if (json.has("masterFile")) {
18076      JsonArray array = json.getAsJsonArray("masterFile");
18077      for (int i = 0; i < array.size(); i++) {
18078        res.getMasterFile().add(parseReference(array.get(i).getAsJsonObject()));
18079      }
18080    };
18081    if (json.has("contact")) {
18082      JsonArray array = json.getAsJsonArray("contact");
18083      for (int i = 0; i < array.size(); i++) {
18084        res.getContact().add(parseMedicinalProductDefinitionMedicinalProductDefinitionContactComponent(array.get(i).getAsJsonObject(), res));
18085      }
18086    };
18087    if (json.has("clinicalTrial")) {
18088      JsonArray array = json.getAsJsonArray("clinicalTrial");
18089      for (int i = 0; i < array.size(); i++) {
18090        res.getClinicalTrial().add(parseReference(array.get(i).getAsJsonObject()));
18091      }
18092    };
18093    if (json.has("name")) {
18094      JsonArray array = json.getAsJsonArray("name");
18095      for (int i = 0; i < array.size(); i++) {
18096        res.getName().add(parseMedicinalProductDefinitionMedicinalProductDefinitionNameComponent(array.get(i).getAsJsonObject(), res));
18097      }
18098    };
18099    if (json.has("crossReference")) {
18100      JsonArray array = json.getAsJsonArray("crossReference");
18101      for (int i = 0; i < array.size(); i++) {
18102        res.getCrossReference().add(parseIdentifier(array.get(i).getAsJsonObject()));
18103      }
18104    };
18105    if (json.has("manufacturingBusinessOperation")) {
18106      JsonArray array = json.getAsJsonArray("manufacturingBusinessOperation");
18107      for (int i = 0; i < array.size(); i++) {
18108        res.getManufacturingBusinessOperation().add(parseMedicinalProductDefinitionMedicinalProductDefinitionManufacturingBusinessOperationComponent(array.get(i).getAsJsonObject(), res));
18109      }
18110    };
18111    if (json.has("specialDesignation")) {
18112      JsonArray array = json.getAsJsonArray("specialDesignation");
18113      for (int i = 0; i < array.size(); i++) {
18114        res.getSpecialDesignation().add(parseMedicinalProductDefinitionMedicinalProductDefinitionSpecialDesignationComponent(array.get(i).getAsJsonObject(), res));
18115      }
18116    };
18117  }
18118
18119  protected MedicinalProductDefinition.MedicinalProductDefinitionContactComponent parseMedicinalProductDefinitionMedicinalProductDefinitionContactComponent(JsonObject json, MedicinalProductDefinition owner) throws IOException, FHIRFormatError {
18120    MedicinalProductDefinition.MedicinalProductDefinitionContactComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionContactComponent();
18121    parseMedicinalProductDefinitionMedicinalProductDefinitionContactComponentProperties(json, owner, res);
18122    return res;
18123  }
18124
18125  protected void parseMedicinalProductDefinitionMedicinalProductDefinitionContactComponentProperties(JsonObject json, MedicinalProductDefinition owner, MedicinalProductDefinition.MedicinalProductDefinitionContactComponent res) throws IOException, FHIRFormatError {
18126    parseBackboneElementProperties(json, res);
18127    if (json.has("type"))
18128      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18129    if (json.has("contact"))
18130      res.setContact(parseReference(json.getAsJsonObject("contact")));
18131  }
18132
18133  protected MedicinalProductDefinition.MedicinalProductDefinitionNameComponent parseMedicinalProductDefinitionMedicinalProductDefinitionNameComponent(JsonObject json, MedicinalProductDefinition owner) throws IOException, FHIRFormatError {
18134    MedicinalProductDefinition.MedicinalProductDefinitionNameComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionNameComponent();
18135    parseMedicinalProductDefinitionMedicinalProductDefinitionNameComponentProperties(json, owner, res);
18136    return res;
18137  }
18138
18139  protected void parseMedicinalProductDefinitionMedicinalProductDefinitionNameComponentProperties(JsonObject json, MedicinalProductDefinition owner, MedicinalProductDefinition.MedicinalProductDefinitionNameComponent res) throws IOException, FHIRFormatError {
18140    parseBackboneElementProperties(json, res);
18141    if (json.has("productName"))
18142      res.setProductNameElement(parseString(json.get("productName").getAsString()));
18143    if (json.has("_productName"))
18144      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
18145    if (json.has("type"))
18146      res.setType(parseCoding(json.getAsJsonObject("type")));
18147    if (json.has("namePart")) {
18148      JsonArray array = json.getAsJsonArray("namePart");
18149      for (int i = 0; i < array.size(); i++) {
18150        res.getNamePart().add(parseMedicinalProductDefinitionMedicinalProductDefinitionNameNamePartComponent(array.get(i).getAsJsonObject(), owner));
18151      }
18152    };
18153    if (json.has("countryLanguage")) {
18154      JsonArray array = json.getAsJsonArray("countryLanguage");
18155      for (int i = 0; i < array.size(); i++) {
18156        res.getCountryLanguage().add(parseMedicinalProductDefinitionMedicinalProductDefinitionNameCountryLanguageComponent(array.get(i).getAsJsonObject(), owner));
18157      }
18158    };
18159  }
18160
18161  protected MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent parseMedicinalProductDefinitionMedicinalProductDefinitionNameNamePartComponent(JsonObject json, MedicinalProductDefinition owner) throws IOException, FHIRFormatError {
18162    MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent();
18163    parseMedicinalProductDefinitionMedicinalProductDefinitionNameNamePartComponentProperties(json, owner, res);
18164    return res;
18165  }
18166
18167  protected void parseMedicinalProductDefinitionMedicinalProductDefinitionNameNamePartComponentProperties(JsonObject json, MedicinalProductDefinition owner, MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent res) throws IOException, FHIRFormatError {
18168    parseBackboneElementProperties(json, res);
18169    if (json.has("part"))
18170      res.setPartElement(parseString(json.get("part").getAsString()));
18171    if (json.has("_part"))
18172      parseElementProperties(json.getAsJsonObject("_part"), res.getPartElement());
18173    if (json.has("type"))
18174      res.setType(parseCoding(json.getAsJsonObject("type")));
18175  }
18176
18177  protected MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent parseMedicinalProductDefinitionMedicinalProductDefinitionNameCountryLanguageComponent(JsonObject json, MedicinalProductDefinition owner) throws IOException, FHIRFormatError {
18178    MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent();
18179    parseMedicinalProductDefinitionMedicinalProductDefinitionNameCountryLanguageComponentProperties(json, owner, res);
18180    return res;
18181  }
18182
18183  protected void parseMedicinalProductDefinitionMedicinalProductDefinitionNameCountryLanguageComponentProperties(JsonObject json, MedicinalProductDefinition owner, MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent res) throws IOException, FHIRFormatError {
18184    parseBackboneElementProperties(json, res);
18185    if (json.has("country"))
18186      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
18187    if (json.has("jurisdiction"))
18188      res.setJurisdiction(parseCodeableConcept(json.getAsJsonObject("jurisdiction")));
18189    if (json.has("language"))
18190      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
18191  }
18192
18193  protected MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent parseMedicinalProductDefinitionMedicinalProductDefinitionManufacturingBusinessOperationComponent(JsonObject json, MedicinalProductDefinition owner) throws IOException, FHIRFormatError {
18194    MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent();
18195    parseMedicinalProductDefinitionMedicinalProductDefinitionManufacturingBusinessOperationComponentProperties(json, owner, res);
18196    return res;
18197  }
18198
18199  protected void parseMedicinalProductDefinitionMedicinalProductDefinitionManufacturingBusinessOperationComponentProperties(JsonObject json, MedicinalProductDefinition owner, MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent res) throws IOException, FHIRFormatError {
18200    parseBackboneElementProperties(json, res);
18201    if (json.has("operationType"))
18202      res.setOperationType(parseCodeableConcept(json.getAsJsonObject("operationType")));
18203    if (json.has("authorisationReferenceNumber"))
18204      res.setAuthorisationReferenceNumber(parseIdentifier(json.getAsJsonObject("authorisationReferenceNumber")));
18205    if (json.has("effectiveDate"))
18206      res.setEffectiveDate(parsePeriod(json.getAsJsonObject("effectiveDate")));
18207    if (json.has("confidentialityIndicator"))
18208      res.setConfidentialityIndicator(parseCodeableConcept(json.getAsJsonObject("confidentialityIndicator")));
18209    if (json.has("manufacturer")) {
18210      JsonArray array = json.getAsJsonArray("manufacturer");
18211      for (int i = 0; i < array.size(); i++) {
18212        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
18213      }
18214    };
18215    if (json.has("regulator"))
18216      res.setRegulator(parseReference(json.getAsJsonObject("regulator")));
18217  }
18218
18219  protected MedicinalProductDefinition.MedicinalProductDefinitionSpecialDesignationComponent parseMedicinalProductDefinitionMedicinalProductDefinitionSpecialDesignationComponent(JsonObject json, MedicinalProductDefinition owner) throws IOException, FHIRFormatError {
18220    MedicinalProductDefinition.MedicinalProductDefinitionSpecialDesignationComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionSpecialDesignationComponent();
18221    parseMedicinalProductDefinitionMedicinalProductDefinitionSpecialDesignationComponentProperties(json, owner, res);
18222    return res;
18223  }
18224
18225  protected void parseMedicinalProductDefinitionMedicinalProductDefinitionSpecialDesignationComponentProperties(JsonObject json, MedicinalProductDefinition owner, MedicinalProductDefinition.MedicinalProductDefinitionSpecialDesignationComponent res) throws IOException, FHIRFormatError {
18226    parseBackboneElementProperties(json, res);
18227    if (json.has("identifier")) {
18228      JsonArray array = json.getAsJsonArray("identifier");
18229      for (int i = 0; i < array.size(); i++) {
18230        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18231      }
18232    };
18233    if (json.has("type"))
18234      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18235    if (json.has("intendedUse"))
18236      res.setIntendedUse(parseCodeableConcept(json.getAsJsonObject("intendedUse")));
18237    Type indication = parseType("indication", json);
18238    if (indication != null)
18239      res.setIndication(indication);
18240    if (json.has("status"))
18241      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
18242    if (json.has("date"))
18243      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18244    if (json.has("_date"))
18245      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
18246    if (json.has("species"))
18247      res.setSpecies(parseCodeableConcept(json.getAsJsonObject("species")));
18248  }
18249
18250  protected MessageDefinition parseMessageDefinition(JsonObject json) throws IOException, FHIRFormatError {
18251    MessageDefinition res = new MessageDefinition();
18252    parseMessageDefinitionProperties(json, res);
18253    return res;
18254  }
18255
18256  protected void parseMessageDefinitionProperties(JsonObject json, MessageDefinition res) throws IOException, FHIRFormatError {
18257    parseDomainResourceProperties(json, res);
18258    if (json.has("url"))
18259      res.setUrlElement(parseUri(json.get("url").getAsString()));
18260    if (json.has("_url"))
18261      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
18262    if (json.has("identifier")) {
18263      JsonArray array = json.getAsJsonArray("identifier");
18264      for (int i = 0; i < array.size(); i++) {
18265        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18266      }
18267    };
18268    if (json.has("version"))
18269      res.setVersionElement(parseString(json.get("version").getAsString()));
18270    if (json.has("_version"))
18271      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
18272    if (json.has("name"))
18273      res.setNameElement(parseString(json.get("name").getAsString()));
18274    if (json.has("_name"))
18275      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18276    if (json.has("title"))
18277      res.setTitleElement(parseString(json.get("title").getAsString()));
18278    if (json.has("_title"))
18279      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
18280    if (json.has("replaces")) {
18281      JsonArray array = json.getAsJsonArray("replaces");
18282      for (int i = 0; i < array.size(); i++) {
18283        res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
18284      }
18285    };
18286    if (json.has("_replaces")) {
18287      JsonArray array = json.getAsJsonArray("_replaces");
18288      for (int i = 0; i < array.size(); i++) {
18289        if (i == res.getReplaces().size())
18290          res.getReplaces().add(parseCanonical(null));
18291        if (array.get(i) instanceof JsonObject) 
18292          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
18293      }
18294    };
18295    if (json.has("status"))
18296      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
18297    if (json.has("_status"))
18298      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18299    if (json.has("experimental"))
18300      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
18301    if (json.has("_experimental"))
18302      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
18303    if (json.has("date"))
18304      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18305    if (json.has("_date"))
18306      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
18307    if (json.has("publisher"))
18308      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
18309    if (json.has("_publisher"))
18310      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
18311    if (json.has("contact")) {
18312      JsonArray array = json.getAsJsonArray("contact");
18313      for (int i = 0; i < array.size(); i++) {
18314        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
18315      }
18316    };
18317    if (json.has("description"))
18318      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18319    if (json.has("_description"))
18320      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18321    if (json.has("useContext")) {
18322      JsonArray array = json.getAsJsonArray("useContext");
18323      for (int i = 0; i < array.size(); i++) {
18324        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
18325      }
18326    };
18327    if (json.has("jurisdiction")) {
18328      JsonArray array = json.getAsJsonArray("jurisdiction");
18329      for (int i = 0; i < array.size(); i++) {
18330        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18331      }
18332    };
18333    if (json.has("purpose"))
18334      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
18335    if (json.has("_purpose"))
18336      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
18337    if (json.has("copyright"))
18338      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
18339    if (json.has("_copyright"))
18340      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
18341    if (json.has("base"))
18342      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
18343    if (json.has("_base"))
18344      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
18345    if (json.has("parent")) {
18346      JsonArray array = json.getAsJsonArray("parent");
18347      for (int i = 0; i < array.size(); i++) {
18348        res.getParent().add(parseCanonical(array.get(i).getAsString()));
18349      }
18350    };
18351    if (json.has("_parent")) {
18352      JsonArray array = json.getAsJsonArray("_parent");
18353      for (int i = 0; i < array.size(); i++) {
18354        if (i == res.getParent().size())
18355          res.getParent().add(parseCanonical(null));
18356        if (array.get(i) instanceof JsonObject) 
18357          parseElementProperties(array.get(i).getAsJsonObject(), res.getParent().get(i));
18358      }
18359    };
18360    Type event = parseType("event", json);
18361    if (event != null)
18362      res.setEvent(event);
18363    if (json.has("category"))
18364      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), MessageDefinition.MessageSignificanceCategory.NULL, new MessageDefinition.MessageSignificanceCategoryEnumFactory()));
18365    if (json.has("_category"))
18366      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
18367    if (json.has("focus")) {
18368      JsonArray array = json.getAsJsonArray("focus");
18369      for (int i = 0; i < array.size(); i++) {
18370        res.getFocus().add(parseMessageDefinitionMessageDefinitionFocusComponent(array.get(i).getAsJsonObject(), res));
18371      }
18372    };
18373    if (json.has("responseRequired"))
18374      res.setResponseRequiredElement(parseEnumeration(json.get("responseRequired").getAsString(), MessageDefinition.MessageheaderResponseRequest.NULL, new MessageDefinition.MessageheaderResponseRequestEnumFactory()));
18375    if (json.has("_responseRequired"))
18376      parseElementProperties(json.getAsJsonObject("_responseRequired"), res.getResponseRequiredElement());
18377    if (json.has("allowedResponse")) {
18378      JsonArray array = json.getAsJsonArray("allowedResponse");
18379      for (int i = 0; i < array.size(); i++) {
18380        res.getAllowedResponse().add(parseMessageDefinitionMessageDefinitionAllowedResponseComponent(array.get(i).getAsJsonObject(), res));
18381      }
18382    };
18383    if (json.has("graph")) {
18384      JsonArray array = json.getAsJsonArray("graph");
18385      for (int i = 0; i < array.size(); i++) {
18386        res.getGraph().add(parseCanonical(array.get(i).getAsString()));
18387      }
18388    };
18389    if (json.has("_graph")) {
18390      JsonArray array = json.getAsJsonArray("_graph");
18391      for (int i = 0; i < array.size(); i++) {
18392        if (i == res.getGraph().size())
18393          res.getGraph().add(parseCanonical(null));
18394        if (array.get(i) instanceof JsonObject) 
18395          parseElementProperties(array.get(i).getAsJsonObject(), res.getGraph().get(i));
18396      }
18397    };
18398  }
18399
18400  protected MessageDefinition.MessageDefinitionFocusComponent parseMessageDefinitionMessageDefinitionFocusComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
18401    MessageDefinition.MessageDefinitionFocusComponent res = new MessageDefinition.MessageDefinitionFocusComponent();
18402    parseMessageDefinitionMessageDefinitionFocusComponentProperties(json, owner, res);
18403    return res;
18404  }
18405
18406  protected void parseMessageDefinitionMessageDefinitionFocusComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionFocusComponent res) throws IOException, FHIRFormatError {
18407    parseBackboneElementProperties(json, res);
18408    if (json.has("code"))
18409      res.setCodeElement(parseCode(json.get("code").getAsString()));
18410    if (json.has("_code"))
18411      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
18412    if (json.has("profile"))
18413      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
18414    if (json.has("_profile"))
18415      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
18416    if (json.has("min"))
18417      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
18418    if (json.has("_min"))
18419      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
18420    if (json.has("max"))
18421      res.setMaxElement(parseString(json.get("max").getAsString()));
18422    if (json.has("_max"))
18423      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
18424  }
18425
18426  protected MessageDefinition.MessageDefinitionAllowedResponseComponent parseMessageDefinitionMessageDefinitionAllowedResponseComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
18427    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
18428    parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(json, owner, res);
18429    return res;
18430  }
18431
18432  protected void parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionAllowedResponseComponent res) throws IOException, FHIRFormatError {
18433    parseBackboneElementProperties(json, res);
18434    if (json.has("message"))
18435      res.setMessageElement(parseCanonical(json.get("message").getAsString()));
18436    if (json.has("_message"))
18437      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
18438    if (json.has("situation"))
18439      res.setSituationElement(parseMarkdown(json.get("situation").getAsString()));
18440    if (json.has("_situation"))
18441      parseElementProperties(json.getAsJsonObject("_situation"), res.getSituationElement());
18442      }
18443
18444  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
18445    MessageHeader res = new MessageHeader();
18446    parseMessageHeaderProperties(json, res);
18447    return res;
18448      }
18449
18450  protected void parseMessageHeaderProperties(JsonObject json, MessageHeader res) throws IOException, FHIRFormatError {
18451    parseDomainResourceProperties(json, res);
18452    Type event = parseType("event", json);
18453    if (event != null)
18454      res.setEvent(event);
18455    if (json.has("destination")) {
18456      JsonArray array = json.getAsJsonArray("destination");
18457      for (int i = 0; i < array.size(); i++) {
18458        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject(), res));
18459      }
18460    };
18461    if (json.has("sender"))
18462      res.setSender(parseReference(json.getAsJsonObject("sender")));
18463    if (json.has("enterer"))
18464      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
18465    if (json.has("author"))
18466      res.setAuthor(parseReference(json.getAsJsonObject("author")));
18467    if (json.has("source"))
18468      res.setSource(parseMessageHeaderMessageSourceComponent(json.getAsJsonObject("source"), res));
18469    if (json.has("responsible"))
18470      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
18471    if (json.has("reason"))
18472      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
18473    if (json.has("response"))
18474      res.setResponse(parseMessageHeaderMessageHeaderResponseComponent(json.getAsJsonObject("response"), res));
18475    if (json.has("focus")) {
18476      JsonArray array = json.getAsJsonArray("focus");
18477      for (int i = 0; i < array.size(); i++) {
18478        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
18479      }
18480    };
18481    if (json.has("definition"))
18482      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
18483    if (json.has("_definition"))
18484      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
18485  }
18486
18487  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
18488    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
18489    parseMessageHeaderMessageDestinationComponentProperties(json, owner, res);
18490    return res;
18491  }
18492
18493  protected void parseMessageHeaderMessageDestinationComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageDestinationComponent res) throws IOException, FHIRFormatError {
18494    parseBackboneElementProperties(json, res);
18495    if (json.has("name"))
18496      res.setNameElement(parseString(json.get("name").getAsString()));
18497    if (json.has("_name"))
18498      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18499    if (json.has("target"))
18500      res.setTarget(parseReference(json.getAsJsonObject("target")));
18501    if (json.has("endpoint"))
18502      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
18503    if (json.has("_endpoint"))
18504      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
18505    if (json.has("receiver"))
18506      res.setReceiver(parseReference(json.getAsJsonObject("receiver")));
18507  }
18508
18509  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
18510    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
18511    parseMessageHeaderMessageSourceComponentProperties(json, owner, res);
18512    return res;
18513  }
18514
18515  protected void parseMessageHeaderMessageSourceComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageSourceComponent res) throws IOException, FHIRFormatError {
18516    parseBackboneElementProperties(json, res);
18517    if (json.has("name"))
18518      res.setNameElement(parseString(json.get("name").getAsString()));
18519    if (json.has("_name"))
18520      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18521    if (json.has("software"))
18522      res.setSoftwareElement(parseString(json.get("software").getAsString()));
18523    if (json.has("_software"))
18524      parseElementProperties(json.getAsJsonObject("_software"), res.getSoftwareElement());
18525    if (json.has("version"))
18526      res.setVersionElement(parseString(json.get("version").getAsString()));
18527    if (json.has("_version"))
18528      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
18529    if (json.has("contact"))
18530      res.setContact(parseContactPoint(json.getAsJsonObject("contact")));
18531    if (json.has("endpoint"))
18532      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
18533    if (json.has("_endpoint"))
18534      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
18535  }
18536
18537  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderMessageHeaderResponseComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
18538    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
18539    parseMessageHeaderMessageHeaderResponseComponentProperties(json, owner, res);
18540    return res;
18541  }
18542
18543  protected void parseMessageHeaderMessageHeaderResponseComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageHeaderResponseComponent res) throws IOException, FHIRFormatError {
18544    parseBackboneElementProperties(json, res);
18545    if (json.has("identifier"))
18546      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
18547    if (json.has("_identifier"))
18548      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
18549    if (json.has("code"))
18550      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
18551    if (json.has("_code"))
18552      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
18553    if (json.has("details"))
18554      res.setDetails(parseReference(json.getAsJsonObject("details")));
18555  }
18556
18557  protected MolecularSequence parseMolecularSequence(JsonObject json) throws IOException, FHIRFormatError {
18558    MolecularSequence res = new MolecularSequence();
18559    parseMolecularSequenceProperties(json, res);
18560    return res;
18561  }
18562
18563  protected void parseMolecularSequenceProperties(JsonObject json, MolecularSequence res) throws IOException, FHIRFormatError {
18564    parseDomainResourceProperties(json, res);
18565    if (json.has("identifier")) {
18566      JsonArray array = json.getAsJsonArray("identifier");
18567      for (int i = 0; i < array.size(); i++) {
18568        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18569      }
18570    };
18571    if (json.has("type"))
18572      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.SequenceType.NULL, new MolecularSequence.SequenceTypeEnumFactory()));
18573    if (json.has("_type"))
18574      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18575    if (json.has("coordinateSystem"))
18576      res.setCoordinateSystemElement(parseInteger(json.get("coordinateSystem").getAsLong()));
18577    if (json.has("_coordinateSystem"))
18578      parseElementProperties(json.getAsJsonObject("_coordinateSystem"), res.getCoordinateSystemElement());
18579    if (json.has("patient"))
18580      res.setPatient(parseReference(json.getAsJsonObject("patient")));
18581    if (json.has("specimen"))
18582      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
18583    if (json.has("device"))
18584      res.setDevice(parseReference(json.getAsJsonObject("device")));
18585    if (json.has("performer"))
18586      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
18587    if (json.has("quantity"))
18588      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
18589    if (json.has("referenceSeq"))
18590      res.setReferenceSeq(parseMolecularSequenceMolecularSequenceReferenceSeqComponent(json.getAsJsonObject("referenceSeq"), res));
18591    if (json.has("variant")) {
18592      JsonArray array = json.getAsJsonArray("variant");
18593      for (int i = 0; i < array.size(); i++) {
18594        res.getVariant().add(parseMolecularSequenceMolecularSequenceVariantComponent(array.get(i).getAsJsonObject(), res));
18595      }
18596    };
18597    if (json.has("observedSeq"))
18598      res.setObservedSeqElement(parseString(json.get("observedSeq").getAsString()));
18599    if (json.has("_observedSeq"))
18600      parseElementProperties(json.getAsJsonObject("_observedSeq"), res.getObservedSeqElement());
18601    if (json.has("quality")) {
18602      JsonArray array = json.getAsJsonArray("quality");
18603      for (int i = 0; i < array.size(); i++) {
18604        res.getQuality().add(parseMolecularSequenceMolecularSequenceQualityComponent(array.get(i).getAsJsonObject(), res));
18605      }
18606    };
18607    if (json.has("readCoverage"))
18608      res.setReadCoverageElement(parseInteger(json.get("readCoverage").getAsLong()));
18609    if (json.has("_readCoverage"))
18610      parseElementProperties(json.getAsJsonObject("_readCoverage"), res.getReadCoverageElement());
18611    if (json.has("repository")) {
18612      JsonArray array = json.getAsJsonArray("repository");
18613      for (int i = 0; i < array.size(); i++) {
18614        res.getRepository().add(parseMolecularSequenceMolecularSequenceRepositoryComponent(array.get(i).getAsJsonObject(), res));
18615      }
18616    };
18617    if (json.has("pointer")) {
18618      JsonArray array = json.getAsJsonArray("pointer");
18619      for (int i = 0; i < array.size(); i++) {
18620        res.getPointer().add(parseReference(array.get(i).getAsJsonObject()));
18621      }
18622    };
18623    if (json.has("structureVariant")) {
18624      JsonArray array = json.getAsJsonArray("structureVariant");
18625      for (int i = 0; i < array.size(); i++) {
18626        res.getStructureVariant().add(parseMolecularSequenceMolecularSequenceStructureVariantComponent(array.get(i).getAsJsonObject(), res));
18627      }
18628    };
18629  }
18630
18631  protected MolecularSequence.MolecularSequenceReferenceSeqComponent parseMolecularSequenceMolecularSequenceReferenceSeqComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18632    MolecularSequence.MolecularSequenceReferenceSeqComponent res = new MolecularSequence.MolecularSequenceReferenceSeqComponent();
18633    parseMolecularSequenceMolecularSequenceReferenceSeqComponentProperties(json, owner, res);
18634    return res;
18635  }
18636
18637  protected void parseMolecularSequenceMolecularSequenceReferenceSeqComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceReferenceSeqComponent res) throws IOException, FHIRFormatError {
18638    parseBackboneElementProperties(json, res);
18639    if (json.has("chromosome"))
18640      res.setChromosome(parseCodeableConcept(json.getAsJsonObject("chromosome")));
18641    if (json.has("genomeBuild"))
18642      res.setGenomeBuildElement(parseString(json.get("genomeBuild").getAsString()));
18643    if (json.has("_genomeBuild"))
18644      parseElementProperties(json.getAsJsonObject("_genomeBuild"), res.getGenomeBuildElement());
18645    if (json.has("orientation"))
18646      res.setOrientationElement(parseEnumeration(json.get("orientation").getAsString(), MolecularSequence.OrientationType.NULL, new MolecularSequence.OrientationTypeEnumFactory()));
18647    if (json.has("_orientation"))
18648      parseElementProperties(json.getAsJsonObject("_orientation"), res.getOrientationElement());
18649    if (json.has("referenceSeqId"))
18650      res.setReferenceSeqId(parseCodeableConcept(json.getAsJsonObject("referenceSeqId")));
18651    if (json.has("referenceSeqPointer"))
18652      res.setReferenceSeqPointer(parseReference(json.getAsJsonObject("referenceSeqPointer")));
18653    if (json.has("referenceSeqString"))
18654      res.setReferenceSeqStringElement(parseString(json.get("referenceSeqString").getAsString()));
18655    if (json.has("_referenceSeqString"))
18656      parseElementProperties(json.getAsJsonObject("_referenceSeqString"), res.getReferenceSeqStringElement());
18657    if (json.has("strand"))
18658      res.setStrandElement(parseEnumeration(json.get("strand").getAsString(), MolecularSequence.StrandType.NULL, new MolecularSequence.StrandTypeEnumFactory()));
18659    if (json.has("_strand"))
18660      parseElementProperties(json.getAsJsonObject("_strand"), res.getStrandElement());
18661    if (json.has("windowStart"))
18662      res.setWindowStartElement(parseInteger(json.get("windowStart").getAsLong()));
18663    if (json.has("_windowStart"))
18664      parseElementProperties(json.getAsJsonObject("_windowStart"), res.getWindowStartElement());
18665    if (json.has("windowEnd"))
18666      res.setWindowEndElement(parseInteger(json.get("windowEnd").getAsLong()));
18667    if (json.has("_windowEnd"))
18668      parseElementProperties(json.getAsJsonObject("_windowEnd"), res.getWindowEndElement());
18669  }
18670
18671  protected MolecularSequence.MolecularSequenceVariantComponent parseMolecularSequenceMolecularSequenceVariantComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18672    MolecularSequence.MolecularSequenceVariantComponent res = new MolecularSequence.MolecularSequenceVariantComponent();
18673    parseMolecularSequenceMolecularSequenceVariantComponentProperties(json, owner, res);
18674    return res;
18675  }
18676
18677  protected void parseMolecularSequenceMolecularSequenceVariantComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceVariantComponent res) throws IOException, FHIRFormatError {
18678    parseBackboneElementProperties(json, res);
18679    if (json.has("start"))
18680      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18681    if (json.has("_start"))
18682      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
18683    if (json.has("end"))
18684      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18685    if (json.has("_end"))
18686      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
18687    if (json.has("observedAllele"))
18688      res.setObservedAlleleElement(parseString(json.get("observedAllele").getAsString()));
18689    if (json.has("_observedAllele"))
18690      parseElementProperties(json.getAsJsonObject("_observedAllele"), res.getObservedAlleleElement());
18691    if (json.has("referenceAllele"))
18692      res.setReferenceAlleleElement(parseString(json.get("referenceAllele").getAsString()));
18693    if (json.has("_referenceAllele"))
18694      parseElementProperties(json.getAsJsonObject("_referenceAllele"), res.getReferenceAlleleElement());
18695    if (json.has("cigar"))
18696      res.setCigarElement(parseString(json.get("cigar").getAsString()));
18697    if (json.has("_cigar"))
18698      parseElementProperties(json.getAsJsonObject("_cigar"), res.getCigarElement());
18699    if (json.has("variantPointer"))
18700      res.setVariantPointer(parseReference(json.getAsJsonObject("variantPointer")));
18701  }
18702
18703  protected MolecularSequence.MolecularSequenceQualityComponent parseMolecularSequenceMolecularSequenceQualityComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18704    MolecularSequence.MolecularSequenceQualityComponent res = new MolecularSequence.MolecularSequenceQualityComponent();
18705    parseMolecularSequenceMolecularSequenceQualityComponentProperties(json, owner, res);
18706    return res;
18707  }
18708
18709  protected void parseMolecularSequenceMolecularSequenceQualityComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceQualityComponent res) throws IOException, FHIRFormatError {
18710    parseBackboneElementProperties(json, res);
18711    if (json.has("type"))
18712      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.QualityType.NULL, new MolecularSequence.QualityTypeEnumFactory()));
18713    if (json.has("_type"))
18714      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18715    if (json.has("standardSequence"))
18716      res.setStandardSequence(parseCodeableConcept(json.getAsJsonObject("standardSequence")));
18717    if (json.has("start"))
18718      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18719    if (json.has("_start"))
18720      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
18721    if (json.has("end"))
18722      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18723    if (json.has("_end"))
18724      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
18725    if (json.has("score"))
18726      res.setScore(parseQuantity(json.getAsJsonObject("score")));
18727    if (json.has("method"))
18728      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
18729    if (json.has("truthTP"))
18730      res.setTruthTPElement(parseDecimal(json.get("truthTP").getAsBigDecimal()));
18731    if (json.has("_truthTP"))
18732      parseElementProperties(json.getAsJsonObject("_truthTP"), res.getTruthTPElement());
18733    if (json.has("queryTP"))
18734      res.setQueryTPElement(parseDecimal(json.get("queryTP").getAsBigDecimal()));
18735    if (json.has("_queryTP"))
18736      parseElementProperties(json.getAsJsonObject("_queryTP"), res.getQueryTPElement());
18737    if (json.has("truthFN"))
18738      res.setTruthFNElement(parseDecimal(json.get("truthFN").getAsBigDecimal()));
18739    if (json.has("_truthFN"))
18740      parseElementProperties(json.getAsJsonObject("_truthFN"), res.getTruthFNElement());
18741    if (json.has("queryFP"))
18742      res.setQueryFPElement(parseDecimal(json.get("queryFP").getAsBigDecimal()));
18743    if (json.has("_queryFP"))
18744      parseElementProperties(json.getAsJsonObject("_queryFP"), res.getQueryFPElement());
18745    if (json.has("gtFP"))
18746      res.setGtFPElement(parseDecimal(json.get("gtFP").getAsBigDecimal()));
18747    if (json.has("_gtFP"))
18748      parseElementProperties(json.getAsJsonObject("_gtFP"), res.getGtFPElement());
18749    if (json.has("precision"))
18750      res.setPrecisionElement(parseDecimal(json.get("precision").getAsBigDecimal()));
18751    if (json.has("_precision"))
18752      parseElementProperties(json.getAsJsonObject("_precision"), res.getPrecisionElement());
18753    if (json.has("recall"))
18754      res.setRecallElement(parseDecimal(json.get("recall").getAsBigDecimal()));
18755    if (json.has("_recall"))
18756      parseElementProperties(json.getAsJsonObject("_recall"), res.getRecallElement());
18757    if (json.has("fScore"))
18758      res.setFScoreElement(parseDecimal(json.get("fScore").getAsBigDecimal()));
18759    if (json.has("_fScore"))
18760      parseElementProperties(json.getAsJsonObject("_fScore"), res.getFScoreElement());
18761    if (json.has("roc"))
18762      res.setRoc(parseMolecularSequenceMolecularSequenceQualityRocComponent(json.getAsJsonObject("roc"), owner));
18763  }
18764
18765  protected MolecularSequence.MolecularSequenceQualityRocComponent parseMolecularSequenceMolecularSequenceQualityRocComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18766    MolecularSequence.MolecularSequenceQualityRocComponent res = new MolecularSequence.MolecularSequenceQualityRocComponent();
18767    parseMolecularSequenceMolecularSequenceQualityRocComponentProperties(json, owner, res);
18768    return res;
18769  }
18770
18771  protected void parseMolecularSequenceMolecularSequenceQualityRocComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceQualityRocComponent res) throws IOException, FHIRFormatError {
18772    parseBackboneElementProperties(json, res);
18773    if (json.has("score")) {
18774      JsonArray array = json.getAsJsonArray("score");
18775      for (int i = 0; i < array.size(); i++) {
18776        res.getScore().add(parseInteger(array.get(i).getAsLong()));
18777      }
18778    };
18779    if (json.has("_score")) {
18780      JsonArray array = json.getAsJsonArray("_score");
18781      for (int i = 0; i < array.size(); i++) {
18782        if (i == res.getScore().size())
18783          res.getScore().add(parseInteger(null));
18784        if (array.get(i) instanceof JsonObject) 
18785          parseElementProperties(array.get(i).getAsJsonObject(), res.getScore().get(i));
18786      }
18787    };
18788    if (json.has("numTP")) {
18789      JsonArray array = json.getAsJsonArray("numTP");
18790      for (int i = 0; i < array.size(); i++) {
18791        res.getNumTP().add(parseInteger(array.get(i).getAsLong()));
18792      }
18793    };
18794    if (json.has("_numTP")) {
18795      JsonArray array = json.getAsJsonArray("_numTP");
18796      for (int i = 0; i < array.size(); i++) {
18797        if (i == res.getNumTP().size())
18798          res.getNumTP().add(parseInteger(null));
18799        if (array.get(i) instanceof JsonObject) 
18800          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumTP().get(i));
18801      }
18802    };
18803    if (json.has("numFP")) {
18804      JsonArray array = json.getAsJsonArray("numFP");
18805      for (int i = 0; i < array.size(); i++) {
18806        res.getNumFP().add(parseInteger(array.get(i).getAsLong()));
18807      }
18808    };
18809    if (json.has("_numFP")) {
18810      JsonArray array = json.getAsJsonArray("_numFP");
18811      for (int i = 0; i < array.size(); i++) {
18812        if (i == res.getNumFP().size())
18813          res.getNumFP().add(parseInteger(null));
18814        if (array.get(i) instanceof JsonObject) 
18815          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFP().get(i));
18816      }
18817    };
18818    if (json.has("numFN")) {
18819      JsonArray array = json.getAsJsonArray("numFN");
18820      for (int i = 0; i < array.size(); i++) {
18821        res.getNumFN().add(parseInteger(array.get(i).getAsLong()));
18822      }
18823    };
18824    if (json.has("_numFN")) {
18825      JsonArray array = json.getAsJsonArray("_numFN");
18826      for (int i = 0; i < array.size(); i++) {
18827        if (i == res.getNumFN().size())
18828          res.getNumFN().add(parseInteger(null));
18829        if (array.get(i) instanceof JsonObject) 
18830          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFN().get(i));
18831      }
18832    };
18833    if (json.has("precision")) {
18834      JsonArray array = json.getAsJsonArray("precision");
18835      for (int i = 0; i < array.size(); i++) {
18836        res.getPrecision().add(parseDecimal(array.get(i).getAsBigDecimal()));
18837      }
18838    };
18839    if (json.has("_precision")) {
18840      JsonArray array = json.getAsJsonArray("_precision");
18841      for (int i = 0; i < array.size(); i++) {
18842        if (i == res.getPrecision().size())
18843          res.getPrecision().add(parseDecimal(null));
18844        if (array.get(i) instanceof JsonObject) 
18845          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrecision().get(i));
18846      }
18847    };
18848    if (json.has("sensitivity")) {
18849      JsonArray array = json.getAsJsonArray("sensitivity");
18850      for (int i = 0; i < array.size(); i++) {
18851        res.getSensitivity().add(parseDecimal(array.get(i).getAsBigDecimal()));
18852      }
18853    };
18854    if (json.has("_sensitivity")) {
18855      JsonArray array = json.getAsJsonArray("_sensitivity");
18856      for (int i = 0; i < array.size(); i++) {
18857        if (i == res.getSensitivity().size())
18858          res.getSensitivity().add(parseDecimal(null));
18859        if (array.get(i) instanceof JsonObject) 
18860          parseElementProperties(array.get(i).getAsJsonObject(), res.getSensitivity().get(i));
18861      }
18862    };
18863    if (json.has("fMeasure")) {
18864      JsonArray array = json.getAsJsonArray("fMeasure");
18865      for (int i = 0; i < array.size(); i++) {
18866        res.getFMeasure().add(parseDecimal(array.get(i).getAsBigDecimal()));
18867      }
18868    };
18869    if (json.has("_fMeasure")) {
18870      JsonArray array = json.getAsJsonArray("_fMeasure");
18871      for (int i = 0; i < array.size(); i++) {
18872        if (i == res.getFMeasure().size())
18873          res.getFMeasure().add(parseDecimal(null));
18874        if (array.get(i) instanceof JsonObject) 
18875          parseElementProperties(array.get(i).getAsJsonObject(), res.getFMeasure().get(i));
18876      }
18877    };
18878  }
18879
18880  protected MolecularSequence.MolecularSequenceRepositoryComponent parseMolecularSequenceMolecularSequenceRepositoryComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18881    MolecularSequence.MolecularSequenceRepositoryComponent res = new MolecularSequence.MolecularSequenceRepositoryComponent();
18882    parseMolecularSequenceMolecularSequenceRepositoryComponentProperties(json, owner, res);
18883    return res;
18884  }
18885
18886  protected void parseMolecularSequenceMolecularSequenceRepositoryComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceRepositoryComponent res) throws IOException, FHIRFormatError {
18887    parseBackboneElementProperties(json, res);
18888    if (json.has("type"))
18889      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.RepositoryType.NULL, new MolecularSequence.RepositoryTypeEnumFactory()));
18890    if (json.has("_type"))
18891      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18892    if (json.has("url"))
18893      res.setUrlElement(parseUri(json.get("url").getAsString()));
18894    if (json.has("_url"))
18895      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
18896    if (json.has("name"))
18897      res.setNameElement(parseString(json.get("name").getAsString()));
18898    if (json.has("_name"))
18899      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18900    if (json.has("datasetId"))
18901      res.setDatasetIdElement(parseString(json.get("datasetId").getAsString()));
18902    if (json.has("_datasetId"))
18903      parseElementProperties(json.getAsJsonObject("_datasetId"), res.getDatasetIdElement());
18904    if (json.has("variantsetId"))
18905      res.setVariantsetIdElement(parseString(json.get("variantsetId").getAsString()));
18906    if (json.has("_variantsetId"))
18907      parseElementProperties(json.getAsJsonObject("_variantsetId"), res.getVariantsetIdElement());
18908    if (json.has("readsetId"))
18909      res.setReadsetIdElement(parseString(json.get("readsetId").getAsString()));
18910    if (json.has("_readsetId"))
18911      parseElementProperties(json.getAsJsonObject("_readsetId"), res.getReadsetIdElement());
18912  }
18913
18914  protected MolecularSequence.MolecularSequenceStructureVariantComponent parseMolecularSequenceMolecularSequenceStructureVariantComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18915    MolecularSequence.MolecularSequenceStructureVariantComponent res = new MolecularSequence.MolecularSequenceStructureVariantComponent();
18916    parseMolecularSequenceMolecularSequenceStructureVariantComponentProperties(json, owner, res);
18917    return res;
18918  }
18919
18920  protected void parseMolecularSequenceMolecularSequenceStructureVariantComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantComponent res) throws IOException, FHIRFormatError {
18921    parseBackboneElementProperties(json, res);
18922    if (json.has("variantType"))
18923      res.setVariantType(parseCodeableConcept(json.getAsJsonObject("variantType")));
18924    if (json.has("exact"))
18925      res.setExactElement(parseBoolean(json.get("exact").getAsBoolean()));
18926    if (json.has("_exact"))
18927      parseElementProperties(json.getAsJsonObject("_exact"), res.getExactElement());
18928    if (json.has("length"))
18929      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
18930    if (json.has("_length"))
18931      parseElementProperties(json.getAsJsonObject("_length"), res.getLengthElement());
18932    if (json.has("outer"))
18933      res.setOuter(parseMolecularSequenceMolecularSequenceStructureVariantOuterComponent(json.getAsJsonObject("outer"), owner));
18934    if (json.has("inner"))
18935      res.setInner(parseMolecularSequenceMolecularSequenceStructureVariantInnerComponent(json.getAsJsonObject("inner"), owner));
18936  }
18937
18938  protected MolecularSequence.MolecularSequenceStructureVariantOuterComponent parseMolecularSequenceMolecularSequenceStructureVariantOuterComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18939    MolecularSequence.MolecularSequenceStructureVariantOuterComponent res = new MolecularSequence.MolecularSequenceStructureVariantOuterComponent();
18940    parseMolecularSequenceMolecularSequenceStructureVariantOuterComponentProperties(json, owner, res);
18941    return res;
18942  }
18943
18944  protected void parseMolecularSequenceMolecularSequenceStructureVariantOuterComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantOuterComponent res) throws IOException, FHIRFormatError {
18945    parseBackboneElementProperties(json, res);
18946    if (json.has("start"))
18947      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18948    if (json.has("_start"))
18949      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
18950    if (json.has("end"))
18951      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18952    if (json.has("_end"))
18953      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
18954  }
18955
18956  protected MolecularSequence.MolecularSequenceStructureVariantInnerComponent parseMolecularSequenceMolecularSequenceStructureVariantInnerComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18957    MolecularSequence.MolecularSequenceStructureVariantInnerComponent res = new MolecularSequence.MolecularSequenceStructureVariantInnerComponent();
18958    parseMolecularSequenceMolecularSequenceStructureVariantInnerComponentProperties(json, owner, res);
18959    return res;
18960  }
18961
18962  protected void parseMolecularSequenceMolecularSequenceStructureVariantInnerComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantInnerComponent res) throws IOException, FHIRFormatError {
18963    parseBackboneElementProperties(json, res);
18964    if (json.has("start"))
18965      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18966    if (json.has("_start"))
18967      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
18968    if (json.has("end"))
18969      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18970    if (json.has("_end"))
18971      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
18972  }
18973
18974  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
18975    NamingSystem res = new NamingSystem();
18976    parseNamingSystemProperties(json, res);
18977    return res;
18978  }
18979
18980  protected void parseNamingSystemProperties(JsonObject json, NamingSystem res) throws IOException, FHIRFormatError {
18981    parseDomainResourceProperties(json, res);
18982    if (json.has("name"))
18983      res.setNameElement(parseString(json.get("name").getAsString()));
18984    if (json.has("_name"))
18985      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18986    if (json.has("status"))
18987      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
18988    if (json.has("_status"))
18989      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18990    if (json.has("kind"))
18991      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
18992    if (json.has("_kind"))
18993      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
18994    if (json.has("date"))
18995      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18996    if (json.has("_date"))
18997      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
18998    if (json.has("publisher"))
18999      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
19000    if (json.has("_publisher"))
19001      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
19002    if (json.has("contact")) {
19003      JsonArray array = json.getAsJsonArray("contact");
19004      for (int i = 0; i < array.size(); i++) {
19005        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19006      }
19007    };
19008    if (json.has("responsible"))
19009      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
19010    if (json.has("_responsible"))
19011      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
19012    if (json.has("type"))
19013      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19014    if (json.has("description"))
19015      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19016    if (json.has("_description"))
19017      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19018    if (json.has("useContext")) {
19019      JsonArray array = json.getAsJsonArray("useContext");
19020      for (int i = 0; i < array.size(); i++) {
19021        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19022      }
19023    };
19024    if (json.has("jurisdiction")) {
19025      JsonArray array = json.getAsJsonArray("jurisdiction");
19026      for (int i = 0; i < array.size(); i++) {
19027        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19028      }
19029    };
19030    if (json.has("usage"))
19031      res.setUsageElement(parseString(json.get("usage").getAsString()));
19032    if (json.has("_usage"))
19033      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
19034    if (json.has("uniqueId")) {
19035      JsonArray array = json.getAsJsonArray("uniqueId");
19036      for (int i = 0; i < array.size(); i++) {
19037        res.getUniqueId().add(parseNamingSystemNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject(), res));
19038      }
19039    };
19040  }
19041
19042  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemNamingSystemUniqueIdComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
19043    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
19044    parseNamingSystemNamingSystemUniqueIdComponentProperties(json, owner, res);
19045    return res;
19046  }
19047
19048  protected void parseNamingSystemNamingSystemUniqueIdComponentProperties(JsonObject json, NamingSystem owner, NamingSystem.NamingSystemUniqueIdComponent res) throws IOException, FHIRFormatError {
19049    parseBackboneElementProperties(json, res);
19050    if (json.has("type"))
19051      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
19052    if (json.has("_type"))
19053      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19054    if (json.has("value"))
19055      res.setValueElement(parseString(json.get("value").getAsString()));
19056    if (json.has("_value"))
19057      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
19058    if (json.has("preferred"))
19059      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
19060    if (json.has("_preferred"))
19061      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
19062    if (json.has("comment"))
19063      res.setCommentElement(parseString(json.get("comment").getAsString()));
19064    if (json.has("_comment"))
19065      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
19066    if (json.has("period"))
19067      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
19068  }
19069
19070  protected NutritionIntake parseNutritionIntake(JsonObject json) throws IOException, FHIRFormatError {
19071    NutritionIntake res = new NutritionIntake();
19072    parseNutritionIntakeProperties(json, res);
19073    return res;
19074  }
19075
19076  protected void parseNutritionIntakeProperties(JsonObject json, NutritionIntake res) throws IOException, FHIRFormatError {
19077    parseDomainResourceProperties(json, res);
19078    if (json.has("identifier")) {
19079      JsonArray array = json.getAsJsonArray("identifier");
19080      for (int i = 0; i < array.size(); i++) {
19081        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19082      }
19083    };
19084    if (json.has("basedOn")) {
19085      JsonArray array = json.getAsJsonArray("basedOn");
19086      for (int i = 0; i < array.size(); i++) {
19087        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
19088      }
19089    };
19090    if (json.has("partOf")) {
19091      JsonArray array = json.getAsJsonArray("partOf");
19092      for (int i = 0; i < array.size(); i++) {
19093        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
19094      }
19095    };
19096    if (json.has("status"))
19097      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionIntake.NutritionIntakeStatus.NULL, new NutritionIntake.NutritionIntakeStatusEnumFactory()));
19098    if (json.has("_status"))
19099      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19100    if (json.has("statusReason")) {
19101      JsonArray array = json.getAsJsonArray("statusReason");
19102      for (int i = 0; i < array.size(); i++) {
19103        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19104      }
19105    };
19106    if (json.has("category")) {
19107      JsonArray array = json.getAsJsonArray("category");
19108      for (int i = 0; i < array.size(); i++) {
19109        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19110      }
19111    };
19112    if (json.has("consumedItem")) {
19113      JsonArray array = json.getAsJsonArray("consumedItem");
19114      for (int i = 0; i < array.size(); i++) {
19115        res.getConsumedItem().add(parseNutritionIntakeNutritionIntakeConsumedItemComponent(array.get(i).getAsJsonObject(), res));
19116      }
19117    };
19118    if (json.has("ingredientLabel")) {
19119      JsonArray array = json.getAsJsonArray("ingredientLabel");
19120      for (int i = 0; i < array.size(); i++) {
19121        res.getIngredientLabel().add(parseNutritionIntakeNutritionIntakeIngredientLabelComponent(array.get(i).getAsJsonObject(), res));
19122      }
19123    };
19124    if (json.has("subject"))
19125      res.setSubject(parseReference(json.getAsJsonObject("subject")));
19126    if (json.has("encounter"))
19127      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
19128    Type effective = parseType("effective", json);
19129    if (effective != null)
19130      res.setEffective(effective);
19131    if (json.has("dateAsserted"))
19132      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
19133    if (json.has("_dateAsserted"))
19134      parseElementProperties(json.getAsJsonObject("_dateAsserted"), res.getDateAssertedElement());
19135    if (json.has("informationSource"))
19136      res.setInformationSource(parseReference(json.getAsJsonObject("informationSource")));
19137    if (json.has("derivedFrom")) {
19138      JsonArray array = json.getAsJsonArray("derivedFrom");
19139      for (int i = 0; i < array.size(); i++) {
19140        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
19141      }
19142    };
19143    if (json.has("reasonCode")) {
19144      JsonArray array = json.getAsJsonArray("reasonCode");
19145      for (int i = 0; i < array.size(); i++) {
19146        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19147      }
19148    };
19149    if (json.has("reasonReference")) {
19150      JsonArray array = json.getAsJsonArray("reasonReference");
19151      for (int i = 0; i < array.size(); i++) {
19152        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
19153      }
19154    };
19155    if (json.has("note")) {
19156      JsonArray array = json.getAsJsonArray("note");
19157      for (int i = 0; i < array.size(); i++) {
19158        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19159      }
19160    };
19161  }
19162
19163  protected NutritionIntake.NutritionIntakeConsumedItemComponent parseNutritionIntakeNutritionIntakeConsumedItemComponent(JsonObject json, NutritionIntake owner) throws IOException, FHIRFormatError {
19164    NutritionIntake.NutritionIntakeConsumedItemComponent res = new NutritionIntake.NutritionIntakeConsumedItemComponent();
19165    parseNutritionIntakeNutritionIntakeConsumedItemComponentProperties(json, owner, res);
19166    return res;
19167  }
19168
19169  protected void parseNutritionIntakeNutritionIntakeConsumedItemComponentProperties(JsonObject json, NutritionIntake owner, NutritionIntake.NutritionIntakeConsumedItemComponent res) throws IOException, FHIRFormatError {
19170    parseBackboneElementProperties(json, res);
19171    if (json.has("type"))
19172      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19173    if (json.has("nutritionProduct"))
19174      res.setNutritionProduct(parseCodeableConcept(json.getAsJsonObject("nutritionProduct")));
19175    if (json.has("schedule"))
19176      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
19177    if (json.has("amount"))
19178      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
19179    if (json.has("rate"))
19180      res.setRate(parseQuantity(json.getAsJsonObject("rate")));
19181    if (json.has("notConsumed"))
19182      res.setNotConsumedElement(parseBoolean(json.get("notConsumed").getAsBoolean()));
19183    if (json.has("_notConsumed"))
19184      parseElementProperties(json.getAsJsonObject("_notConsumed"), res.getNotConsumedElement());
19185    if (json.has("notConsumedReason"))
19186      res.setNotConsumedReason(parseCodeableConcept(json.getAsJsonObject("notConsumedReason")));
19187  }
19188
19189  protected NutritionIntake.NutritionIntakeIngredientLabelComponent parseNutritionIntakeNutritionIntakeIngredientLabelComponent(JsonObject json, NutritionIntake owner) throws IOException, FHIRFormatError {
19190    NutritionIntake.NutritionIntakeIngredientLabelComponent res = new NutritionIntake.NutritionIntakeIngredientLabelComponent();
19191    parseNutritionIntakeNutritionIntakeIngredientLabelComponentProperties(json, owner, res);
19192    return res;
19193  }
19194
19195  protected void parseNutritionIntakeNutritionIntakeIngredientLabelComponentProperties(JsonObject json, NutritionIntake owner, NutritionIntake.NutritionIntakeIngredientLabelComponent res) throws IOException, FHIRFormatError {
19196    parseBackboneElementProperties(json, res);
19197    if (json.has("nutrient"))
19198      res.setNutrient(parseCodeableConcept(json.getAsJsonObject("nutrient")));
19199    if (json.has("amount"))
19200      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
19201  }
19202
19203  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
19204    NutritionOrder res = new NutritionOrder();
19205    parseNutritionOrderProperties(json, res);
19206    return res;
19207  }
19208
19209  protected void parseNutritionOrderProperties(JsonObject json, NutritionOrder res) throws IOException, FHIRFormatError {
19210    parseDomainResourceProperties(json, res);
19211    if (json.has("identifier")) {
19212      JsonArray array = json.getAsJsonArray("identifier");
19213      for (int i = 0; i < array.size(); i++) {
19214        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19215      }
19216    };
19217    if (json.has("instantiatesCanonical")) {
19218      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
19219      for (int i = 0; i < array.size(); i++) {
19220        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
19221      }
19222    };
19223    if (json.has("_instantiatesCanonical")) {
19224      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
19225      for (int i = 0; i < array.size(); i++) {
19226        if (i == res.getInstantiatesCanonical().size())
19227          res.getInstantiatesCanonical().add(parseCanonical(null));
19228        if (array.get(i) instanceof JsonObject) 
19229          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
19230      }
19231    };
19232    if (json.has("instantiatesUri")) {
19233      JsonArray array = json.getAsJsonArray("instantiatesUri");
19234      for (int i = 0; i < array.size(); i++) {
19235        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
19236      }
19237    };
19238    if (json.has("_instantiatesUri")) {
19239      JsonArray array = json.getAsJsonArray("_instantiatesUri");
19240      for (int i = 0; i < array.size(); i++) {
19241        if (i == res.getInstantiatesUri().size())
19242          res.getInstantiatesUri().add(parseUri(null));
19243        if (array.get(i) instanceof JsonObject) 
19244          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
19245      }
19246    };
19247    if (json.has("instantiates")) {
19248      JsonArray array = json.getAsJsonArray("instantiates");
19249      for (int i = 0; i < array.size(); i++) {
19250        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
19251      }
19252    };
19253    if (json.has("_instantiates")) {
19254      JsonArray array = json.getAsJsonArray("_instantiates");
19255      for (int i = 0; i < array.size(); i++) {
19256        if (i == res.getInstantiates().size())
19257          res.getInstantiates().add(parseUri(null));
19258        if (array.get(i) instanceof JsonObject) 
19259          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
19260      }
19261    };
19262    if (json.has("status"))
19263      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionOrder.NutritionOrderStatus.NULL, new NutritionOrder.NutritionOrderStatusEnumFactory()));
19264    if (json.has("_status"))
19265      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19266    if (json.has("intent"))
19267      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), NutritionOrder.NutritiionOrderIntent.NULL, new NutritionOrder.NutritiionOrderIntentEnumFactory()));
19268    if (json.has("_intent"))
19269      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
19270    if (json.has("patient"))
19271      res.setPatient(parseReference(json.getAsJsonObject("patient")));
19272    if (json.has("encounter"))
19273      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
19274    if (json.has("dateTime"))
19275      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
19276    if (json.has("_dateTime"))
19277      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
19278    if (json.has("orderer"))
19279      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
19280    if (json.has("allergyIntolerance")) {
19281      JsonArray array = json.getAsJsonArray("allergyIntolerance");
19282      for (int i = 0; i < array.size(); i++) {
19283        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
19284      }
19285    };
19286    if (json.has("foodPreferenceModifier")) {
19287      JsonArray array = json.getAsJsonArray("foodPreferenceModifier");
19288      for (int i = 0; i < array.size(); i++) {
19289        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19290      }
19291    };
19292    if (json.has("excludeFoodModifier")) {
19293      JsonArray array = json.getAsJsonArray("excludeFoodModifier");
19294      for (int i = 0; i < array.size(); i++) {
19295        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19296      }
19297    };
19298    if (json.has("oralDiet"))
19299      res.setOralDiet(parseNutritionOrderNutritionOrderOralDietComponent(json.getAsJsonObject("oralDiet"), res));
19300    if (json.has("supplement")) {
19301      JsonArray array = json.getAsJsonArray("supplement");
19302      for (int i = 0; i < array.size(); i++) {
19303        res.getSupplement().add(parseNutritionOrderNutritionOrderSupplementComponent(array.get(i).getAsJsonObject(), res));
19304      }
19305    };
19306    if (json.has("enteralFormula"))
19307      res.setEnteralFormula(parseNutritionOrderNutritionOrderEnteralFormulaComponent(json.getAsJsonObject("enteralFormula"), res));
19308    if (json.has("note")) {
19309      JsonArray array = json.getAsJsonArray("note");
19310      for (int i = 0; i < array.size(); i++) {
19311        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19312      }
19313    };
19314  }
19315
19316  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderNutritionOrderOralDietComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
19317    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
19318    parseNutritionOrderNutritionOrderOralDietComponentProperties(json, owner, res);
19319    return res;
19320  }
19321
19322  protected void parseNutritionOrderNutritionOrderOralDietComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietComponent res) throws IOException, FHIRFormatError {
19323    parseBackboneElementProperties(json, res);
19324    if (json.has("type")) {
19325      JsonArray array = json.getAsJsonArray("type");
19326      for (int i = 0; i < array.size(); i++) {
19327        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19328      }
19329    };
19330    if (json.has("schedule")) {
19331      JsonArray array = json.getAsJsonArray("schedule");
19332      for (int i = 0; i < array.size(); i++) {
19333        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
19334      }
19335    };
19336    if (json.has("nutrient")) {
19337      JsonArray array = json.getAsJsonArray("nutrient");
19338      for (int i = 0; i < array.size(); i++) {
19339        res.getNutrient().add(parseNutritionOrderNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject(), owner));
19340      }
19341    };
19342    if (json.has("texture")) {
19343      JsonArray array = json.getAsJsonArray("texture");
19344      for (int i = 0; i < array.size(); i++) {
19345        res.getTexture().add(parseNutritionOrderNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject(), owner));
19346      }
19347    };
19348    if (json.has("fluidConsistencyType")) {
19349      JsonArray array = json.getAsJsonArray("fluidConsistencyType");
19350      for (int i = 0; i < array.size(); i++) {
19351        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19352      }
19353    };
19354    if (json.has("instruction"))
19355      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
19356    if (json.has("_instruction"))
19357      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
19358  }
19359
19360  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderNutritionOrderOralDietNutrientComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
19361    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
19362    parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(json, owner, res);
19363    return res;
19364  }
19365
19366  protected void parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietNutrientComponent res) throws IOException, FHIRFormatError {
19367    parseBackboneElementProperties(json, res);
19368    if (json.has("modifier"))
19369      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
19370    if (json.has("amount"))
19371      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
19372  }
19373
19374  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderNutritionOrderOralDietTextureComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
19375    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
19376    parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(json, owner, res);
19377    return res;
19378  }
19379
19380  protected void parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietTextureComponent res) throws IOException, FHIRFormatError {
19381    parseBackboneElementProperties(json, res);
19382    if (json.has("modifier"))
19383      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
19384    if (json.has("foodType"))
19385      res.setFoodType(parseCodeableConcept(json.getAsJsonObject("foodType")));
19386  }
19387
19388  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderNutritionOrderSupplementComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
19389    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
19390    parseNutritionOrderNutritionOrderSupplementComponentProperties(json, owner, res);
19391    return res;
19392  }
19393
19394  protected void parseNutritionOrderNutritionOrderSupplementComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderSupplementComponent res) throws IOException, FHIRFormatError {
19395    parseBackboneElementProperties(json, res);
19396    if (json.has("type"))
19397      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19398    if (json.has("productName"))
19399      res.setProductNameElement(parseString(json.get("productName").getAsString()));
19400    if (json.has("_productName"))
19401      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
19402    if (json.has("schedule")) {
19403      JsonArray array = json.getAsJsonArray("schedule");
19404      for (int i = 0; i < array.size(); i++) {
19405        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
19406      }
19407    };
19408    if (json.has("quantity"))
19409      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
19410    if (json.has("instruction"))
19411      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
19412    if (json.has("_instruction"))
19413      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
19414  }
19415
19416  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderNutritionOrderEnteralFormulaComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
19417    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
19418    parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(json, owner, res);
19419    return res;
19420  }
19421
19422  protected void parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaComponent res) throws IOException, FHIRFormatError {
19423    parseBackboneElementProperties(json, res);
19424    if (json.has("baseFormulaType"))
19425      res.setBaseFormulaType(parseCodeableConcept(json.getAsJsonObject("baseFormulaType")));
19426    if (json.has("baseFormulaProductName"))
19427      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
19428    if (json.has("_baseFormulaProductName"))
19429      parseElementProperties(json.getAsJsonObject("_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
19430    if (json.has("additiveType"))
19431      res.setAdditiveType(parseCodeableConcept(json.getAsJsonObject("additiveType")));
19432    if (json.has("additiveProductName"))
19433      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
19434    if (json.has("_additiveProductName"))
19435      parseElementProperties(json.getAsJsonObject("_additiveProductName"), res.getAdditiveProductNameElement());
19436    if (json.has("caloricDensity"))
19437      res.setCaloricDensity(parseQuantity(json.getAsJsonObject("caloricDensity")));
19438    if (json.has("routeofAdministration"))
19439      res.setRouteofAdministration(parseCodeableConcept(json.getAsJsonObject("routeofAdministration")));
19440    if (json.has("administration")) {
19441      JsonArray array = json.getAsJsonArray("administration");
19442      for (int i = 0; i < array.size(); i++) {
19443        res.getAdministration().add(parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject(), owner));
19444      }
19445    };
19446    if (json.has("maxVolumeToDeliver"))
19447      res.setMaxVolumeToDeliver(parseQuantity(json.getAsJsonObject("maxVolumeToDeliver")));
19448    if (json.has("administrationInstruction"))
19449      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
19450    if (json.has("_administrationInstruction"))
19451      parseElementProperties(json.getAsJsonObject("_administrationInstruction"), res.getAdministrationInstructionElement());
19452  }
19453
19454  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
19455    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
19456    parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(json, owner, res);
19457    return res;
19458  }
19459
19460  protected void parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res) throws IOException, FHIRFormatError {
19461    parseBackboneElementProperties(json, res);
19462    if (json.has("schedule"))
19463      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
19464    if (json.has("quantity"))
19465      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
19466    Type rate = parseType("rate", json);
19467    if (rate != null)
19468      res.setRate(rate);
19469  }
19470
19471  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
19472    Observation res = new Observation();
19473    parseObservationProperties(json, res);
19474    return res;
19475  }
19476
19477  protected void parseObservationProperties(JsonObject json, Observation res) throws IOException, FHIRFormatError {
19478    parseDomainResourceProperties(json, res);
19479    if (json.has("identifier")) {
19480      JsonArray array = json.getAsJsonArray("identifier");
19481      for (int i = 0; i < array.size(); i++) {
19482        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19483      }
19484    };
19485    if (json.has("basedOn")) {
19486      JsonArray array = json.getAsJsonArray("basedOn");
19487      for (int i = 0; i < array.size(); i++) {
19488        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
19489      }
19490    };
19491    if (json.has("partOf")) {
19492      JsonArray array = json.getAsJsonArray("partOf");
19493      for (int i = 0; i < array.size(); i++) {
19494        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
19495      }
19496    };
19497    if (json.has("status"))
19498      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Observation.ObservationStatus.NULL, new Observation.ObservationStatusEnumFactory()));
19499    if (json.has("_status"))
19500      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19501    if (json.has("category")) {
19502      JsonArray array = json.getAsJsonArray("category");
19503      for (int i = 0; i < array.size(); i++) {
19504        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19505      }
19506    };
19507    if (json.has("code"))
19508      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
19509    if (json.has("subject"))
19510      res.setSubject(parseReference(json.getAsJsonObject("subject")));
19511    if (json.has("focus")) {
19512      JsonArray array = json.getAsJsonArray("focus");
19513      for (int i = 0; i < array.size(); i++) {
19514        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
19515      }
19516    };
19517    if (json.has("encounter"))
19518      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
19519    Type effective = parseType("effective", json);
19520    if (effective != null)
19521      res.setEffective(effective);
19522    if (json.has("issued"))
19523      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
19524    if (json.has("_issued"))
19525      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
19526    if (json.has("performer")) {
19527      JsonArray array = json.getAsJsonArray("performer");
19528      for (int i = 0; i < array.size(); i++) {
19529        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
19530      }
19531    };
19532    Type value = parseType("value", json);
19533    if (value != null)
19534      res.setValue(value);
19535    if (json.has("dataAbsentReason"))
19536      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
19537    if (json.has("interpretation")) {
19538      JsonArray array = json.getAsJsonArray("interpretation");
19539      for (int i = 0; i < array.size(); i++) {
19540        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19541      }
19542    };
19543    if (json.has("note")) {
19544      JsonArray array = json.getAsJsonArray("note");
19545      for (int i = 0; i < array.size(); i++) {
19546        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19547      }
19548    };
19549    if (json.has("bodySite"))
19550      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
19551    if (json.has("method"))
19552      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
19553    if (json.has("specimen"))
19554      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
19555    if (json.has("device"))
19556      res.setDevice(parseReference(json.getAsJsonObject("device")));
19557    if (json.has("referenceRange")) {
19558      JsonArray array = json.getAsJsonArray("referenceRange");
19559      for (int i = 0; i < array.size(); i++) {
19560        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), res));
19561      }
19562    };
19563    if (json.has("hasMember")) {
19564      JsonArray array = json.getAsJsonArray("hasMember");
19565      for (int i = 0; i < array.size(); i++) {
19566        res.getHasMember().add(parseReference(array.get(i).getAsJsonObject()));
19567      }
19568    };
19569    if (json.has("derivedFrom")) {
19570      JsonArray array = json.getAsJsonArray("derivedFrom");
19571      for (int i = 0; i < array.size(); i++) {
19572        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
19573      }
19574    };
19575    if (json.has("component")) {
19576      JsonArray array = json.getAsJsonArray("component");
19577      for (int i = 0; i < array.size(); i++) {
19578        res.getComponent().add(parseObservationObservationComponentComponent(array.get(i).getAsJsonObject(), res));
19579      }
19580    };
19581  }
19582
19583  protected Observation.ObservationReferenceRangeComponent parseObservationObservationReferenceRangeComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
19584    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
19585    parseObservationObservationReferenceRangeComponentProperties(json, owner, res);
19586    return res;
19587  }
19588
19589  protected void parseObservationObservationReferenceRangeComponentProperties(JsonObject json, Observation owner, Observation.ObservationReferenceRangeComponent res) throws IOException, FHIRFormatError {
19590    parseBackboneElementProperties(json, res);
19591    if (json.has("low"))
19592      res.setLow(parseQuantity(json.getAsJsonObject("low")));
19593    if (json.has("high"))
19594      res.setHigh(parseQuantity(json.getAsJsonObject("high")));
19595    if (json.has("type"))
19596      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19597    if (json.has("appliesTo")) {
19598      JsonArray array = json.getAsJsonArray("appliesTo");
19599      for (int i = 0; i < array.size(); i++) {
19600        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19601      }
19602    };
19603    if (json.has("age"))
19604      res.setAge(parseRange(json.getAsJsonObject("age")));
19605    if (json.has("text"))
19606      res.setTextElement(parseString(json.get("text").getAsString()));
19607    if (json.has("_text"))
19608      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
19609  }
19610
19611  protected Observation.ObservationComponentComponent parseObservationObservationComponentComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
19612    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
19613    parseObservationObservationComponentComponentProperties(json, owner, res);
19614    return res;
19615  }
19616
19617  protected void parseObservationObservationComponentComponentProperties(JsonObject json, Observation owner, Observation.ObservationComponentComponent res) throws IOException, FHIRFormatError {
19618    parseBackboneElementProperties(json, res);
19619    if (json.has("code"))
19620      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
19621    Type value = parseType("value", json);
19622    if (value != null)
19623      res.setValue(value);
19624    if (json.has("dataAbsentReason"))
19625      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
19626    if (json.has("interpretation")) {
19627      JsonArray array = json.getAsJsonArray("interpretation");
19628      for (int i = 0; i < array.size(); i++) {
19629        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19630      }
19631    };
19632    if (json.has("referenceRange")) {
19633      JsonArray array = json.getAsJsonArray("referenceRange");
19634      for (int i = 0; i < array.size(); i++) {
19635        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), owner));
19636      }
19637    };
19638  }
19639
19640  protected ObservationDefinition parseObservationDefinition(JsonObject json) throws IOException, FHIRFormatError {
19641    ObservationDefinition res = new ObservationDefinition();
19642    parseObservationDefinitionProperties(json, res);
19643    return res;
19644  }
19645
19646  protected void parseObservationDefinitionProperties(JsonObject json, ObservationDefinition res) throws IOException, FHIRFormatError {
19647    parseDomainResourceProperties(json, res);
19648    if (json.has("url"))
19649      res.setUrlElement(parseUri(json.get("url").getAsString()));
19650    if (json.has("_url"))
19651      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
19652    if (json.has("identifier"))
19653      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
19654    if (json.has("version"))
19655      res.setVersionElement(parseString(json.get("version").getAsString()));
19656    if (json.has("_version"))
19657      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
19658    if (json.has("title"))
19659      res.setTitleElement(parseString(json.get("title").getAsString()));
19660    if (json.has("_title"))
19661      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
19662    if (json.has("derivedFromCanonical")) {
19663      JsonArray array = json.getAsJsonArray("derivedFromCanonical");
19664      for (int i = 0; i < array.size(); i++) {
19665        res.getDerivedFromCanonical().add(parseCanonical(array.get(i).getAsString()));
19666      }
19667    };
19668    if (json.has("_derivedFromCanonical")) {
19669      JsonArray array = json.getAsJsonArray("_derivedFromCanonical");
19670      for (int i = 0; i < array.size(); i++) {
19671        if (i == res.getDerivedFromCanonical().size())
19672          res.getDerivedFromCanonical().add(parseCanonical(null));
19673        if (array.get(i) instanceof JsonObject) 
19674          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromCanonical().get(i));
19675      }
19676    };
19677    if (json.has("derivedFromUri")) {
19678      JsonArray array = json.getAsJsonArray("derivedFromUri");
19679      for (int i = 0; i < array.size(); i++) {
19680        res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
19681      }
19682    };
19683    if (json.has("_derivedFromUri")) {
19684      JsonArray array = json.getAsJsonArray("_derivedFromUri");
19685      for (int i = 0; i < array.size(); i++) {
19686        if (i == res.getDerivedFromUri().size())
19687          res.getDerivedFromUri().add(parseUri(null));
19688        if (array.get(i) instanceof JsonObject) 
19689          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
19690      }
19691    };
19692    if (json.has("status"))
19693      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ObservationDefinition.PublicationStatus.NULL, new ObservationDefinition.PublicationStatusEnumFactory()));
19694    if (json.has("_status"))
19695      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19696    if (json.has("experimental"))
19697      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
19698    if (json.has("_experimental"))
19699      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
19700    Type subject = parseType("subject", json);
19701    if (subject != null)
19702      res.setSubject(subject);
19703    if (json.has("date"))
19704      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19705    if (json.has("_date"))
19706      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
19707    if (json.has("publisher"))
19708      res.setPublisher(parseReference(json.getAsJsonObject("publisher")));
19709    if (json.has("contact")) {
19710      JsonArray array = json.getAsJsonArray("contact");
19711      for (int i = 0; i < array.size(); i++) {
19712        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19713      }
19714    };
19715    if (json.has("description"))
19716      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19717    if (json.has("_description"))
19718      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19719    if (json.has("useContext")) {
19720      JsonArray array = json.getAsJsonArray("useContext");
19721      for (int i = 0; i < array.size(); i++) {
19722        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19723      }
19724    };
19725    if (json.has("jurisdiction")) {
19726      JsonArray array = json.getAsJsonArray("jurisdiction");
19727      for (int i = 0; i < array.size(); i++) {
19728        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19729      }
19730    };
19731    if (json.has("purpose"))
19732      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
19733    if (json.has("_purpose"))
19734      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
19735    if (json.has("copyright"))
19736      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
19737    if (json.has("_copyright"))
19738      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
19739    if (json.has("approvalDate"))
19740      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
19741    if (json.has("_approvalDate"))
19742      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
19743    if (json.has("lastReviewDate"))
19744      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
19745    if (json.has("_lastReviewDate"))
19746      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
19747    if (json.has("effectivePeriod"))
19748      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
19749    if (json.has("performerType"))
19750      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
19751    if (json.has("category")) {
19752      JsonArray array = json.getAsJsonArray("category");
19753      for (int i = 0; i < array.size(); i++) {
19754        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19755      }
19756    };
19757    if (json.has("code"))
19758      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
19759    if (json.has("permittedDataType")) {
19760      JsonArray array = json.getAsJsonArray("permittedDataType");
19761      for (int i = 0; i < array.size(); i++) {
19762        res.getPermittedDataType().add(parseEnumeration(array.get(i).getAsString(), ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
19763      }
19764    };
19765    if (json.has("_permittedDataType")) {
19766      JsonArray array = json.getAsJsonArray("_permittedDataType");
19767      for (int i = 0; i < array.size(); i++) {
19768        if (i == res.getPermittedDataType().size())
19769          res.getPermittedDataType().add(parseEnumeration(null, ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
19770        if (array.get(i) instanceof JsonObject) 
19771          parseElementProperties(array.get(i).getAsJsonObject(), res.getPermittedDataType().get(i));
19772      }
19773    };
19774    if (json.has("multipleResultsAllowed"))
19775      res.setMultipleResultsAllowedElement(parseBoolean(json.get("multipleResultsAllowed").getAsBoolean()));
19776    if (json.has("_multipleResultsAllowed"))
19777      parseElementProperties(json.getAsJsonObject("_multipleResultsAllowed"), res.getMultipleResultsAllowedElement());
19778    if (json.has("bodySite"))
19779      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
19780    if (json.has("method"))
19781      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
19782    if (json.has("specimen"))
19783      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
19784    if (json.has("device"))
19785      res.setDevice(parseReference(json.getAsJsonObject("device")));
19786    if (json.has("preferredReportName"))
19787      res.setPreferredReportNameElement(parseString(json.get("preferredReportName").getAsString()));
19788    if (json.has("_preferredReportName"))
19789      parseElementProperties(json.getAsJsonObject("_preferredReportName"), res.getPreferredReportNameElement());
19790    if (json.has("quantitativeDetails"))
19791      res.setQuantitativeDetails(parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(json.getAsJsonObject("quantitativeDetails"), res));
19792    if (json.has("qualifiedInterval")) {
19793      JsonArray array = json.getAsJsonArray("qualifiedInterval");
19794      for (int i = 0; i < array.size(); i++) {
19795        res.getQualifiedInterval().add(parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(array.get(i).getAsJsonObject(), res));
19796      }
19797    };
19798    if (json.has("validCodedValueSet"))
19799      res.setValidCodedValueSet(parseReference(json.getAsJsonObject("validCodedValueSet")));
19800    if (json.has("normalCodedValueSet"))
19801      res.setNormalCodedValueSet(parseReference(json.getAsJsonObject("normalCodedValueSet")));
19802    if (json.has("abnormalCodedValueSet"))
19803      res.setAbnormalCodedValueSet(parseReference(json.getAsJsonObject("abnormalCodedValueSet")));
19804    if (json.has("criticalCodedValueSet"))
19805      res.setCriticalCodedValueSet(parseReference(json.getAsJsonObject("criticalCodedValueSet")));
19806    if (json.has("hasMember")) {
19807      JsonArray array = json.getAsJsonArray("hasMember");
19808      for (int i = 0; i < array.size(); i++) {
19809        res.getHasMember().add(parseReference(array.get(i).getAsJsonObject()));
19810      }
19811    };
19812    if (json.has("component")) {
19813      JsonArray array = json.getAsJsonArray("component");
19814      for (int i = 0; i < array.size(); i++) {
19815        res.getComponent().add(parseObservationDefinitionObservationDefinitionComponentComponent(array.get(i).getAsJsonObject(), res));
19816      }
19817    };
19818  }
19819
19820  protected ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
19821    ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res = new ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent();
19822    parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(json, owner, res);
19823    return res;
19824  }
19825
19826  protected void parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(JsonObject json, ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res) throws IOException, FHIRFormatError {
19827    parseBackboneElementProperties(json, res);
19828    if (json.has("customaryUnit"))
19829      res.setCustomaryUnit(parseCodeableConcept(json.getAsJsonObject("customaryUnit")));
19830    if (json.has("unit"))
19831      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
19832    if (json.has("conversionFactor"))
19833      res.setConversionFactorElement(parseDecimal(json.get("conversionFactor").getAsBigDecimal()));
19834    if (json.has("_conversionFactor"))
19835      parseElementProperties(json.getAsJsonObject("_conversionFactor"), res.getConversionFactorElement());
19836    if (json.has("decimalPrecision"))
19837      res.setDecimalPrecisionElement(parseInteger(json.get("decimalPrecision").getAsLong()));
19838    if (json.has("_decimalPrecision"))
19839      parseElementProperties(json.getAsJsonObject("_decimalPrecision"), res.getDecimalPrecisionElement());
19840  }
19841
19842  protected ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
19843    ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res = new ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
19844    parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(json, owner, res);
19845    return res;
19846  }
19847
19848  protected void parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(JsonObject json, ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res) throws IOException, FHIRFormatError {
19849    parseBackboneElementProperties(json, res);
19850    if (json.has("category"))
19851      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), ObservationDefinition.ObservationRangeCategory.NULL, new ObservationDefinition.ObservationRangeCategoryEnumFactory()));
19852    if (json.has("_category"))
19853      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
19854    if (json.has("range"))
19855      res.setRange(parseRange(json.getAsJsonObject("range")));
19856    if (json.has("context"))
19857      res.setContext(parseCodeableConcept(json.getAsJsonObject("context")));
19858    if (json.has("appliesTo")) {
19859      JsonArray array = json.getAsJsonArray("appliesTo");
19860      for (int i = 0; i < array.size(); i++) {
19861        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19862      }
19863    };
19864    if (json.has("gender"))
19865      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
19866    if (json.has("_gender"))
19867      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
19868    if (json.has("age"))
19869      res.setAge(parseRange(json.getAsJsonObject("age")));
19870    if (json.has("gestationalAge"))
19871      res.setGestationalAge(parseRange(json.getAsJsonObject("gestationalAge")));
19872    if (json.has("condition"))
19873      res.setConditionElement(parseString(json.get("condition").getAsString()));
19874    if (json.has("_condition"))
19875      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
19876  }
19877
19878  protected ObservationDefinition.ObservationDefinitionComponentComponent parseObservationDefinitionObservationDefinitionComponentComponent(JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
19879    ObservationDefinition.ObservationDefinitionComponentComponent res = new ObservationDefinition.ObservationDefinitionComponentComponent();
19880    parseObservationDefinitionObservationDefinitionComponentComponentProperties(json, owner, res);
19881    return res;
19882  }
19883
19884  protected void parseObservationDefinitionObservationDefinitionComponentComponentProperties(JsonObject json, ObservationDefinition owner, ObservationDefinition.ObservationDefinitionComponentComponent res) throws IOException, FHIRFormatError {
19885    parseBackboneElementProperties(json, res);
19886    if (json.has("code"))
19887      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
19888    if (json.has("permittedDataType")) {
19889      JsonArray array = json.getAsJsonArray("permittedDataType");
19890      for (int i = 0; i < array.size(); i++) {
19891        res.getPermittedDataType().add(parseEnumeration(array.get(i).getAsString(), ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
19892      }
19893    };
19894    if (json.has("_permittedDataType")) {
19895      JsonArray array = json.getAsJsonArray("_permittedDataType");
19896      for (int i = 0; i < array.size(); i++) {
19897        if (i == res.getPermittedDataType().size())
19898          res.getPermittedDataType().add(parseEnumeration(null, ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
19899        if (array.get(i) instanceof JsonObject) 
19900          parseElementProperties(array.get(i).getAsJsonObject(), res.getPermittedDataType().get(i));
19901      }
19902    };
19903    if (json.has("quantitativeDetails"))
19904      res.setQuantitativeDetails(parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(json.getAsJsonObject("quantitativeDetails"), owner));
19905    if (json.has("qualifiedInterval")) {
19906      JsonArray array = json.getAsJsonArray("qualifiedInterval");
19907      for (int i = 0; i < array.size(); i++) {
19908        res.getQualifiedInterval().add(parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(array.get(i).getAsJsonObject(), owner));
19909      }
19910    };
19911  }
19912
19913  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
19914    OperationDefinition res = new OperationDefinition();
19915    parseOperationDefinitionProperties(json, res);
19916    return res;
19917  }
19918
19919  protected void parseOperationDefinitionProperties(JsonObject json, OperationDefinition res) throws IOException, FHIRFormatError {
19920    parseDomainResourceProperties(json, res);
19921    if (json.has("url"))
19922      res.setUrlElement(parseUri(json.get("url").getAsString()));
19923    if (json.has("_url"))
19924      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
19925    if (json.has("version"))
19926      res.setVersionElement(parseString(json.get("version").getAsString()));
19927    if (json.has("_version"))
19928      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
19929    if (json.has("name"))
19930      res.setNameElement(parseString(json.get("name").getAsString()));
19931    if (json.has("_name"))
19932      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19933    if (json.has("title"))
19934      res.setTitleElement(parseString(json.get("title").getAsString()));
19935    if (json.has("_title"))
19936      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
19937    if (json.has("status"))
19938      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19939    if (json.has("_status"))
19940      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19941    if (json.has("kind"))
19942      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
19943    if (json.has("_kind"))
19944      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
19945    if (json.has("experimental"))
19946      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
19947    if (json.has("_experimental"))
19948      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
19949    if (json.has("date"))
19950      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19951    if (json.has("_date"))
19952      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
19953    if (json.has("publisher"))
19954      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
19955    if (json.has("_publisher"))
19956      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
19957    if (json.has("contact")) {
19958      JsonArray array = json.getAsJsonArray("contact");
19959      for (int i = 0; i < array.size(); i++) {
19960        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19961      }
19962    };
19963    if (json.has("description"))
19964      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19965    if (json.has("_description"))
19966      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19967    if (json.has("useContext")) {
19968      JsonArray array = json.getAsJsonArray("useContext");
19969      for (int i = 0; i < array.size(); i++) {
19970        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19971      }
19972    };
19973    if (json.has("jurisdiction")) {
19974      JsonArray array = json.getAsJsonArray("jurisdiction");
19975      for (int i = 0; i < array.size(); i++) {
19976        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19977      }
19978    };
19979    if (json.has("purpose"))
19980      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
19981    if (json.has("_purpose"))
19982      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
19983    if (json.has("affectsState"))
19984      res.setAffectsStateElement(parseBoolean(json.get("affectsState").getAsBoolean()));
19985    if (json.has("_affectsState"))
19986      parseElementProperties(json.getAsJsonObject("_affectsState"), res.getAffectsStateElement());
19987    if (json.has("code"))
19988      res.setCodeElement(parseCode(json.get("code").getAsString()));
19989    if (json.has("_code"))
19990      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
19991    if (json.has("comment"))
19992      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
19993    if (json.has("_comment"))
19994      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
19995    if (json.has("base"))
19996      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
19997    if (json.has("_base"))
19998      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
19999    if (json.has("resource")) {
20000      JsonArray array = json.getAsJsonArray("resource");
20001      for (int i = 0; i < array.size(); i++) {
20002        res.getResource().add(parseCode(array.get(i).getAsString()));
20003      }
20004    };
20005    if (json.has("_resource")) {
20006      JsonArray array = json.getAsJsonArray("_resource");
20007      for (int i = 0; i < array.size(); i++) {
20008        if (i == res.getResource().size())
20009          res.getResource().add(parseCode(null));
20010        if (array.get(i) instanceof JsonObject) 
20011          parseElementProperties(array.get(i).getAsJsonObject(), res.getResource().get(i));
20012      }
20013    };
20014    if (json.has("system"))
20015      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
20016    if (json.has("_system"))
20017      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
20018    if (json.has("type"))
20019      res.setTypeElement(parseBoolean(json.get("type").getAsBoolean()));
20020    if (json.has("_type"))
20021      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
20022    if (json.has("instance"))
20023      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
20024    if (json.has("_instance"))
20025      parseElementProperties(json.getAsJsonObject("_instance"), res.getInstanceElement());
20026    if (json.has("inputProfile"))
20027      res.setInputProfileElement(parseCanonical(json.get("inputProfile").getAsString()));
20028    if (json.has("_inputProfile"))
20029      parseElementProperties(json.getAsJsonObject("_inputProfile"), res.getInputProfileElement());
20030    if (json.has("outputProfile"))
20031      res.setOutputProfileElement(parseCanonical(json.get("outputProfile").getAsString()));
20032    if (json.has("_outputProfile"))
20033      parseElementProperties(json.getAsJsonObject("_outputProfile"), res.getOutputProfileElement());
20034    if (json.has("parameter")) {
20035      JsonArray array = json.getAsJsonArray("parameter");
20036      for (int i = 0; i < array.size(); i++) {
20037        res.getParameter().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), res));
20038      }
20039    };
20040    if (json.has("overload")) {
20041      JsonArray array = json.getAsJsonArray("overload");
20042      for (int i = 0; i < array.size(); i++) {
20043        res.getOverload().add(parseOperationDefinitionOperationDefinitionOverloadComponent(array.get(i).getAsJsonObject(), res));
20044      }
20045    };
20046  }
20047
20048  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionOperationDefinitionParameterComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
20049    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
20050    parseOperationDefinitionOperationDefinitionParameterComponentProperties(json, owner, res);
20051    return res;
20052  }
20053
20054  protected void parseOperationDefinitionOperationDefinitionParameterComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterComponent res) throws IOException, FHIRFormatError {
20055    parseBackboneElementProperties(json, res);
20056    if (json.has("name"))
20057      res.setNameElement(parseCode(json.get("name").getAsString()));
20058    if (json.has("_name"))
20059      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
20060    if (json.has("use"))
20061      res.setUseElement(parseEnumeration(json.get("use").getAsString(), OperationDefinition.OperationParameterUse.NULL, new OperationDefinition.OperationParameterUseEnumFactory()));
20062    if (json.has("_use"))
20063      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
20064    if (json.has("min"))
20065      res.setMinElement(parseInteger(json.get("min").getAsLong()));
20066    if (json.has("_min"))
20067      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
20068    if (json.has("max"))
20069      res.setMaxElement(parseString(json.get("max").getAsString()));
20070    if (json.has("_max"))
20071      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
20072    if (json.has("documentation"))
20073      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
20074    if (json.has("_documentation"))
20075      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
20076    if (json.has("type"))
20077      res.setTypeElement(parseCode(json.get("type").getAsString()));
20078    if (json.has("_type"))
20079      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
20080    if (json.has("targetProfile")) {
20081      JsonArray array = json.getAsJsonArray("targetProfile");
20082      for (int i = 0; i < array.size(); i++) {
20083        res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
20084      }
20085    };
20086    if (json.has("_targetProfile")) {
20087      JsonArray array = json.getAsJsonArray("_targetProfile");
20088      for (int i = 0; i < array.size(); i++) {
20089        if (i == res.getTargetProfile().size())
20090          res.getTargetProfile().add(parseCanonical(null));
20091        if (array.get(i) instanceof JsonObject) 
20092          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
20093      }
20094    };
20095    if (json.has("searchType"))
20096      res.setSearchTypeElement(parseEnumeration(json.get("searchType").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
20097    if (json.has("_searchType"))
20098      parseElementProperties(json.getAsJsonObject("_searchType"), res.getSearchTypeElement());
20099    if (json.has("binding"))
20100      res.setBinding(parseOperationDefinitionOperationDefinitionParameterBindingComponent(json.getAsJsonObject("binding"), owner));
20101    if (json.has("referencedFrom")) {
20102      JsonArray array = json.getAsJsonArray("referencedFrom");
20103      for (int i = 0; i < array.size(); i++) {
20104        res.getReferencedFrom().add(parseOperationDefinitionOperationDefinitionParameterReferencedFromComponent(array.get(i).getAsJsonObject(), owner));
20105      }
20106    };
20107    if (json.has("part")) {
20108      JsonArray array = json.getAsJsonArray("part");
20109      for (int i = 0; i < array.size(); i++) {
20110        res.getPart().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
20111      }
20112    };
20113  }
20114
20115  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionOperationDefinitionParameterBindingComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
20116    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
20117    parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(json, owner, res);
20118    return res;
20119  }
20120
20121  protected void parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterBindingComponent res) throws IOException, FHIRFormatError {
20122    parseBackboneElementProperties(json, res);
20123    if (json.has("strength"))
20124      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
20125    if (json.has("_strength"))
20126      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
20127    if (json.has("valueSet"))
20128      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
20129    if (json.has("_valueSet"))
20130      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
20131  }
20132
20133  protected OperationDefinition.OperationDefinitionParameterReferencedFromComponent parseOperationDefinitionOperationDefinitionParameterReferencedFromComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
20134    OperationDefinition.OperationDefinitionParameterReferencedFromComponent res = new OperationDefinition.OperationDefinitionParameterReferencedFromComponent();
20135    parseOperationDefinitionOperationDefinitionParameterReferencedFromComponentProperties(json, owner, res);
20136    return res;
20137  }
20138
20139  protected void parseOperationDefinitionOperationDefinitionParameterReferencedFromComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterReferencedFromComponent res) throws IOException, FHIRFormatError {
20140    parseBackboneElementProperties(json, res);
20141    if (json.has("source"))
20142      res.setSourceElement(parseString(json.get("source").getAsString()));
20143    if (json.has("_source"))
20144      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
20145    if (json.has("sourceId"))
20146      res.setSourceIdElement(parseString(json.get("sourceId").getAsString()));
20147    if (json.has("_sourceId"))
20148      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
20149  }
20150
20151  protected OperationDefinition.OperationDefinitionOverloadComponent parseOperationDefinitionOperationDefinitionOverloadComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
20152    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
20153    parseOperationDefinitionOperationDefinitionOverloadComponentProperties(json, owner, res);
20154    return res;
20155  }
20156
20157  protected void parseOperationDefinitionOperationDefinitionOverloadComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionOverloadComponent res) throws IOException, FHIRFormatError {
20158    parseBackboneElementProperties(json, res);
20159    if (json.has("parameterName")) {
20160      JsonArray array = json.getAsJsonArray("parameterName");
20161      for (int i = 0; i < array.size(); i++) {
20162        res.getParameterName().add(parseString(array.get(i).getAsString()));
20163      }
20164    };
20165    if (json.has("_parameterName")) {
20166      JsonArray array = json.getAsJsonArray("_parameterName");
20167      for (int i = 0; i < array.size(); i++) {
20168        if (i == res.getParameterName().size())
20169          res.getParameterName().add(parseString(null));
20170        if (array.get(i) instanceof JsonObject) 
20171          parseElementProperties(array.get(i).getAsJsonObject(), res.getParameterName().get(i));
20172      }
20173    };
20174    if (json.has("comment"))
20175      res.setCommentElement(parseString(json.get("comment").getAsString()));
20176    if (json.has("_comment"))
20177      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
20178  }
20179
20180  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
20181    OperationOutcome res = new OperationOutcome();
20182    parseOperationOutcomeProperties(json, res);
20183    return res;
20184  }
20185
20186  protected void parseOperationOutcomeProperties(JsonObject json, OperationOutcome res) throws IOException, FHIRFormatError {
20187    parseDomainResourceProperties(json, res);
20188    if (json.has("issue")) {
20189      JsonArray array = json.getAsJsonArray("issue");
20190      for (int i = 0; i < array.size(); i++) {
20191        res.getIssue().add(parseOperationOutcomeOperationOutcomeIssueComponent(array.get(i).getAsJsonObject(), res));
20192      }
20193    };
20194  }
20195
20196  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeOperationOutcomeIssueComponent(JsonObject json, OperationOutcome owner) throws IOException, FHIRFormatError {
20197    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
20198    parseOperationOutcomeOperationOutcomeIssueComponentProperties(json, owner, res);
20199    return res;
20200  }
20201
20202  protected void parseOperationOutcomeOperationOutcomeIssueComponentProperties(JsonObject json, OperationOutcome owner, OperationOutcome.OperationOutcomeIssueComponent res) throws IOException, FHIRFormatError {
20203    parseBackboneElementProperties(json, res);
20204    if (json.has("severity"))
20205      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
20206    if (json.has("_severity"))
20207      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
20208    if (json.has("code"))
20209      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
20210    if (json.has("_code"))
20211      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
20212    if (json.has("details"))
20213      res.setDetails(parseCodeableConcept(json.getAsJsonObject("details")));
20214    if (json.has("diagnostics"))
20215      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
20216    if (json.has("_diagnostics"))
20217      parseElementProperties(json.getAsJsonObject("_diagnostics"), res.getDiagnosticsElement());
20218    if (json.has("location")) {
20219      JsonArray array = json.getAsJsonArray("location");
20220      for (int i = 0; i < array.size(); i++) {
20221        res.getLocation().add(parseString(array.get(i).getAsString()));
20222      }
20223    };
20224    if (json.has("_location")) {
20225      JsonArray array = json.getAsJsonArray("_location");
20226      for (int i = 0; i < array.size(); i++) {
20227        if (i == res.getLocation().size())
20228          res.getLocation().add(parseString(null));
20229        if (array.get(i) instanceof JsonObject) 
20230          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
20231      }
20232    };
20233    if (json.has("expression")) {
20234      JsonArray array = json.getAsJsonArray("expression");
20235      for (int i = 0; i < array.size(); i++) {
20236        res.getExpression().add(parseString(array.get(i).getAsString()));
20237      }
20238    };
20239    if (json.has("_expression")) {
20240      JsonArray array = json.getAsJsonArray("_expression");
20241      for (int i = 0; i < array.size(); i++) {
20242        if (i == res.getExpression().size())
20243          res.getExpression().add(parseString(null));
20244        if (array.get(i) instanceof JsonObject) 
20245          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
20246      }
20247    };
20248  }
20249
20250  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
20251    Organization res = new Organization();
20252    parseOrganizationProperties(json, res);
20253    return res;
20254  }
20255
20256  protected void parseOrganizationProperties(JsonObject json, Organization res) throws IOException, FHIRFormatError {
20257    parseDomainResourceProperties(json, res);
20258    if (json.has("identifier")) {
20259      JsonArray array = json.getAsJsonArray("identifier");
20260      for (int i = 0; i < array.size(); i++) {
20261        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20262      }
20263    };
20264    if (json.has("active"))
20265      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20266    if (json.has("_active"))
20267      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
20268    if (json.has("type")) {
20269      JsonArray array = json.getAsJsonArray("type");
20270      for (int i = 0; i < array.size(); i++) {
20271        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20272      }
20273    };
20274    if (json.has("name"))
20275      res.setNameElement(parseString(json.get("name").getAsString()));
20276    if (json.has("_name"))
20277      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
20278    if (json.has("alias")) {
20279      JsonArray array = json.getAsJsonArray("alias");
20280      for (int i = 0; i < array.size(); i++) {
20281        res.getAlias().add(parseString(array.get(i).getAsString()));
20282      }
20283    };
20284    if (json.has("_alias")) {
20285      JsonArray array = json.getAsJsonArray("_alias");
20286      for (int i = 0; i < array.size(); i++) {
20287        if (i == res.getAlias().size())
20288          res.getAlias().add(parseString(null));
20289        if (array.get(i) instanceof JsonObject) 
20290          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
20291      }
20292    };
20293    if (json.has("telecom")) {
20294      JsonArray array = json.getAsJsonArray("telecom");
20295      for (int i = 0; i < array.size(); i++) {
20296        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20297      }
20298    };
20299    if (json.has("address")) {
20300      JsonArray array = json.getAsJsonArray("address");
20301      for (int i = 0; i < array.size(); i++) {
20302        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
20303      }
20304    };
20305    if (json.has("partOf"))
20306      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
20307    if (json.has("contact")) {
20308      JsonArray array = json.getAsJsonArray("contact");
20309      for (int i = 0; i < array.size(); i++) {
20310        res.getContact().add(parseOrganizationOrganizationContactComponent(array.get(i).getAsJsonObject(), res));
20311      }
20312    };
20313    if (json.has("endpoint")) {
20314      JsonArray array = json.getAsJsonArray("endpoint");
20315      for (int i = 0; i < array.size(); i++) {
20316        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
20317      }
20318    };
20319  }
20320
20321  protected Organization.OrganizationContactComponent parseOrganizationOrganizationContactComponent(JsonObject json, Organization owner) throws IOException, FHIRFormatError {
20322    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
20323    parseOrganizationOrganizationContactComponentProperties(json, owner, res);
20324    return res;
20325  }
20326
20327  protected void parseOrganizationOrganizationContactComponentProperties(JsonObject json, Organization owner, Organization.OrganizationContactComponent res) throws IOException, FHIRFormatError {
20328    parseBackboneElementProperties(json, res);
20329    if (json.has("purpose"))
20330      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
20331    if (json.has("name"))
20332      res.setName(parseHumanName(json.getAsJsonObject("name")));
20333    if (json.has("telecom")) {
20334      JsonArray array = json.getAsJsonArray("telecom");
20335      for (int i = 0; i < array.size(); i++) {
20336        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20337      }
20338    };
20339    if (json.has("address"))
20340      res.setAddress(parseAddress(json.getAsJsonObject("address")));
20341  }
20342
20343  protected OrganizationAffiliation parseOrganizationAffiliation(JsonObject json) throws IOException, FHIRFormatError {
20344    OrganizationAffiliation res = new OrganizationAffiliation();
20345    parseOrganizationAffiliationProperties(json, res);
20346    return res;
20347  }
20348
20349  protected void parseOrganizationAffiliationProperties(JsonObject json, OrganizationAffiliation res) throws IOException, FHIRFormatError {
20350    parseDomainResourceProperties(json, res);
20351    if (json.has("identifier")) {
20352      JsonArray array = json.getAsJsonArray("identifier");
20353      for (int i = 0; i < array.size(); i++) {
20354        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20355      }
20356    };
20357    if (json.has("active"))
20358      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20359    if (json.has("_active"))
20360      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
20361    if (json.has("period"))
20362      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
20363    if (json.has("organization"))
20364      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
20365    if (json.has("participatingOrganization"))
20366      res.setParticipatingOrganization(parseReference(json.getAsJsonObject("participatingOrganization")));
20367    if (json.has("network")) {
20368      JsonArray array = json.getAsJsonArray("network");
20369      for (int i = 0; i < array.size(); i++) {
20370        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
20371      }
20372    };
20373    if (json.has("code")) {
20374      JsonArray array = json.getAsJsonArray("code");
20375      for (int i = 0; i < array.size(); i++) {
20376        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20377      }
20378    };
20379    if (json.has("specialty")) {
20380      JsonArray array = json.getAsJsonArray("specialty");
20381      for (int i = 0; i < array.size(); i++) {
20382        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20383      }
20384    };
20385    if (json.has("location")) {
20386      JsonArray array = json.getAsJsonArray("location");
20387      for (int i = 0; i < array.size(); i++) {
20388        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
20389      }
20390    };
20391    if (json.has("healthcareService")) {
20392      JsonArray array = json.getAsJsonArray("healthcareService");
20393      for (int i = 0; i < array.size(); i++) {
20394        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
20395      }
20396    };
20397    if (json.has("telecom")) {
20398      JsonArray array = json.getAsJsonArray("telecom");
20399      for (int i = 0; i < array.size(); i++) {
20400        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20401      }
20402    };
20403    if (json.has("endpoint")) {
20404      JsonArray array = json.getAsJsonArray("endpoint");
20405      for (int i = 0; i < array.size(); i++) {
20406        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
20407      }
20408    };
20409  }
20410
20411  protected PackagedProductDefinition parsePackagedProductDefinition(JsonObject json) throws IOException, FHIRFormatError {
20412    PackagedProductDefinition res = new PackagedProductDefinition();
20413    parsePackagedProductDefinitionProperties(json, res);
20414    return res;
20415  }
20416
20417  protected void parsePackagedProductDefinitionProperties(JsonObject json, PackagedProductDefinition res) throws IOException, FHIRFormatError {
20418    parseDomainResourceProperties(json, res);
20419    if (json.has("identifier")) {
20420      JsonArray array = json.getAsJsonArray("identifier");
20421      for (int i = 0; i < array.size(); i++) {
20422        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20423      }
20424    };
20425    if (json.has("subject")) {
20426      JsonArray array = json.getAsJsonArray("subject");
20427      for (int i = 0; i < array.size(); i++) {
20428        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
20429      }
20430    };
20431    if (json.has("description"))
20432      res.setDescriptionElement(parseString(json.get("description").getAsString()));
20433    if (json.has("_description"))
20434      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20435    if (json.has("legalStatusOfSupply"))
20436      res.setLegalStatusOfSupply(parseCodeableConcept(json.getAsJsonObject("legalStatusOfSupply")));
20437    if (json.has("marketingStatus")) {
20438      JsonArray array = json.getAsJsonArray("marketingStatus");
20439      for (int i = 0; i < array.size(); i++) {
20440        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
20441      }
20442    };
20443    if (json.has("marketingAuthorization"))
20444      res.setMarketingAuthorization(parseReference(json.getAsJsonObject("marketingAuthorization")));
20445    if (json.has("manufacturer")) {
20446      JsonArray array = json.getAsJsonArray("manufacturer");
20447      for (int i = 0; i < array.size(); i++) {
20448        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
20449      }
20450    };
20451    if (json.has("batchIdentifier")) {
20452      JsonArray array = json.getAsJsonArray("batchIdentifier");
20453      for (int i = 0; i < array.size(); i++) {
20454        res.getBatchIdentifier().add(parsePackagedProductDefinitionPackagedProductDefinitionBatchIdentifierComponent(array.get(i).getAsJsonObject(), res));
20455      }
20456    };
20457    if (json.has("package")) {
20458      JsonArray array = json.getAsJsonArray("package");
20459      for (int i = 0; i < array.size(); i++) {
20460        res.getPackage().add(parsePackagedProductDefinitionPackagedProductDefinitionPackageComponent(array.get(i).getAsJsonObject(), res));
20461      }
20462    };
20463  }
20464
20465  protected PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent parsePackagedProductDefinitionPackagedProductDefinitionBatchIdentifierComponent(JsonObject json, PackagedProductDefinition owner) throws IOException, FHIRFormatError {
20466    PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent res = new PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent();
20467    parsePackagedProductDefinitionPackagedProductDefinitionBatchIdentifierComponentProperties(json, owner, res);
20468    return res;
20469  }
20470
20471  protected void parsePackagedProductDefinitionPackagedProductDefinitionBatchIdentifierComponentProperties(JsonObject json, PackagedProductDefinition owner, PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent res) throws IOException, FHIRFormatError {
20472    parseBackboneElementProperties(json, res);
20473    if (json.has("outerPackaging"))
20474      res.setOuterPackaging(parseIdentifier(json.getAsJsonObject("outerPackaging")));
20475    if (json.has("immediatePackaging"))
20476      res.setImmediatePackaging(parseIdentifier(json.getAsJsonObject("immediatePackaging")));
20477  }
20478
20479  protected PackagedProductDefinition.PackagedProductDefinitionPackageComponent parsePackagedProductDefinitionPackagedProductDefinitionPackageComponent(JsonObject json, PackagedProductDefinition owner) throws IOException, FHIRFormatError {
20480    PackagedProductDefinition.PackagedProductDefinitionPackageComponent res = new PackagedProductDefinition.PackagedProductDefinitionPackageComponent();
20481    parsePackagedProductDefinitionPackagedProductDefinitionPackageComponentProperties(json, owner, res);
20482    return res;
20483  }
20484
20485  protected void parsePackagedProductDefinitionPackagedProductDefinitionPackageComponentProperties(JsonObject json, PackagedProductDefinition owner, PackagedProductDefinition.PackagedProductDefinitionPackageComponent res) throws IOException, FHIRFormatError {
20486    parseBackboneElementProperties(json, res);
20487    if (json.has("identifier")) {
20488      JsonArray array = json.getAsJsonArray("identifier");
20489      for (int i = 0; i < array.size(); i++) {
20490        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20491      }
20492    };
20493    if (json.has("type"))
20494      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
20495    if (json.has("quantity"))
20496      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
20497    if (json.has("material")) {
20498      JsonArray array = json.getAsJsonArray("material");
20499      for (int i = 0; i < array.size(); i++) {
20500        res.getMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20501      }
20502    };
20503    if (json.has("alternateMaterial")) {
20504      JsonArray array = json.getAsJsonArray("alternateMaterial");
20505      for (int i = 0; i < array.size(); i++) {
20506        res.getAlternateMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20507      }
20508    };
20509    if (json.has("shelfLifeStorage")) {
20510      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
20511      for (int i = 0; i < array.size(); i++) {
20512        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
20513      }
20514    };
20515    if (json.has("manufacturer")) {
20516      JsonArray array = json.getAsJsonArray("manufacturer");
20517      for (int i = 0; i < array.size(); i++) {
20518        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
20519      }
20520    };
20521    if (json.has("characteristic")) {
20522      JsonArray array = json.getAsJsonArray("characteristic");
20523      for (int i = 0; i < array.size(); i++) {
20524        res.getCharacteristic().add(parsePackagedProductDefinitionPackagedProductDefinitionPackageCharacteristicComponent(array.get(i).getAsJsonObject(), owner));
20525      }
20526    };
20527    if (json.has("containedItem")) {
20528      JsonArray array = json.getAsJsonArray("containedItem");
20529      for (int i = 0; i < array.size(); i++) {
20530        res.getContainedItem().add(parsePackagedProductDefinitionPackagedProductDefinitionPackageContainedItemComponent(array.get(i).getAsJsonObject(), owner));
20531      }
20532    };
20533    if (json.has("package")) {
20534      JsonArray array = json.getAsJsonArray("package");
20535      for (int i = 0; i < array.size(); i++) {
20536        res.getPackage().add(parsePackagedProductDefinitionPackagedProductDefinitionPackageComponent(array.get(i).getAsJsonObject(), owner));
20537      }
20538    };
20539  }
20540
20541  protected PackagedProductDefinition.PackagedProductDefinitionPackageCharacteristicComponent parsePackagedProductDefinitionPackagedProductDefinitionPackageCharacteristicComponent(JsonObject json, PackagedProductDefinition owner) throws IOException, FHIRFormatError {
20542    PackagedProductDefinition.PackagedProductDefinitionPackageCharacteristicComponent res = new PackagedProductDefinition.PackagedProductDefinitionPackageCharacteristicComponent();
20543    parsePackagedProductDefinitionPackagedProductDefinitionPackageCharacteristicComponentProperties(json, owner, res);
20544    return res;
20545  }
20546
20547  protected void parsePackagedProductDefinitionPackagedProductDefinitionPackageCharacteristicComponentProperties(JsonObject json, PackagedProductDefinition owner, PackagedProductDefinition.PackagedProductDefinitionPackageCharacteristicComponent res) throws IOException, FHIRFormatError {
20548    parseBackboneElementProperties(json, res);
20549    if (json.has("code"))
20550      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
20551    Type value = parseType("value", json);
20552    if (value != null)
20553      res.setValue(value);
20554  }
20555
20556  protected PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent parsePackagedProductDefinitionPackagedProductDefinitionPackageContainedItemComponent(JsonObject json, PackagedProductDefinition owner) throws IOException, FHIRFormatError {
20557    PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent res = new PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent();
20558    parsePackagedProductDefinitionPackagedProductDefinitionPackageContainedItemComponentProperties(json, owner, res);
20559    return res;
20560  }
20561
20562  protected void parsePackagedProductDefinitionPackagedProductDefinitionPackageContainedItemComponentProperties(JsonObject json, PackagedProductDefinition owner, PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent res) throws IOException, FHIRFormatError {
20563    parseBackboneElementProperties(json, res);
20564    if (json.has("item")) {
20565      JsonArray array = json.getAsJsonArray("item");
20566      for (int i = 0; i < array.size(); i++) {
20567        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
20568      }
20569    };
20570    Type amount = parseType("amount", json);
20571    if (amount != null)
20572      res.setAmount(amount);
20573  }
20574
20575  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
20576    Patient res = new Patient();
20577    parsePatientProperties(json, res);
20578    return res;
20579  }
20580
20581  protected void parsePatientProperties(JsonObject json, Patient res) throws IOException, FHIRFormatError {
20582    parseDomainResourceProperties(json, res);
20583    if (json.has("identifier")) {
20584      JsonArray array = json.getAsJsonArray("identifier");
20585      for (int i = 0; i < array.size(); i++) {
20586        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20587      }
20588    };
20589    if (json.has("active"))
20590      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20591    if (json.has("_active"))
20592      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
20593    if (json.has("name")) {
20594      JsonArray array = json.getAsJsonArray("name");
20595      for (int i = 0; i < array.size(); i++) {
20596        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
20597      }
20598    };
20599    if (json.has("telecom")) {
20600      JsonArray array = json.getAsJsonArray("telecom");
20601      for (int i = 0; i < array.size(); i++) {
20602        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20603      }
20604    };
20605    if (json.has("gender"))
20606      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
20607    if (json.has("_gender"))
20608      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
20609    if (json.has("birthDate"))
20610      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
20611    if (json.has("_birthDate"))
20612      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
20613    Type deceased = parseType("deceased", json);
20614    if (deceased != null)
20615      res.setDeceased(deceased);
20616    if (json.has("address")) {
20617      JsonArray array = json.getAsJsonArray("address");
20618      for (int i = 0; i < array.size(); i++) {
20619        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
20620      }
20621    };
20622    if (json.has("maritalStatus"))
20623      res.setMaritalStatus(parseCodeableConcept(json.getAsJsonObject("maritalStatus")));
20624    Type multipleBirth = parseType("multipleBirth", json);
20625    if (multipleBirth != null)
20626      res.setMultipleBirth(multipleBirth);
20627    if (json.has("photo")) {
20628      JsonArray array = json.getAsJsonArray("photo");
20629      for (int i = 0; i < array.size(); i++) {
20630        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
20631      }
20632    };
20633    if (json.has("contact")) {
20634      JsonArray array = json.getAsJsonArray("contact");
20635      for (int i = 0; i < array.size(); i++) {
20636        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject(), res));
20637      }
20638    };
20639    if (json.has("communication")) {
20640      JsonArray array = json.getAsJsonArray("communication");
20641      for (int i = 0; i < array.size(); i++) {
20642        res.getCommunication().add(parsePatientPatientCommunicationComponent(array.get(i).getAsJsonObject(), res));
20643      }
20644    };
20645    if (json.has("generalPractitioner")) {
20646      JsonArray array = json.getAsJsonArray("generalPractitioner");
20647      for (int i = 0; i < array.size(); i++) {
20648        res.getGeneralPractitioner().add(parseReference(array.get(i).getAsJsonObject()));
20649      }
20650    };
20651    if (json.has("managingOrganization"))
20652      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
20653    if (json.has("link")) {
20654      JsonArray array = json.getAsJsonArray("link");
20655      for (int i = 0; i < array.size(); i++) {
20656        res.getLink().add(parsePatientPatientLinkComponent(array.get(i).getAsJsonObject(), res));
20657      }
20658    };
20659  }
20660
20661  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
20662    Patient.ContactComponent res = new Patient.ContactComponent();
20663    parsePatientContactComponentProperties(json, owner, res);
20664    return res;
20665  }
20666
20667  protected void parsePatientContactComponentProperties(JsonObject json, Patient owner, Patient.ContactComponent res) throws IOException, FHIRFormatError {
20668    parseBackboneElementProperties(json, res);
20669    if (json.has("relationship")) {
20670      JsonArray array = json.getAsJsonArray("relationship");
20671      for (int i = 0; i < array.size(); i++) {
20672        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20673      }
20674    };
20675    if (json.has("name"))
20676      res.setName(parseHumanName(json.getAsJsonObject("name")));
20677    if (json.has("telecom")) {
20678      JsonArray array = json.getAsJsonArray("telecom");
20679      for (int i = 0; i < array.size(); i++) {
20680        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20681      }
20682    };
20683    if (json.has("address"))
20684      res.setAddress(parseAddress(json.getAsJsonObject("address")));
20685    if (json.has("gender"))
20686      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
20687    if (json.has("_gender"))
20688      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
20689    if (json.has("organization"))
20690      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
20691    if (json.has("period"))
20692      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
20693  }
20694
20695  protected Patient.PatientCommunicationComponent parsePatientPatientCommunicationComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
20696    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
20697    parsePatientPatientCommunicationComponentProperties(json, owner, res);
20698    return res;
20699  }
20700
20701  protected void parsePatientPatientCommunicationComponentProperties(JsonObject json, Patient owner, Patient.PatientCommunicationComponent res) throws IOException, FHIRFormatError {
20702    parseBackboneElementProperties(json, res);
20703    if (json.has("language"))
20704      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
20705    if (json.has("preferred"))
20706      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
20707    if (json.has("_preferred"))
20708      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
20709  }
20710
20711  protected Patient.PatientLinkComponent parsePatientPatientLinkComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
20712    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
20713    parsePatientPatientLinkComponentProperties(json, owner, res);
20714    return res;
20715  }
20716
20717  protected void parsePatientPatientLinkComponentProperties(JsonObject json, Patient owner, Patient.PatientLinkComponent res) throws IOException, FHIRFormatError {
20718    parseBackboneElementProperties(json, res);
20719    if (json.has("other"))
20720      res.setOther(parseReference(json.getAsJsonObject("other")));
20721    if (json.has("type"))
20722      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
20723    if (json.has("_type"))
20724      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
20725  }
20726
20727  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
20728    PaymentNotice res = new PaymentNotice();
20729    parsePaymentNoticeProperties(json, res);
20730    return res;
20731  }
20732
20733  protected void parsePaymentNoticeProperties(JsonObject json, PaymentNotice res) throws IOException, FHIRFormatError {
20734    parseDomainResourceProperties(json, res);
20735    if (json.has("identifier")) {
20736      JsonArray array = json.getAsJsonArray("identifier");
20737      for (int i = 0; i < array.size(); i++) {
20738        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20739      }
20740    };
20741    if (json.has("status"))
20742      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentNotice.PaymentNoticeStatus.NULL, new PaymentNotice.PaymentNoticeStatusEnumFactory()));
20743    if (json.has("_status"))
20744      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20745    if (json.has("request"))
20746      res.setRequest(parseReference(json.getAsJsonObject("request")));
20747    if (json.has("response"))
20748      res.setResponse(parseReference(json.getAsJsonObject("response")));
20749    if (json.has("created"))
20750      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
20751    if (json.has("_created"))
20752      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
20753    if (json.has("provider"))
20754      res.setProvider(parseReference(json.getAsJsonObject("provider")));
20755    if (json.has("payment"))
20756      res.setPayment(parseReference(json.getAsJsonObject("payment")));
20757    if (json.has("paymentDate"))
20758      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
20759    if (json.has("_paymentDate"))
20760      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
20761    if (json.has("payee"))
20762      res.setPayee(parseReference(json.getAsJsonObject("payee")));
20763    if (json.has("recipient"))
20764      res.setRecipient(parseReference(json.getAsJsonObject("recipient")));
20765    if (json.has("amount"))
20766      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
20767    if (json.has("paymentStatus"))
20768      res.setPaymentStatus(parseCodeableConcept(json.getAsJsonObject("paymentStatus")));
20769  }
20770
20771  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
20772    PaymentReconciliation res = new PaymentReconciliation();
20773    parsePaymentReconciliationProperties(json, res);
20774    return res;
20775  }
20776
20777  protected void parsePaymentReconciliationProperties(JsonObject json, PaymentReconciliation res) throws IOException, FHIRFormatError {
20778    parseDomainResourceProperties(json, res);
20779    if (json.has("identifier")) {
20780      JsonArray array = json.getAsJsonArray("identifier");
20781      for (int i = 0; i < array.size(); i++) {
20782        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20783      }
20784    };
20785    if (json.has("status"))
20786      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentReconciliation.PaymentReconciliationStatus.NULL, new PaymentReconciliation.PaymentReconciliationStatusEnumFactory()));
20787    if (json.has("_status"))
20788      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20789    if (json.has("period"))
20790      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
20791    if (json.has("created"))
20792      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
20793    if (json.has("_created"))
20794      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
20795    if (json.has("paymentIssuer"))
20796      res.setPaymentIssuer(parseReference(json.getAsJsonObject("paymentIssuer")));
20797    if (json.has("request"))
20798      res.setRequest(parseReference(json.getAsJsonObject("request")));
20799    if (json.has("requestor"))
20800      res.setRequestor(parseReference(json.getAsJsonObject("requestor")));
20801    if (json.has("outcome"))
20802      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
20803    if (json.has("_outcome"))
20804      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
20805    if (json.has("disposition"))
20806      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
20807    if (json.has("_disposition"))
20808      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
20809    if (json.has("paymentDate"))
20810      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
20811    if (json.has("_paymentDate"))
20812      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
20813    if (json.has("paymentAmount"))
20814      res.setPaymentAmount(parseMoney(json.getAsJsonObject("paymentAmount")));
20815    if (json.has("paymentIdentifier"))
20816      res.setPaymentIdentifier(parseIdentifier(json.getAsJsonObject("paymentIdentifier")));
20817    if (json.has("detail")) {
20818      JsonArray array = json.getAsJsonArray("detail");
20819      for (int i = 0; i < array.size(); i++) {
20820        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject(), res));
20821      }
20822    };
20823    if (json.has("formCode"))
20824      res.setFormCode(parseCodeableConcept(json.getAsJsonObject("formCode")));
20825    if (json.has("processNote")) {
20826      JsonArray array = json.getAsJsonArray("processNote");
20827      for (int i = 0; i < array.size(); i++) {
20828        res.getProcessNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject(), res));
20829      }
20830    };
20831  }
20832
20833  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
20834    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
20835    parsePaymentReconciliationDetailsComponentProperties(json, owner, res);
20836    return res;
20837  }
20838
20839  protected void parsePaymentReconciliationDetailsComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.DetailsComponent res) throws IOException, FHIRFormatError {
20840    parseBackboneElementProperties(json, res);
20841    if (json.has("identifier"))
20842      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
20843    if (json.has("predecessor"))
20844      res.setPredecessor(parseIdentifier(json.getAsJsonObject("predecessor")));
20845    if (json.has("type"))
20846      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
20847    if (json.has("request"))
20848      res.setRequest(parseReference(json.getAsJsonObject("request")));
20849    if (json.has("submitter"))
20850      res.setSubmitter(parseReference(json.getAsJsonObject("submitter")));
20851    if (json.has("response"))
20852      res.setResponse(parseReference(json.getAsJsonObject("response")));
20853    if (json.has("date"))
20854      res.setDateElement(parseDate(json.get("date").getAsString()));
20855    if (json.has("_date"))
20856      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
20857    if (json.has("responsible"))
20858      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
20859    if (json.has("payee"))
20860      res.setPayee(parseReference(json.getAsJsonObject("payee")));
20861    if (json.has("amount"))
20862      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
20863  }
20864
20865  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
20866    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
20867    parsePaymentReconciliationNotesComponentProperties(json, owner, res);
20868    return res;
20869  }
20870
20871  protected void parsePaymentReconciliationNotesComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.NotesComponent res) throws IOException, FHIRFormatError {
20872    parseBackboneElementProperties(json, res);
20873    if (json.has("type"))
20874      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
20875    if (json.has("_type"))
20876      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
20877    if (json.has("text"))
20878      res.setTextElement(parseString(json.get("text").getAsString()));
20879    if (json.has("_text"))
20880      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
20881  }
20882
20883  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
20884    Person res = new Person();
20885    parsePersonProperties(json, res);
20886    return res;
20887  }
20888
20889  protected void parsePersonProperties(JsonObject json, Person res) throws IOException, FHIRFormatError {
20890    parseDomainResourceProperties(json, res);
20891    if (json.has("identifier")) {
20892      JsonArray array = json.getAsJsonArray("identifier");
20893      for (int i = 0; i < array.size(); i++) {
20894        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20895      }
20896    };
20897    if (json.has("name")) {
20898      JsonArray array = json.getAsJsonArray("name");
20899      for (int i = 0; i < array.size(); i++) {
20900        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
20901      }
20902    };
20903    if (json.has("telecom")) {
20904      JsonArray array = json.getAsJsonArray("telecom");
20905      for (int i = 0; i < array.size(); i++) {
20906        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20907      }
20908    };
20909    if (json.has("gender"))
20910      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
20911    if (json.has("_gender"))
20912      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
20913    if (json.has("birthDate"))
20914      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
20915    if (json.has("_birthDate"))
20916      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
20917    if (json.has("address")) {
20918      JsonArray array = json.getAsJsonArray("address");
20919      for (int i = 0; i < array.size(); i++) {
20920        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
20921      }
20922    };
20923    if (json.has("photo"))
20924      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
20925    if (json.has("managingOrganization"))
20926      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
20927    if (json.has("active"))
20928      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20929    if (json.has("_active"))
20930      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
20931    if (json.has("link")) {
20932      JsonArray array = json.getAsJsonArray("link");
20933      for (int i = 0; i < array.size(); i++) {
20934        res.getLink().add(parsePersonPersonLinkComponent(array.get(i).getAsJsonObject(), res));
20935      }
20936    };
20937  }
20938
20939  protected Person.PersonLinkComponent parsePersonPersonLinkComponent(JsonObject json, Person owner) throws IOException, FHIRFormatError {
20940    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
20941    parsePersonPersonLinkComponentProperties(json, owner, res);
20942    return res;
20943  }
20944
20945  protected void parsePersonPersonLinkComponentProperties(JsonObject json, Person owner, Person.PersonLinkComponent res) throws IOException, FHIRFormatError {
20946    parseBackboneElementProperties(json, res);
20947    if (json.has("target"))
20948      res.setTarget(parseReference(json.getAsJsonObject("target")));
20949    if (json.has("assurance"))
20950      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
20951    if (json.has("_assurance"))
20952      parseElementProperties(json.getAsJsonObject("_assurance"), res.getAssuranceElement());
20953  }
20954
20955  protected PlanDefinition parsePlanDefinition(JsonObject json) throws IOException, FHIRFormatError {
20956    PlanDefinition res = new PlanDefinition();
20957    parsePlanDefinitionProperties(json, res);
20958    return res;
20959  }
20960
20961  protected void parsePlanDefinitionProperties(JsonObject json, PlanDefinition res) throws IOException, FHIRFormatError {
20962    parseDomainResourceProperties(json, res);
20963    if (json.has("url"))
20964      res.setUrlElement(parseUri(json.get("url").getAsString()));
20965    if (json.has("_url"))
20966      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
20967    if (json.has("identifier")) {
20968      JsonArray array = json.getAsJsonArray("identifier");
20969      for (int i = 0; i < array.size(); i++) {
20970        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20971      }
20972    };
20973    if (json.has("version"))
20974      res.setVersionElement(parseString(json.get("version").getAsString()));
20975    if (json.has("_version"))
20976      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
20977    if (json.has("name"))
20978      res.setNameElement(parseString(json.get("name").getAsString()));
20979    if (json.has("_name"))
20980      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
20981    if (json.has("title"))
20982      res.setTitleElement(parseString(json.get("title").getAsString()));
20983    if (json.has("_title"))
20984      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
20985    if (json.has("subtitle"))
20986      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
20987    if (json.has("_subtitle"))
20988      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
20989    if (json.has("type"))
20990      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
20991    if (json.has("status"))
20992      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
20993    if (json.has("_status"))
20994      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20995    if (json.has("experimental"))
20996      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
20997    if (json.has("_experimental"))
20998      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
20999    Type subject = parseType("subject", json);
21000    if (subject != null)
21001      res.setSubject(subject);
21002    if (json.has("date"))
21003      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21004    if (json.has("_date"))
21005      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
21006    if (json.has("publisher"))
21007      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21008    if (json.has("_publisher"))
21009      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
21010    if (json.has("contact")) {
21011      JsonArray array = json.getAsJsonArray("contact");
21012      for (int i = 0; i < array.size(); i++) {
21013        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21014      }
21015    };
21016    if (json.has("description"))
21017      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21018    if (json.has("_description"))
21019      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21020    if (json.has("useContext")) {
21021      JsonArray array = json.getAsJsonArray("useContext");
21022      for (int i = 0; i < array.size(); i++) {
21023        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21024      }
21025    };
21026    if (json.has("jurisdiction")) {
21027      JsonArray array = json.getAsJsonArray("jurisdiction");
21028      for (int i = 0; i < array.size(); i++) {
21029        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21030      }
21031    };
21032    if (json.has("purpose"))
21033      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
21034    if (json.has("_purpose"))
21035      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
21036    if (json.has("usage"))
21037      res.setUsageElement(parseString(json.get("usage").getAsString()));
21038    if (json.has("_usage"))
21039      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
21040    if (json.has("copyright"))
21041      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
21042    if (json.has("_copyright"))
21043      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
21044    if (json.has("approvalDate"))
21045      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
21046    if (json.has("_approvalDate"))
21047      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
21048    if (json.has("lastReviewDate"))
21049      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
21050    if (json.has("_lastReviewDate"))
21051      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
21052    if (json.has("effectivePeriod"))
21053      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
21054    if (json.has("topic")) {
21055      JsonArray array = json.getAsJsonArray("topic");
21056      for (int i = 0; i < array.size(); i++) {
21057        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21058      }
21059    };
21060    if (json.has("author")) {
21061      JsonArray array = json.getAsJsonArray("author");
21062      for (int i = 0; i < array.size(); i++) {
21063        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
21064      }
21065    };
21066    if (json.has("editor")) {
21067      JsonArray array = json.getAsJsonArray("editor");
21068      for (int i = 0; i < array.size(); i++) {
21069        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
21070      }
21071    };
21072    if (json.has("reviewer")) {
21073      JsonArray array = json.getAsJsonArray("reviewer");
21074      for (int i = 0; i < array.size(); i++) {
21075        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
21076      }
21077    };
21078    if (json.has("endorser")) {
21079      JsonArray array = json.getAsJsonArray("endorser");
21080      for (int i = 0; i < array.size(); i++) {
21081        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
21082      }
21083    };
21084    if (json.has("relatedArtifact")) {
21085      JsonArray array = json.getAsJsonArray("relatedArtifact");
21086      for (int i = 0; i < array.size(); i++) {
21087        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
21088      }
21089    };
21090    if (json.has("library")) {
21091      JsonArray array = json.getAsJsonArray("library");
21092      for (int i = 0; i < array.size(); i++) {
21093        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
21094      }
21095    };
21096    if (json.has("_library")) {
21097      JsonArray array = json.getAsJsonArray("_library");
21098      for (int i = 0; i < array.size(); i++) {
21099        if (i == res.getLibrary().size())
21100          res.getLibrary().add(parseCanonical(null));
21101        if (array.get(i) instanceof JsonObject) 
21102          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
21103      }
21104    };
21105    if (json.has("goal")) {
21106      JsonArray array = json.getAsJsonArray("goal");
21107      for (int i = 0; i < array.size(); i++) {
21108        res.getGoal().add(parsePlanDefinitionPlanDefinitionGoalComponent(array.get(i).getAsJsonObject(), res));
21109      }
21110    };
21111    if (json.has("action")) {
21112      JsonArray array = json.getAsJsonArray("action");
21113      for (int i = 0; i < array.size(); i++) {
21114        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), res));
21115      }
21116    };
21117  }
21118
21119  protected PlanDefinition.PlanDefinitionGoalComponent parsePlanDefinitionPlanDefinitionGoalComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
21120    PlanDefinition.PlanDefinitionGoalComponent res = new PlanDefinition.PlanDefinitionGoalComponent();
21121    parsePlanDefinitionPlanDefinitionGoalComponentProperties(json, owner, res);
21122    return res;
21123  }
21124
21125  protected void parsePlanDefinitionPlanDefinitionGoalComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalComponent res) throws IOException, FHIRFormatError {
21126    parseBackboneElementProperties(json, res);
21127    if (json.has("category"))
21128      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
21129    if (json.has("description"))
21130      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
21131    if (json.has("priority"))
21132      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
21133    if (json.has("start"))
21134      res.setStart(parseCodeableConcept(json.getAsJsonObject("start")));
21135    if (json.has("addresses")) {
21136      JsonArray array = json.getAsJsonArray("addresses");
21137      for (int i = 0; i < array.size(); i++) {
21138        res.getAddresses().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21139      }
21140    };
21141    if (json.has("documentation")) {
21142      JsonArray array = json.getAsJsonArray("documentation");
21143      for (int i = 0; i < array.size(); i++) {
21144        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
21145      }
21146    };
21147    if (json.has("target")) {
21148      JsonArray array = json.getAsJsonArray("target");
21149      for (int i = 0; i < array.size(); i++) {
21150        res.getTarget().add(parsePlanDefinitionPlanDefinitionGoalTargetComponent(array.get(i).getAsJsonObject(), owner));
21151      }
21152    };
21153  }
21154
21155  protected PlanDefinition.PlanDefinitionGoalTargetComponent parsePlanDefinitionPlanDefinitionGoalTargetComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
21156    PlanDefinition.PlanDefinitionGoalTargetComponent res = new PlanDefinition.PlanDefinitionGoalTargetComponent();
21157    parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(json, owner, res);
21158    return res;
21159  }
21160
21161  protected void parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalTargetComponent res) throws IOException, FHIRFormatError {
21162    parseBackboneElementProperties(json, res);
21163    if (json.has("measure"))
21164      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
21165    Type detail = parseType("detail", json);
21166    if (detail != null)
21167      res.setDetail(detail);
21168    if (json.has("due"))
21169      res.setDue(parseDuration(json.getAsJsonObject("due")));
21170  }
21171
21172  protected PlanDefinition.PlanDefinitionActionComponent parsePlanDefinitionPlanDefinitionActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
21173    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
21174    parsePlanDefinitionPlanDefinitionActionComponentProperties(json, owner, res);
21175    return res;
21176  }
21177
21178  protected void parsePlanDefinitionPlanDefinitionActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionComponent res) throws IOException, FHIRFormatError {
21179    parseBackboneElementProperties(json, res);
21180    if (json.has("prefix"))
21181      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
21182    if (json.has("_prefix"))
21183      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
21184    if (json.has("title"))
21185      res.setTitleElement(parseString(json.get("title").getAsString()));
21186    if (json.has("_title"))
21187      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
21188    if (json.has("description"))
21189      res.setDescriptionElement(parseString(json.get("description").getAsString()));
21190    if (json.has("_description"))
21191      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21192    if (json.has("textEquivalent"))
21193      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
21194    if (json.has("_textEquivalent"))
21195      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
21196    if (json.has("priority"))
21197      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), PlanDefinition.RequestPriority.NULL, new PlanDefinition.RequestPriorityEnumFactory()));
21198    if (json.has("_priority"))
21199      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
21200    if (json.has("code")) {
21201      JsonArray array = json.getAsJsonArray("code");
21202      for (int i = 0; i < array.size(); i++) {
21203        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21204      }
21205    };
21206    if (json.has("reason")) {
21207      JsonArray array = json.getAsJsonArray("reason");
21208      for (int i = 0; i < array.size(); i++) {
21209        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21210      }
21211    };
21212    if (json.has("documentation")) {
21213      JsonArray array = json.getAsJsonArray("documentation");
21214      for (int i = 0; i < array.size(); i++) {
21215        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
21216      }
21217    };
21218    if (json.has("goalId")) {
21219      JsonArray array = json.getAsJsonArray("goalId");
21220      for (int i = 0; i < array.size(); i++) {
21221        res.getGoalId().add(parseId(array.get(i).getAsString()));
21222      }
21223    };
21224    if (json.has("_goalId")) {
21225      JsonArray array = json.getAsJsonArray("_goalId");
21226      for (int i = 0; i < array.size(); i++) {
21227        if (i == res.getGoalId().size())
21228          res.getGoalId().add(parseId(null));
21229        if (array.get(i) instanceof JsonObject) 
21230          parseElementProperties(array.get(i).getAsJsonObject(), res.getGoalId().get(i));
21231      }
21232    };
21233    Type subject = parseType("subject", json);
21234    if (subject != null)
21235      res.setSubject(subject);
21236    if (json.has("trigger")) {
21237      JsonArray array = json.getAsJsonArray("trigger");
21238      for (int i = 0; i < array.size(); i++) {
21239        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
21240      }
21241    };
21242    if (json.has("condition")) {
21243      JsonArray array = json.getAsJsonArray("condition");
21244      for (int i = 0; i < array.size(); i++) {
21245        res.getCondition().add(parsePlanDefinitionPlanDefinitionActionConditionComponent(array.get(i).getAsJsonObject(), owner));
21246      }
21247    };
21248    if (json.has("input")) {
21249      JsonArray array = json.getAsJsonArray("input");
21250      for (int i = 0; i < array.size(); i++) {
21251        res.getInput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
21252      }
21253    };
21254    if (json.has("output")) {
21255      JsonArray array = json.getAsJsonArray("output");
21256      for (int i = 0; i < array.size(); i++) {
21257        res.getOutput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
21258      }
21259    };
21260    if (json.has("relatedAction")) {
21261      JsonArray array = json.getAsJsonArray("relatedAction");
21262      for (int i = 0; i < array.size(); i++) {
21263        res.getRelatedAction().add(parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
21264      }
21265    };
21266    Type timing = parseType("timing", json);
21267    if (timing != null)
21268      res.setTiming(timing);
21269    if (json.has("participant")) {
21270      JsonArray array = json.getAsJsonArray("participant");
21271      for (int i = 0; i < array.size(); i++) {
21272        res.getParticipant().add(parsePlanDefinitionPlanDefinitionActionParticipantComponent(array.get(i).getAsJsonObject(), owner));
21273      }
21274    };
21275    if (json.has("type"))
21276      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21277    if (json.has("groupingBehavior"))
21278      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), PlanDefinition.ActionGroupingBehavior.NULL, new PlanDefinition.ActionGroupingBehaviorEnumFactory()));
21279    if (json.has("_groupingBehavior"))
21280      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
21281    if (json.has("selectionBehavior"))
21282      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), PlanDefinition.ActionSelectionBehavior.NULL, new PlanDefinition.ActionSelectionBehaviorEnumFactory()));
21283    if (json.has("_selectionBehavior"))
21284      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
21285    if (json.has("requiredBehavior"))
21286      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), PlanDefinition.ActionRequiredBehavior.NULL, new PlanDefinition.ActionRequiredBehaviorEnumFactory()));
21287    if (json.has("_requiredBehavior"))
21288      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
21289    if (json.has("precheckBehavior"))
21290      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), PlanDefinition.ActionPrecheckBehavior.NULL, new PlanDefinition.ActionPrecheckBehaviorEnumFactory()));
21291    if (json.has("_precheckBehavior"))
21292      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
21293    if (json.has("cardinalityBehavior"))
21294      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), PlanDefinition.ActionCardinalityBehavior.NULL, new PlanDefinition.ActionCardinalityBehaviorEnumFactory()));
21295    if (json.has("_cardinalityBehavior"))
21296      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
21297    Type definition = parseType("definition", json);
21298    if (definition != null)
21299      res.setDefinition(definition);
21300    if (json.has("transform"))
21301      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
21302    if (json.has("_transform"))
21303      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
21304    if (json.has("dynamicValue")) {
21305      JsonArray array = json.getAsJsonArray("dynamicValue");
21306      for (int i = 0; i < array.size(); i++) {
21307        res.getDynamicValue().add(parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(array.get(i).getAsJsonObject(), owner));
21308      }
21309    };
21310    if (json.has("action")) {
21311      JsonArray array = json.getAsJsonArray("action");
21312      for (int i = 0; i < array.size(); i++) {
21313        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), owner));
21314      }
21315    };
21316  }
21317
21318  protected PlanDefinition.PlanDefinitionActionConditionComponent parsePlanDefinitionPlanDefinitionActionConditionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
21319    PlanDefinition.PlanDefinitionActionConditionComponent res = new PlanDefinition.PlanDefinitionActionConditionComponent();
21320    parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(json, owner, res);
21321    return res;
21322  }
21323
21324  protected void parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionConditionComponent res) throws IOException, FHIRFormatError {
21325    parseBackboneElementProperties(json, res);
21326    if (json.has("kind"))
21327      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), PlanDefinition.ActionConditionKind.NULL, new PlanDefinition.ActionConditionKindEnumFactory()));
21328    if (json.has("_kind"))
21329      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
21330    if (json.has("expression"))
21331      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
21332  }
21333
21334  protected PlanDefinition.PlanDefinitionActionRelatedActionComponent parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
21335    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
21336    parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(json, owner, res);
21337    return res;
21338  }
21339
21340  protected void parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionRelatedActionComponent res) throws IOException, FHIRFormatError {
21341    parseBackboneElementProperties(json, res);
21342    if (json.has("actionId"))
21343      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
21344    if (json.has("_actionId"))
21345      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
21346    if (json.has("relationship"))
21347      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), PlanDefinition.ActionRelationshipType.NULL, new PlanDefinition.ActionRelationshipTypeEnumFactory()));
21348    if (json.has("_relationship"))
21349      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
21350    Type offset = parseType("offset", json);
21351    if (offset != null)
21352      res.setOffset(offset);
21353  }
21354
21355  protected PlanDefinition.PlanDefinitionActionParticipantComponent parsePlanDefinitionPlanDefinitionActionParticipantComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
21356    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
21357    parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(json, owner, res);
21358    return res;
21359  }
21360
21361  protected void parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionParticipantComponent res) throws IOException, FHIRFormatError {
21362    parseBackboneElementProperties(json, res);
21363    if (json.has("type"))
21364      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), PlanDefinition.ActionParticipantType.NULL, new PlanDefinition.ActionParticipantTypeEnumFactory()));
21365    if (json.has("_type"))
21366      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
21367    if (json.has("role"))
21368      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
21369  }
21370
21371  protected PlanDefinition.PlanDefinitionActionDynamicValueComponent parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
21372    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
21373    parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(json, owner, res);
21374    return res;
21375  }
21376
21377  protected void parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionDynamicValueComponent res) throws IOException, FHIRFormatError {
21378    parseBackboneElementProperties(json, res);
21379    if (json.has("path"))
21380      res.setPathElement(parseString(json.get("path").getAsString()));
21381    if (json.has("_path"))
21382      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
21383    if (json.has("expression"))
21384      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
21385  }
21386
21387  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
21388    Practitioner res = new Practitioner();
21389    parsePractitionerProperties(json, res);
21390    return res;
21391  }
21392
21393  protected void parsePractitionerProperties(JsonObject json, Practitioner res) throws IOException, FHIRFormatError {
21394    parseDomainResourceProperties(json, res);
21395    if (json.has("identifier")) {
21396      JsonArray array = json.getAsJsonArray("identifier");
21397      for (int i = 0; i < array.size(); i++) {
21398        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21399      }
21400    };
21401    if (json.has("active"))
21402      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
21403    if (json.has("_active"))
21404      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
21405    if (json.has("name")) {
21406      JsonArray array = json.getAsJsonArray("name");
21407      for (int i = 0; i < array.size(); i++) {
21408        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
21409      }
21410    };
21411    if (json.has("telecom")) {
21412      JsonArray array = json.getAsJsonArray("telecom");
21413      for (int i = 0; i < array.size(); i++) {
21414        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
21415      }
21416    };
21417    if (json.has("address")) {
21418      JsonArray array = json.getAsJsonArray("address");
21419      for (int i = 0; i < array.size(); i++) {
21420        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
21421      }
21422    };
21423    if (json.has("gender"))
21424      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
21425    if (json.has("_gender"))
21426      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
21427    if (json.has("birthDate"))
21428      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
21429    if (json.has("_birthDate"))
21430      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
21431    if (json.has("photo")) {
21432      JsonArray array = json.getAsJsonArray("photo");
21433      for (int i = 0; i < array.size(); i++) {
21434        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
21435      }
21436    };
21437    if (json.has("qualification")) {
21438      JsonArray array = json.getAsJsonArray("qualification");
21439      for (int i = 0; i < array.size(); i++) {
21440        res.getQualification().add(parsePractitionerPractitionerQualificationComponent(array.get(i).getAsJsonObject(), res));
21441      }
21442    };
21443    if (json.has("communication")) {
21444      JsonArray array = json.getAsJsonArray("communication");
21445      for (int i = 0; i < array.size(); i++) {
21446        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21447      }
21448    };
21449  }
21450
21451  protected Practitioner.PractitionerQualificationComponent parsePractitionerPractitionerQualificationComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
21452    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
21453    parsePractitionerPractitionerQualificationComponentProperties(json, owner, res);
21454    return res;
21455  }
21456
21457  protected void parsePractitionerPractitionerQualificationComponentProperties(JsonObject json, Practitioner owner, Practitioner.PractitionerQualificationComponent res) throws IOException, FHIRFormatError {
21458    parseBackboneElementProperties(json, res);
21459    if (json.has("identifier")) {
21460      JsonArray array = json.getAsJsonArray("identifier");
21461      for (int i = 0; i < array.size(); i++) {
21462        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21463      }
21464    };
21465    if (json.has("code"))
21466      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
21467    if (json.has("period"))
21468      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
21469    if (json.has("issuer"))
21470      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
21471  }
21472
21473  protected PractitionerRole parsePractitionerRole(JsonObject json) throws IOException, FHIRFormatError {
21474    PractitionerRole res = new PractitionerRole();
21475    parsePractitionerRoleProperties(json, res);
21476    return res;
21477  }
21478
21479  protected void parsePractitionerRoleProperties(JsonObject json, PractitionerRole res) throws IOException, FHIRFormatError {
21480    parseDomainResourceProperties(json, res);
21481    if (json.has("identifier")) {
21482      JsonArray array = json.getAsJsonArray("identifier");
21483      for (int i = 0; i < array.size(); i++) {
21484        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21485      }
21486    };
21487    if (json.has("active"))
21488      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
21489    if (json.has("_active"))
21490      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
21491    if (json.has("period"))
21492      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
21493    if (json.has("practitioner"))
21494      res.setPractitioner(parseReference(json.getAsJsonObject("practitioner")));
21495    if (json.has("organization"))
21496      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
21497    if (json.has("code")) {
21498      JsonArray array = json.getAsJsonArray("code");
21499      for (int i = 0; i < array.size(); i++) {
21500        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21501      }
21502    };
21503    if (json.has("specialty")) {
21504      JsonArray array = json.getAsJsonArray("specialty");
21505      for (int i = 0; i < array.size(); i++) {
21506        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21507      }
21508    };
21509    if (json.has("location")) {
21510      JsonArray array = json.getAsJsonArray("location");
21511      for (int i = 0; i < array.size(); i++) {
21512        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
21513      }
21514    };
21515    if (json.has("healthcareService")) {
21516      JsonArray array = json.getAsJsonArray("healthcareService");
21517      for (int i = 0; i < array.size(); i++) {
21518        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
21519      }
21520    };
21521    if (json.has("telecom")) {
21522      JsonArray array = json.getAsJsonArray("telecom");
21523      for (int i = 0; i < array.size(); i++) {
21524        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
21525      }
21526    };
21527    if (json.has("availableTime")) {
21528      JsonArray array = json.getAsJsonArray("availableTime");
21529      for (int i = 0; i < array.size(); i++) {
21530        res.getAvailableTime().add(parsePractitionerRolePractitionerRoleAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
21531      }
21532    };
21533    if (json.has("notAvailable")) {
21534      JsonArray array = json.getAsJsonArray("notAvailable");
21535      for (int i = 0; i < array.size(); i++) {
21536        res.getNotAvailable().add(parsePractitionerRolePractitionerRoleNotAvailableComponent(array.get(i).getAsJsonObject(), res));
21537      }
21538    };
21539    if (json.has("availabilityExceptions"))
21540      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
21541    if (json.has("_availabilityExceptions"))
21542      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
21543    if (json.has("endpoint")) {
21544      JsonArray array = json.getAsJsonArray("endpoint");
21545      for (int i = 0; i < array.size(); i++) {
21546        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
21547      }
21548    };
21549  }
21550
21551  protected PractitionerRole.PractitionerRoleAvailableTimeComponent parsePractitionerRolePractitionerRoleAvailableTimeComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
21552    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
21553    parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(json, owner, res);
21554    return res;
21555  }
21556
21557  protected void parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleAvailableTimeComponent res) throws IOException, FHIRFormatError {
21558    parseBackboneElementProperties(json, res);
21559    if (json.has("daysOfWeek")) {
21560      JsonArray array = json.getAsJsonArray("daysOfWeek");
21561      for (int i = 0; i < array.size(); i++) {
21562        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
21563      }
21564    };
21565    if (json.has("_daysOfWeek")) {
21566      JsonArray array = json.getAsJsonArray("_daysOfWeek");
21567      for (int i = 0; i < array.size(); i++) {
21568        if (i == res.getDaysOfWeek().size())
21569          res.getDaysOfWeek().add(parseEnumeration(null, PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
21570        if (array.get(i) instanceof JsonObject) 
21571          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
21572      }
21573    };
21574    if (json.has("allDay"))
21575      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
21576    if (json.has("_allDay"))
21577      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
21578    if (json.has("availableStartTime"))
21579      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
21580    if (json.has("_availableStartTime"))
21581      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
21582    if (json.has("availableEndTime"))
21583      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
21584    if (json.has("_availableEndTime"))
21585      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
21586  }
21587
21588  protected PractitionerRole.PractitionerRoleNotAvailableComponent parsePractitionerRolePractitionerRoleNotAvailableComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
21589    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
21590    parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(json, owner, res);
21591    return res;
21592  }
21593
21594  protected void parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleNotAvailableComponent res) throws IOException, FHIRFormatError {
21595    parseBackboneElementProperties(json, res);
21596    if (json.has("description"))
21597      res.setDescriptionElement(parseString(json.get("description").getAsString()));
21598    if (json.has("_description"))
21599      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21600    if (json.has("during"))
21601      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
21602  }
21603
21604  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
21605    Procedure res = new Procedure();
21606    parseProcedureProperties(json, res);
21607    return res;
21608  }
21609
21610  protected void parseProcedureProperties(JsonObject json, Procedure res) throws IOException, FHIRFormatError {
21611    parseDomainResourceProperties(json, res);
21612    if (json.has("identifier")) {
21613      JsonArray array = json.getAsJsonArray("identifier");
21614      for (int i = 0; i < array.size(); i++) {
21615        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21616      }
21617    };
21618    if (json.has("instantiatesCanonical")) {
21619      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
21620      for (int i = 0; i < array.size(); i++) {
21621        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
21622      }
21623    };
21624    if (json.has("_instantiatesCanonical")) {
21625      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
21626      for (int i = 0; i < array.size(); i++) {
21627        if (i == res.getInstantiatesCanonical().size())
21628          res.getInstantiatesCanonical().add(parseCanonical(null));
21629        if (array.get(i) instanceof JsonObject) 
21630          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
21631      }
21632    };
21633    if (json.has("instantiatesUri")) {
21634      JsonArray array = json.getAsJsonArray("instantiatesUri");
21635      for (int i = 0; i < array.size(); i++) {
21636        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
21637      }
21638    };
21639    if (json.has("_instantiatesUri")) {
21640      JsonArray array = json.getAsJsonArray("_instantiatesUri");
21641      for (int i = 0; i < array.size(); i++) {
21642        if (i == res.getInstantiatesUri().size())
21643          res.getInstantiatesUri().add(parseUri(null));
21644        if (array.get(i) instanceof JsonObject) 
21645          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
21646      }
21647    };
21648    if (json.has("basedOn")) {
21649      JsonArray array = json.getAsJsonArray("basedOn");
21650      for (int i = 0; i < array.size(); i++) {
21651        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
21652      }
21653    };
21654    if (json.has("partOf")) {
21655      JsonArray array = json.getAsJsonArray("partOf");
21656      for (int i = 0; i < array.size(); i++) {
21657        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
21658      }
21659    };
21660    if (json.has("status"))
21661      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Procedure.ProcedureStatus.NULL, new Procedure.ProcedureStatusEnumFactory()));
21662    if (json.has("_status"))
21663      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21664    if (json.has("statusReason"))
21665      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
21666    if (json.has("category")) {
21667      JsonArray array = json.getAsJsonArray("category");
21668      for (int i = 0; i < array.size(); i++) {
21669        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21670      }
21671    };
21672    if (json.has("code"))
21673      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
21674    if (json.has("subject"))
21675      res.setSubject(parseReference(json.getAsJsonObject("subject")));
21676    if (json.has("encounter"))
21677      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
21678    Type occurrence = parseType("occurrence", json);
21679    if (occurrence != null)
21680      res.setOccurrence(occurrence);
21681    if (json.has("recorded"))
21682      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
21683    if (json.has("_recorded"))
21684      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
21685    if (json.has("recorder"))
21686      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
21687    Type reported = parseType("reported", json);
21688    if (reported != null)
21689      res.setReported(reported);
21690    if (json.has("performer")) {
21691      JsonArray array = json.getAsJsonArray("performer");
21692      for (int i = 0; i < array.size(); i++) {
21693        res.getPerformer().add(parseProcedureProcedurePerformerComponent(array.get(i).getAsJsonObject(), res));
21694      }
21695    };
21696    if (json.has("location"))
21697      res.setLocation(parseReference(json.getAsJsonObject("location")));
21698    if (json.has("reasonCode")) {
21699      JsonArray array = json.getAsJsonArray("reasonCode");
21700      for (int i = 0; i < array.size(); i++) {
21701        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21702      }
21703    };
21704    if (json.has("reasonReference")) {
21705      JsonArray array = json.getAsJsonArray("reasonReference");
21706      for (int i = 0; i < array.size(); i++) {
21707        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
21708      }
21709    };
21710    if (json.has("bodySite")) {
21711      JsonArray array = json.getAsJsonArray("bodySite");
21712      for (int i = 0; i < array.size(); i++) {
21713        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21714      }
21715    };
21716    if (json.has("outcome"))
21717      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
21718    if (json.has("report")) {
21719      JsonArray array = json.getAsJsonArray("report");
21720      for (int i = 0; i < array.size(); i++) {
21721        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
21722      }
21723    };
21724    if (json.has("complication")) {
21725      JsonArray array = json.getAsJsonArray("complication");
21726      for (int i = 0; i < array.size(); i++) {
21727        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21728      }
21729    };
21730    if (json.has("complicationDetail")) {
21731      JsonArray array = json.getAsJsonArray("complicationDetail");
21732      for (int i = 0; i < array.size(); i++) {
21733        res.getComplicationDetail().add(parseReference(array.get(i).getAsJsonObject()));
21734      }
21735    };
21736    if (json.has("followUp")) {
21737      JsonArray array = json.getAsJsonArray("followUp");
21738      for (int i = 0; i < array.size(); i++) {
21739        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21740      }
21741    };
21742    if (json.has("note")) {
21743      JsonArray array = json.getAsJsonArray("note");
21744      for (int i = 0; i < array.size(); i++) {
21745        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
21746      }
21747    };
21748    if (json.has("focalDevice")) {
21749      JsonArray array = json.getAsJsonArray("focalDevice");
21750      for (int i = 0; i < array.size(); i++) {
21751        res.getFocalDevice().add(parseProcedureProcedureFocalDeviceComponent(array.get(i).getAsJsonObject(), res));
21752      }
21753    };
21754    if (json.has("usedReference")) {
21755      JsonArray array = json.getAsJsonArray("usedReference");
21756      for (int i = 0; i < array.size(); i++) {
21757        res.getUsedReference().add(parseReference(array.get(i).getAsJsonObject()));
21758      }
21759    };
21760    if (json.has("usedCode")) {
21761      JsonArray array = json.getAsJsonArray("usedCode");
21762      for (int i = 0; i < array.size(); i++) {
21763        res.getUsedCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21764      }
21765    };
21766  }
21767
21768  protected Procedure.ProcedurePerformerComponent parseProcedureProcedurePerformerComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
21769    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
21770    parseProcedureProcedurePerformerComponentProperties(json, owner, res);
21771    return res;
21772  }
21773
21774  protected void parseProcedureProcedurePerformerComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedurePerformerComponent res) throws IOException, FHIRFormatError {
21775    parseBackboneElementProperties(json, res);
21776    if (json.has("function"))
21777      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
21778    if (json.has("actor"))
21779      res.setActor(parseReference(json.getAsJsonObject("actor")));
21780    if (json.has("onBehalfOf"))
21781      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
21782  }
21783
21784  protected Procedure.ProcedureFocalDeviceComponent parseProcedureProcedureFocalDeviceComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
21785    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
21786    parseProcedureProcedureFocalDeviceComponentProperties(json, owner, res);
21787    return res;
21788  }
21789
21790  protected void parseProcedureProcedureFocalDeviceComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedureFocalDeviceComponent res) throws IOException, FHIRFormatError {
21791    parseBackboneElementProperties(json, res);
21792    if (json.has("action"))
21793      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
21794    if (json.has("manipulated"))
21795      res.setManipulated(parseReference(json.getAsJsonObject("manipulated")));
21796  }
21797
21798  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
21799    Provenance res = new Provenance();
21800    parseProvenanceProperties(json, res);
21801    return res;
21802  }
21803
21804  protected void parseProvenanceProperties(JsonObject json, Provenance res) throws IOException, FHIRFormatError {
21805    parseDomainResourceProperties(json, res);
21806    if (json.has("target")) {
21807      JsonArray array = json.getAsJsonArray("target");
21808      for (int i = 0; i < array.size(); i++) {
21809        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
21810      }
21811    };
21812    Type occurred = parseType("occurred", json);
21813    if (occurred != null)
21814      res.setOccurred(occurred);
21815    if (json.has("recorded"))
21816      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
21817    if (json.has("_recorded"))
21818      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
21819    if (json.has("policy")) {
21820      JsonArray array = json.getAsJsonArray("policy");
21821      for (int i = 0; i < array.size(); i++) {
21822        res.getPolicy().add(parseUri(array.get(i).getAsString()));
21823      }
21824    };
21825    if (json.has("_policy")) {
21826      JsonArray array = json.getAsJsonArray("_policy");
21827      for (int i = 0; i < array.size(); i++) {
21828        if (i == res.getPolicy().size())
21829          res.getPolicy().add(parseUri(null));
21830        if (array.get(i) instanceof JsonObject) 
21831          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
21832      }
21833    };
21834    if (json.has("location"))
21835      res.setLocation(parseReference(json.getAsJsonObject("location")));
21836    if (json.has("reason")) {
21837      JsonArray array = json.getAsJsonArray("reason");
21838      for (int i = 0; i < array.size(); i++) {
21839        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21840      }
21841    };
21842    if (json.has("activity"))
21843      res.setActivity(parseCodeableConcept(json.getAsJsonObject("activity")));
21844    if (json.has("agent")) {
21845      JsonArray array = json.getAsJsonArray("agent");
21846      for (int i = 0; i < array.size(); i++) {
21847        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), res));
21848      }
21849    };
21850    if (json.has("entity")) {
21851      JsonArray array = json.getAsJsonArray("entity");
21852      for (int i = 0; i < array.size(); i++) {
21853        res.getEntity().add(parseProvenanceProvenanceEntityComponent(array.get(i).getAsJsonObject(), res));
21854      }
21855    };
21856    if (json.has("signature")) {
21857      JsonArray array = json.getAsJsonArray("signature");
21858      for (int i = 0; i < array.size(); i++) {
21859        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
21860      }
21861    };
21862  }
21863
21864  protected Provenance.ProvenanceAgentComponent parseProvenanceProvenanceAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
21865    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
21866    parseProvenanceProvenanceAgentComponentProperties(json, owner, res);
21867    return res;
21868  }
21869
21870  protected void parseProvenanceProvenanceAgentComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceAgentComponent res) throws IOException, FHIRFormatError {
21871    parseBackboneElementProperties(json, res);
21872    if (json.has("type"))
21873      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21874    if (json.has("role")) {
21875      JsonArray array = json.getAsJsonArray("role");
21876      for (int i = 0; i < array.size(); i++) {
21877        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21878      }
21879    };
21880    if (json.has("who"))
21881      res.setWho(parseReference(json.getAsJsonObject("who")));
21882    if (json.has("onBehalfOf"))
21883      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
21884  }
21885
21886  protected Provenance.ProvenanceEntityComponent parseProvenanceProvenanceEntityComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
21887    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
21888    parseProvenanceProvenanceEntityComponentProperties(json, owner, res);
21889    return res;
21890  }
21891
21892  protected void parseProvenanceProvenanceEntityComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceEntityComponent res) throws IOException, FHIRFormatError {
21893    parseBackboneElementProperties(json, res);
21894    if (json.has("role"))
21895      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
21896    if (json.has("_role"))
21897      parseElementProperties(json.getAsJsonObject("_role"), res.getRoleElement());
21898    if (json.has("what"))
21899      res.setWhat(parseReference(json.getAsJsonObject("what")));
21900    if (json.has("agent")) {
21901      JsonArray array = json.getAsJsonArray("agent");
21902      for (int i = 0; i < array.size(); i++) {
21903        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), owner));
21904      }
21905    };
21906  }
21907
21908  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
21909    Questionnaire res = new Questionnaire();
21910    parseQuestionnaireProperties(json, res);
21911    return res;
21912  }
21913
21914  protected void parseQuestionnaireProperties(JsonObject json, Questionnaire res) throws IOException, FHIRFormatError {
21915    parseDomainResourceProperties(json, res);
21916    if (json.has("url"))
21917      res.setUrlElement(parseUri(json.get("url").getAsString()));
21918    if (json.has("_url"))
21919      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
21920    if (json.has("identifier")) {
21921      JsonArray array = json.getAsJsonArray("identifier");
21922      for (int i = 0; i < array.size(); i++) {
21923        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21924      }
21925    };
21926    if (json.has("version"))
21927      res.setVersionElement(parseString(json.get("version").getAsString()));
21928    if (json.has("_version"))
21929      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
21930    if (json.has("name"))
21931      res.setNameElement(parseString(json.get("name").getAsString()));
21932    if (json.has("_name"))
21933      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21934    if (json.has("title"))
21935      res.setTitleElement(parseString(json.get("title").getAsString()));
21936    if (json.has("_title"))
21937      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
21938    if (json.has("derivedFrom")) {
21939      JsonArray array = json.getAsJsonArray("derivedFrom");
21940      for (int i = 0; i < array.size(); i++) {
21941        res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
21942      }
21943    };
21944    if (json.has("_derivedFrom")) {
21945      JsonArray array = json.getAsJsonArray("_derivedFrom");
21946      for (int i = 0; i < array.size(); i++) {
21947        if (i == res.getDerivedFrom().size())
21948          res.getDerivedFrom().add(parseCanonical(null));
21949        if (array.get(i) instanceof JsonObject) 
21950          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
21951      }
21952    };
21953    if (json.has("status"))
21954      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
21955    if (json.has("_status"))
21956      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21957    if (json.has("experimental"))
21958      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
21959    if (json.has("_experimental"))
21960      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
21961    if (json.has("subjectType")) {
21962      JsonArray array = json.getAsJsonArray("subjectType");
21963      for (int i = 0; i < array.size(); i++) {
21964        res.getSubjectType().add(parseCode(array.get(i).getAsString()));
21965      }
21966    };
21967    if (json.has("_subjectType")) {
21968      JsonArray array = json.getAsJsonArray("_subjectType");
21969      for (int i = 0; i < array.size(); i++) {
21970        if (i == res.getSubjectType().size())
21971          res.getSubjectType().add(parseCode(null));
21972        if (array.get(i) instanceof JsonObject) 
21973          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
21974      }
21975    };
21976    if (json.has("date"))
21977      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21978    if (json.has("_date"))
21979      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
21980    if (json.has("publisher"))
21981      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21982    if (json.has("_publisher"))
21983      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
21984    if (json.has("contact")) {
21985      JsonArray array = json.getAsJsonArray("contact");
21986      for (int i = 0; i < array.size(); i++) {
21987        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21988      }
21989    };
21990    if (json.has("description"))
21991      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21992    if (json.has("_description"))
21993      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21994    if (json.has("useContext")) {
21995      JsonArray array = json.getAsJsonArray("useContext");
21996      for (int i = 0; i < array.size(); i++) {
21997        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21998      }
21999    };
22000    if (json.has("jurisdiction")) {
22001      JsonArray array = json.getAsJsonArray("jurisdiction");
22002      for (int i = 0; i < array.size(); i++) {
22003        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22004      }
22005    };
22006    if (json.has("purpose"))
22007      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
22008    if (json.has("_purpose"))
22009      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
22010    if (json.has("copyright"))
22011      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
22012    if (json.has("_copyright"))
22013      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
22014    if (json.has("approvalDate"))
22015      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
22016    if (json.has("_approvalDate"))
22017      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
22018    if (json.has("lastReviewDate"))
22019      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
22020    if (json.has("_lastReviewDate"))
22021      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
22022    if (json.has("effectivePeriod"))
22023      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
22024    if (json.has("code")) {
22025      JsonArray array = json.getAsJsonArray("code");
22026      for (int i = 0; i < array.size(); i++) {
22027        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
22028      }
22029    };
22030    if (json.has("item")) {
22031      JsonArray array = json.getAsJsonArray("item");
22032      for (int i = 0; i < array.size(); i++) {
22033        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), res));
22034      }
22035    };
22036  }
22037
22038  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireQuestionnaireItemComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
22039    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
22040    parseQuestionnaireQuestionnaireItemComponentProperties(json, owner, res);
22041    return res;
22042  }
22043
22044  protected void parseQuestionnaireQuestionnaireItemComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemComponent res) throws IOException, FHIRFormatError {
22045    parseBackboneElementProperties(json, res);
22046    if (json.has("linkId"))
22047      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
22048    if (json.has("_linkId"))
22049      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
22050    if (json.has("definition"))
22051      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
22052    if (json.has("_definition"))
22053      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
22054    if (json.has("code")) {
22055      JsonArray array = json.getAsJsonArray("code");
22056      for (int i = 0; i < array.size(); i++) {
22057        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
22058      }
22059    };
22060    if (json.has("prefix"))
22061      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
22062    if (json.has("_prefix"))
22063      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
22064    if (json.has("text"))
22065      res.setTextElement(parseString(json.get("text").getAsString()));
22066    if (json.has("_text"))
22067      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
22068    if (json.has("type"))
22069      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.QuestionnaireItemType.NULL, new Questionnaire.QuestionnaireItemTypeEnumFactory()));
22070    if (json.has("_type"))
22071      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
22072    if (json.has("enableWhen")) {
22073      JsonArray array = json.getAsJsonArray("enableWhen");
22074      for (int i = 0; i < array.size(); i++) {
22075        res.getEnableWhen().add(parseQuestionnaireQuestionnaireItemEnableWhenComponent(array.get(i).getAsJsonObject(), owner));
22076      }
22077    };
22078    if (json.has("enableBehavior"))
22079      res.setEnableBehaviorElement(parseEnumeration(json.get("enableBehavior").getAsString(), Questionnaire.EnableWhenBehavior.NULL, new Questionnaire.EnableWhenBehaviorEnumFactory()));
22080    if (json.has("_enableBehavior"))
22081      parseElementProperties(json.getAsJsonObject("_enableBehavior"), res.getEnableBehaviorElement());
22082    if (json.has("required"))
22083      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
22084    if (json.has("_required"))
22085      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
22086    if (json.has("repeats"))
22087      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
22088    if (json.has("_repeats"))
22089      parseElementProperties(json.getAsJsonObject("_repeats"), res.getRepeatsElement());
22090    if (json.has("readOnly"))
22091      res.setReadOnlyElement(parseBoolean(json.get("readOnly").getAsBoolean()));
22092    if (json.has("_readOnly"))
22093      parseElementProperties(json.getAsJsonObject("_readOnly"), res.getReadOnlyElement());
22094    if (json.has("maxLength"))
22095      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
22096    if (json.has("_maxLength"))
22097      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
22098    if (json.has("answerValueSet"))
22099      res.setAnswerValueSetElement(parseCanonical(json.get("answerValueSet").getAsString()));
22100    if (json.has("_answerValueSet"))
22101      parseElementProperties(json.getAsJsonObject("_answerValueSet"), res.getAnswerValueSetElement());
22102    if (json.has("answerOption")) {
22103      JsonArray array = json.getAsJsonArray("answerOption");
22104      for (int i = 0; i < array.size(); i++) {
22105        res.getAnswerOption().add(parseQuestionnaireQuestionnaireItemAnswerOptionComponent(array.get(i).getAsJsonObject(), owner));
22106      }
22107    };
22108    if (json.has("initial")) {
22109      JsonArray array = json.getAsJsonArray("initial");
22110      for (int i = 0; i < array.size(); i++) {
22111        res.getInitial().add(parseQuestionnaireQuestionnaireItemInitialComponent(array.get(i).getAsJsonObject(), owner));
22112      }
22113    };
22114    if (json.has("item")) {
22115      JsonArray array = json.getAsJsonArray("item");
22116      for (int i = 0; i < array.size(); i++) {
22117        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), owner));
22118      }
22119    };
22120  }
22121
22122  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireQuestionnaireItemEnableWhenComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
22123    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
22124    parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(json, owner, res);
22125    return res;
22126  }
22127
22128  protected void parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemEnableWhenComponent res) throws IOException, FHIRFormatError {
22129    parseBackboneElementProperties(json, res);
22130    if (json.has("question"))
22131      res.setQuestionElement(parseString(json.get("question").getAsString()));
22132    if (json.has("_question"))
22133      parseElementProperties(json.getAsJsonObject("_question"), res.getQuestionElement());
22134    if (json.has("operator"))
22135      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), Questionnaire.QuestionnaireItemOperator.NULL, new Questionnaire.QuestionnaireItemOperatorEnumFactory()));
22136    if (json.has("_operator"))
22137      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
22138    Type answer = parseType("answer", json);
22139    if (answer != null)
22140      res.setAnswer(answer);
22141  }
22142
22143  protected Questionnaire.QuestionnaireItemAnswerOptionComponent parseQuestionnaireQuestionnaireItemAnswerOptionComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
22144    Questionnaire.QuestionnaireItemAnswerOptionComponent res = new Questionnaire.QuestionnaireItemAnswerOptionComponent();
22145    parseQuestionnaireQuestionnaireItemAnswerOptionComponentProperties(json, owner, res);
22146    return res;
22147  }
22148
22149  protected void parseQuestionnaireQuestionnaireItemAnswerOptionComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemAnswerOptionComponent res) throws IOException, FHIRFormatError {
22150    parseBackboneElementProperties(json, res);
22151    Type value = parseType("value", json);
22152    if (value != null)
22153      res.setValue(value);
22154    if (json.has("initialSelected"))
22155      res.setInitialSelectedElement(parseBoolean(json.get("initialSelected").getAsBoolean()));
22156    if (json.has("_initialSelected"))
22157      parseElementProperties(json.getAsJsonObject("_initialSelected"), res.getInitialSelectedElement());
22158  }
22159
22160  protected Questionnaire.QuestionnaireItemInitialComponent parseQuestionnaireQuestionnaireItemInitialComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
22161    Questionnaire.QuestionnaireItemInitialComponent res = new Questionnaire.QuestionnaireItemInitialComponent();
22162    parseQuestionnaireQuestionnaireItemInitialComponentProperties(json, owner, res);
22163    return res;
22164  }
22165
22166  protected void parseQuestionnaireQuestionnaireItemInitialComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemInitialComponent res) throws IOException, FHIRFormatError {
22167    parseBackboneElementProperties(json, res);
22168    Type value = parseType("value", json);
22169    if (value != null)
22170      res.setValue(value);
22171  }
22172
22173  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
22174    QuestionnaireResponse res = new QuestionnaireResponse();
22175    parseQuestionnaireResponseProperties(json, res);
22176    return res;
22177  }
22178
22179  protected void parseQuestionnaireResponseProperties(JsonObject json, QuestionnaireResponse res) throws IOException, FHIRFormatError {
22180    parseDomainResourceProperties(json, res);
22181    if (json.has("identifier"))
22182      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
22183    if (json.has("basedOn")) {
22184      JsonArray array = json.getAsJsonArray("basedOn");
22185      for (int i = 0; i < array.size(); i++) {
22186        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
22187      }
22188    };
22189    if (json.has("partOf")) {
22190      JsonArray array = json.getAsJsonArray("partOf");
22191      for (int i = 0; i < array.size(); i++) {
22192        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
22193      }
22194    };
22195    if (json.has("questionnaire"))
22196      res.setQuestionnaireElement(parseCanonical(json.get("questionnaire").getAsString()));
22197    if (json.has("_questionnaire"))
22198      parseElementProperties(json.getAsJsonObject("_questionnaire"), res.getQuestionnaireElement());
22199    if (json.has("status"))
22200      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
22201    if (json.has("_status"))
22202      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22203    if (json.has("subject"))
22204      res.setSubject(parseReference(json.getAsJsonObject("subject")));
22205    if (json.has("encounter"))
22206      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
22207    if (json.has("authored"))
22208      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
22209    if (json.has("_authored"))
22210      parseElementProperties(json.getAsJsonObject("_authored"), res.getAuthoredElement());
22211    if (json.has("author"))
22212      res.setAuthor(parseReference(json.getAsJsonObject("author")));
22213    if (json.has("source"))
22214      res.setSource(parseReference(json.getAsJsonObject("source")));
22215    if (json.has("item")) {
22216      JsonArray array = json.getAsJsonArray("item");
22217      for (int i = 0; i < array.size(); i++) {
22218        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), res));
22219      }
22220    };
22221  }
22222
22223  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseQuestionnaireResponseItemComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
22224    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
22225    parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(json, owner, res);
22226    return res;
22227  }
22228
22229  protected void parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemComponent res) throws IOException, FHIRFormatError {
22230    parseBackboneElementProperties(json, res);
22231    if (json.has("linkId"))
22232      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
22233    if (json.has("_linkId"))
22234      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
22235    if (json.has("definition"))
22236      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
22237    if (json.has("_definition"))
22238      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
22239    if (json.has("text"))
22240      res.setTextElement(parseString(json.get("text").getAsString()));
22241    if (json.has("_text"))
22242      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
22243    if (json.has("answer")) {
22244      JsonArray array = json.getAsJsonArray("answer");
22245      for (int i = 0; i < array.size(); i++) {
22246        res.getAnswer().add(parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(array.get(i).getAsJsonObject(), owner));
22247      }
22248    };
22249    if (json.has("item")) {
22250      JsonArray array = json.getAsJsonArray("item");
22251      for (int i = 0; i < array.size(); i++) {
22252        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
22253      }
22254    };
22255  }
22256
22257  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
22258    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
22259    parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(json, owner, res);
22260    return res;
22261  }
22262
22263  protected void parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res) throws IOException, FHIRFormatError {
22264    parseBackboneElementProperties(json, res);
22265    Type value = parseType("value", json);
22266    if (value != null)
22267      res.setValue(value);
22268    if (json.has("item")) {
22269      JsonArray array = json.getAsJsonArray("item");
22270      for (int i = 0; i < array.size(); i++) {
22271        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
22272      }
22273    };
22274  }
22275
22276  protected RegulatedAuthorization parseRegulatedAuthorization(JsonObject json) throws IOException, FHIRFormatError {
22277    RegulatedAuthorization res = new RegulatedAuthorization();
22278    parseRegulatedAuthorizationProperties(json, res);
22279    return res;
22280  }
22281
22282  protected void parseRegulatedAuthorizationProperties(JsonObject json, RegulatedAuthorization res) throws IOException, FHIRFormatError {
22283    parseDomainResourceProperties(json, res);
22284    if (json.has("identifier")) {
22285      JsonArray array = json.getAsJsonArray("identifier");
22286      for (int i = 0; i < array.size(); i++) {
22287        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22288      }
22289    };
22290    if (json.has("subject"))
22291      res.setSubject(parseReference(json.getAsJsonObject("subject")));
22292    if (json.has("type"))
22293      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22294    if (json.has("description"))
22295      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22296    if (json.has("_description"))
22297      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22298    if (json.has("region")) {
22299      JsonArray array = json.getAsJsonArray("region");
22300      for (int i = 0; i < array.size(); i++) {
22301        res.getRegion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22302      }
22303    };
22304    if (json.has("status"))
22305      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
22306    if (json.has("statusDate"))
22307      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
22308    if (json.has("_statusDate"))
22309      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
22310    if (json.has("validityPeriod"))
22311      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
22312    if (json.has("basis")) {
22313      JsonArray array = json.getAsJsonArray("basis");
22314      for (int i = 0; i < array.size(); i++) {
22315        res.getBasis().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22316      }
22317    };
22318    if (json.has("relatedDate")) {
22319      JsonArray array = json.getAsJsonArray("relatedDate");
22320      for (int i = 0; i < array.size(); i++) {
22321        res.getRelatedDate().add(parseRegulatedAuthorizationRegulatedAuthorizationRelatedDateComponent(array.get(i).getAsJsonObject(), res));
22322      }
22323    };
22324    if (json.has("jurisdictionalAuthorization")) {
22325      JsonArray array = json.getAsJsonArray("jurisdictionalAuthorization");
22326      for (int i = 0; i < array.size(); i++) {
22327        res.getJurisdictionalAuthorization().add(parseReference(array.get(i).getAsJsonObject()));
22328      }
22329    };
22330    if (json.has("holder"))
22331      res.setHolder(parseReference(json.getAsJsonObject("holder")));
22332    if (json.has("regulator"))
22333      res.setRegulator(parseReference(json.getAsJsonObject("regulator")));
22334    if (json.has("case"))
22335      res.setCase(parseRegulatedAuthorizationRegulatedAuthorizationCaseComponent(json.getAsJsonObject("case"), res));
22336  }
22337
22338  protected RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent parseRegulatedAuthorizationRegulatedAuthorizationRelatedDateComponent(JsonObject json, RegulatedAuthorization owner) throws IOException, FHIRFormatError {
22339    RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent res = new RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent();
22340    parseRegulatedAuthorizationRegulatedAuthorizationRelatedDateComponentProperties(json, owner, res);
22341    return res;
22342  }
22343
22344  protected void parseRegulatedAuthorizationRegulatedAuthorizationRelatedDateComponentProperties(JsonObject json, RegulatedAuthorization owner, RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent res) throws IOException, FHIRFormatError {
22345    parseBackboneElementProperties(json, res);
22346    Type date = parseType("date", json);
22347    if (date != null)
22348      res.setDate(date);
22349    if (json.has("type"))
22350      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22351  }
22352
22353  protected RegulatedAuthorization.RegulatedAuthorizationCaseComponent parseRegulatedAuthorizationRegulatedAuthorizationCaseComponent(JsonObject json, RegulatedAuthorization owner) throws IOException, FHIRFormatError {
22354    RegulatedAuthorization.RegulatedAuthorizationCaseComponent res = new RegulatedAuthorization.RegulatedAuthorizationCaseComponent();
22355    parseRegulatedAuthorizationRegulatedAuthorizationCaseComponentProperties(json, owner, res);
22356    return res;
22357  }
22358
22359  protected void parseRegulatedAuthorizationRegulatedAuthorizationCaseComponentProperties(JsonObject json, RegulatedAuthorization owner, RegulatedAuthorization.RegulatedAuthorizationCaseComponent res) throws IOException, FHIRFormatError {
22360    parseBackboneElementProperties(json, res);
22361    if (json.has("identifier"))
22362      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
22363    if (json.has("type"))
22364      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22365    if (json.has("status"))
22366      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
22367    Type date = parseType("date", json);
22368    if (date != null)
22369      res.setDate(date);
22370    if (json.has("application")) {
22371      JsonArray array = json.getAsJsonArray("application");
22372      for (int i = 0; i < array.size(); i++) {
22373        res.getApplication().add(parseRegulatedAuthorizationRegulatedAuthorizationCaseComponent(array.get(i).getAsJsonObject(), owner));
22374      }
22375    };
22376  }
22377
22378  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
22379    RelatedPerson res = new RelatedPerson();
22380    parseRelatedPersonProperties(json, res);
22381    return res;
22382  }
22383
22384  protected void parseRelatedPersonProperties(JsonObject json, RelatedPerson res) throws IOException, FHIRFormatError {
22385    parseDomainResourceProperties(json, res);
22386    if (json.has("identifier")) {
22387      JsonArray array = json.getAsJsonArray("identifier");
22388      for (int i = 0; i < array.size(); i++) {
22389        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22390      }
22391    };
22392    if (json.has("active"))
22393      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
22394    if (json.has("_active"))
22395      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
22396    if (json.has("patient"))
22397      res.setPatient(parseReference(json.getAsJsonObject("patient")));
22398    if (json.has("relationship")) {
22399      JsonArray array = json.getAsJsonArray("relationship");
22400      for (int i = 0; i < array.size(); i++) {
22401        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22402      }
22403    };
22404    if (json.has("name")) {
22405      JsonArray array = json.getAsJsonArray("name");
22406      for (int i = 0; i < array.size(); i++) {
22407        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
22408      }
22409    };
22410    if (json.has("telecom")) {
22411      JsonArray array = json.getAsJsonArray("telecom");
22412      for (int i = 0; i < array.size(); i++) {
22413        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
22414      }
22415    };
22416    if (json.has("gender"))
22417      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
22418    if (json.has("_gender"))
22419      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
22420    if (json.has("birthDate"))
22421      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
22422    if (json.has("_birthDate"))
22423      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
22424    if (json.has("address")) {
22425      JsonArray array = json.getAsJsonArray("address");
22426      for (int i = 0; i < array.size(); i++) {
22427        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
22428      }
22429    };
22430    if (json.has("photo")) {
22431      JsonArray array = json.getAsJsonArray("photo");
22432      for (int i = 0; i < array.size(); i++) {
22433        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
22434      }
22435    };
22436    if (json.has("period"))
22437      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
22438    if (json.has("communication")) {
22439      JsonArray array = json.getAsJsonArray("communication");
22440      for (int i = 0; i < array.size(); i++) {
22441        res.getCommunication().add(parseRelatedPersonRelatedPersonCommunicationComponent(array.get(i).getAsJsonObject(), res));
22442      }
22443    };
22444  }
22445
22446  protected RelatedPerson.RelatedPersonCommunicationComponent parseRelatedPersonRelatedPersonCommunicationComponent(JsonObject json, RelatedPerson owner) throws IOException, FHIRFormatError {
22447    RelatedPerson.RelatedPersonCommunicationComponent res = new RelatedPerson.RelatedPersonCommunicationComponent();
22448    parseRelatedPersonRelatedPersonCommunicationComponentProperties(json, owner, res);
22449    return res;
22450  }
22451
22452  protected void parseRelatedPersonRelatedPersonCommunicationComponentProperties(JsonObject json, RelatedPerson owner, RelatedPerson.RelatedPersonCommunicationComponent res) throws IOException, FHIRFormatError {
22453    parseBackboneElementProperties(json, res);
22454    if (json.has("language"))
22455      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
22456    if (json.has("preferred"))
22457      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
22458    if (json.has("_preferred"))
22459      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
22460  }
22461
22462  protected RequestGroup parseRequestGroup(JsonObject json) throws IOException, FHIRFormatError {
22463    RequestGroup res = new RequestGroup();
22464    parseRequestGroupProperties(json, res);
22465    return res;
22466  }
22467
22468  protected void parseRequestGroupProperties(JsonObject json, RequestGroup res) throws IOException, FHIRFormatError {
22469    parseDomainResourceProperties(json, res);
22470    if (json.has("identifier")) {
22471      JsonArray array = json.getAsJsonArray("identifier");
22472      for (int i = 0; i < array.size(); i++) {
22473        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22474      }
22475    };
22476    if (json.has("instantiatesCanonical")) {
22477      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
22478      for (int i = 0; i < array.size(); i++) {
22479        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
22480      }
22481    };
22482    if (json.has("_instantiatesCanonical")) {
22483      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
22484      for (int i = 0; i < array.size(); i++) {
22485        if (i == res.getInstantiatesCanonical().size())
22486          res.getInstantiatesCanonical().add(parseCanonical(null));
22487        if (array.get(i) instanceof JsonObject) 
22488          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
22489      }
22490    };
22491    if (json.has("instantiatesUri")) {
22492      JsonArray array = json.getAsJsonArray("instantiatesUri");
22493      for (int i = 0; i < array.size(); i++) {
22494        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
22495      }
22496    };
22497    if (json.has("_instantiatesUri")) {
22498      JsonArray array = json.getAsJsonArray("_instantiatesUri");
22499      for (int i = 0; i < array.size(); i++) {
22500        if (i == res.getInstantiatesUri().size())
22501          res.getInstantiatesUri().add(parseUri(null));
22502        if (array.get(i) instanceof JsonObject) 
22503          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
22504      }
22505    };
22506    if (json.has("basedOn")) {
22507      JsonArray array = json.getAsJsonArray("basedOn");
22508      for (int i = 0; i < array.size(); i++) {
22509        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
22510      }
22511    };
22512    if (json.has("replaces")) {
22513      JsonArray array = json.getAsJsonArray("replaces");
22514      for (int i = 0; i < array.size(); i++) {
22515        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
22516      }
22517    };
22518    if (json.has("groupIdentifier"))
22519      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
22520    if (json.has("status"))
22521      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RequestGroup.RequestStatus.NULL, new RequestGroup.RequestStatusEnumFactory()));
22522    if (json.has("_status"))
22523      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22524    if (json.has("intent"))
22525      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), RequestGroup.RequestIntent.NULL, new RequestGroup.RequestIntentEnumFactory()));
22526    if (json.has("_intent"))
22527      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
22528    if (json.has("priority"))
22529      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
22530    if (json.has("_priority"))
22531      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
22532    if (json.has("code"))
22533      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
22534    if (json.has("subject"))
22535      res.setSubject(parseReference(json.getAsJsonObject("subject")));
22536    if (json.has("encounter"))
22537      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
22538    if (json.has("authoredOn"))
22539      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
22540    if (json.has("_authoredOn"))
22541      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
22542    if (json.has("author"))
22543      res.setAuthor(parseReference(json.getAsJsonObject("author")));
22544    if (json.has("reasonCode")) {
22545      JsonArray array = json.getAsJsonArray("reasonCode");
22546      for (int i = 0; i < array.size(); i++) {
22547        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22548      }
22549    };
22550    if (json.has("reasonReference")) {
22551      JsonArray array = json.getAsJsonArray("reasonReference");
22552      for (int i = 0; i < array.size(); i++) {
22553        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
22554      }
22555    };
22556    if (json.has("note")) {
22557      JsonArray array = json.getAsJsonArray("note");
22558      for (int i = 0; i < array.size(); i++) {
22559        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22560      }
22561    };
22562    if (json.has("action")) {
22563      JsonArray array = json.getAsJsonArray("action");
22564      for (int i = 0; i < array.size(); i++) {
22565        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), res));
22566      }
22567    };
22568  }
22569
22570  protected RequestGroup.RequestGroupActionComponent parseRequestGroupRequestGroupActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
22571    RequestGroup.RequestGroupActionComponent res = new RequestGroup.RequestGroupActionComponent();
22572    parseRequestGroupRequestGroupActionComponentProperties(json, owner, res);
22573    return res;
22574  }
22575
22576  protected void parseRequestGroupRequestGroupActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionComponent res) throws IOException, FHIRFormatError {
22577    parseBackboneElementProperties(json, res);
22578    if (json.has("prefix"))
22579      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
22580    if (json.has("_prefix"))
22581      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
22582    if (json.has("title"))
22583      res.setTitleElement(parseString(json.get("title").getAsString()));
22584    if (json.has("_title"))
22585      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
22586    if (json.has("description"))
22587      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22588    if (json.has("_description"))
22589      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22590    if (json.has("textEquivalent"))
22591      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
22592    if (json.has("_textEquivalent"))
22593      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
22594    if (json.has("priority"))
22595      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
22596    if (json.has("_priority"))
22597      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
22598    if (json.has("code")) {
22599      JsonArray array = json.getAsJsonArray("code");
22600      for (int i = 0; i < array.size(); i++) {
22601        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22602      }
22603    };
22604    if (json.has("documentation")) {
22605      JsonArray array = json.getAsJsonArray("documentation");
22606      for (int i = 0; i < array.size(); i++) {
22607        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
22608      }
22609    };
22610    if (json.has("condition")) {
22611      JsonArray array = json.getAsJsonArray("condition");
22612      for (int i = 0; i < array.size(); i++) {
22613        res.getCondition().add(parseRequestGroupRequestGroupActionConditionComponent(array.get(i).getAsJsonObject(), owner));
22614      }
22615    };
22616    if (json.has("relatedAction")) {
22617      JsonArray array = json.getAsJsonArray("relatedAction");
22618      for (int i = 0; i < array.size(); i++) {
22619        res.getRelatedAction().add(parseRequestGroupRequestGroupActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
22620      }
22621    };
22622    Type timing = parseType("timing", json);
22623    if (timing != null)
22624      res.setTiming(timing);
22625    if (json.has("participant")) {
22626      JsonArray array = json.getAsJsonArray("participant");
22627      for (int i = 0; i < array.size(); i++) {
22628        res.getParticipant().add(parseReference(array.get(i).getAsJsonObject()));
22629      }
22630    };
22631    if (json.has("type"))
22632      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22633    if (json.has("groupingBehavior"))
22634      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), RequestGroup.ActionGroupingBehavior.NULL, new RequestGroup.ActionGroupingBehaviorEnumFactory()));
22635    if (json.has("_groupingBehavior"))
22636      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
22637    if (json.has("selectionBehavior"))
22638      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), RequestGroup.ActionSelectionBehavior.NULL, new RequestGroup.ActionSelectionBehaviorEnumFactory()));
22639    if (json.has("_selectionBehavior"))
22640      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
22641    if (json.has("requiredBehavior"))
22642      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), RequestGroup.ActionRequiredBehavior.NULL, new RequestGroup.ActionRequiredBehaviorEnumFactory()));
22643    if (json.has("_requiredBehavior"))
22644      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
22645    if (json.has("precheckBehavior"))
22646      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), RequestGroup.ActionPrecheckBehavior.NULL, new RequestGroup.ActionPrecheckBehaviorEnumFactory()));
22647    if (json.has("_precheckBehavior"))
22648      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
22649    if (json.has("cardinalityBehavior"))
22650      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), RequestGroup.ActionCardinalityBehavior.NULL, new RequestGroup.ActionCardinalityBehaviorEnumFactory()));
22651    if (json.has("_cardinalityBehavior"))
22652      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
22653    if (json.has("resource"))
22654      res.setResource(parseReference(json.getAsJsonObject("resource")));
22655    if (json.has("action")) {
22656      JsonArray array = json.getAsJsonArray("action");
22657      for (int i = 0; i < array.size(); i++) {
22658        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), owner));
22659      }
22660    };
22661  }
22662
22663  protected RequestGroup.RequestGroupActionConditionComponent parseRequestGroupRequestGroupActionConditionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
22664    RequestGroup.RequestGroupActionConditionComponent res = new RequestGroup.RequestGroupActionConditionComponent();
22665    parseRequestGroupRequestGroupActionConditionComponentProperties(json, owner, res);
22666    return res;
22667  }
22668
22669  protected void parseRequestGroupRequestGroupActionConditionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionConditionComponent res) throws IOException, FHIRFormatError {
22670    parseBackboneElementProperties(json, res);
22671    if (json.has("kind"))
22672      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), RequestGroup.ActionConditionKind.NULL, new RequestGroup.ActionConditionKindEnumFactory()));
22673    if (json.has("_kind"))
22674      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
22675    if (json.has("expression"))
22676      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
22677  }
22678
22679  protected RequestGroup.RequestGroupActionRelatedActionComponent parseRequestGroupRequestGroupActionRelatedActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
22680    RequestGroup.RequestGroupActionRelatedActionComponent res = new RequestGroup.RequestGroupActionRelatedActionComponent();
22681    parseRequestGroupRequestGroupActionRelatedActionComponentProperties(json, owner, res);
22682    return res;
22683      }
22684
22685  protected void parseRequestGroupRequestGroupActionRelatedActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionRelatedActionComponent res) throws IOException, FHIRFormatError {
22686    parseBackboneElementProperties(json, res);
22687    if (json.has("actionId"))
22688      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
22689    if (json.has("_actionId"))
22690      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
22691    if (json.has("relationship"))
22692      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), RequestGroup.ActionRelationshipType.NULL, new RequestGroup.ActionRelationshipTypeEnumFactory()));
22693    if (json.has("_relationship"))
22694      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
22695    Type offset = parseType("offset", json);
22696    if (offset != null)
22697      res.setOffset(offset);
22698  }
22699
22700  protected ResearchStudy parseResearchStudy(JsonObject json) throws IOException, FHIRFormatError {
22701    ResearchStudy res = new ResearchStudy();
22702    parseResearchStudyProperties(json, res);
22703    return res;
22704  }
22705
22706  protected void parseResearchStudyProperties(JsonObject json, ResearchStudy res) throws IOException, FHIRFormatError {
22707    parseDomainResourceProperties(json, res);
22708    if (json.has("identifier")) {
22709      JsonArray array = json.getAsJsonArray("identifier");
22710      for (int i = 0; i < array.size(); i++) {
22711        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22712      }
22713    };
22714    if (json.has("title"))
22715      res.setTitleElement(parseString(json.get("title").getAsString()));
22716    if (json.has("_title"))
22717      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
22718    if (json.has("protocol")) {
22719      JsonArray array = json.getAsJsonArray("protocol");
22720      for (int i = 0; i < array.size(); i++) {
22721        res.getProtocol().add(parseReference(array.get(i).getAsJsonObject()));
22722      }
22723    };
22724    if (json.has("partOf")) {
22725      JsonArray array = json.getAsJsonArray("partOf");
22726      for (int i = 0; i < array.size(); i++) {
22727        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
22728      }
22729    };
22730    if (json.has("status"))
22731      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchStudy.ResearchStudyStatus.NULL, new ResearchStudy.ResearchStudyStatusEnumFactory()));
22732    if (json.has("_status"))
22733      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22734    if (json.has("primaryPurposeType"))
22735      res.setPrimaryPurposeType(parseCodeableConcept(json.getAsJsonObject("primaryPurposeType")));
22736    if (json.has("phase"))
22737      res.setPhase(parseCodeableConcept(json.getAsJsonObject("phase")));
22738    if (json.has("category")) {
22739      JsonArray array = json.getAsJsonArray("category");
22740      for (int i = 0; i < array.size(); i++) {
22741        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22742      }
22743    };
22744    if (json.has("focus")) {
22745      JsonArray array = json.getAsJsonArray("focus");
22746      for (int i = 0; i < array.size(); i++) {
22747        res.getFocus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22748      }
22749    };
22750    if (json.has("condition")) {
22751      JsonArray array = json.getAsJsonArray("condition");
22752      for (int i = 0; i < array.size(); i++) {
22753        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22754      }
22755    };
22756    if (json.has("contact")) {
22757      JsonArray array = json.getAsJsonArray("contact");
22758      for (int i = 0; i < array.size(); i++) {
22759        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22760      }
22761    };
22762    if (json.has("relatedArtifact")) {
22763      JsonArray array = json.getAsJsonArray("relatedArtifact");
22764      for (int i = 0; i < array.size(); i++) {
22765        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
22766      }
22767    };
22768    if (json.has("keyword")) {
22769      JsonArray array = json.getAsJsonArray("keyword");
22770      for (int i = 0; i < array.size(); i++) {
22771        res.getKeyword().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22772      }
22773    };
22774    if (json.has("location")) {
22775      JsonArray array = json.getAsJsonArray("location");
22776      for (int i = 0; i < array.size(); i++) {
22777        res.getLocation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22778      }
22779    };
22780    if (json.has("description"))
22781      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22782    if (json.has("_description"))
22783      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22784    if (json.has("enrollment")) {
22785      JsonArray array = json.getAsJsonArray("enrollment");
22786      for (int i = 0; i < array.size(); i++) {
22787        res.getEnrollment().add(parseReference(array.get(i).getAsJsonObject()));
22788      }
22789    };
22790    if (json.has("period"))
22791      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
22792    if (json.has("sponsor"))
22793      res.setSponsor(parseReference(json.getAsJsonObject("sponsor")));
22794    if (json.has("principalInvestigator"))
22795      res.setPrincipalInvestigator(parseReference(json.getAsJsonObject("principalInvestigator")));
22796    if (json.has("site")) {
22797      JsonArray array = json.getAsJsonArray("site");
22798      for (int i = 0; i < array.size(); i++) {
22799        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
22800      }
22801    };
22802    if (json.has("reasonStopped"))
22803      res.setReasonStopped(parseCodeableConcept(json.getAsJsonObject("reasonStopped")));
22804    if (json.has("note")) {
22805      JsonArray array = json.getAsJsonArray("note");
22806      for (int i = 0; i < array.size(); i++) {
22807        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22808      }
22809    };
22810    if (json.has("arm")) {
22811      JsonArray array = json.getAsJsonArray("arm");
22812      for (int i = 0; i < array.size(); i++) {
22813        res.getArm().add(parseResearchStudyResearchStudyArmComponent(array.get(i).getAsJsonObject(), res));
22814      }
22815    };
22816    if (json.has("objective")) {
22817      JsonArray array = json.getAsJsonArray("objective");
22818      for (int i = 0; i < array.size(); i++) {
22819        res.getObjective().add(parseResearchStudyResearchStudyObjectiveComponent(array.get(i).getAsJsonObject(), res));
22820      }
22821    };
22822  }
22823
22824  protected ResearchStudy.ResearchStudyArmComponent parseResearchStudyResearchStudyArmComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
22825    ResearchStudy.ResearchStudyArmComponent res = new ResearchStudy.ResearchStudyArmComponent();
22826    parseResearchStudyResearchStudyArmComponentProperties(json, owner, res);
22827    return res;
22828  }
22829
22830  protected void parseResearchStudyResearchStudyArmComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyArmComponent res) throws IOException, FHIRFormatError {
22831    parseBackboneElementProperties(json, res);
22832    if (json.has("name"))
22833      res.setNameElement(parseString(json.get("name").getAsString()));
22834    if (json.has("_name"))
22835      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22836    if (json.has("type"))
22837      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22838    if (json.has("description"))
22839      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22840    if (json.has("_description"))
22841      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22842  }
22843
22844  protected ResearchStudy.ResearchStudyObjectiveComponent parseResearchStudyResearchStudyObjectiveComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
22845    ResearchStudy.ResearchStudyObjectiveComponent res = new ResearchStudy.ResearchStudyObjectiveComponent();
22846    parseResearchStudyResearchStudyObjectiveComponentProperties(json, owner, res);
22847    return res;
22848  }
22849
22850  protected void parseResearchStudyResearchStudyObjectiveComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyObjectiveComponent res) throws IOException, FHIRFormatError {
22851    parseBackboneElementProperties(json, res);
22852    if (json.has("name"))
22853      res.setNameElement(parseString(json.get("name").getAsString()));
22854    if (json.has("_name"))
22855      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22856    if (json.has("type"))
22857      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22858  }
22859
22860  protected ResearchSubject parseResearchSubject(JsonObject json) throws IOException, FHIRFormatError {
22861    ResearchSubject res = new ResearchSubject();
22862    parseResearchSubjectProperties(json, res);
22863    return res;
22864  }
22865
22866  protected void parseResearchSubjectProperties(JsonObject json, ResearchSubject res) throws IOException, FHIRFormatError {
22867    parseDomainResourceProperties(json, res);
22868    if (json.has("identifier")) {
22869      JsonArray array = json.getAsJsonArray("identifier");
22870      for (int i = 0; i < array.size(); i++) {
22871        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22872      }
22873    };
22874    if (json.has("status"))
22875      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchSubject.ResearchSubjectStatus.NULL, new ResearchSubject.ResearchSubjectStatusEnumFactory()));
22876    if (json.has("_status"))
22877      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22878    if (json.has("period"))
22879      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
22880    if (json.has("study"))
22881      res.setStudy(parseReference(json.getAsJsonObject("study")));
22882    if (json.has("individual"))
22883      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
22884    if (json.has("assignedArm"))
22885      res.setAssignedArmElement(parseString(json.get("assignedArm").getAsString()));
22886    if (json.has("_assignedArm"))
22887      parseElementProperties(json.getAsJsonObject("_assignedArm"), res.getAssignedArmElement());
22888    if (json.has("actualArm"))
22889      res.setActualArmElement(parseString(json.get("actualArm").getAsString()));
22890    if (json.has("_actualArm"))
22891      parseElementProperties(json.getAsJsonObject("_actualArm"), res.getActualArmElement());
22892    if (json.has("consent"))
22893      res.setConsent(parseReference(json.getAsJsonObject("consent")));
22894  }
22895
22896  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
22897    RiskAssessment res = new RiskAssessment();
22898    parseRiskAssessmentProperties(json, res);
22899    return res;
22900  }
22901
22902  protected void parseRiskAssessmentProperties(JsonObject json, RiskAssessment res) throws IOException, FHIRFormatError {
22903    parseDomainResourceProperties(json, res);
22904    if (json.has("identifier")) {
22905      JsonArray array = json.getAsJsonArray("identifier");
22906      for (int i = 0; i < array.size(); i++) {
22907        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22908      }
22909    };
22910    if (json.has("basedOn"))
22911      res.setBasedOn(parseReference(json.getAsJsonObject("basedOn")));
22912    if (json.has("parent"))
22913      res.setParent(parseReference(json.getAsJsonObject("parent")));
22914    if (json.has("status"))
22915      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RiskAssessment.RiskAssessmentStatus.NULL, new RiskAssessment.RiskAssessmentStatusEnumFactory()));
22916    if (json.has("_status"))
22917      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22918    if (json.has("method"))
22919      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
22920    if (json.has("code"))
22921      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
22922    if (json.has("subject"))
22923      res.setSubject(parseReference(json.getAsJsonObject("subject")));
22924    if (json.has("encounter"))
22925      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
22926    Type occurrence = parseType("occurrence", json);
22927    if (occurrence != null)
22928      res.setOccurrence(occurrence);
22929    if (json.has("condition"))
22930      res.setCondition(parseReference(json.getAsJsonObject("condition")));
22931    if (json.has("performer"))
22932      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
22933    if (json.has("reasonCode")) {
22934      JsonArray array = json.getAsJsonArray("reasonCode");
22935      for (int i = 0; i < array.size(); i++) {
22936        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22937      }
22938    };
22939    if (json.has("reasonReference")) {
22940      JsonArray array = json.getAsJsonArray("reasonReference");
22941      for (int i = 0; i < array.size(); i++) {
22942        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
22943      }
22944    };
22945    if (json.has("basis")) {
22946      JsonArray array = json.getAsJsonArray("basis");
22947      for (int i = 0; i < array.size(); i++) {
22948        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
22949      }
22950    };
22951    if (json.has("prediction")) {
22952      JsonArray array = json.getAsJsonArray("prediction");
22953      for (int i = 0; i < array.size(); i++) {
22954        res.getPrediction().add(parseRiskAssessmentRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject(), res));
22955      }
22956    };
22957    if (json.has("mitigation"))
22958      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
22959    if (json.has("_mitigation"))
22960      parseElementProperties(json.getAsJsonObject("_mitigation"), res.getMitigationElement());
22961    if (json.has("note")) {
22962      JsonArray array = json.getAsJsonArray("note");
22963      for (int i = 0; i < array.size(); i++) {
22964        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22965      }
22966    };
22967  }
22968
22969  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentRiskAssessmentPredictionComponent(JsonObject json, RiskAssessment owner) throws IOException, FHIRFormatError {
22970    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
22971    parseRiskAssessmentRiskAssessmentPredictionComponentProperties(json, owner, res);
22972    return res;
22973  }
22974
22975  protected void parseRiskAssessmentRiskAssessmentPredictionComponentProperties(JsonObject json, RiskAssessment owner, RiskAssessment.RiskAssessmentPredictionComponent res) throws IOException, FHIRFormatError {
22976    parseBackboneElementProperties(json, res);
22977    if (json.has("outcome"))
22978      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
22979    Type probability = parseType("probability", json);
22980    if (probability != null)
22981      res.setProbability(probability);
22982    if (json.has("qualitativeRisk"))
22983      res.setQualitativeRisk(parseCodeableConcept(json.getAsJsonObject("qualitativeRisk")));
22984    if (json.has("relativeRisk"))
22985      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
22986    if (json.has("_relativeRisk"))
22987      parseElementProperties(json.getAsJsonObject("_relativeRisk"), res.getRelativeRiskElement());
22988    Type when = parseType("when", json);
22989    if (when != null)
22990      res.setWhen(when);
22991    if (json.has("rationale"))
22992      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
22993    if (json.has("_rationale"))
22994      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
22995  }
22996
22997  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
22998    Schedule res = new Schedule();
22999    parseScheduleProperties(json, res);
23000    return res;
23001  }
23002
23003  protected void parseScheduleProperties(JsonObject json, Schedule res) throws IOException, FHIRFormatError {
23004    parseDomainResourceProperties(json, res);
23005    if (json.has("identifier")) {
23006      JsonArray array = json.getAsJsonArray("identifier");
23007      for (int i = 0; i < array.size(); i++) {
23008        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23009      }
23010    };
23011    if (json.has("active"))
23012      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
23013    if (json.has("_active"))
23014      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
23015    if (json.has("serviceCategory")) {
23016      JsonArray array = json.getAsJsonArray("serviceCategory");
23017      for (int i = 0; i < array.size(); i++) {
23018        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23019      }
23020    };
23021    if (json.has("serviceType")) {
23022      JsonArray array = json.getAsJsonArray("serviceType");
23023      for (int i = 0; i < array.size(); i++) {
23024        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23025      }
23026    };
23027    if (json.has("specialty")) {
23028      JsonArray array = json.getAsJsonArray("specialty");
23029      for (int i = 0; i < array.size(); i++) {
23030        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23031      }
23032    };
23033    if (json.has("actor")) {
23034      JsonArray array = json.getAsJsonArray("actor");
23035      for (int i = 0; i < array.size(); i++) {
23036        res.getActor().add(parseReference(array.get(i).getAsJsonObject()));
23037      }
23038    };
23039    if (json.has("planningHorizon"))
23040      res.setPlanningHorizon(parsePeriod(json.getAsJsonObject("planningHorizon")));
23041    if (json.has("comment"))
23042      res.setCommentElement(parseString(json.get("comment").getAsString()));
23043    if (json.has("_comment"))
23044      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
23045  }
23046
23047  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
23048    SearchParameter res = new SearchParameter();
23049    parseSearchParameterProperties(json, res);
23050    return res;
23051  }
23052
23053  protected void parseSearchParameterProperties(JsonObject json, SearchParameter res) throws IOException, FHIRFormatError {
23054    parseDomainResourceProperties(json, res);
23055    if (json.has("url"))
23056      res.setUrlElement(parseUri(json.get("url").getAsString()));
23057    if (json.has("_url"))
23058      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
23059    if (json.has("version"))
23060      res.setVersionElement(parseString(json.get("version").getAsString()));
23061    if (json.has("_version"))
23062      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
23063    if (json.has("name"))
23064      res.setNameElement(parseString(json.get("name").getAsString()));
23065    if (json.has("_name"))
23066      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23067    if (json.has("derivedFrom"))
23068      res.setDerivedFromElement(parseCanonical(json.get("derivedFrom").getAsString()));
23069    if (json.has("_derivedFrom"))
23070      parseElementProperties(json.getAsJsonObject("_derivedFrom"), res.getDerivedFromElement());
23071    if (json.has("status"))
23072      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
23073    if (json.has("_status"))
23074      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23075    if (json.has("experimental"))
23076      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23077    if (json.has("_experimental"))
23078      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
23079    if (json.has("date"))
23080      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23081    if (json.has("_date"))
23082      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
23083    if (json.has("publisher"))
23084      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23085    if (json.has("_publisher"))
23086      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
23087    if (json.has("contact")) {
23088      JsonArray array = json.getAsJsonArray("contact");
23089      for (int i = 0; i < array.size(); i++) {
23090        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23091      }
23092    };
23093    if (json.has("description"))
23094      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23095    if (json.has("_description"))
23096      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23097    if (json.has("useContext")) {
23098      JsonArray array = json.getAsJsonArray("useContext");
23099      for (int i = 0; i < array.size(); i++) {
23100        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23101      }
23102    };
23103    if (json.has("jurisdiction")) {
23104      JsonArray array = json.getAsJsonArray("jurisdiction");
23105      for (int i = 0; i < array.size(); i++) {
23106        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23107      }
23108    };
23109    if (json.has("purpose"))
23110      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23111    if (json.has("_purpose"))
23112      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
23113    if (json.has("code"))
23114      res.setCodeElement(parseCode(json.get("code").getAsString()));
23115    if (json.has("_code"))
23116      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
23117    if (json.has("base")) {
23118      JsonArray array = json.getAsJsonArray("base");
23119      for (int i = 0; i < array.size(); i++) {
23120        res.getBase().add(parseCode(array.get(i).getAsString()));
23121      }
23122    };
23123    if (json.has("_base")) {
23124      JsonArray array = json.getAsJsonArray("_base");
23125      for (int i = 0; i < array.size(); i++) {
23126        if (i == res.getBase().size())
23127          res.getBase().add(parseCode(null));
23128        if (array.get(i) instanceof JsonObject) 
23129          parseElementProperties(array.get(i).getAsJsonObject(), res.getBase().get(i));
23130      }
23131    };
23132    if (json.has("type"))
23133      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
23134    if (json.has("_type"))
23135      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
23136    if (json.has("expression"))
23137      res.setExpressionElement(parseString(json.get("expression").getAsString()));
23138    if (json.has("_expression"))
23139      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
23140    if (json.has("xpath"))
23141      res.setXpathElement(parseString(json.get("xpath").getAsString()));
23142    if (json.has("_xpath"))
23143      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
23144    if (json.has("xpathUsage"))
23145      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(), SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
23146    if (json.has("_xpathUsage"))
23147      parseElementProperties(json.getAsJsonObject("_xpathUsage"), res.getXpathUsageElement());
23148    if (json.has("target")) {
23149      JsonArray array = json.getAsJsonArray("target");
23150      for (int i = 0; i < array.size(); i++) {
23151        res.getTarget().add(parseCode(array.get(i).getAsString()));
23152      }
23153    };
23154    if (json.has("_target")) {
23155      JsonArray array = json.getAsJsonArray("_target");
23156      for (int i = 0; i < array.size(); i++) {
23157        if (i == res.getTarget().size())
23158          res.getTarget().add(parseCode(null));
23159        if (array.get(i) instanceof JsonObject) 
23160          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
23161      }
23162    };
23163    if (json.has("multipleOr"))
23164      res.setMultipleOrElement(parseBoolean(json.get("multipleOr").getAsBoolean()));
23165    if (json.has("_multipleOr"))
23166      parseElementProperties(json.getAsJsonObject("_multipleOr"), res.getMultipleOrElement());
23167    if (json.has("multipleAnd"))
23168      res.setMultipleAndElement(parseBoolean(json.get("multipleAnd").getAsBoolean()));
23169    if (json.has("_multipleAnd"))
23170      parseElementProperties(json.getAsJsonObject("_multipleAnd"), res.getMultipleAndElement());
23171    if (json.has("comparator")) {
23172      JsonArray array = json.getAsJsonArray("comparator");
23173      for (int i = 0; i < array.size(); i++) {
23174        res.getComparator().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
23175      }
23176    };
23177    if (json.has("_comparator")) {
23178      JsonArray array = json.getAsJsonArray("_comparator");
23179      for (int i = 0; i < array.size(); i++) {
23180        if (i == res.getComparator().size())
23181          res.getComparator().add(parseEnumeration(null, SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
23182        if (array.get(i) instanceof JsonObject) 
23183          parseElementProperties(array.get(i).getAsJsonObject(), res.getComparator().get(i));
23184      }
23185    };
23186    if (json.has("modifier")) {
23187      JsonArray array = json.getAsJsonArray("modifier");
23188      for (int i = 0; i < array.size(); i++) {
23189        res.getModifier().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
23190      }
23191    };
23192    if (json.has("_modifier")) {
23193      JsonArray array = json.getAsJsonArray("_modifier");
23194      for (int i = 0; i < array.size(); i++) {
23195        if (i == res.getModifier().size())
23196          res.getModifier().add(parseEnumeration(null, SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
23197        if (array.get(i) instanceof JsonObject) 
23198          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
23199      }
23200    };
23201    if (json.has("chain")) {
23202      JsonArray array = json.getAsJsonArray("chain");
23203      for (int i = 0; i < array.size(); i++) {
23204        res.getChain().add(parseString(array.get(i).getAsString()));
23205      }
23206    };
23207    if (json.has("_chain")) {
23208      JsonArray array = json.getAsJsonArray("_chain");
23209      for (int i = 0; i < array.size(); i++) {
23210        if (i == res.getChain().size())
23211          res.getChain().add(parseString(null));
23212        if (array.get(i) instanceof JsonObject) 
23213          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
23214      }
23215    };
23216    if (json.has("component")) {
23217      JsonArray array = json.getAsJsonArray("component");
23218      for (int i = 0; i < array.size(); i++) {
23219        res.getComponent().add(parseSearchParameterSearchParameterComponentComponent(array.get(i).getAsJsonObject(), res));
23220      }
23221    };
23222  }
23223
23224  protected SearchParameter.SearchParameterComponentComponent parseSearchParameterSearchParameterComponentComponent(JsonObject json, SearchParameter owner) throws IOException, FHIRFormatError {
23225    SearchParameter.SearchParameterComponentComponent res = new SearchParameter.SearchParameterComponentComponent();
23226    parseSearchParameterSearchParameterComponentComponentProperties(json, owner, res);
23227    return res;
23228  }
23229
23230  protected void parseSearchParameterSearchParameterComponentComponentProperties(JsonObject json, SearchParameter owner, SearchParameter.SearchParameterComponentComponent res) throws IOException, FHIRFormatError {
23231    parseBackboneElementProperties(json, res);
23232    if (json.has("definition"))
23233      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
23234    if (json.has("_definition"))
23235      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
23236    if (json.has("expression"))
23237      res.setExpressionElement(parseString(json.get("expression").getAsString()));
23238    if (json.has("_expression"))
23239      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
23240  }
23241
23242  protected ServiceRequest parseServiceRequest(JsonObject json) throws IOException, FHIRFormatError {
23243    ServiceRequest res = new ServiceRequest();
23244    parseServiceRequestProperties(json, res);
23245    return res;
23246  }
23247
23248  protected void parseServiceRequestProperties(JsonObject json, ServiceRequest res) throws IOException, FHIRFormatError {
23249    parseDomainResourceProperties(json, res);
23250    if (json.has("identifier")) {
23251      JsonArray array = json.getAsJsonArray("identifier");
23252      for (int i = 0; i < array.size(); i++) {
23253        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23254      }
23255    };
23256    if (json.has("instantiatesCanonical")) {
23257      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
23258      for (int i = 0; i < array.size(); i++) {
23259        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
23260      }
23261    };
23262    if (json.has("_instantiatesCanonical")) {
23263      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
23264      for (int i = 0; i < array.size(); i++) {
23265        if (i == res.getInstantiatesCanonical().size())
23266          res.getInstantiatesCanonical().add(parseCanonical(null));
23267        if (array.get(i) instanceof JsonObject) 
23268          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
23269      }
23270    };
23271    if (json.has("instantiatesUri")) {
23272      JsonArray array = json.getAsJsonArray("instantiatesUri");
23273      for (int i = 0; i < array.size(); i++) {
23274        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
23275      }
23276    };
23277    if (json.has("_instantiatesUri")) {
23278      JsonArray array = json.getAsJsonArray("_instantiatesUri");
23279      for (int i = 0; i < array.size(); i++) {
23280        if (i == res.getInstantiatesUri().size())
23281          res.getInstantiatesUri().add(parseUri(null));
23282        if (array.get(i) instanceof JsonObject) 
23283          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
23284      }
23285    };
23286    if (json.has("basedOn")) {
23287      JsonArray array = json.getAsJsonArray("basedOn");
23288      for (int i = 0; i < array.size(); i++) {
23289        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
23290      }
23291    };
23292    if (json.has("replaces")) {
23293      JsonArray array = json.getAsJsonArray("replaces");
23294      for (int i = 0; i < array.size(); i++) {
23295        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
23296      }
23297    };
23298    if (json.has("requisition"))
23299      res.setRequisition(parseIdentifier(json.getAsJsonObject("requisition")));
23300    if (json.has("status"))
23301      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ServiceRequest.ServiceRequestStatus.NULL, new ServiceRequest.ServiceRequestStatusEnumFactory()));
23302    if (json.has("_status"))
23303      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23304    if (json.has("intent"))
23305      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ServiceRequest.ServiceRequestIntent.NULL, new ServiceRequest.ServiceRequestIntentEnumFactory()));
23306    if (json.has("_intent"))
23307      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
23308    if (json.has("category")) {
23309      JsonArray array = json.getAsJsonArray("category");
23310      for (int i = 0; i < array.size(); i++) {
23311        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23312      }
23313    };
23314    if (json.has("priority"))
23315      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ServiceRequest.ServiceRequestPriority.NULL, new ServiceRequest.ServiceRequestPriorityEnumFactory()));
23316    if (json.has("_priority"))
23317      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
23318    if (json.has("doNotPerform"))
23319      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
23320    if (json.has("_doNotPerform"))
23321      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
23322    if (json.has("code"))
23323      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
23324    if (json.has("orderDetail")) {
23325      JsonArray array = json.getAsJsonArray("orderDetail");
23326      for (int i = 0; i < array.size(); i++) {
23327        res.getOrderDetail().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23328      }
23329    };
23330    Type quantity = parseType("quantity", json);
23331    if (quantity != null)
23332      res.setQuantity(quantity);
23333    if (json.has("subject"))
23334      res.setSubject(parseReference(json.getAsJsonObject("subject")));
23335    if (json.has("encounter"))
23336      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
23337    Type occurrence = parseType("occurrence", json);
23338    if (occurrence != null)
23339      res.setOccurrence(occurrence);
23340    Type asNeeded = parseType("asNeeded", json);
23341    if (asNeeded != null)
23342      res.setAsNeeded(asNeeded);
23343    if (json.has("authoredOn"))
23344      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
23345    if (json.has("_authoredOn"))
23346      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
23347    if (json.has("requester"))
23348      res.setRequester(parseReference(json.getAsJsonObject("requester")));
23349    if (json.has("performerType"))
23350      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
23351    if (json.has("performer")) {
23352      JsonArray array = json.getAsJsonArray("performer");
23353      for (int i = 0; i < array.size(); i++) {
23354        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
23355      }
23356    };
23357    if (json.has("locationCode")) {
23358      JsonArray array = json.getAsJsonArray("locationCode");
23359      for (int i = 0; i < array.size(); i++) {
23360        res.getLocationCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23361      }
23362    };
23363    if (json.has("locationReference")) {
23364      JsonArray array = json.getAsJsonArray("locationReference");
23365      for (int i = 0; i < array.size(); i++) {
23366        res.getLocationReference().add(parseReference(array.get(i).getAsJsonObject()));
23367      }
23368    };
23369    if (json.has("reasonCode")) {
23370      JsonArray array = json.getAsJsonArray("reasonCode");
23371      for (int i = 0; i < array.size(); i++) {
23372        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23373      }
23374    };
23375    if (json.has("reasonReference")) {
23376      JsonArray array = json.getAsJsonArray("reasonReference");
23377      for (int i = 0; i < array.size(); i++) {
23378        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
23379      }
23380    };
23381    if (json.has("insurance")) {
23382      JsonArray array = json.getAsJsonArray("insurance");
23383      for (int i = 0; i < array.size(); i++) {
23384        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
23385      }
23386    };
23387    if (json.has("supportingInfo")) {
23388      JsonArray array = json.getAsJsonArray("supportingInfo");
23389      for (int i = 0; i < array.size(); i++) {
23390        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
23391      }
23392    };
23393    if (json.has("specimen")) {
23394      JsonArray array = json.getAsJsonArray("specimen");
23395      for (int i = 0; i < array.size(); i++) {
23396        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
23397      }
23398    };
23399    if (json.has("bodySite")) {
23400      JsonArray array = json.getAsJsonArray("bodySite");
23401      for (int i = 0; i < array.size(); i++) {
23402        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23403      }
23404    };
23405    if (json.has("note")) {
23406      JsonArray array = json.getAsJsonArray("note");
23407      for (int i = 0; i < array.size(); i++) {
23408        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23409      }
23410    };
23411    if (json.has("patientInstruction"))
23412      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
23413    if (json.has("_patientInstruction"))
23414      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
23415    if (json.has("relevantHistory")) {
23416      JsonArray array = json.getAsJsonArray("relevantHistory");
23417      for (int i = 0; i < array.size(); i++) {
23418        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
23419      }
23420    };
23421  }
23422
23423  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
23424    Slot res = new Slot();
23425    parseSlotProperties(json, res);
23426    return res;
23427  }
23428
23429  protected void parseSlotProperties(JsonObject json, Slot res) throws IOException, FHIRFormatError {
23430    parseDomainResourceProperties(json, res);
23431    if (json.has("identifier")) {
23432      JsonArray array = json.getAsJsonArray("identifier");
23433      for (int i = 0; i < array.size(); i++) {
23434        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23435      }
23436    };
23437    if (json.has("serviceCategory")) {
23438      JsonArray array = json.getAsJsonArray("serviceCategory");
23439      for (int i = 0; i < array.size(); i++) {
23440        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23441      }
23442    };
23443    if (json.has("serviceType")) {
23444      JsonArray array = json.getAsJsonArray("serviceType");
23445      for (int i = 0; i < array.size(); i++) {
23446        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23447      }
23448    };
23449    if (json.has("specialty")) {
23450      JsonArray array = json.getAsJsonArray("specialty");
23451      for (int i = 0; i < array.size(); i++) {
23452        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23453      }
23454    };
23455    if (json.has("appointmentType"))
23456      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
23457    if (json.has("schedule"))
23458      res.setSchedule(parseReference(json.getAsJsonObject("schedule")));
23459    if (json.has("status"))
23460      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
23461    if (json.has("_status"))
23462      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23463    if (json.has("start"))
23464      res.setStartElement(parseInstant(json.get("start").getAsString()));
23465    if (json.has("_start"))
23466      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
23467    if (json.has("end"))
23468      res.setEndElement(parseInstant(json.get("end").getAsString()));
23469    if (json.has("_end"))
23470      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
23471    if (json.has("overbooked"))
23472      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
23473    if (json.has("_overbooked"))
23474      parseElementProperties(json.getAsJsonObject("_overbooked"), res.getOverbookedElement());
23475    if (json.has("comment"))
23476      res.setCommentElement(parseString(json.get("comment").getAsString()));
23477    if (json.has("_comment"))
23478      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
23479  }
23480
23481  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
23482    Specimen res = new Specimen();
23483    parseSpecimenProperties(json, res);
23484    return res;
23485  }
23486
23487  protected void parseSpecimenProperties(JsonObject json, Specimen res) throws IOException, FHIRFormatError {
23488    parseDomainResourceProperties(json, res);
23489    if (json.has("identifier")) {
23490      JsonArray array = json.getAsJsonArray("identifier");
23491      for (int i = 0; i < array.size(); i++) {
23492        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23493      }
23494    };
23495    if (json.has("accessionIdentifier"))
23496      res.setAccessionIdentifier(parseIdentifier(json.getAsJsonObject("accessionIdentifier")));
23497    if (json.has("status"))
23498      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
23499    if (json.has("_status"))
23500      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23501    if (json.has("type"))
23502      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23503    if (json.has("subject"))
23504      res.setSubject(parseReference(json.getAsJsonObject("subject")));
23505    if (json.has("receivedTime"))
23506      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
23507    if (json.has("_receivedTime"))
23508      parseElementProperties(json.getAsJsonObject("_receivedTime"), res.getReceivedTimeElement());
23509    if (json.has("parent")) {
23510      JsonArray array = json.getAsJsonArray("parent");
23511      for (int i = 0; i < array.size(); i++) {
23512        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
23513      }
23514    };
23515    if (json.has("request")) {
23516      JsonArray array = json.getAsJsonArray("request");
23517      for (int i = 0; i < array.size(); i++) {
23518        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
23519      }
23520    };
23521    if (json.has("collection"))
23522      res.setCollection(parseSpecimenSpecimenCollectionComponent(json.getAsJsonObject("collection"), res));
23523    if (json.has("processing")) {
23524      JsonArray array = json.getAsJsonArray("processing");
23525      for (int i = 0; i < array.size(); i++) {
23526        res.getProcessing().add(parseSpecimenSpecimenProcessingComponent(array.get(i).getAsJsonObject(), res));
23527      }
23528    };
23529    if (json.has("container")) {
23530      JsonArray array = json.getAsJsonArray("container");
23531      for (int i = 0; i < array.size(); i++) {
23532        res.getContainer().add(parseSpecimenSpecimenContainerComponent(array.get(i).getAsJsonObject(), res));
23533      }
23534    };
23535    if (json.has("condition")) {
23536      JsonArray array = json.getAsJsonArray("condition");
23537      for (int i = 0; i < array.size(); i++) {
23538        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23539      }
23540    };
23541    if (json.has("note")) {
23542      JsonArray array = json.getAsJsonArray("note");
23543      for (int i = 0; i < array.size(); i++) {
23544        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23545      }
23546    };
23547  }
23548
23549  protected Specimen.SpecimenCollectionComponent parseSpecimenSpecimenCollectionComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
23550    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
23551    parseSpecimenSpecimenCollectionComponentProperties(json, owner, res);
23552    return res;
23553  }
23554
23555  protected void parseSpecimenSpecimenCollectionComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenCollectionComponent res) throws IOException, FHIRFormatError {
23556    parseBackboneElementProperties(json, res);
23557    if (json.has("collector"))
23558      res.setCollector(parseReference(json.getAsJsonObject("collector")));
23559    Type collected = parseType("collected", json);
23560    if (collected != null)
23561      res.setCollected(collected);
23562    if (json.has("duration"))
23563      res.setDuration(parseDuration(json.getAsJsonObject("duration")));
23564    if (json.has("quantity"))
23565      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
23566    if (json.has("method"))
23567      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
23568    if (json.has("bodySite"))
23569      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
23570    Type fastingStatus = parseType("fastingStatus", json);
23571    if (fastingStatus != null)
23572      res.setFastingStatus(fastingStatus);
23573  }
23574
23575  protected Specimen.SpecimenProcessingComponent parseSpecimenSpecimenProcessingComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
23576    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
23577    parseSpecimenSpecimenProcessingComponentProperties(json, owner, res);
23578    return res;
23579  }
23580
23581  protected void parseSpecimenSpecimenProcessingComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenProcessingComponent res) throws IOException, FHIRFormatError {
23582    parseBackboneElementProperties(json, res);
23583    if (json.has("description"))
23584      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23585    if (json.has("_description"))
23586      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23587    if (json.has("procedure"))
23588      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
23589    if (json.has("additive")) {
23590      JsonArray array = json.getAsJsonArray("additive");
23591      for (int i = 0; i < array.size(); i++) {
23592        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
23593      }
23594    };
23595    Type time = parseType("time", json);
23596    if (time != null)
23597      res.setTime(time);
23598  }
23599
23600  protected Specimen.SpecimenContainerComponent parseSpecimenSpecimenContainerComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
23601    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
23602    parseSpecimenSpecimenContainerComponentProperties(json, owner, res);
23603    return res;
23604  }
23605
23606  protected void parseSpecimenSpecimenContainerComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenContainerComponent res) throws IOException, FHIRFormatError {
23607    parseBackboneElementProperties(json, res);
23608    if (json.has("identifier")) {
23609      JsonArray array = json.getAsJsonArray("identifier");
23610      for (int i = 0; i < array.size(); i++) {
23611        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23612      }
23613    };
23614    if (json.has("description"))
23615      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23616    if (json.has("_description"))
23617      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23618    if (json.has("type"))
23619      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23620    if (json.has("capacity"))
23621      res.setCapacity(parseQuantity(json.getAsJsonObject("capacity")));
23622    if (json.has("specimenQuantity"))
23623      res.setSpecimenQuantity(parseQuantity(json.getAsJsonObject("specimenQuantity")));
23624    Type additive = parseType("additive", json);
23625    if (additive != null)
23626      res.setAdditive(additive);
23627  }
23628
23629  protected SpecimenDefinition parseSpecimenDefinition(JsonObject json) throws IOException, FHIRFormatError {
23630    SpecimenDefinition res = new SpecimenDefinition();
23631    parseSpecimenDefinitionProperties(json, res);
23632    return res;
23633  }
23634
23635  protected void parseSpecimenDefinitionProperties(JsonObject json, SpecimenDefinition res) throws IOException, FHIRFormatError {
23636    parseDomainResourceProperties(json, res);
23637    if (json.has("url"))
23638      res.setUrlElement(parseUri(json.get("url").getAsString()));
23639    if (json.has("_url"))
23640      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
23641    if (json.has("identifier"))
23642      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
23643    if (json.has("version"))
23644      res.setVersionElement(parseString(json.get("version").getAsString()));
23645    if (json.has("_version"))
23646      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
23647    if (json.has("title"))
23648      res.setTitleElement(parseString(json.get("title").getAsString()));
23649    if (json.has("_title"))
23650      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
23651    if (json.has("derivedFromCanonical")) {
23652      JsonArray array = json.getAsJsonArray("derivedFromCanonical");
23653      for (int i = 0; i < array.size(); i++) {
23654        res.getDerivedFromCanonical().add(parseCanonical(array.get(i).getAsString()));
23655      }
23656    };
23657    if (json.has("_derivedFromCanonical")) {
23658      JsonArray array = json.getAsJsonArray("_derivedFromCanonical");
23659      for (int i = 0; i < array.size(); i++) {
23660        if (i == res.getDerivedFromCanonical().size())
23661          res.getDerivedFromCanonical().add(parseCanonical(null));
23662        if (array.get(i) instanceof JsonObject) 
23663          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromCanonical().get(i));
23664      }
23665    };
23666    if (json.has("derivedFromUri")) {
23667      JsonArray array = json.getAsJsonArray("derivedFromUri");
23668      for (int i = 0; i < array.size(); i++) {
23669        res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
23670      }
23671    };
23672    if (json.has("_derivedFromUri")) {
23673      JsonArray array = json.getAsJsonArray("_derivedFromUri");
23674      for (int i = 0; i < array.size(); i++) {
23675        if (i == res.getDerivedFromUri().size())
23676          res.getDerivedFromUri().add(parseUri(null));
23677        if (array.get(i) instanceof JsonObject) 
23678          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
23679      }
23680    };
23681    if (json.has("status"))
23682      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SpecimenDefinition.PublicationStatus.NULL, new SpecimenDefinition.PublicationStatusEnumFactory()));
23683    if (json.has("_status"))
23684      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23685    if (json.has("experimental"))
23686      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23687    if (json.has("_experimental"))
23688      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
23689    Type subject = parseType("subject", json);
23690    if (subject != null)
23691      res.setSubject(subject);
23692    if (json.has("date"))
23693      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23694    if (json.has("_date"))
23695      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
23696    if (json.has("publisher"))
23697      res.setPublisher(parseReference(json.getAsJsonObject("publisher")));
23698    if (json.has("contact")) {
23699      JsonArray array = json.getAsJsonArray("contact");
23700      for (int i = 0; i < array.size(); i++) {
23701        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23702      }
23703    };
23704    if (json.has("description"))
23705      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23706    if (json.has("_description"))
23707      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23708    if (json.has("useContext")) {
23709      JsonArray array = json.getAsJsonArray("useContext");
23710      for (int i = 0; i < array.size(); i++) {
23711        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23712      }
23713    };
23714    if (json.has("jurisdiction")) {
23715      JsonArray array = json.getAsJsonArray("jurisdiction");
23716      for (int i = 0; i < array.size(); i++) {
23717        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23718      }
23719    };
23720    if (json.has("purpose"))
23721      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23722    if (json.has("_purpose"))
23723      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
23724    if (json.has("copyright"))
23725      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
23726    if (json.has("_copyright"))
23727      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
23728    if (json.has("approvalDate"))
23729      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
23730    if (json.has("_approvalDate"))
23731      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
23732    if (json.has("lastReviewDate"))
23733      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
23734    if (json.has("_lastReviewDate"))
23735      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
23736    if (json.has("effectivePeriod"))
23737      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
23738    if (json.has("typeCollected"))
23739      res.setTypeCollected(parseCodeableConcept(json.getAsJsonObject("typeCollected")));
23740    if (json.has("patientPreparation")) {
23741      JsonArray array = json.getAsJsonArray("patientPreparation");
23742      for (int i = 0; i < array.size(); i++) {
23743        res.getPatientPreparation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23744      }
23745    };
23746    if (json.has("timeAspect"))
23747      res.setTimeAspectElement(parseString(json.get("timeAspect").getAsString()));
23748    if (json.has("_timeAspect"))
23749      parseElementProperties(json.getAsJsonObject("_timeAspect"), res.getTimeAspectElement());
23750    if (json.has("collection")) {
23751      JsonArray array = json.getAsJsonArray("collection");
23752      for (int i = 0; i < array.size(); i++) {
23753        res.getCollection().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23754      }
23755    };
23756    if (json.has("typeTested")) {
23757      JsonArray array = json.getAsJsonArray("typeTested");
23758      for (int i = 0; i < array.size(); i++) {
23759        res.getTypeTested().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(array.get(i).getAsJsonObject(), res));
23760      }
23761    };
23762  }
23763
23764  protected SpecimenDefinition.SpecimenDefinitionTypeTestedComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23765    SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedComponent();
23766    parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentProperties(json, owner, res);
23767    return res;
23768  }
23769
23770  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res) throws IOException, FHIRFormatError {
23771    parseBackboneElementProperties(json, res);
23772    if (json.has("isDerived"))
23773      res.setIsDerivedElement(parseBoolean(json.get("isDerived").getAsBoolean()));
23774    if (json.has("_isDerived"))
23775      parseElementProperties(json.getAsJsonObject("_isDerived"), res.getIsDerivedElement());
23776    if (json.has("type"))
23777      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23778    if (json.has("preference"))
23779      res.setPreferenceElement(parseEnumeration(json.get("preference").getAsString(), SpecimenDefinition.SpecimenContainedPreference.NULL, new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory()));
23780    if (json.has("_preference"))
23781      parseElementProperties(json.getAsJsonObject("_preference"), res.getPreferenceElement());
23782    if (json.has("container"))
23783      res.setContainer(parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(json.getAsJsonObject("container"), owner));
23784    if (json.has("requirement"))
23785      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
23786    if (json.has("_requirement"))
23787      parseElementProperties(json.getAsJsonObject("_requirement"), res.getRequirementElement());
23788    if (json.has("retentionTime"))
23789      res.setRetentionTime(parseDuration(json.getAsJsonObject("retentionTime")));
23790    if (json.has("singleUse"))
23791      res.setSingleUseElement(parseBoolean(json.get("singleUse").getAsBoolean()));
23792    if (json.has("_singleUse"))
23793      parseElementProperties(json.getAsJsonObject("_singleUse"), res.getSingleUseElement());
23794    if (json.has("rejectionCriterion")) {
23795      JsonArray array = json.getAsJsonArray("rejectionCriterion");
23796      for (int i = 0; i < array.size(); i++) {
23797        res.getRejectionCriterion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23798      }
23799    };
23800    if (json.has("handling")) {
23801      JsonArray array = json.getAsJsonArray("handling");
23802      for (int i = 0; i < array.size(); i++) {
23803        res.getHandling().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(array.get(i).getAsJsonObject(), owner));
23804      }
23805    };
23806    if (json.has("testingDestination")) {
23807      JsonArray array = json.getAsJsonArray("testingDestination");
23808      for (int i = 0; i < array.size(); i++) {
23809        res.getTestingDestination().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23810      }
23811    };
23812  }
23813
23814  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23815    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent();
23816    parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentProperties(json, owner, res);
23817    return res;
23818  }
23819
23820  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res) throws IOException, FHIRFormatError {
23821    parseBackboneElementProperties(json, res);
23822    if (json.has("material"))
23823      res.setMaterial(parseCodeableConcept(json.getAsJsonObject("material")));
23824    if (json.has("type"))
23825      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23826    if (json.has("cap"))
23827      res.setCap(parseCodeableConcept(json.getAsJsonObject("cap")));
23828    if (json.has("description"))
23829      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23830    if (json.has("_description"))
23831      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23832    if (json.has("capacity"))
23833      res.setCapacity(parseQuantity(json.getAsJsonObject("capacity")));
23834    Type minimumVolume = parseType("minimumVolume", json);
23835    if (minimumVolume != null)
23836      res.setMinimumVolume(minimumVolume);
23837    if (json.has("additive")) {
23838      JsonArray array = json.getAsJsonArray("additive");
23839      for (int i = 0; i < array.size(); i++) {
23840        res.getAdditive().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(array.get(i).getAsJsonObject(), owner));
23841      }
23842    };
23843    if (json.has("preparation"))
23844      res.setPreparationElement(parseString(json.get("preparation").getAsString()));
23845    if (json.has("_preparation"))
23846      parseElementProperties(json.getAsJsonObject("_preparation"), res.getPreparationElement());
23847  }
23848
23849  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23850    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent();
23851    parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(json, owner, res);
23852    return res;
23853  }
23854
23855  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res) throws IOException, FHIRFormatError {
23856    parseBackboneElementProperties(json, res);
23857    Type additive = parseType("additive", json);
23858    if (additive != null)
23859      res.setAdditive(additive);
23860  }
23861
23862  protected SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23863    SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent();
23864    parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentProperties(json, owner, res);
23865    return res;
23866  }
23867
23868  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res) throws IOException, FHIRFormatError {
23869    parseBackboneElementProperties(json, res);
23870    if (json.has("temperatureQualifier"))
23871      res.setTemperatureQualifier(parseCodeableConcept(json.getAsJsonObject("temperatureQualifier")));
23872    if (json.has("temperatureRange"))
23873      res.setTemperatureRange(parseRange(json.getAsJsonObject("temperatureRange")));
23874    if (json.has("maxDuration"))
23875      res.setMaxDuration(parseDuration(json.getAsJsonObject("maxDuration")));
23876    if (json.has("instruction"))
23877      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
23878    if (json.has("_instruction"))
23879      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
23880  }
23881
23882  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
23883    StructureDefinition res = new StructureDefinition();
23884    parseStructureDefinitionProperties(json, res);
23885    return res;
23886  }
23887
23888  protected void parseStructureDefinitionProperties(JsonObject json, StructureDefinition res) throws IOException, FHIRFormatError {
23889    parseDomainResourceProperties(json, res);
23890    if (json.has("url"))
23891      res.setUrlElement(parseUri(json.get("url").getAsString()));
23892    if (json.has("_url"))
23893      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
23894    if (json.has("identifier")) {
23895      JsonArray array = json.getAsJsonArray("identifier");
23896      for (int i = 0; i < array.size(); i++) {
23897        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23898      }
23899    };
23900    if (json.has("version"))
23901      res.setVersionElement(parseString(json.get("version").getAsString()));
23902    if (json.has("_version"))
23903      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
23904    if (json.has("name"))
23905      res.setNameElement(parseString(json.get("name").getAsString()));
23906    if (json.has("_name"))
23907      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23908    if (json.has("title"))
23909      res.setTitleElement(parseString(json.get("title").getAsString()));
23910    if (json.has("_title"))
23911      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
23912    if (json.has("status"))
23913      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
23914    if (json.has("_status"))
23915      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23916    if (json.has("experimental"))
23917      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23918    if (json.has("_experimental"))
23919      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
23920    if (json.has("date"))
23921      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23922    if (json.has("_date"))
23923      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
23924    if (json.has("publisher"))
23925      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23926    if (json.has("_publisher"))
23927      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
23928    if (json.has("contact")) {
23929      JsonArray array = json.getAsJsonArray("contact");
23930      for (int i = 0; i < array.size(); i++) {
23931        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23932      }
23933    };
23934    if (json.has("description"))
23935      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23936    if (json.has("_description"))
23937      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23938    if (json.has("useContext")) {
23939      JsonArray array = json.getAsJsonArray("useContext");
23940      for (int i = 0; i < array.size(); i++) {
23941        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23942      }
23943    };
23944    if (json.has("jurisdiction")) {
23945      JsonArray array = json.getAsJsonArray("jurisdiction");
23946      for (int i = 0; i < array.size(); i++) {
23947        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23948      }
23949    };
23950    if (json.has("purpose"))
23951      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23952    if (json.has("_purpose"))
23953      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
23954    if (json.has("copyright"))
23955      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
23956    if (json.has("_copyright"))
23957      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
23958    if (json.has("keyword")) {
23959      JsonArray array = json.getAsJsonArray("keyword");
23960      for (int i = 0; i < array.size(); i++) {
23961        res.getKeyword().add(parseCoding(array.get(i).getAsJsonObject()));
23962      }
23963    };
23964    if (json.has("fhirVersion"))
23965      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
23966    if (json.has("_fhirVersion"))
23967      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
23968    if (json.has("mapping")) {
23969      JsonArray array = json.getAsJsonArray("mapping");
23970      for (int i = 0; i < array.size(); i++) {
23971        res.getMapping().add(parseStructureDefinitionStructureDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
23972      }
23973    };
23974    if (json.has("kind"))
23975      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
23976    if (json.has("_kind"))
23977      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
23978    if (json.has("abstract"))
23979      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
23980    if (json.has("_abstract"))
23981      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
23982    if (json.has("context")) {
23983      JsonArray array = json.getAsJsonArray("context");
23984      for (int i = 0; i < array.size(); i++) {
23985        res.getContext().add(parseStructureDefinitionStructureDefinitionContextComponent(array.get(i).getAsJsonObject(), res));
23986      }
23987    };
23988    if (json.has("contextInvariant")) {
23989      JsonArray array = json.getAsJsonArray("contextInvariant");
23990      for (int i = 0; i < array.size(); i++) {
23991        res.getContextInvariant().add(parseString(array.get(i).getAsString()));
23992      }
23993    };
23994    if (json.has("_contextInvariant")) {
23995      JsonArray array = json.getAsJsonArray("_contextInvariant");
23996      for (int i = 0; i < array.size(); i++) {
23997        if (i == res.getContextInvariant().size())
23998          res.getContextInvariant().add(parseString(null));
23999        if (array.get(i) instanceof JsonObject) 
24000          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextInvariant().get(i));
24001      }
24002    };
24003    if (json.has("type"))
24004      res.setTypeElement(parseUri(json.get("type").getAsString()));
24005    if (json.has("_type"))
24006      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
24007    if (json.has("baseDefinition"))
24008      res.setBaseDefinitionElement(parseCanonical(json.get("baseDefinition").getAsString()));
24009    if (json.has("_baseDefinition"))
24010      parseElementProperties(json.getAsJsonObject("_baseDefinition"), res.getBaseDefinitionElement());
24011    if (json.has("derivation"))
24012      res.setDerivationElement(parseEnumeration(json.get("derivation").getAsString(), StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
24013    if (json.has("_derivation"))
24014      parseElementProperties(json.getAsJsonObject("_derivation"), res.getDerivationElement());
24015    if (json.has("snapshot"))
24016      res.setSnapshot(parseStructureDefinitionStructureDefinitionSnapshotComponent(json.getAsJsonObject("snapshot"), res));
24017    if (json.has("differential"))
24018      res.setDifferential(parseStructureDefinitionStructureDefinitionDifferentialComponent(json.getAsJsonObject("differential"), res));
24019  }
24020
24021  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionStructureDefinitionMappingComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
24022    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
24023    parseStructureDefinitionStructureDefinitionMappingComponentProperties(json, owner, res);
24024    return res;
24025  }
24026
24027  protected void parseStructureDefinitionStructureDefinitionMappingComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionMappingComponent res) throws IOException, FHIRFormatError {
24028    parseBackboneElementProperties(json, res);
24029    if (json.has("identity"))
24030      res.setIdentityElement(parseId(json.get("identity").getAsString()));
24031    if (json.has("_identity"))
24032      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
24033    if (json.has("uri"))
24034      res.setUriElement(parseUri(json.get("uri").getAsString()));
24035    if (json.has("_uri"))
24036      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
24037    if (json.has("name"))
24038      res.setNameElement(parseString(json.get("name").getAsString()));
24039    if (json.has("_name"))
24040      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24041    if (json.has("comment"))
24042      res.setCommentElement(parseString(json.get("comment").getAsString()));
24043    if (json.has("_comment"))
24044      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
24045  }
24046
24047  protected StructureDefinition.StructureDefinitionContextComponent parseStructureDefinitionStructureDefinitionContextComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
24048    StructureDefinition.StructureDefinitionContextComponent res = new StructureDefinition.StructureDefinitionContextComponent();
24049    parseStructureDefinitionStructureDefinitionContextComponentProperties(json, owner, res);
24050    return res;
24051  }
24052
24053  protected void parseStructureDefinitionStructureDefinitionContextComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionContextComponent res) throws IOException, FHIRFormatError {
24054    parseBackboneElementProperties(json, res);
24055    if (json.has("type"))
24056      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), StructureDefinition.ExtensionContextType.NULL, new StructureDefinition.ExtensionContextTypeEnumFactory()));
24057    if (json.has("_type"))
24058      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
24059    if (json.has("expression"))
24060      res.setExpressionElement(parseString(json.get("expression").getAsString()));
24061    if (json.has("_expression"))
24062      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
24063  }
24064
24065  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionStructureDefinitionSnapshotComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
24066    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
24067    parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(json, owner, res);
24068    return res;
24069  }
24070
24071  protected void parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionSnapshotComponent res) throws IOException, FHIRFormatError {
24072    parseBackboneElementProperties(json, res);
24073    if (json.has("element")) {
24074      JsonArray array = json.getAsJsonArray("element");
24075      for (int i = 0; i < array.size(); i++) {
24076        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
24077      }
24078    };
24079  }
24080
24081  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionStructureDefinitionDifferentialComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
24082    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
24083    parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(json, owner, res);
24084    return res;
24085  }
24086
24087  protected void parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionDifferentialComponent res) throws IOException, FHIRFormatError {
24088    parseBackboneElementProperties(json, res);
24089    if (json.has("element")) {
24090      JsonArray array = json.getAsJsonArray("element");
24091      for (int i = 0; i < array.size(); i++) {
24092        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
24093      }
24094    };
24095  }
24096
24097  protected StructureMap parseStructureMap(JsonObject json) throws IOException, FHIRFormatError {
24098    StructureMap res = new StructureMap();
24099    parseStructureMapProperties(json, res);
24100    return res;
24101  }
24102
24103  protected void parseStructureMapProperties(JsonObject json, StructureMap res) throws IOException, FHIRFormatError {
24104    parseDomainResourceProperties(json, res);
24105    if (json.has("url"))
24106      res.setUrlElement(parseUri(json.get("url").getAsString()));
24107    if (json.has("_url"))
24108      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
24109    if (json.has("identifier")) {
24110      JsonArray array = json.getAsJsonArray("identifier");
24111      for (int i = 0; i < array.size(); i++) {
24112        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24113      }
24114    };
24115    if (json.has("version"))
24116      res.setVersionElement(parseString(json.get("version").getAsString()));
24117    if (json.has("_version"))
24118      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
24119    if (json.has("name"))
24120      res.setNameElement(parseString(json.get("name").getAsString()));
24121    if (json.has("_name"))
24122      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24123    if (json.has("title"))
24124      res.setTitleElement(parseString(json.get("title").getAsString()));
24125    if (json.has("_title"))
24126      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
24127    if (json.has("status"))
24128      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
24129    if (json.has("_status"))
24130      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24131    if (json.has("experimental"))
24132      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
24133    if (json.has("_experimental"))
24134      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
24135    if (json.has("date"))
24136      res.setDateElement(parseDateTime(json.get("date").getAsString()));
24137    if (json.has("_date"))
24138      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
24139    if (json.has("publisher"))
24140      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
24141    if (json.has("_publisher"))
24142      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
24143    if (json.has("contact")) {
24144      JsonArray array = json.getAsJsonArray("contact");
24145      for (int i = 0; i < array.size(); i++) {
24146        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
24147      }
24148    };
24149    if (json.has("description"))
24150      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
24151    if (json.has("_description"))
24152      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24153    if (json.has("useContext")) {
24154      JsonArray array = json.getAsJsonArray("useContext");
24155      for (int i = 0; i < array.size(); i++) {
24156        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
24157      }
24158    };
24159    if (json.has("jurisdiction")) {
24160      JsonArray array = json.getAsJsonArray("jurisdiction");
24161      for (int i = 0; i < array.size(); i++) {
24162        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24163      }
24164    };
24165    if (json.has("purpose"))
24166      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
24167    if (json.has("_purpose"))
24168      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
24169    if (json.has("copyright"))
24170      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
24171    if (json.has("_copyright"))
24172      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
24173    if (json.has("structure")) {
24174      JsonArray array = json.getAsJsonArray("structure");
24175      for (int i = 0; i < array.size(); i++) {
24176        res.getStructure().add(parseStructureMapStructureMapStructureComponent(array.get(i).getAsJsonObject(), res));
24177      }
24178    };
24179    if (json.has("import")) {
24180      JsonArray array = json.getAsJsonArray("import");
24181      for (int i = 0; i < array.size(); i++) {
24182        res.getImport().add(parseCanonical(array.get(i).getAsString()));
24183      }
24184    };
24185    if (json.has("_import")) {
24186      JsonArray array = json.getAsJsonArray("_import");
24187      for (int i = 0; i < array.size(); i++) {
24188        if (i == res.getImport().size())
24189          res.getImport().add(parseCanonical(null));
24190        if (array.get(i) instanceof JsonObject) 
24191          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
24192      }
24193    };
24194    if (json.has("group")) {
24195      JsonArray array = json.getAsJsonArray("group");
24196      for (int i = 0; i < array.size(); i++) {
24197        res.getGroup().add(parseStructureMapStructureMapGroupComponent(array.get(i).getAsJsonObject(), res));
24198      }
24199    };
24200  }
24201
24202  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureMapStructureComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24203    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
24204    parseStructureMapStructureMapStructureComponentProperties(json, owner, res);
24205    return res;
24206  }
24207
24208  protected void parseStructureMapStructureMapStructureComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapStructureComponent res) throws IOException, FHIRFormatError {
24209    parseBackboneElementProperties(json, res);
24210    if (json.has("url"))
24211      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
24212    if (json.has("_url"))
24213      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
24214    if (json.has("mode"))
24215      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapModelMode.NULL, new StructureMap.StructureMapModelModeEnumFactory()));
24216    if (json.has("_mode"))
24217      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
24218    if (json.has("alias"))
24219      res.setAliasElement(parseString(json.get("alias").getAsString()));
24220    if (json.has("_alias"))
24221      parseElementProperties(json.getAsJsonObject("_alias"), res.getAliasElement());
24222    if (json.has("documentation"))
24223      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
24224    if (json.has("_documentation"))
24225      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
24226  }
24227
24228  protected StructureMap.StructureMapGroupComponent parseStructureMapStructureMapGroupComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24229    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
24230    parseStructureMapStructureMapGroupComponentProperties(json, owner, res);
24231    return res;
24232  }
24233
24234  protected void parseStructureMapStructureMapGroupComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupComponent res) throws IOException, FHIRFormatError {
24235    parseBackboneElementProperties(json, res);
24236    if (json.has("name"))
24237      res.setNameElement(parseId(json.get("name").getAsString()));
24238    if (json.has("_name"))
24239      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24240    if (json.has("extends"))
24241      res.setExtendsElement(parseId(json.get("extends").getAsString()));
24242    if (json.has("_extends"))
24243      parseElementProperties(json.getAsJsonObject("_extends"), res.getExtendsElement());
24244    if (json.has("typeMode"))
24245      res.setTypeModeElement(parseEnumeration(json.get("typeMode").getAsString(), StructureMap.StructureMapGroupTypeMode.NULL, new StructureMap.StructureMapGroupTypeModeEnumFactory()));
24246    if (json.has("_typeMode"))
24247      parseElementProperties(json.getAsJsonObject("_typeMode"), res.getTypeModeElement());
24248    if (json.has("documentation"))
24249      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
24250    if (json.has("_documentation"))
24251      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
24252    if (json.has("input")) {
24253      JsonArray array = json.getAsJsonArray("input");
24254      for (int i = 0; i < array.size(); i++) {
24255        res.getInput().add(parseStructureMapStructureMapGroupInputComponent(array.get(i).getAsJsonObject(), owner));
24256      }
24257    };
24258    if (json.has("rule")) {
24259      JsonArray array = json.getAsJsonArray("rule");
24260      for (int i = 0; i < array.size(); i++) {
24261        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
24262      }
24263    };
24264  }
24265
24266  protected StructureMap.StructureMapGroupInputComponent parseStructureMapStructureMapGroupInputComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24267    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
24268    parseStructureMapStructureMapGroupInputComponentProperties(json, owner, res);
24269    return res;
24270  }
24271
24272  protected void parseStructureMapStructureMapGroupInputComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupInputComponent res) throws IOException, FHIRFormatError {
24273    parseBackboneElementProperties(json, res);
24274    if (json.has("name"))
24275      res.setNameElement(parseId(json.get("name").getAsString()));
24276    if (json.has("_name"))
24277      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24278    if (json.has("type"))
24279      res.setTypeElement(parseString(json.get("type").getAsString()));
24280    if (json.has("_type"))
24281      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
24282    if (json.has("mode"))
24283      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapInputMode.NULL, new StructureMap.StructureMapInputModeEnumFactory()));
24284    if (json.has("_mode"))
24285      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
24286    if (json.has("documentation"))
24287      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
24288    if (json.has("_documentation"))
24289      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
24290  }
24291
24292  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapStructureMapGroupRuleComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24293    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
24294    parseStructureMapStructureMapGroupRuleComponentProperties(json, owner, res);
24295    return res;
24296  }
24297
24298  protected void parseStructureMapStructureMapGroupRuleComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleComponent res) throws IOException, FHIRFormatError {
24299    parseBackboneElementProperties(json, res);
24300    if (json.has("name"))
24301      res.setNameElement(parseId(json.get("name").getAsString()));
24302    if (json.has("_name"))
24303      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24304    if (json.has("source")) {
24305      JsonArray array = json.getAsJsonArray("source");
24306      for (int i = 0; i < array.size(); i++) {
24307        res.getSource().add(parseStructureMapStructureMapGroupRuleSourceComponent(array.get(i).getAsJsonObject(), owner));
24308      }
24309    };
24310    if (json.has("target")) {
24311      JsonArray array = json.getAsJsonArray("target");
24312      for (int i = 0; i < array.size(); i++) {
24313        res.getTarget().add(parseStructureMapStructureMapGroupRuleTargetComponent(array.get(i).getAsJsonObject(), owner));
24314      }
24315    };
24316    if (json.has("rule")) {
24317      JsonArray array = json.getAsJsonArray("rule");
24318      for (int i = 0; i < array.size(); i++) {
24319        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
24320      }
24321    };
24322    if (json.has("dependent")) {
24323      JsonArray array = json.getAsJsonArray("dependent");
24324      for (int i = 0; i < array.size(); i++) {
24325        res.getDependent().add(parseStructureMapStructureMapGroupRuleDependentComponent(array.get(i).getAsJsonObject(), owner));
24326      }
24327    };
24328    if (json.has("documentation"))
24329      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
24330    if (json.has("_documentation"))
24331      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
24332  }
24333
24334  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapStructureMapGroupRuleSourceComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24335    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
24336    parseStructureMapStructureMapGroupRuleSourceComponentProperties(json, owner, res);
24337    return res;
24338  }
24339
24340  protected void parseStructureMapStructureMapGroupRuleSourceComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleSourceComponent res) throws IOException, FHIRFormatError {
24341    parseBackboneElementProperties(json, res);
24342    if (json.has("context"))
24343      res.setContextElement(parseId(json.get("context").getAsString()));
24344    if (json.has("_context"))
24345      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
24346    if (json.has("min"))
24347      res.setMinElement(parseInteger(json.get("min").getAsLong()));
24348    if (json.has("_min"))
24349      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
24350    if (json.has("max"))
24351      res.setMaxElement(parseString(json.get("max").getAsString()));
24352    if (json.has("_max"))
24353      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
24354    if (json.has("type"))
24355      res.setTypeElement(parseString(json.get("type").getAsString()));
24356    if (json.has("_type"))
24357      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
24358    Type defaultValue = parseType("defaultValue", json);
24359    if (defaultValue != null)
24360      res.setDefaultValue(defaultValue);
24361    if (json.has("element"))
24362      res.setElementElement(parseString(json.get("element").getAsString()));
24363    if (json.has("_element"))
24364      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
24365    if (json.has("listMode"))
24366      res.setListModeElement(parseEnumeration(json.get("listMode").getAsString(), StructureMap.StructureMapSourceListMode.NULL, new StructureMap.StructureMapSourceListModeEnumFactory()));
24367    if (json.has("_listMode"))
24368      parseElementProperties(json.getAsJsonObject("_listMode"), res.getListModeElement());
24369    if (json.has("variable"))
24370      res.setVariableElement(parseId(json.get("variable").getAsString()));
24371    if (json.has("_variable"))
24372      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
24373    if (json.has("condition"))
24374      res.setConditionElement(parseString(json.get("condition").getAsString()));
24375    if (json.has("_condition"))
24376      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
24377    if (json.has("check"))
24378      res.setCheckElement(parseString(json.get("check").getAsString()));
24379    if (json.has("_check"))
24380      parseElementProperties(json.getAsJsonObject("_check"), res.getCheckElement());
24381    if (json.has("logMessage"))
24382      res.setLogMessageElement(parseString(json.get("logMessage").getAsString()));
24383    if (json.has("_logMessage"))
24384      parseElementProperties(json.getAsJsonObject("_logMessage"), res.getLogMessageElement());
24385  }
24386
24387  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapStructureMapGroupRuleTargetComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24388    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
24389    parseStructureMapStructureMapGroupRuleTargetComponentProperties(json, owner, res);
24390    return res;
24391  }
24392
24393  protected void parseStructureMapStructureMapGroupRuleTargetComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetComponent res) throws IOException, FHIRFormatError {
24394    parseBackboneElementProperties(json, res);
24395    if (json.has("context"))
24396      res.setContextElement(parseId(json.get("context").getAsString()));
24397    if (json.has("_context"))
24398      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
24399    if (json.has("contextType"))
24400      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
24401    if (json.has("_contextType"))
24402      parseElementProperties(json.getAsJsonObject("_contextType"), res.getContextTypeElement());
24403    if (json.has("element"))
24404      res.setElementElement(parseString(json.get("element").getAsString()));
24405    if (json.has("_element"))
24406      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
24407    if (json.has("variable"))
24408      res.setVariableElement(parseId(json.get("variable").getAsString()));
24409    if (json.has("_variable"))
24410      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
24411    if (json.has("listMode")) {
24412      JsonArray array = json.getAsJsonArray("listMode");
24413      for (int i = 0; i < array.size(); i++) {
24414        res.getListMode().add(parseEnumeration(array.get(i).getAsString(), StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
24415      }
24416    };
24417    if (json.has("_listMode")) {
24418      JsonArray array = json.getAsJsonArray("_listMode");
24419      for (int i = 0; i < array.size(); i++) {
24420        if (i == res.getListMode().size())
24421          res.getListMode().add(parseEnumeration(null, StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
24422        if (array.get(i) instanceof JsonObject) 
24423          parseElementProperties(array.get(i).getAsJsonObject(), res.getListMode().get(i));
24424      }
24425    };
24426    if (json.has("listRuleId"))
24427      res.setListRuleIdElement(parseId(json.get("listRuleId").getAsString()));
24428    if (json.has("_listRuleId"))
24429      parseElementProperties(json.getAsJsonObject("_listRuleId"), res.getListRuleIdElement());
24430    if (json.has("transform"))
24431      res.setTransformElement(parseEnumeration(json.get("transform").getAsString(), StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
24432    if (json.has("_transform"))
24433      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
24434    if (json.has("parameter")) {
24435      JsonArray array = json.getAsJsonArray("parameter");
24436      for (int i = 0; i < array.size(); i++) {
24437        res.getParameter().add(parseStructureMapStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject(), owner));
24438      }
24439    };
24440  }
24441
24442  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapStructureMapGroupRuleTargetParameterComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24443    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
24444    parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(json, owner, res);
24445    return res;
24446  }
24447
24448  protected void parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetParameterComponent res) throws IOException, FHIRFormatError {
24449    parseBackboneElementProperties(json, res);
24450    Type value = parseType("value", json);
24451    if (value != null)
24452      res.setValue(value);
24453  }
24454
24455  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapStructureMapGroupRuleDependentComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24456    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
24457    parseStructureMapStructureMapGroupRuleDependentComponentProperties(json, owner, res);
24458    return res;
24459  }
24460
24461  protected void parseStructureMapStructureMapGroupRuleDependentComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleDependentComponent res) throws IOException, FHIRFormatError {
24462    parseBackboneElementProperties(json, res);
24463    if (json.has("name"))
24464      res.setNameElement(parseId(json.get("name").getAsString()));
24465    if (json.has("_name"))
24466      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24467    if (json.has("variable")) {
24468      JsonArray array = json.getAsJsonArray("variable");
24469      for (int i = 0; i < array.size(); i++) {
24470        res.getVariable().add(parseString(array.get(i).getAsString()));
24471      }
24472    };
24473    if (json.has("_variable")) {
24474      JsonArray array = json.getAsJsonArray("_variable");
24475      for (int i = 0; i < array.size(); i++) {
24476        if (i == res.getVariable().size())
24477          res.getVariable().add(parseString(null));
24478        if (array.get(i) instanceof JsonObject) 
24479          parseElementProperties(array.get(i).getAsJsonObject(), res.getVariable().get(i));
24480      }
24481    };
24482  }
24483
24484  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
24485    Subscription res = new Subscription();
24486    parseSubscriptionProperties(json, res);
24487    return res;
24488  }
24489
24490  protected void parseSubscriptionProperties(JsonObject json, Subscription res) throws IOException, FHIRFormatError {
24491    parseDomainResourceProperties(json, res);
24492    if (json.has("identifier")) {
24493      JsonArray array = json.getAsJsonArray("identifier");
24494      for (int i = 0; i < array.size(); i++) {
24495        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24496      }
24497    };
24498    if (json.has("name"))
24499      res.setNameElement(parseString(json.get("name").getAsString()));
24500    if (json.has("_name"))
24501      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24502    if (json.has("status"))
24503      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Subscription.SubscriptionStatus.NULL, new Subscription.SubscriptionStatusEnumFactory()));
24504    if (json.has("_status"))
24505      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24506    if (json.has("topic"))
24507      res.setTopic(parseReference(json.getAsJsonObject("topic")));
24508    if (json.has("contact")) {
24509      JsonArray array = json.getAsJsonArray("contact");
24510      for (int i = 0; i < array.size(); i++) {
24511        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
24512      }
24513    };
24514    if (json.has("end"))
24515      res.setEndElement(parseInstant(json.get("end").getAsString()));
24516    if (json.has("_end"))
24517      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
24518    if (json.has("reason"))
24519      res.setReasonElement(parseString(json.get("reason").getAsString()));
24520    if (json.has("_reason"))
24521      parseElementProperties(json.getAsJsonObject("_reason"), res.getReasonElement());
24522    if (json.has("filterBy")) {
24523      JsonArray array = json.getAsJsonArray("filterBy");
24524      for (int i = 0; i < array.size(); i++) {
24525        res.getFilterBy().add(parseSubscriptionSubscriptionFilterByComponent(array.get(i).getAsJsonObject(), res));
24526      }
24527    };
24528    if (json.has("error")) {
24529      JsonArray array = json.getAsJsonArray("error");
24530      for (int i = 0; i < array.size(); i++) {
24531        res.getError().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24532      }
24533    };
24534    if (json.has("eventCount"))
24535      res.setEventCountElement(parseUnsignedInt(json.get("eventCount").getAsString()));
24536    if (json.has("_eventCount"))
24537      parseElementProperties(json.getAsJsonObject("_eventCount"), res.getEventCountElement());
24538    if (json.has("channel"))
24539      res.setChannel(parseSubscriptionSubscriptionChannelComponent(json.getAsJsonObject("channel"), res));
24540  }
24541
24542  protected Subscription.SubscriptionFilterByComponent parseSubscriptionSubscriptionFilterByComponent(JsonObject json, Subscription owner) throws IOException, FHIRFormatError {
24543    Subscription.SubscriptionFilterByComponent res = new Subscription.SubscriptionFilterByComponent();
24544    parseSubscriptionSubscriptionFilterByComponentProperties(json, owner, res);
24545    return res;
24546  }
24547
24548  protected void parseSubscriptionSubscriptionFilterByComponentProperties(JsonObject json, Subscription owner, Subscription.SubscriptionFilterByComponent res) throws IOException, FHIRFormatError {
24549    parseBackboneElementProperties(json, res);
24550    if (json.has("name"))
24551      res.setNameElement(parseString(json.get("name").getAsString()));
24552    if (json.has("_name"))
24553      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24554    if (json.has("matchType"))
24555      res.setMatchTypeElement(parseEnumeration(json.get("matchType").getAsString(), Subscription.SubscriptionFilterByMatchType.NULL, new Subscription.SubscriptionFilterByMatchTypeEnumFactory()));
24556    if (json.has("_matchType"))
24557      parseElementProperties(json.getAsJsonObject("_matchType"), res.getMatchTypeElement());
24558    if (json.has("value"))
24559      res.setValueElement(parseString(json.get("value").getAsString()));
24560    if (json.has("_value"))
24561      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
24562  }
24563
24564  protected Subscription.SubscriptionChannelComponent parseSubscriptionSubscriptionChannelComponent(JsonObject json, Subscription owner) throws IOException, FHIRFormatError {
24565    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
24566    parseSubscriptionSubscriptionChannelComponentProperties(json, owner, res);
24567    return res;
24568  }
24569
24570  protected void parseSubscriptionSubscriptionChannelComponentProperties(JsonObject json, Subscription owner, Subscription.SubscriptionChannelComponent res) throws IOException, FHIRFormatError {
24571    parseBackboneElementProperties(json, res);
24572    if (json.has("type"))
24573      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24574    if (json.has("endpoint"))
24575      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
24576    if (json.has("_endpoint"))
24577      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
24578    if (json.has("header")) {
24579      JsonArray array = json.getAsJsonArray("header");
24580      for (int i = 0; i < array.size(); i++) {
24581        res.getHeader().add(parseString(array.get(i).getAsString()));
24582      }
24583    };
24584    if (json.has("_header")) {
24585      JsonArray array = json.getAsJsonArray("_header");
24586      for (int i = 0; i < array.size(); i++) {
24587        if (i == res.getHeader().size())
24588          res.getHeader().add(parseString(null));
24589        if (array.get(i) instanceof JsonObject) 
24590          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
24591      }
24592    };
24593    if (json.has("heartbeatPeriod"))
24594      res.setHeartbeatPeriodElement(parseUnsignedInt(json.get("heartbeatPeriod").getAsString()));
24595    if (json.has("_heartbeatPeriod"))
24596      parseElementProperties(json.getAsJsonObject("_heartbeatPeriod"), res.getHeartbeatPeriodElement());
24597    if (json.has("payload"))
24598      res.setPayload(parseSubscriptionSubscriptionChannelPayloadComponent(json.getAsJsonObject("payload"), owner));
24599  }
24600
24601  protected Subscription.SubscriptionChannelPayloadComponent parseSubscriptionSubscriptionChannelPayloadComponent(JsonObject json, Subscription owner) throws IOException, FHIRFormatError {
24602    Subscription.SubscriptionChannelPayloadComponent res = new Subscription.SubscriptionChannelPayloadComponent();
24603    parseSubscriptionSubscriptionChannelPayloadComponentProperties(json, owner, res);
24604    return res;
24605  }
24606
24607  protected void parseSubscriptionSubscriptionChannelPayloadComponentProperties(JsonObject json, Subscription owner, Subscription.SubscriptionChannelPayloadComponent res) throws IOException, FHIRFormatError {
24608    parseBackboneElementProperties(json, res);
24609    if (json.has("contentType"))
24610      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
24611    if (json.has("_contentType"))
24612      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
24613    if (json.has("content"))
24614      res.setContentElement(parseEnumeration(json.get("content").getAsString(), Subscription.SubscriptionPayloadContent.NULL, new Subscription.SubscriptionPayloadContentEnumFactory()));
24615    if (json.has("_content"))
24616      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
24617  }
24618
24619  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
24620    Substance res = new Substance();
24621    parseSubstanceProperties(json, res);
24622    return res;
24623  }
24624
24625  protected void parseSubstanceProperties(JsonObject json, Substance res) throws IOException, FHIRFormatError {
24626    parseDomainResourceProperties(json, res);
24627    if (json.has("identifier")) {
24628      JsonArray array = json.getAsJsonArray("identifier");
24629      for (int i = 0; i < array.size(); i++) {
24630        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24631      }
24632    };
24633    if (json.has("status"))
24634      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Substance.FHIRSubstanceStatus.NULL, new Substance.FHIRSubstanceStatusEnumFactory()));
24635    if (json.has("_status"))
24636      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24637    if (json.has("category")) {
24638      JsonArray array = json.getAsJsonArray("category");
24639      for (int i = 0; i < array.size(); i++) {
24640        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24641      }
24642    };
24643    if (json.has("code"))
24644      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
24645    if (json.has("description"))
24646      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24647    if (json.has("_description"))
24648      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24649    if (json.has("instance")) {
24650      JsonArray array = json.getAsJsonArray("instance");
24651      for (int i = 0; i < array.size(); i++) {
24652        res.getInstance().add(parseSubstanceSubstanceInstanceComponent(array.get(i).getAsJsonObject(), res));
24653      }
24654    };
24655    if (json.has("ingredient")) {
24656      JsonArray array = json.getAsJsonArray("ingredient");
24657      for (int i = 0; i < array.size(); i++) {
24658        res.getIngredient().add(parseSubstanceSubstanceIngredientComponent(array.get(i).getAsJsonObject(), res));
24659      }
24660    };
24661  }
24662
24663  protected Substance.SubstanceInstanceComponent parseSubstanceSubstanceInstanceComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
24664    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
24665    parseSubstanceSubstanceInstanceComponentProperties(json, owner, res);
24666    return res;
24667  }
24668
24669  protected void parseSubstanceSubstanceInstanceComponentProperties(JsonObject json, Substance owner, Substance.SubstanceInstanceComponent res) throws IOException, FHIRFormatError {
24670    parseBackboneElementProperties(json, res);
24671    if (json.has("identifier"))
24672      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24673    if (json.has("expiry"))
24674      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
24675    if (json.has("_expiry"))
24676      parseElementProperties(json.getAsJsonObject("_expiry"), res.getExpiryElement());
24677    if (json.has("quantity"))
24678      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
24679  }
24680
24681  protected Substance.SubstanceIngredientComponent parseSubstanceSubstanceIngredientComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
24682    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
24683    parseSubstanceSubstanceIngredientComponentProperties(json, owner, res);
24684    return res;
24685  }
24686
24687  protected void parseSubstanceSubstanceIngredientComponentProperties(JsonObject json, Substance owner, Substance.SubstanceIngredientComponent res) throws IOException, FHIRFormatError {
24688    parseBackboneElementProperties(json, res);
24689    if (json.has("quantity"))
24690      res.setQuantity(parseRatio(json.getAsJsonObject("quantity")));
24691    Type substance = parseType("substance", json);
24692    if (substance != null)
24693      res.setSubstance(substance);
24694  }
24695
24696  protected SubstanceDefinition parseSubstanceDefinition(JsonObject json) throws IOException, FHIRFormatError {
24697    SubstanceDefinition res = new SubstanceDefinition();
24698    parseSubstanceDefinitionProperties(json, res);
24699    return res;
24700  }
24701
24702  protected void parseSubstanceDefinitionProperties(JsonObject json, SubstanceDefinition res) throws IOException, FHIRFormatError {
24703    parseDomainResourceProperties(json, res);
24704    if (json.has("identifier"))
24705      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24706    if (json.has("status"))
24707      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
24708    if (json.has("category"))
24709      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
24710    if (json.has("domain"))
24711      res.setDomain(parseCodeableConcept(json.getAsJsonObject("domain")));
24712    if (json.has("description"))
24713      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24714    if (json.has("_description"))
24715      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24716    if (json.has("source")) {
24717      JsonArray array = json.getAsJsonArray("source");
24718      for (int i = 0; i < array.size(); i++) {
24719        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24720      }
24721    };
24722    if (json.has("note")) {
24723      JsonArray array = json.getAsJsonArray("note");
24724      for (int i = 0; i < array.size(); i++) {
24725        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
24726      }
24727    };
24728    if (json.has("moiety")) {
24729      JsonArray array = json.getAsJsonArray("moiety");
24730      for (int i = 0; i < array.size(); i++) {
24731        res.getMoiety().add(parseSubstanceDefinitionSubstanceDefinitionMoietyComponent(array.get(i).getAsJsonObject(), res));
24732      }
24733    };
24734    if (json.has("property")) {
24735      JsonArray array = json.getAsJsonArray("property");
24736      for (int i = 0; i < array.size(); i++) {
24737        res.getProperty().add(parseSubstanceDefinitionSubstanceDefinitionPropertyComponent(array.get(i).getAsJsonObject(), res));
24738      }
24739    };
24740    if (json.has("referenceInformation"))
24741      res.setReferenceInformation(parseReference(json.getAsJsonObject("referenceInformation")));
24742    if (json.has("structure"))
24743      res.setStructure(parseSubstanceDefinitionSubstanceDefinitionStructureComponent(json.getAsJsonObject("structure"), res));
24744    if (json.has("code")) {
24745      JsonArray array = json.getAsJsonArray("code");
24746      for (int i = 0; i < array.size(); i++) {
24747        res.getCode().add(parseSubstanceDefinitionSubstanceDefinitionCodeComponent(array.get(i).getAsJsonObject(), res));
24748      }
24749    };
24750    if (json.has("name")) {
24751      JsonArray array = json.getAsJsonArray("name");
24752      for (int i = 0; i < array.size(); i++) {
24753        res.getName().add(parseSubstanceDefinitionSubstanceDefinitionNameComponent(array.get(i).getAsJsonObject(), res));
24754      }
24755    };
24756    if (json.has("molecularWeight")) {
24757      JsonArray array = json.getAsJsonArray("molecularWeight");
24758      for (int i = 0; i < array.size(); i++) {
24759        res.getMolecularWeight().add(parseSubstanceDefinitionSubstanceDefinitionStructureIsotopeMolecularWeightComponent(array.get(i).getAsJsonObject(), res));
24760      }
24761    };
24762    if (json.has("relationship")) {
24763      JsonArray array = json.getAsJsonArray("relationship");
24764      for (int i = 0; i < array.size(); i++) {
24765        res.getRelationship().add(parseSubstanceDefinitionSubstanceDefinitionRelationshipComponent(array.get(i).getAsJsonObject(), res));
24766      }
24767    };
24768    if (json.has("nucleicAcid"))
24769      res.setNucleicAcid(parseReference(json.getAsJsonObject("nucleicAcid")));
24770    if (json.has("polymer"))
24771      res.setPolymer(parseReference(json.getAsJsonObject("polymer")));
24772    if (json.has("protein"))
24773      res.setProtein(parseReference(json.getAsJsonObject("protein")));
24774    if (json.has("sourceMaterial"))
24775      res.setSourceMaterial(parseReference(json.getAsJsonObject("sourceMaterial")));
24776  }
24777
24778  protected SubstanceDefinition.SubstanceDefinitionMoietyComponent parseSubstanceDefinitionSubstanceDefinitionMoietyComponent(JsonObject json, SubstanceDefinition owner) throws IOException, FHIRFormatError {
24779    SubstanceDefinition.SubstanceDefinitionMoietyComponent res = new SubstanceDefinition.SubstanceDefinitionMoietyComponent();
24780    parseSubstanceDefinitionSubstanceDefinitionMoietyComponentProperties(json, owner, res);
24781    return res;
24782  }
24783
24784  protected void parseSubstanceDefinitionSubstanceDefinitionMoietyComponentProperties(JsonObject json, SubstanceDefinition owner, SubstanceDefinition.SubstanceDefinitionMoietyComponent res) throws IOException, FHIRFormatError {
24785    parseBackboneElementProperties(json, res);
24786    if (json.has("role"))
24787      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
24788    if (json.has("identifier"))
24789      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24790    if (json.has("name"))
24791      res.setNameElement(parseString(json.get("name").getAsString()));
24792    if (json.has("_name"))
24793      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24794    if (json.has("stereochemistry"))
24795      res.setStereochemistry(parseCodeableConcept(json.getAsJsonObject("stereochemistry")));
24796    if (json.has("opticalActivity"))
24797      res.setOpticalActivity(parseCodeableConcept(json.getAsJsonObject("opticalActivity")));
24798    if (json.has("molecularFormula"))
24799      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
24800    if (json.has("_molecularFormula"))
24801      parseElementProperties(json.getAsJsonObject("_molecularFormula"), res.getMolecularFormulaElement());
24802    Type amount = parseType("amount", json);
24803    if (amount != null)
24804      res.setAmount(amount);
24805    if (json.has("amountType"))
24806      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
24807  }
24808
24809  protected SubstanceDefinition.SubstanceDefinitionPropertyComponent parseSubstanceDefinitionSubstanceDefinitionPropertyComponent(JsonObject json, SubstanceDefinition owner) throws IOException, FHIRFormatError {
24810    SubstanceDefinition.SubstanceDefinitionPropertyComponent res = new SubstanceDefinition.SubstanceDefinitionPropertyComponent();
24811    parseSubstanceDefinitionSubstanceDefinitionPropertyComponentProperties(json, owner, res);
24812    return res;
24813  }
24814
24815  protected void parseSubstanceDefinitionSubstanceDefinitionPropertyComponentProperties(JsonObject json, SubstanceDefinition owner, SubstanceDefinition.SubstanceDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
24816    parseBackboneElementProperties(json, res);
24817    if (json.has("category"))
24818      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
24819    if (json.has("code"))
24820      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
24821    if (json.has("parameters"))
24822      res.setParametersElement(parseString(json.get("parameters").getAsString()));
24823    if (json.has("_parameters"))
24824      parseElementProperties(json.getAsJsonObject("_parameters"), res.getParametersElement());
24825    Type definingSubstance = parseType("definingSubstance", json);
24826    if (definingSubstance != null)
24827      res.setDefiningSubstance(definingSubstance);
24828    Type amount = parseType("amount", json);
24829    if (amount != null)
24830      res.setAmount(amount);
24831    if (json.has("referenceRange"))
24832      res.setReferenceRange(parseRange(json.getAsJsonObject("referenceRange")));
24833    if (json.has("source")) {
24834      JsonArray array = json.getAsJsonArray("source");
24835      for (int i = 0; i < array.size(); i++) {
24836        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24837      }
24838    };
24839  }
24840
24841  protected SubstanceDefinition.SubstanceDefinitionStructureComponent parseSubstanceDefinitionSubstanceDefinitionStructureComponent(JsonObject json, SubstanceDefinition owner) throws IOException, FHIRFormatError {
24842    SubstanceDefinition.SubstanceDefinitionStructureComponent res = new SubstanceDefinition.SubstanceDefinitionStructureComponent();
24843    parseSubstanceDefinitionSubstanceDefinitionStructureComponentProperties(json, owner, res);
24844    return res;
24845  }
24846
24847  protected void parseSubstanceDefinitionSubstanceDefinitionStructureComponentProperties(JsonObject json, SubstanceDefinition owner, SubstanceDefinition.SubstanceDefinitionStructureComponent res) throws IOException, FHIRFormatError {
24848    parseBackboneElementProperties(json, res);
24849    if (json.has("stereochemistry"))
24850      res.setStereochemistry(parseCodeableConcept(json.getAsJsonObject("stereochemistry")));
24851    if (json.has("opticalActivity"))
24852      res.setOpticalActivity(parseCodeableConcept(json.getAsJsonObject("opticalActivity")));
24853    if (json.has("molecularFormula"))
24854      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
24855    if (json.has("_molecularFormula"))
24856      parseElementProperties(json.getAsJsonObject("_molecularFormula"), res.getMolecularFormulaElement());
24857    if (json.has("molecularFormulaByMoiety"))
24858      res.setMolecularFormulaByMoietyElement(parseString(json.get("molecularFormulaByMoiety").getAsString()));
24859    if (json.has("_molecularFormulaByMoiety"))
24860      parseElementProperties(json.getAsJsonObject("_molecularFormulaByMoiety"), res.getMolecularFormulaByMoietyElement());
24861    if (json.has("isotope")) {
24862      JsonArray array = json.getAsJsonArray("isotope");
24863      for (int i = 0; i < array.size(); i++) {
24864        res.getIsotope().add(parseSubstanceDefinitionSubstanceDefinitionStructureIsotopeComponent(array.get(i).getAsJsonObject(), owner));
24865      }
24866    };
24867    if (json.has("molecularWeight"))
24868      res.setMolecularWeight(parseSubstanceDefinitionSubstanceDefinitionStructureIsotopeMolecularWeightComponent(json.getAsJsonObject("molecularWeight"), owner));
24869    if (json.has("source")) {
24870      JsonArray array = json.getAsJsonArray("source");
24871      for (int i = 0; i < array.size(); i++) {
24872        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24873      }
24874    };
24875    if (json.has("representation")) {
24876      JsonArray array = json.getAsJsonArray("representation");
24877      for (int i = 0; i < array.size(); i++) {
24878        res.getRepresentation().add(parseSubstanceDefinitionSubstanceDefinitionStructureRepresentationComponent(array.get(i).getAsJsonObject(), owner));
24879      }
24880    };
24881  }
24882
24883  protected SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent parseSubstanceDefinitionSubstanceDefinitionStructureIsotopeComponent(JsonObject json, SubstanceDefinition owner) throws IOException, FHIRFormatError {
24884    SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent res = new SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent();
24885    parseSubstanceDefinitionSubstanceDefinitionStructureIsotopeComponentProperties(json, owner, res);
24886    return res;
24887  }
24888
24889  protected void parseSubstanceDefinitionSubstanceDefinitionStructureIsotopeComponentProperties(JsonObject json, SubstanceDefinition owner, SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent res) throws IOException, FHIRFormatError {
24890    parseBackboneElementProperties(json, res);
24891    if (json.has("identifier"))
24892      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24893    if (json.has("name"))
24894      res.setName(parseCodeableConcept(json.getAsJsonObject("name")));
24895    if (json.has("substitution"))
24896      res.setSubstitution(parseCodeableConcept(json.getAsJsonObject("substitution")));
24897    if (json.has("halfLife"))
24898      res.setHalfLife(parseQuantity(json.getAsJsonObject("halfLife")));
24899    if (json.has("molecularWeight"))
24900      res.setMolecularWeight(parseSubstanceDefinitionSubstanceDefinitionStructureIsotopeMolecularWeightComponent(json.getAsJsonObject("molecularWeight"), owner));
24901  }
24902
24903  protected SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent parseSubstanceDefinitionSubstanceDefinitionStructureIsotopeMolecularWeightComponent(JsonObject json, SubstanceDefinition owner) throws IOException, FHIRFormatError {
24904    SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent res = new SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent();
24905    parseSubstanceDefinitionSubstanceDefinitionStructureIsotopeMolecularWeightComponentProperties(json, owner, res);
24906    return res;
24907  }
24908
24909  protected void parseSubstanceDefinitionSubstanceDefinitionStructureIsotopeMolecularWeightComponentProperties(JsonObject json, SubstanceDefinition owner, SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent res) throws IOException, FHIRFormatError {
24910    parseBackboneElementProperties(json, res);
24911    if (json.has("method"))
24912      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
24913    if (json.has("type"))
24914      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24915    if (json.has("amount"))
24916      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
24917  }
24918
24919  protected SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent parseSubstanceDefinitionSubstanceDefinitionStructureRepresentationComponent(JsonObject json, SubstanceDefinition owner) throws IOException, FHIRFormatError {
24920    SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent res = new SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent();
24921    parseSubstanceDefinitionSubstanceDefinitionStructureRepresentationComponentProperties(json, owner, res);
24922    return res;
24923  }
24924
24925  protected void parseSubstanceDefinitionSubstanceDefinitionStructureRepresentationComponentProperties(JsonObject json, SubstanceDefinition owner, SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent res) throws IOException, FHIRFormatError {
24926    parseBackboneElementProperties(json, res);
24927    if (json.has("type"))
24928      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24929    if (json.has("representation"))
24930      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
24931    if (json.has("_representation"))
24932      parseElementProperties(json.getAsJsonObject("_representation"), res.getRepresentationElement());
24933    if (json.has("attachment"))
24934      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
24935  }
24936
24937  protected SubstanceDefinition.SubstanceDefinitionCodeComponent parseSubstanceDefinitionSubstanceDefinitionCodeComponent(JsonObject json, SubstanceDefinition owner) throws IOException, FHIRFormatError {
24938    SubstanceDefinition.SubstanceDefinitionCodeComponent res = new SubstanceDefinition.SubstanceDefinitionCodeComponent();
24939    parseSubstanceDefinitionSubstanceDefinitionCodeComponentProperties(json, owner, res);
24940    return res;
24941  }
24942
24943  protected void parseSubstanceDefinitionSubstanceDefinitionCodeComponentProperties(JsonObject json, SubstanceDefinition owner, SubstanceDefinition.SubstanceDefinitionCodeComponent res) throws IOException, FHIRFormatError {
24944    parseBackboneElementProperties(json, res);
24945    if (json.has("code"))
24946      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
24947    if (json.has("status"))
24948      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
24949    if (json.has("statusDate"))
24950      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
24951    if (json.has("_statusDate"))
24952      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
24953    if (json.has("note")) {
24954      JsonArray array = json.getAsJsonArray("note");
24955      for (int i = 0; i < array.size(); i++) {
24956        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
24957      }
24958    };
24959    if (json.has("source")) {
24960      JsonArray array = json.getAsJsonArray("source");
24961      for (int i = 0; i < array.size(); i++) {
24962        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24963      }
24964    };
24965  }
24966
24967  protected SubstanceDefinition.SubstanceDefinitionNameComponent parseSubstanceDefinitionSubstanceDefinitionNameComponent(JsonObject json, SubstanceDefinition owner) throws IOException, FHIRFormatError {
24968    SubstanceDefinition.SubstanceDefinitionNameComponent res = new SubstanceDefinition.SubstanceDefinitionNameComponent();
24969    parseSubstanceDefinitionSubstanceDefinitionNameComponentProperties(json, owner, res);
24970    return res;
24971  }
24972
24973  protected void parseSubstanceDefinitionSubstanceDefinitionNameComponentProperties(JsonObject json, SubstanceDefinition owner, SubstanceDefinition.SubstanceDefinitionNameComponent res) throws IOException, FHIRFormatError {
24974    parseBackboneElementProperties(json, res);
24975    if (json.has("name"))
24976      res.setNameElement(parseString(json.get("name").getAsString()));
24977    if (json.has("_name"))
24978      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24979    if (json.has("type"))
24980      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24981    if (json.has("status"))
24982      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
24983    if (json.has("preferred"))
24984      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
24985    if (json.has("_preferred"))
24986      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
24987    if (json.has("language")) {
24988      JsonArray array = json.getAsJsonArray("language");
24989      for (int i = 0; i < array.size(); i++) {
24990        res.getLanguage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24991      }
24992    };
24993    if (json.has("domain")) {
24994      JsonArray array = json.getAsJsonArray("domain");
24995      for (int i = 0; i < array.size(); i++) {
24996        res.getDomain().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24997      }
24998    };
24999    if (json.has("jurisdiction")) {
25000      JsonArray array = json.getAsJsonArray("jurisdiction");
25001      for (int i = 0; i < array.size(); i++) {
25002        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25003      }
25004    };
25005    if (json.has("synonym")) {
25006      JsonArray array = json.getAsJsonArray("synonym");
25007      for (int i = 0; i < array.size(); i++) {
25008        res.getSynonym().add(parseSubstanceDefinitionSubstanceDefinitionNameComponent(array.get(i).getAsJsonObject(), owner));
25009      }
25010    };
25011    if (json.has("translation")) {
25012      JsonArray array = json.getAsJsonArray("translation");
25013      for (int i = 0; i < array.size(); i++) {
25014        res.getTranslation().add(parseSubstanceDefinitionSubstanceDefinitionNameComponent(array.get(i).getAsJsonObject(), owner));
25015      }
25016    };
25017    if (json.has("official")) {
25018      JsonArray array = json.getAsJsonArray("official");
25019      for (int i = 0; i < array.size(); i++) {
25020        res.getOfficial().add(parseSubstanceDefinitionSubstanceDefinitionNameOfficialComponent(array.get(i).getAsJsonObject(), owner));
25021      }
25022    };
25023    if (json.has("source")) {
25024      JsonArray array = json.getAsJsonArray("source");
25025      for (int i = 0; i < array.size(); i++) {
25026        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25027      }
25028    };
25029  }
25030
25031  protected SubstanceDefinition.SubstanceDefinitionNameOfficialComponent parseSubstanceDefinitionSubstanceDefinitionNameOfficialComponent(JsonObject json, SubstanceDefinition owner) throws IOException, FHIRFormatError {
25032    SubstanceDefinition.SubstanceDefinitionNameOfficialComponent res = new SubstanceDefinition.SubstanceDefinitionNameOfficialComponent();
25033    parseSubstanceDefinitionSubstanceDefinitionNameOfficialComponentProperties(json, owner, res);
25034    return res;
25035  }
25036
25037  protected void parseSubstanceDefinitionSubstanceDefinitionNameOfficialComponentProperties(JsonObject json, SubstanceDefinition owner, SubstanceDefinition.SubstanceDefinitionNameOfficialComponent res) throws IOException, FHIRFormatError {
25038    parseBackboneElementProperties(json, res);
25039    if (json.has("authority"))
25040      res.setAuthority(parseCodeableConcept(json.getAsJsonObject("authority")));
25041    if (json.has("status"))
25042      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
25043    if (json.has("date"))
25044      res.setDateElement(parseDateTime(json.get("date").getAsString()));
25045    if (json.has("_date"))
25046      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
25047  }
25048
25049  protected SubstanceDefinition.SubstanceDefinitionRelationshipComponent parseSubstanceDefinitionSubstanceDefinitionRelationshipComponent(JsonObject json, SubstanceDefinition owner) throws IOException, FHIRFormatError {
25050    SubstanceDefinition.SubstanceDefinitionRelationshipComponent res = new SubstanceDefinition.SubstanceDefinitionRelationshipComponent();
25051    parseSubstanceDefinitionSubstanceDefinitionRelationshipComponentProperties(json, owner, res);
25052    return res;
25053  }
25054
25055  protected void parseSubstanceDefinitionSubstanceDefinitionRelationshipComponentProperties(JsonObject json, SubstanceDefinition owner, SubstanceDefinition.SubstanceDefinitionRelationshipComponent res) throws IOException, FHIRFormatError {
25056    parseBackboneElementProperties(json, res);
25057    Type substanceDefinition = parseType("substanceDefinition", json);
25058    if (substanceDefinition != null)
25059      res.setSubstanceDefinition(substanceDefinition);
25060    if (json.has("relationship"))
25061      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
25062    if (json.has("isDefining"))
25063      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
25064    if (json.has("_isDefining"))
25065      parseElementProperties(json.getAsJsonObject("_isDefining"), res.getIsDefiningElement());
25066    Type amount = parseType("amount", json);
25067    if (amount != null)
25068      res.setAmount(amount);
25069    if (json.has("amountRatioLowLimit"))
25070      res.setAmountRatioLowLimit(parseRatio(json.getAsJsonObject("amountRatioLowLimit")));
25071    if (json.has("amountType"))
25072      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
25073    if (json.has("source")) {
25074      JsonArray array = json.getAsJsonArray("source");
25075      for (int i = 0; i < array.size(); i++) {
25076        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25077      }
25078    };
25079  }
25080
25081  protected SubstanceNucleicAcid parseSubstanceNucleicAcid(JsonObject json) throws IOException, FHIRFormatError {
25082    SubstanceNucleicAcid res = new SubstanceNucleicAcid();
25083    parseSubstanceNucleicAcidProperties(json, res);
25084    return res;
25085  }
25086
25087  protected void parseSubstanceNucleicAcidProperties(JsonObject json, SubstanceNucleicAcid res) throws IOException, FHIRFormatError {
25088    parseDomainResourceProperties(json, res);
25089    if (json.has("sequenceType"))
25090      res.setSequenceType(parseCodeableConcept(json.getAsJsonObject("sequenceType")));
25091    if (json.has("numberOfSubunits"))
25092      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
25093    if (json.has("_numberOfSubunits"))
25094      parseElementProperties(json.getAsJsonObject("_numberOfSubunits"), res.getNumberOfSubunitsElement());
25095    if (json.has("areaOfHybridisation"))
25096      res.setAreaOfHybridisationElement(parseString(json.get("areaOfHybridisation").getAsString()));
25097    if (json.has("_areaOfHybridisation"))
25098      parseElementProperties(json.getAsJsonObject("_areaOfHybridisation"), res.getAreaOfHybridisationElement());
25099    if (json.has("oligoNucleotideType"))
25100      res.setOligoNucleotideType(parseCodeableConcept(json.getAsJsonObject("oligoNucleotideType")));
25101    if (json.has("subunit")) {
25102      JsonArray array = json.getAsJsonArray("subunit");
25103      for (int i = 0; i < array.size(); i++) {
25104        res.getSubunit().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(array.get(i).getAsJsonObject(), res));
25105      }
25106    };
25107  }
25108
25109  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
25110    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent();
25111    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentProperties(json, owner, res);
25112    return res;
25113  }
25114
25115  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentProperties(JsonObject json, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res) throws IOException, FHIRFormatError {
25116    parseBackboneElementProperties(json, res);
25117    if (json.has("subunit"))
25118      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
25119    if (json.has("_subunit"))
25120      parseElementProperties(json.getAsJsonObject("_subunit"), res.getSubunitElement());
25121    if (json.has("sequence"))
25122      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
25123    if (json.has("_sequence"))
25124      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
25125    if (json.has("length"))
25126      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
25127    if (json.has("_length"))
25128      parseElementProperties(json.getAsJsonObject("_length"), res.getLengthElement());
25129    if (json.has("sequenceAttachment"))
25130      res.setSequenceAttachment(parseAttachment(json.getAsJsonObject("sequenceAttachment")));
25131    if (json.has("fivePrime"))
25132      res.setFivePrime(parseCodeableConcept(json.getAsJsonObject("fivePrime")));
25133    if (json.has("threePrime"))
25134      res.setThreePrime(parseCodeableConcept(json.getAsJsonObject("threePrime")));
25135    if (json.has("linkage")) {
25136      JsonArray array = json.getAsJsonArray("linkage");
25137      for (int i = 0; i < array.size(); i++) {
25138        res.getLinkage().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(array.get(i).getAsJsonObject(), owner));
25139      }
25140    };
25141    if (json.has("sugar")) {
25142      JsonArray array = json.getAsJsonArray("sugar");
25143      for (int i = 0; i < array.size(); i++) {
25144        res.getSugar().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(array.get(i).getAsJsonObject(), owner));
25145      }
25146    };
25147  }
25148
25149  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
25150    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent();
25151    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentProperties(json, owner, res);
25152    return res;
25153  }
25154
25155  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentProperties(JsonObject json, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res) throws IOException, FHIRFormatError {
25156    parseBackboneElementProperties(json, res);
25157    if (json.has("connectivity"))
25158      res.setConnectivityElement(parseString(json.get("connectivity").getAsString()));
25159    if (json.has("_connectivity"))
25160      parseElementProperties(json.getAsJsonObject("_connectivity"), res.getConnectivityElement());
25161    if (json.has("identifier"))
25162      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
25163    if (json.has("name"))
25164      res.setNameElement(parseString(json.get("name").getAsString()));
25165    if (json.has("_name"))
25166      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25167    if (json.has("residueSite"))
25168      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
25169    if (json.has("_residueSite"))
25170      parseElementProperties(json.getAsJsonObject("_residueSite"), res.getResidueSiteElement());
25171  }
25172
25173  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
25174    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent();
25175    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentProperties(json, owner, res);
25176    return res;
25177  }
25178
25179  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentProperties(JsonObject json, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res) throws IOException, FHIRFormatError {
25180    parseBackboneElementProperties(json, res);
25181    if (json.has("identifier"))
25182      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
25183    if (json.has("name"))
25184      res.setNameElement(parseString(json.get("name").getAsString()));
25185    if (json.has("_name"))
25186      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25187    if (json.has("residueSite"))
25188      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
25189    if (json.has("_residueSite"))
25190      parseElementProperties(json.getAsJsonObject("_residueSite"), res.getResidueSiteElement());
25191  }
25192
25193  protected SubstancePolymer parseSubstancePolymer(JsonObject json) throws IOException, FHIRFormatError {
25194    SubstancePolymer res = new SubstancePolymer();
25195    parseSubstancePolymerProperties(json, res);
25196    return res;
25197  }
25198
25199  protected void parseSubstancePolymerProperties(JsonObject json, SubstancePolymer res) throws IOException, FHIRFormatError {
25200    parseDomainResourceProperties(json, res);
25201    if (json.has("class"))
25202      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
25203    if (json.has("geometry"))
25204      res.setGeometry(parseCodeableConcept(json.getAsJsonObject("geometry")));
25205    if (json.has("copolymerConnectivity")) {
25206      JsonArray array = json.getAsJsonArray("copolymerConnectivity");
25207      for (int i = 0; i < array.size(); i++) {
25208        res.getCopolymerConnectivity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25209      }
25210    };
25211    if (json.has("modification")) {
25212      JsonArray array = json.getAsJsonArray("modification");
25213      for (int i = 0; i < array.size(); i++) {
25214        res.getModification().add(parseString(array.get(i).getAsString()));
25215      }
25216    };
25217    if (json.has("_modification")) {
25218      JsonArray array = json.getAsJsonArray("_modification");
25219      for (int i = 0; i < array.size(); i++) {
25220        if (i == res.getModification().size())
25221          res.getModification().add(parseString(null));
25222        if (array.get(i) instanceof JsonObject) 
25223          parseElementProperties(array.get(i).getAsJsonObject(), res.getModification().get(i));
25224      }
25225    };
25226    if (json.has("monomerSet")) {
25227      JsonArray array = json.getAsJsonArray("monomerSet");
25228      for (int i = 0; i < array.size(); i++) {
25229        res.getMonomerSet().add(parseSubstancePolymerSubstancePolymerMonomerSetComponent(array.get(i).getAsJsonObject(), res));
25230      }
25231    };
25232    if (json.has("repeat")) {
25233      JsonArray array = json.getAsJsonArray("repeat");
25234      for (int i = 0; i < array.size(); i++) {
25235        res.getRepeat().add(parseSubstancePolymerSubstancePolymerRepeatComponent(array.get(i).getAsJsonObject(), res));
25236      }
25237    };
25238  }
25239
25240  protected SubstancePolymer.SubstancePolymerMonomerSetComponent parseSubstancePolymerSubstancePolymerMonomerSetComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
25241    SubstancePolymer.SubstancePolymerMonomerSetComponent res = new SubstancePolymer.SubstancePolymerMonomerSetComponent();
25242    parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(json, owner, res);
25243    return res;
25244  }
25245
25246  protected void parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetComponent res) throws IOException, FHIRFormatError {
25247    parseBackboneElementProperties(json, res);
25248    if (json.has("ratioType"))
25249      res.setRatioType(parseCodeableConcept(json.getAsJsonObject("ratioType")));
25250    if (json.has("startingMaterial")) {
25251      JsonArray array = json.getAsJsonArray("startingMaterial");
25252      for (int i = 0; i < array.size(); i++) {
25253        res.getStartingMaterial().add(parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(array.get(i).getAsJsonObject(), owner));
25254      }
25255    };
25256  }
25257
25258  protected SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
25259    SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res = new SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent();
25260    parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(json, owner, res);
25261    return res;
25262  }
25263
25264  protected void parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res) throws IOException, FHIRFormatError {
25265    parseBackboneElementProperties(json, res);
25266    if (json.has("material"))
25267      res.setMaterial(parseCodeableConcept(json.getAsJsonObject("material")));
25268    if (json.has("type"))
25269      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25270    if (json.has("isDefining"))
25271      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
25272    if (json.has("_isDefining"))
25273      parseElementProperties(json.getAsJsonObject("_isDefining"), res.getIsDefiningElement());
25274    if (json.has("amount"))
25275      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
25276  }
25277
25278  protected SubstancePolymer.SubstancePolymerRepeatComponent parseSubstancePolymerSubstancePolymerRepeatComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
25279    SubstancePolymer.SubstancePolymerRepeatComponent res = new SubstancePolymer.SubstancePolymerRepeatComponent();
25280    parseSubstancePolymerSubstancePolymerRepeatComponentProperties(json, owner, res);
25281    return res;
25282  }
25283
25284  protected void parseSubstancePolymerSubstancePolymerRepeatComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatComponent res) throws IOException, FHIRFormatError {
25285    parseBackboneElementProperties(json, res);
25286    if (json.has("numberOfUnits"))
25287      res.setNumberOfUnitsElement(parseInteger(json.get("numberOfUnits").getAsLong()));
25288    if (json.has("_numberOfUnits"))
25289      parseElementProperties(json.getAsJsonObject("_numberOfUnits"), res.getNumberOfUnitsElement());
25290    if (json.has("averageMolecularFormula"))
25291      res.setAverageMolecularFormulaElement(parseString(json.get("averageMolecularFormula").getAsString()));
25292    if (json.has("_averageMolecularFormula"))
25293      parseElementProperties(json.getAsJsonObject("_averageMolecularFormula"), res.getAverageMolecularFormulaElement());
25294    if (json.has("repeatUnitAmountType"))
25295      res.setRepeatUnitAmountType(parseCodeableConcept(json.getAsJsonObject("repeatUnitAmountType")));
25296    if (json.has("repeatUnit")) {
25297      JsonArray array = json.getAsJsonArray("repeatUnit");
25298      for (int i = 0; i < array.size(); i++) {
25299        res.getRepeatUnit().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(array.get(i).getAsJsonObject(), owner));
25300      }
25301    };
25302  }
25303
25304  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
25305    SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent();
25306    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(json, owner, res);
25307    return res;
25308  }
25309
25310  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res) throws IOException, FHIRFormatError {
25311    parseBackboneElementProperties(json, res);
25312    if (json.has("orientationOfPolymerisation"))
25313      res.setOrientationOfPolymerisation(parseCodeableConcept(json.getAsJsonObject("orientationOfPolymerisation")));
25314    if (json.has("repeatUnit"))
25315      res.setRepeatUnitElement(parseString(json.get("repeatUnit").getAsString()));
25316    if (json.has("_repeatUnit"))
25317      parseElementProperties(json.getAsJsonObject("_repeatUnit"), res.getRepeatUnitElement());
25318    if (json.has("amount"))
25319      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
25320    if (json.has("degreeOfPolymerisation")) {
25321      JsonArray array = json.getAsJsonArray("degreeOfPolymerisation");
25322      for (int i = 0; i < array.size(); i++) {
25323        res.getDegreeOfPolymerisation().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(array.get(i).getAsJsonObject(), owner));
25324      }
25325    };
25326    if (json.has("structuralRepresentation")) {
25327      JsonArray array = json.getAsJsonArray("structuralRepresentation");
25328      for (int i = 0; i < array.size(); i++) {
25329        res.getStructuralRepresentation().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(array.get(i).getAsJsonObject(), owner));
25330      }
25331    };
25332  }
25333
25334  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
25335    SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent();
25336    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(json, owner, res);
25337    return res;
25338  }
25339
25340  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res) throws IOException, FHIRFormatError {
25341    parseBackboneElementProperties(json, res);
25342    if (json.has("degree"))
25343      res.setDegree(parseCodeableConcept(json.getAsJsonObject("degree")));
25344    if (json.has("amount"))
25345      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
25346  }
25347
25348  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
25349    SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent();
25350    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(json, owner, res);
25351    return res;
25352  }
25353
25354  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res) throws IOException, FHIRFormatError {
25355    parseBackboneElementProperties(json, res);
25356    if (json.has("type"))
25357      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25358    if (json.has("representation"))
25359      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
25360    if (json.has("_representation"))
25361      parseElementProperties(json.getAsJsonObject("_representation"), res.getRepresentationElement());
25362    if (json.has("attachment"))
25363      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
25364  }
25365
25366  protected SubstanceProtein parseSubstanceProtein(JsonObject json) throws IOException, FHIRFormatError {
25367    SubstanceProtein res = new SubstanceProtein();
25368    parseSubstanceProteinProperties(json, res);
25369    return res;
25370  }
25371
25372  protected void parseSubstanceProteinProperties(JsonObject json, SubstanceProtein res) throws IOException, FHIRFormatError {
25373    parseDomainResourceProperties(json, res);
25374    if (json.has("sequenceType"))
25375      res.setSequenceType(parseCodeableConcept(json.getAsJsonObject("sequenceType")));
25376    if (json.has("numberOfSubunits"))
25377      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
25378    if (json.has("_numberOfSubunits"))
25379      parseElementProperties(json.getAsJsonObject("_numberOfSubunits"), res.getNumberOfSubunitsElement());
25380    if (json.has("disulfideLinkage")) {
25381      JsonArray array = json.getAsJsonArray("disulfideLinkage");
25382      for (int i = 0; i < array.size(); i++) {
25383        res.getDisulfideLinkage().add(parseString(array.get(i).getAsString()));
25384      }
25385    };
25386    if (json.has("_disulfideLinkage")) {
25387      JsonArray array = json.getAsJsonArray("_disulfideLinkage");
25388      for (int i = 0; i < array.size(); i++) {
25389        if (i == res.getDisulfideLinkage().size())
25390          res.getDisulfideLinkage().add(parseString(null));
25391        if (array.get(i) instanceof JsonObject) 
25392          parseElementProperties(array.get(i).getAsJsonObject(), res.getDisulfideLinkage().get(i));
25393      }
25394    };
25395    if (json.has("subunit")) {
25396      JsonArray array = json.getAsJsonArray("subunit");
25397      for (int i = 0; i < array.size(); i++) {
25398        res.getSubunit().add(parseSubstanceProteinSubstanceProteinSubunitComponent(array.get(i).getAsJsonObject(), res));
25399      }
25400    };
25401  }
25402
25403  protected SubstanceProtein.SubstanceProteinSubunitComponent parseSubstanceProteinSubstanceProteinSubunitComponent(JsonObject json, SubstanceProtein owner) throws IOException, FHIRFormatError {
25404    SubstanceProtein.SubstanceProteinSubunitComponent res = new SubstanceProtein.SubstanceProteinSubunitComponent();
25405    parseSubstanceProteinSubstanceProteinSubunitComponentProperties(json, owner, res);
25406    return res;
25407  }
25408
25409  protected void parseSubstanceProteinSubstanceProteinSubunitComponentProperties(JsonObject json, SubstanceProtein owner, SubstanceProtein.SubstanceProteinSubunitComponent res) throws IOException, FHIRFormatError {
25410    parseBackboneElementProperties(json, res);
25411    if (json.has("subunit"))
25412      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
25413    if (json.has("_subunit"))
25414      parseElementProperties(json.getAsJsonObject("_subunit"), res.getSubunitElement());
25415    if (json.has("sequence"))
25416      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
25417    if (json.has("_sequence"))
25418      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
25419    if (json.has("length"))
25420      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
25421    if (json.has("_length"))
25422      parseElementProperties(json.getAsJsonObject("_length"), res.getLengthElement());
25423    if (json.has("sequenceAttachment"))
25424      res.setSequenceAttachment(parseAttachment(json.getAsJsonObject("sequenceAttachment")));
25425    if (json.has("nTerminalModificationId"))
25426      res.setNTerminalModificationId(parseIdentifier(json.getAsJsonObject("nTerminalModificationId")));
25427    if (json.has("nTerminalModification"))
25428      res.setNTerminalModificationElement(parseString(json.get("nTerminalModification").getAsString()));
25429    if (json.has("_nTerminalModification"))
25430      parseElementProperties(json.getAsJsonObject("_nTerminalModification"), res.getNTerminalModificationElement());
25431    if (json.has("cTerminalModificationId"))
25432      res.setCTerminalModificationId(parseIdentifier(json.getAsJsonObject("cTerminalModificationId")));
25433    if (json.has("cTerminalModification"))
25434      res.setCTerminalModificationElement(parseString(json.get("cTerminalModification").getAsString()));
25435    if (json.has("_cTerminalModification"))
25436      parseElementProperties(json.getAsJsonObject("_cTerminalModification"), res.getCTerminalModificationElement());
25437  }
25438
25439  protected SubstanceReferenceInformation parseSubstanceReferenceInformation(JsonObject json) throws IOException, FHIRFormatError {
25440    SubstanceReferenceInformation res = new SubstanceReferenceInformation();
25441    parseSubstanceReferenceInformationProperties(json, res);
25442    return res;
25443  }
25444
25445  protected void parseSubstanceReferenceInformationProperties(JsonObject json, SubstanceReferenceInformation res) throws IOException, FHIRFormatError {
25446    parseDomainResourceProperties(json, res);
25447    if (json.has("comment"))
25448      res.setCommentElement(parseString(json.get("comment").getAsString()));
25449    if (json.has("_comment"))
25450      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
25451    if (json.has("gene")) {
25452      JsonArray array = json.getAsJsonArray("gene");
25453      for (int i = 0; i < array.size(); i++) {
25454        res.getGene().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(array.get(i).getAsJsonObject(), res));
25455      }
25456    };
25457    if (json.has("geneElement")) {
25458      JsonArray array = json.getAsJsonArray("geneElement");
25459      for (int i = 0; i < array.size(); i++) {
25460        res.getGeneElement().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(array.get(i).getAsJsonObject(), res));
25461      }
25462    };
25463    if (json.has("classification")) {
25464      JsonArray array = json.getAsJsonArray("classification");
25465      for (int i = 0; i < array.size(); i++) {
25466        res.getClassification().add(parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(array.get(i).getAsJsonObject(), res));
25467      }
25468    };
25469    if (json.has("target")) {
25470      JsonArray array = json.getAsJsonArray("target");
25471      for (int i = 0; i < array.size(); i++) {
25472        res.getTarget().add(parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(array.get(i).getAsJsonObject(), res));
25473      }
25474    };
25475  }
25476
25477  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
25478    SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent();
25479    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(json, owner, res);
25480    return res;
25481  }
25482
25483  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res) throws IOException, FHIRFormatError {
25484    parseBackboneElementProperties(json, res);
25485    if (json.has("geneSequenceOrigin"))
25486      res.setGeneSequenceOrigin(parseCodeableConcept(json.getAsJsonObject("geneSequenceOrigin")));
25487    if (json.has("gene"))
25488      res.setGene(parseCodeableConcept(json.getAsJsonObject("gene")));
25489    if (json.has("source")) {
25490      JsonArray array = json.getAsJsonArray("source");
25491      for (int i = 0; i < array.size(); i++) {
25492        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25493      }
25494    };
25495  }
25496
25497  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
25498    SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent();
25499    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(json, owner, res);
25500    return res;
25501  }
25502
25503  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res) throws IOException, FHIRFormatError {
25504    parseBackboneElementProperties(json, res);
25505    if (json.has("type"))
25506      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25507    if (json.has("element"))
25508      res.setElement(parseIdentifier(json.getAsJsonObject("element")));
25509    if (json.has("source")) {
25510      JsonArray array = json.getAsJsonArray("source");
25511      for (int i = 0; i < array.size(); i++) {
25512        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25513      }
25514    };
25515  }
25516
25517  protected SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
25518    SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent();
25519    parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(json, owner, res);
25520    return res;
25521  }
25522
25523  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res) throws IOException, FHIRFormatError {
25524    parseBackboneElementProperties(json, res);
25525    if (json.has("domain"))
25526      res.setDomain(parseCodeableConcept(json.getAsJsonObject("domain")));
25527    if (json.has("classification"))
25528      res.setClassification(parseCodeableConcept(json.getAsJsonObject("classification")));
25529    if (json.has("subtype")) {
25530      JsonArray array = json.getAsJsonArray("subtype");
25531      for (int i = 0; i < array.size(); i++) {
25532        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25533      }
25534    };
25535    if (json.has("source")) {
25536      JsonArray array = json.getAsJsonArray("source");
25537      for (int i = 0; i < array.size(); i++) {
25538        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25539      }
25540    };
25541  }
25542
25543  protected SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
25544    SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent();
25545    parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(json, owner, res);
25546    return res;
25547  }
25548
25549  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res) throws IOException, FHIRFormatError {
25550    parseBackboneElementProperties(json, res);
25551    if (json.has("target"))
25552      res.setTarget(parseIdentifier(json.getAsJsonObject("target")));
25553    if (json.has("type"))
25554      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25555    if (json.has("interaction"))
25556      res.setInteraction(parseCodeableConcept(json.getAsJsonObject("interaction")));
25557    if (json.has("organism"))
25558      res.setOrganism(parseCodeableConcept(json.getAsJsonObject("organism")));
25559    if (json.has("organismType"))
25560      res.setOrganismType(parseCodeableConcept(json.getAsJsonObject("organismType")));
25561    Type amount = parseType("amount", json);
25562    if (amount != null)
25563      res.setAmount(amount);
25564    if (json.has("amountType"))
25565      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
25566    if (json.has("source")) {
25567      JsonArray array = json.getAsJsonArray("source");
25568      for (int i = 0; i < array.size(); i++) {
25569        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25570      }
25571    };
25572  }
25573
25574  protected SubstanceSourceMaterial parseSubstanceSourceMaterial(JsonObject json) throws IOException, FHIRFormatError {
25575    SubstanceSourceMaterial res = new SubstanceSourceMaterial();
25576    parseSubstanceSourceMaterialProperties(json, res);
25577    return res;
25578  }
25579
25580  protected void parseSubstanceSourceMaterialProperties(JsonObject json, SubstanceSourceMaterial res) throws IOException, FHIRFormatError {
25581    parseDomainResourceProperties(json, res);
25582    if (json.has("sourceMaterialClass"))
25583      res.setSourceMaterialClass(parseCodeableConcept(json.getAsJsonObject("sourceMaterialClass")));
25584    if (json.has("sourceMaterialType"))
25585      res.setSourceMaterialType(parseCodeableConcept(json.getAsJsonObject("sourceMaterialType")));
25586    if (json.has("sourceMaterialState"))
25587      res.setSourceMaterialState(parseCodeableConcept(json.getAsJsonObject("sourceMaterialState")));
25588    if (json.has("organismId"))
25589      res.setOrganismId(parseIdentifier(json.getAsJsonObject("organismId")));
25590    if (json.has("organismName"))
25591      res.setOrganismNameElement(parseString(json.get("organismName").getAsString()));
25592    if (json.has("_organismName"))
25593      parseElementProperties(json.getAsJsonObject("_organismName"), res.getOrganismNameElement());
25594    if (json.has("parentSubstanceId")) {
25595      JsonArray array = json.getAsJsonArray("parentSubstanceId");
25596      for (int i = 0; i < array.size(); i++) {
25597        res.getParentSubstanceId().add(parseIdentifier(array.get(i).getAsJsonObject()));
25598      }
25599    };
25600    if (json.has("parentSubstanceName")) {
25601      JsonArray array = json.getAsJsonArray("parentSubstanceName");
25602      for (int i = 0; i < array.size(); i++) {
25603        res.getParentSubstanceName().add(parseString(array.get(i).getAsString()));
25604      }
25605    };
25606    if (json.has("_parentSubstanceName")) {
25607      JsonArray array = json.getAsJsonArray("_parentSubstanceName");
25608      for (int i = 0; i < array.size(); i++) {
25609        if (i == res.getParentSubstanceName().size())
25610          res.getParentSubstanceName().add(parseString(null));
25611        if (array.get(i) instanceof JsonObject) 
25612          parseElementProperties(array.get(i).getAsJsonObject(), res.getParentSubstanceName().get(i));
25613      }
25614    };
25615    if (json.has("countryOfOrigin")) {
25616      JsonArray array = json.getAsJsonArray("countryOfOrigin");
25617      for (int i = 0; i < array.size(); i++) {
25618        res.getCountryOfOrigin().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25619      }
25620    };
25621    if (json.has("geographicalLocation")) {
25622      JsonArray array = json.getAsJsonArray("geographicalLocation");
25623      for (int i = 0; i < array.size(); i++) {
25624        res.getGeographicalLocation().add(parseString(array.get(i).getAsString()));
25625      }
25626    };
25627    if (json.has("_geographicalLocation")) {
25628      JsonArray array = json.getAsJsonArray("_geographicalLocation");
25629      for (int i = 0; i < array.size(); i++) {
25630        if (i == res.getGeographicalLocation().size())
25631          res.getGeographicalLocation().add(parseString(null));
25632        if (array.get(i) instanceof JsonObject) 
25633          parseElementProperties(array.get(i).getAsJsonObject(), res.getGeographicalLocation().get(i));
25634      }
25635    };
25636    if (json.has("developmentStage"))
25637      res.setDevelopmentStage(parseCodeableConcept(json.getAsJsonObject("developmentStage")));
25638    if (json.has("fractionDescription")) {
25639      JsonArray array = json.getAsJsonArray("fractionDescription");
25640      for (int i = 0; i < array.size(); i++) {
25641        res.getFractionDescription().add(parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(array.get(i).getAsJsonObject(), res));
25642      }
25643    };
25644    if (json.has("organism"))
25645      res.setOrganism(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(json.getAsJsonObject("organism"), res));
25646    if (json.has("partDescription")) {
25647      JsonArray array = json.getAsJsonArray("partDescription");
25648      for (int i = 0; i < array.size(); i++) {
25649        res.getPartDescription().add(parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(array.get(i).getAsJsonObject(), res));
25650      }
25651    };
25652  }
25653
25654  protected SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
25655    SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent();
25656    parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentProperties(json, owner, res);
25657    return res;
25658  }
25659
25660  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res) throws IOException, FHIRFormatError {
25661    parseBackboneElementProperties(json, res);
25662    if (json.has("fraction"))
25663      res.setFractionElement(parseString(json.get("fraction").getAsString()));
25664    if (json.has("_fraction"))
25665      parseElementProperties(json.getAsJsonObject("_fraction"), res.getFractionElement());
25666    if (json.has("materialType"))
25667      res.setMaterialType(parseCodeableConcept(json.getAsJsonObject("materialType")));
25668  }
25669
25670  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
25671    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent();
25672    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentProperties(json, owner, res);
25673    return res;
25674  }
25675
25676  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res) throws IOException, FHIRFormatError {
25677    parseBackboneElementProperties(json, res);
25678    if (json.has("family"))
25679      res.setFamily(parseCodeableConcept(json.getAsJsonObject("family")));
25680    if (json.has("genus"))
25681      res.setGenus(parseCodeableConcept(json.getAsJsonObject("genus")));
25682    if (json.has("species"))
25683      res.setSpecies(parseCodeableConcept(json.getAsJsonObject("species")));
25684    if (json.has("intraspecificType"))
25685      res.setIntraspecificType(parseCodeableConcept(json.getAsJsonObject("intraspecificType")));
25686    if (json.has("intraspecificDescription"))
25687      res.setIntraspecificDescriptionElement(parseString(json.get("intraspecificDescription").getAsString()));
25688    if (json.has("_intraspecificDescription"))
25689      parseElementProperties(json.getAsJsonObject("_intraspecificDescription"), res.getIntraspecificDescriptionElement());
25690    if (json.has("author")) {
25691      JsonArray array = json.getAsJsonArray("author");
25692      for (int i = 0; i < array.size(); i++) {
25693        res.getAuthor().add(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(array.get(i).getAsJsonObject(), owner));
25694      }
25695    };
25696    if (json.has("hybrid"))
25697      res.setHybrid(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(json.getAsJsonObject("hybrid"), owner));
25698    if (json.has("organismGeneral"))
25699      res.setOrganismGeneral(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(json.getAsJsonObject("organismGeneral"), owner));
25700  }
25701
25702  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
25703    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent();
25704    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentProperties(json, owner, res);
25705    return res;
25706  }
25707
25708  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res) throws IOException, FHIRFormatError {
25709    parseBackboneElementProperties(json, res);
25710    if (json.has("authorType"))
25711      res.setAuthorType(parseCodeableConcept(json.getAsJsonObject("authorType")));
25712    if (json.has("authorDescription"))
25713      res.setAuthorDescriptionElement(parseString(json.get("authorDescription").getAsString()));
25714    if (json.has("_authorDescription"))
25715      parseElementProperties(json.getAsJsonObject("_authorDescription"), res.getAuthorDescriptionElement());
25716  }
25717
25718  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
25719    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent();
25720    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentProperties(json, owner, res);
25721    return res;
25722  }
25723
25724  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res) throws IOException, FHIRFormatError {
25725    parseBackboneElementProperties(json, res);
25726    if (json.has("maternalOrganismId"))
25727      res.setMaternalOrganismIdElement(parseString(json.get("maternalOrganismId").getAsString()));
25728    if (json.has("_maternalOrganismId"))
25729      parseElementProperties(json.getAsJsonObject("_maternalOrganismId"), res.getMaternalOrganismIdElement());
25730    if (json.has("maternalOrganismName"))
25731      res.setMaternalOrganismNameElement(parseString(json.get("maternalOrganismName").getAsString()));
25732    if (json.has("_maternalOrganismName"))
25733      parseElementProperties(json.getAsJsonObject("_maternalOrganismName"), res.getMaternalOrganismNameElement());
25734    if (json.has("paternalOrganismId"))
25735      res.setPaternalOrganismIdElement(parseString(json.get("paternalOrganismId").getAsString()));
25736    if (json.has("_paternalOrganismId"))
25737      parseElementProperties(json.getAsJsonObject("_paternalOrganismId"), res.getPaternalOrganismIdElement());
25738    if (json.has("paternalOrganismName"))
25739      res.setPaternalOrganismNameElement(parseString(json.get("paternalOrganismName").getAsString()));
25740    if (json.has("_paternalOrganismName"))
25741      parseElementProperties(json.getAsJsonObject("_paternalOrganismName"), res.getPaternalOrganismNameElement());
25742    if (json.has("hybridType"))
25743      res.setHybridType(parseCodeableConcept(json.getAsJsonObject("hybridType")));
25744  }
25745
25746  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
25747    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent();
25748    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(json, owner, res);
25749    return res;
25750  }
25751
25752  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res) throws IOException, FHIRFormatError {
25753    parseBackboneElementProperties(json, res);
25754    if (json.has("kingdom"))
25755      res.setKingdom(parseCodeableConcept(json.getAsJsonObject("kingdom")));
25756    if (json.has("phylum"))
25757      res.setPhylum(parseCodeableConcept(json.getAsJsonObject("phylum")));
25758    if (json.has("class"))
25759      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
25760    if (json.has("order"))
25761      res.setOrder(parseCodeableConcept(json.getAsJsonObject("order")));
25762  }
25763
25764  protected SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
25765    SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent();
25766    parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentProperties(json, owner, res);
25767    return res;
25768  }
25769
25770  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res) throws IOException, FHIRFormatError {
25771    parseBackboneElementProperties(json, res);
25772    if (json.has("part"))
25773      res.setPart(parseCodeableConcept(json.getAsJsonObject("part")));
25774    if (json.has("partLocation"))
25775      res.setPartLocation(parseCodeableConcept(json.getAsJsonObject("partLocation")));
25776  }
25777
25778  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
25779    SupplyDelivery res = new SupplyDelivery();
25780    parseSupplyDeliveryProperties(json, res);
25781    return res;
25782  }
25783
25784  protected void parseSupplyDeliveryProperties(JsonObject json, SupplyDelivery res) throws IOException, FHIRFormatError {
25785    parseDomainResourceProperties(json, res);
25786    if (json.has("identifier")) {
25787      JsonArray array = json.getAsJsonArray("identifier");
25788      for (int i = 0; i < array.size(); i++) {
25789        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25790      }
25791    };
25792    if (json.has("basedOn")) {
25793      JsonArray array = json.getAsJsonArray("basedOn");
25794      for (int i = 0; i < array.size(); i++) {
25795        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
25796      }
25797    };
25798    if (json.has("partOf")) {
25799      JsonArray array = json.getAsJsonArray("partOf");
25800      for (int i = 0; i < array.size(); i++) {
25801        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
25802      }
25803    };
25804    if (json.has("status"))
25805      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
25806    if (json.has("_status"))
25807      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25808    if (json.has("patient"))
25809      res.setPatient(parseReference(json.getAsJsonObject("patient")));
25810    if (json.has("type"))
25811      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25812    if (json.has("suppliedItem"))
25813      res.setSuppliedItem(parseSupplyDeliverySupplyDeliverySuppliedItemComponent(json.getAsJsonObject("suppliedItem"), res));
25814    Type occurrence = parseType("occurrence", json);
25815    if (occurrence != null)
25816      res.setOccurrence(occurrence);
25817    if (json.has("supplier"))
25818      res.setSupplier(parseReference(json.getAsJsonObject("supplier")));
25819    if (json.has("destination"))
25820      res.setDestination(parseReference(json.getAsJsonObject("destination")));
25821    if (json.has("receiver")) {
25822      JsonArray array = json.getAsJsonArray("receiver");
25823      for (int i = 0; i < array.size(); i++) {
25824        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
25825      }
25826    };
25827  }
25828
25829  protected SupplyDelivery.SupplyDeliverySuppliedItemComponent parseSupplyDeliverySupplyDeliverySuppliedItemComponent(JsonObject json, SupplyDelivery owner) throws IOException, FHIRFormatError {
25830    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
25831    parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(json, owner, res);
25832    return res;
25833  }
25834
25835  protected void parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(JsonObject json, SupplyDelivery owner, SupplyDelivery.SupplyDeliverySuppliedItemComponent res) throws IOException, FHIRFormatError {
25836    parseBackboneElementProperties(json, res);
25837    if (json.has("quantity"))
25838      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
25839    Type item = parseType("item", json);
25840    if (item != null)
25841      res.setItem(item);
25842  }
25843
25844  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
25845    SupplyRequest res = new SupplyRequest();
25846    parseSupplyRequestProperties(json, res);
25847    return res;
25848  }
25849
25850  protected void parseSupplyRequestProperties(JsonObject json, SupplyRequest res) throws IOException, FHIRFormatError {
25851    parseDomainResourceProperties(json, res);
25852    if (json.has("identifier")) {
25853      JsonArray array = json.getAsJsonArray("identifier");
25854      for (int i = 0; i < array.size(); i++) {
25855        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25856      }
25857    };
25858    if (json.has("status"))
25859      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
25860    if (json.has("_status"))
25861      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25862    if (json.has("category"))
25863      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
25864    if (json.has("priority"))
25865      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), SupplyRequest.RequestPriority.NULL, new SupplyRequest.RequestPriorityEnumFactory()));
25866    if (json.has("_priority"))
25867      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
25868    Type item = parseType("item", json);
25869    if (item != null)
25870      res.setItem(item);
25871    if (json.has("quantity"))
25872      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
25873    if (json.has("parameter")) {
25874      JsonArray array = json.getAsJsonArray("parameter");
25875      for (int i = 0; i < array.size(); i++) {
25876        res.getParameter().add(parseSupplyRequestSupplyRequestParameterComponent(array.get(i).getAsJsonObject(), res));
25877      }
25878    };
25879    Type occurrence = parseType("occurrence", json);
25880    if (occurrence != null)
25881      res.setOccurrence(occurrence);
25882    if (json.has("authoredOn"))
25883      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
25884    if (json.has("_authoredOn"))
25885      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
25886    if (json.has("requester"))
25887      res.setRequester(parseReference(json.getAsJsonObject("requester")));
25888    if (json.has("supplier")) {
25889      JsonArray array = json.getAsJsonArray("supplier");
25890      for (int i = 0; i < array.size(); i++) {
25891        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
25892      }
25893    };
25894    if (json.has("reasonCode")) {
25895      JsonArray array = json.getAsJsonArray("reasonCode");
25896      for (int i = 0; i < array.size(); i++) {
25897        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25898      }
25899    };
25900    if (json.has("reasonReference")) {
25901      JsonArray array = json.getAsJsonArray("reasonReference");
25902      for (int i = 0; i < array.size(); i++) {
25903        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
25904      }
25905    };
25906    if (json.has("deliverFrom"))
25907      res.setDeliverFrom(parseReference(json.getAsJsonObject("deliverFrom")));
25908    if (json.has("deliverTo"))
25909      res.setDeliverTo(parseReference(json.getAsJsonObject("deliverTo")));
25910  }
25911
25912  protected SupplyRequest.SupplyRequestParameterComponent parseSupplyRequestSupplyRequestParameterComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
25913    SupplyRequest.SupplyRequestParameterComponent res = new SupplyRequest.SupplyRequestParameterComponent();
25914    parseSupplyRequestSupplyRequestParameterComponentProperties(json, owner, res);
25915    return res;
25916  }
25917
25918  protected void parseSupplyRequestSupplyRequestParameterComponentProperties(JsonObject json, SupplyRequest owner, SupplyRequest.SupplyRequestParameterComponent res) throws IOException, FHIRFormatError {
25919    parseBackboneElementProperties(json, res);
25920    if (json.has("code"))
25921      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
25922    Type value = parseType("value", json);
25923    if (value != null)
25924      res.setValue(value);
25925  }
25926
25927  protected Task parseTask(JsonObject json) throws IOException, FHIRFormatError {
25928    Task res = new Task();
25929    parseTaskProperties(json, res);
25930    return res;
25931  }
25932
25933  protected void parseTaskProperties(JsonObject json, Task res) throws IOException, FHIRFormatError {
25934    parseDomainResourceProperties(json, res);
25935    if (json.has("identifier")) {
25936      JsonArray array = json.getAsJsonArray("identifier");
25937      for (int i = 0; i < array.size(); i++) {
25938        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25939      }
25940    };
25941    if (json.has("instantiatesCanonical"))
25942      res.setInstantiatesCanonicalElement(parseCanonical(json.get("instantiatesCanonical").getAsString()));
25943    if (json.has("_instantiatesCanonical"))
25944      parseElementProperties(json.getAsJsonObject("_instantiatesCanonical"), res.getInstantiatesCanonicalElement());
25945    if (json.has("instantiatesUri"))
25946      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
25947    if (json.has("_instantiatesUri"))
25948      parseElementProperties(json.getAsJsonObject("_instantiatesUri"), res.getInstantiatesUriElement());
25949    if (json.has("basedOn")) {
25950      JsonArray array = json.getAsJsonArray("basedOn");
25951      for (int i = 0; i < array.size(); i++) {
25952        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
25953      }
25954    };
25955    if (json.has("groupIdentifier"))
25956      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
25957    if (json.has("partOf")) {
25958      JsonArray array = json.getAsJsonArray("partOf");
25959      for (int i = 0; i < array.size(); i++) {
25960        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
25961      }
25962    };
25963    if (json.has("status"))
25964      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
25965    if (json.has("_status"))
25966      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25967    if (json.has("statusReason"))
25968      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
25969    if (json.has("businessStatus"))
25970      res.setBusinessStatus(parseCodeableConcept(json.getAsJsonObject("businessStatus")));
25971    if (json.has("intent"))
25972      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Task.TaskIntent.NULL, new Task.TaskIntentEnumFactory()));
25973    if (json.has("_intent"))
25974      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
25975    if (json.has("priority"))
25976      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Task.TaskPriority.NULL, new Task.TaskPriorityEnumFactory()));
25977    if (json.has("_priority"))
25978      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
25979    if (json.has("code"))
25980      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
25981    if (json.has("description"))
25982      res.setDescriptionElement(parseString(json.get("description").getAsString()));
25983    if (json.has("_description"))
25984      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
25985    if (json.has("focus"))
25986      res.setFocus(parseReference(json.getAsJsonObject("focus")));
25987    if (json.has("for"))
25988      res.setFor(parseReference(json.getAsJsonObject("for")));
25989    if (json.has("encounter"))
25990      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
25991    if (json.has("executionPeriod"))
25992      res.setExecutionPeriod(parsePeriod(json.getAsJsonObject("executionPeriod")));
25993    if (json.has("authoredOn"))
25994      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
25995    if (json.has("_authoredOn"))
25996      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
25997    if (json.has("lastModified"))
25998      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
25999    if (json.has("_lastModified"))
26000      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
26001    if (json.has("requester"))
26002      res.setRequester(parseReference(json.getAsJsonObject("requester")));
26003    if (json.has("performerType")) {
26004      JsonArray array = json.getAsJsonArray("performerType");
26005      for (int i = 0; i < array.size(); i++) {
26006        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26007      }
26008    };
26009    if (json.has("owner"))
26010      res.setOwner(parseReference(json.getAsJsonObject("owner")));
26011    if (json.has("location"))
26012      res.setLocation(parseReference(json.getAsJsonObject("location")));
26013    if (json.has("reasonCode"))
26014      res.setReasonCode(parseCodeableConcept(json.getAsJsonObject("reasonCode")));
26015    if (json.has("reasonReference"))
26016      res.setReasonReference(parseReference(json.getAsJsonObject("reasonReference")));
26017    if (json.has("insurance")) {
26018      JsonArray array = json.getAsJsonArray("insurance");
26019      for (int i = 0; i < array.size(); i++) {
26020        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
26021      }
26022    };
26023    if (json.has("note")) {
26024      JsonArray array = json.getAsJsonArray("note");
26025      for (int i = 0; i < array.size(); i++) {
26026        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
26027      }
26028    };
26029    if (json.has("relevantHistory")) {
26030      JsonArray array = json.getAsJsonArray("relevantHistory");
26031      for (int i = 0; i < array.size(); i++) {
26032        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
26033      }
26034    };
26035    if (json.has("restriction"))
26036      res.setRestriction(parseTaskTaskRestrictionComponent(json.getAsJsonObject("restriction"), res));
26037    if (json.has("input")) {
26038      JsonArray array = json.getAsJsonArray("input");
26039      for (int i = 0; i < array.size(); i++) {
26040        res.getInput().add(parseTaskParameterComponent(array.get(i).getAsJsonObject(), res));
26041      }
26042    };
26043    if (json.has("output")) {
26044      JsonArray array = json.getAsJsonArray("output");
26045      for (int i = 0; i < array.size(); i++) {
26046        res.getOutput().add(parseTaskTaskOutputComponent(array.get(i).getAsJsonObject(), res));
26047      }
26048    };
26049  }
26050
26051  protected Task.TaskRestrictionComponent parseTaskTaskRestrictionComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
26052    Task.TaskRestrictionComponent res = new Task.TaskRestrictionComponent();
26053    parseTaskTaskRestrictionComponentProperties(json, owner, res);
26054    return res;
26055  }
26056
26057  protected void parseTaskTaskRestrictionComponentProperties(JsonObject json, Task owner, Task.TaskRestrictionComponent res) throws IOException, FHIRFormatError {
26058    parseBackboneElementProperties(json, res);
26059    if (json.has("repetitions"))
26060      res.setRepetitionsElement(parsePositiveInt(json.get("repetitions").getAsString()));
26061    if (json.has("_repetitions"))
26062      parseElementProperties(json.getAsJsonObject("_repetitions"), res.getRepetitionsElement());
26063    if (json.has("period"))
26064      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
26065    if (json.has("recipient")) {
26066      JsonArray array = json.getAsJsonArray("recipient");
26067      for (int i = 0; i < array.size(); i++) {
26068        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
26069      }
26070    };
26071  }
26072
26073  protected Task.ParameterComponent parseTaskParameterComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
26074    Task.ParameterComponent res = new Task.ParameterComponent();
26075    parseTaskParameterComponentProperties(json, owner, res);
26076    return res;
26077  }
26078
26079  protected void parseTaskParameterComponentProperties(JsonObject json, Task owner, Task.ParameterComponent res) throws IOException, FHIRFormatError {
26080    parseBackboneElementProperties(json, res);
26081    if (json.has("type"))
26082      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
26083    Type value = parseType("value", json);
26084    if (value != null)
26085      res.setValue(value);
26086  }
26087
26088  protected Task.TaskOutputComponent parseTaskTaskOutputComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
26089    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
26090    parseTaskTaskOutputComponentProperties(json, owner, res);
26091    return res;
26092  }
26093
26094  protected void parseTaskTaskOutputComponentProperties(JsonObject json, Task owner, Task.TaskOutputComponent res) throws IOException, FHIRFormatError {
26095    parseBackboneElementProperties(json, res);
26096    if (json.has("type"))
26097      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
26098    Type value = parseType("value", json);
26099    if (value != null)
26100      res.setValue(value);
26101  }
26102
26103  protected TerminologyCapabilities parseTerminologyCapabilities(JsonObject json) throws IOException, FHIRFormatError {
26104    TerminologyCapabilities res = new TerminologyCapabilities();
26105    parseTerminologyCapabilitiesProperties(json, res);
26106    return res;
26107  }
26108
26109  protected void parseTerminologyCapabilitiesProperties(JsonObject json, TerminologyCapabilities res) throws IOException, FHIRFormatError {
26110    parseDomainResourceProperties(json, res);
26111    if (json.has("url"))
26112      res.setUrlElement(parseUri(json.get("url").getAsString()));
26113    if (json.has("_url"))
26114      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
26115    if (json.has("version"))
26116      res.setVersionElement(parseString(json.get("version").getAsString()));
26117    if (json.has("_version"))
26118      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
26119    if (json.has("name"))
26120      res.setNameElement(parseString(json.get("name").getAsString()));
26121    if (json.has("_name"))
26122      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26123    if (json.has("title"))
26124      res.setTitleElement(parseString(json.get("title").getAsString()));
26125    if (json.has("_title"))
26126      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
26127    if (json.has("status"))
26128      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
26129    if (json.has("_status"))
26130      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
26131    if (json.has("experimental"))
26132      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
26133    if (json.has("_experimental"))
26134      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
26135    if (json.has("date"))
26136      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26137    if (json.has("_date"))
26138      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
26139    if (json.has("publisher"))
26140      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
26141    if (json.has("_publisher"))
26142      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
26143    if (json.has("contact")) {
26144      JsonArray array = json.getAsJsonArray("contact");
26145      for (int i = 0; i < array.size(); i++) {
26146        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
26147      }
26148    };
26149    if (json.has("description"))
26150      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26151    if (json.has("_description"))
26152      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26153    if (json.has("useContext")) {
26154      JsonArray array = json.getAsJsonArray("useContext");
26155      for (int i = 0; i < array.size(); i++) {
26156        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
26157      }
26158    };
26159    if (json.has("jurisdiction")) {
26160      JsonArray array = json.getAsJsonArray("jurisdiction");
26161      for (int i = 0; i < array.size(); i++) {
26162        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26163      }
26164    };
26165    if (json.has("purpose"))
26166      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
26167    if (json.has("_purpose"))
26168      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
26169    if (json.has("copyright"))
26170      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
26171    if (json.has("_copyright"))
26172      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
26173    if (json.has("kind"))
26174      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), TerminologyCapabilities.CapabilityStatementKind.NULL, new TerminologyCapabilities.CapabilityStatementKindEnumFactory()));
26175    if (json.has("_kind"))
26176      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
26177    if (json.has("software"))
26178      res.setSoftware(parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(json.getAsJsonObject("software"), res));
26179    if (json.has("implementation"))
26180      res.setImplementation(parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(json.getAsJsonObject("implementation"), res));
26181    if (json.has("lockedDate"))
26182      res.setLockedDateElement(parseBoolean(json.get("lockedDate").getAsBoolean()));
26183    if (json.has("_lockedDate"))
26184      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
26185    if (json.has("codeSystem")) {
26186      JsonArray array = json.getAsJsonArray("codeSystem");
26187      for (int i = 0; i < array.size(); i++) {
26188        res.getCodeSystem().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(array.get(i).getAsJsonObject(), res));
26189      }
26190    };
26191    if (json.has("expansion"))
26192      res.setExpansion(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(json.getAsJsonObject("expansion"), res));
26193    if (json.has("codeSearch"))
26194      res.setCodeSearchElement(parseEnumeration(json.get("codeSearch").getAsString(), TerminologyCapabilities.CodeSearchSupport.NULL, new TerminologyCapabilities.CodeSearchSupportEnumFactory()));
26195    if (json.has("_codeSearch"))
26196      parseElementProperties(json.getAsJsonObject("_codeSearch"), res.getCodeSearchElement());
26197    if (json.has("validateCode"))
26198      res.setValidateCode(parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(json.getAsJsonObject("validateCode"), res));
26199    if (json.has("translation"))
26200      res.setTranslation(parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(json.getAsJsonObject("translation"), res));
26201    if (json.has("closure"))
26202      res.setClosure(parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(json.getAsJsonObject("closure"), res));
26203  }
26204
26205  protected TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26206    TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res = new TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent();
26207    parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentProperties(json, owner, res);
26208    return res;
26209  }
26210
26211  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res) throws IOException, FHIRFormatError {
26212    parseBackboneElementProperties(json, res);
26213    if (json.has("name"))
26214      res.setNameElement(parseString(json.get("name").getAsString()));
26215    if (json.has("_name"))
26216      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26217    if (json.has("version"))
26218      res.setVersionElement(parseString(json.get("version").getAsString()));
26219    if (json.has("_version"))
26220      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
26221  }
26222
26223  protected TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26224    TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent();
26225    parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentProperties(json, owner, res);
26226    return res;
26227  }
26228
26229  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res) throws IOException, FHIRFormatError {
26230    parseBackboneElementProperties(json, res);
26231    if (json.has("description"))
26232      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26233    if (json.has("_description"))
26234      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26235    if (json.has("url"))
26236      res.setUrlElement(parseUrl(json.get("url").getAsString()));
26237    if (json.has("_url"))
26238      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
26239  }
26240
26241  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26242    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent();
26243    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(json, owner, res);
26244    return res;
26245  }
26246
26247  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res) throws IOException, FHIRFormatError {
26248    parseBackboneElementProperties(json, res);
26249    if (json.has("uri"))
26250      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
26251    if (json.has("_uri"))
26252      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
26253    if (json.has("version")) {
26254      JsonArray array = json.getAsJsonArray("version");
26255      for (int i = 0; i < array.size(); i++) {
26256        res.getVersion().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(array.get(i).getAsJsonObject(), owner));
26257      }
26258    };
26259    if (json.has("subsumption"))
26260      res.setSubsumptionElement(parseBoolean(json.get("subsumption").getAsBoolean()));
26261    if (json.has("_subsumption"))
26262      parseElementProperties(json.getAsJsonObject("_subsumption"), res.getSubsumptionElement());
26263  }
26264
26265  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26266    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent();
26267    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(json, owner, res);
26268    return res;
26269  }
26270
26271  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res) throws IOException, FHIRFormatError {
26272    parseBackboneElementProperties(json, res);
26273    if (json.has("code"))
26274      res.setCodeElement(parseString(json.get("code").getAsString()));
26275    if (json.has("_code"))
26276      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
26277    if (json.has("isDefault"))
26278      res.setIsDefaultElement(parseBoolean(json.get("isDefault").getAsBoolean()));
26279    if (json.has("_isDefault"))
26280      parseElementProperties(json.getAsJsonObject("_isDefault"), res.getIsDefaultElement());
26281    if (json.has("compositional"))
26282      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
26283    if (json.has("_compositional"))
26284      parseElementProperties(json.getAsJsonObject("_compositional"), res.getCompositionalElement());
26285    if (json.has("language")) {
26286      JsonArray array = json.getAsJsonArray("language");
26287      for (int i = 0; i < array.size(); i++) {
26288        res.getLanguage().add(parseCode(array.get(i).getAsString()));
26289      }
26290    };
26291    if (json.has("_language")) {
26292      JsonArray array = json.getAsJsonArray("_language");
26293      for (int i = 0; i < array.size(); i++) {
26294        if (i == res.getLanguage().size())
26295          res.getLanguage().add(parseCode(null));
26296        if (array.get(i) instanceof JsonObject) 
26297          parseElementProperties(array.get(i).getAsJsonObject(), res.getLanguage().get(i));
26298      }
26299    };
26300    if (json.has("filter")) {
26301      JsonArray array = json.getAsJsonArray("filter");
26302      for (int i = 0; i < array.size(); i++) {
26303        res.getFilter().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(array.get(i).getAsJsonObject(), owner));
26304      }
26305    };
26306    if (json.has("property")) {
26307      JsonArray array = json.getAsJsonArray("property");
26308      for (int i = 0; i < array.size(); i++) {
26309        res.getProperty().add(parseCode(array.get(i).getAsString()));
26310      }
26311    };
26312    if (json.has("_property")) {
26313      JsonArray array = json.getAsJsonArray("_property");
26314      for (int i = 0; i < array.size(); i++) {
26315        if (i == res.getProperty().size())
26316          res.getProperty().add(parseCode(null));
26317        if (array.get(i) instanceof JsonObject) 
26318          parseElementProperties(array.get(i).getAsJsonObject(), res.getProperty().get(i));
26319      }
26320    };
26321  }
26322
26323  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26324    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent();
26325    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(json, owner, res);
26326    return res;
26327  }
26328
26329  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res) throws IOException, FHIRFormatError {
26330    parseBackboneElementProperties(json, res);
26331    if (json.has("code"))
26332      res.setCodeElement(parseCode(json.get("code").getAsString()));
26333    if (json.has("_code"))
26334      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
26335    if (json.has("op")) {
26336      JsonArray array = json.getAsJsonArray("op");
26337      for (int i = 0; i < array.size(); i++) {
26338        res.getOp().add(parseCode(array.get(i).getAsString()));
26339      }
26340    };
26341    if (json.has("_op")) {
26342      JsonArray array = json.getAsJsonArray("_op");
26343      for (int i = 0; i < array.size(); i++) {
26344        if (i == res.getOp().size())
26345          res.getOp().add(parseCode(null));
26346        if (array.get(i) instanceof JsonObject) 
26347          parseElementProperties(array.get(i).getAsJsonObject(), res.getOp().get(i));
26348      }
26349    };
26350  }
26351
26352  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26353    TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent();
26354    parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(json, owner, res);
26355    return res;
26356  }
26357
26358  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res) throws IOException, FHIRFormatError {
26359    parseBackboneElementProperties(json, res);
26360    if (json.has("hierarchical"))
26361      res.setHierarchicalElement(parseBoolean(json.get("hierarchical").getAsBoolean()));
26362    if (json.has("_hierarchical"))
26363      parseElementProperties(json.getAsJsonObject("_hierarchical"), res.getHierarchicalElement());
26364    if (json.has("paging"))
26365      res.setPagingElement(parseBoolean(json.get("paging").getAsBoolean()));
26366    if (json.has("_paging"))
26367      parseElementProperties(json.getAsJsonObject("_paging"), res.getPagingElement());
26368    if (json.has("incomplete"))
26369      res.setIncompleteElement(parseBoolean(json.get("incomplete").getAsBoolean()));
26370    if (json.has("_incomplete"))
26371      parseElementProperties(json.getAsJsonObject("_incomplete"), res.getIncompleteElement());
26372    if (json.has("parameter")) {
26373      JsonArray array = json.getAsJsonArray("parameter");
26374      for (int i = 0; i < array.size(); i++) {
26375        res.getParameter().add(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
26376      }
26377    };
26378    if (json.has("textFilter"))
26379      res.setTextFilterElement(parseMarkdown(json.get("textFilter").getAsString()));
26380    if (json.has("_textFilter"))
26381      parseElementProperties(json.getAsJsonObject("_textFilter"), res.getTextFilterElement());
26382  }
26383
26384  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26385    TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent();
26386    parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentProperties(json, owner, res);
26387    return res;
26388  }
26389
26390  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res) throws IOException, FHIRFormatError {
26391    parseBackboneElementProperties(json, res);
26392    if (json.has("name"))
26393      res.setNameElement(parseCode(json.get("name").getAsString()));
26394    if (json.has("_name"))
26395      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26396    if (json.has("documentation"))
26397      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
26398    if (json.has("_documentation"))
26399      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
26400  }
26401
26402  protected TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26403    TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res = new TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent();
26404    parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(json, owner, res);
26405    return res;
26406  }
26407
26408  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res) throws IOException, FHIRFormatError {
26409    parseBackboneElementProperties(json, res);
26410    if (json.has("translations"))
26411      res.setTranslationsElement(parseBoolean(json.get("translations").getAsBoolean()));
26412    if (json.has("_translations"))
26413      parseElementProperties(json.getAsJsonObject("_translations"), res.getTranslationsElement());
26414  }
26415
26416  protected TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26417    TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent();
26418    parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(json, owner, res);
26419    return res;
26420  }
26421
26422  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res) throws IOException, FHIRFormatError {
26423    parseBackboneElementProperties(json, res);
26424    if (json.has("needsMap"))
26425      res.setNeedsMapElement(parseBoolean(json.get("needsMap").getAsBoolean()));
26426    if (json.has("_needsMap"))
26427      parseElementProperties(json.getAsJsonObject("_needsMap"), res.getNeedsMapElement());
26428  }
26429
26430  protected TerminologyCapabilities.TerminologyCapabilitiesClosureComponent parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26431    TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res = new TerminologyCapabilities.TerminologyCapabilitiesClosureComponent();
26432    parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(json, owner, res);
26433    return res;
26434  }
26435
26436  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res) throws IOException, FHIRFormatError {
26437    parseBackboneElementProperties(json, res);
26438    if (json.has("translation"))
26439      res.setTranslationElement(parseBoolean(json.get("translation").getAsBoolean()));
26440    if (json.has("_translation"))
26441      parseElementProperties(json.getAsJsonObject("_translation"), res.getTranslationElement());
26442  }
26443
26444  protected TestReport parseTestReport(JsonObject json) throws IOException, FHIRFormatError {
26445    TestReport res = new TestReport();
26446    parseTestReportProperties(json, res);
26447    return res;
26448  }
26449
26450  protected void parseTestReportProperties(JsonObject json, TestReport res) throws IOException, FHIRFormatError {
26451    parseDomainResourceProperties(json, res);
26452    if (json.has("identifier"))
26453      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
26454    if (json.has("name"))
26455      res.setNameElement(parseString(json.get("name").getAsString()));
26456    if (json.has("_name"))
26457      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26458    if (json.has("status"))
26459      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), TestReport.TestReportStatus.NULL, new TestReport.TestReportStatusEnumFactory()));
26460    if (json.has("_status"))
26461      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
26462    if (json.has("testScript"))
26463      res.setTestScript(parseReference(json.getAsJsonObject("testScript")));
26464    if (json.has("result"))
26465      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportResult.NULL, new TestReport.TestReportResultEnumFactory()));
26466    if (json.has("_result"))
26467      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
26468    if (json.has("score"))
26469      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
26470    if (json.has("_score"))
26471      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
26472    if (json.has("tester"))
26473      res.setTesterElement(parseString(json.get("tester").getAsString()));
26474    if (json.has("_tester"))
26475      parseElementProperties(json.getAsJsonObject("_tester"), res.getTesterElement());
26476    if (json.has("issued"))
26477      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
26478    if (json.has("_issued"))
26479      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
26480    if (json.has("participant")) {
26481      JsonArray array = json.getAsJsonArray("participant");
26482      for (int i = 0; i < array.size(); i++) {
26483        res.getParticipant().add(parseTestReportTestReportParticipantComponent(array.get(i).getAsJsonObject(), res));
26484      }
26485    };
26486    if (json.has("setup"))
26487      res.setSetup(parseTestReportTestReportSetupComponent(json.getAsJsonObject("setup"), res));
26488    if (json.has("test")) {
26489      JsonArray array = json.getAsJsonArray("test");
26490      for (int i = 0; i < array.size(); i++) {
26491        res.getTest().add(parseTestReportTestReportTestComponent(array.get(i).getAsJsonObject(), res));
26492      }
26493    };
26494    if (json.has("teardown"))
26495      res.setTeardown(parseTestReportTestReportTeardownComponent(json.getAsJsonObject("teardown"), res));
26496  }
26497
26498  protected TestReport.TestReportParticipantComponent parseTestReportTestReportParticipantComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26499    TestReport.TestReportParticipantComponent res = new TestReport.TestReportParticipantComponent();
26500    parseTestReportTestReportParticipantComponentProperties(json, owner, res);
26501    return res;
26502  }
26503
26504  protected void parseTestReportTestReportParticipantComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportParticipantComponent res) throws IOException, FHIRFormatError {
26505    parseBackboneElementProperties(json, res);
26506    if (json.has("type"))
26507      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TestReport.TestReportParticipantType.NULL, new TestReport.TestReportParticipantTypeEnumFactory()));
26508    if (json.has("_type"))
26509      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
26510    if (json.has("uri"))
26511      res.setUriElement(parseUri(json.get("uri").getAsString()));
26512    if (json.has("_uri"))
26513      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
26514    if (json.has("display"))
26515      res.setDisplayElement(parseString(json.get("display").getAsString()));
26516    if (json.has("_display"))
26517      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
26518  }
26519
26520  protected TestReport.TestReportSetupComponent parseTestReportTestReportSetupComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26521    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
26522    parseTestReportTestReportSetupComponentProperties(json, owner, res);
26523    return res;
26524  }
26525
26526  protected void parseTestReportTestReportSetupComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportSetupComponent res) throws IOException, FHIRFormatError {
26527    parseBackboneElementProperties(json, res);
26528    if (json.has("action")) {
26529      JsonArray array = json.getAsJsonArray("action");
26530      for (int i = 0; i < array.size(); i++) {
26531        res.getAction().add(parseTestReportSetupActionComponent(array.get(i).getAsJsonObject(), owner));
26532      }
26533    };
26534  }
26535
26536  protected TestReport.SetupActionComponent parseTestReportSetupActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26537    TestReport.SetupActionComponent res = new TestReport.SetupActionComponent();
26538    parseTestReportSetupActionComponentProperties(json, owner, res);
26539    return res;
26540  }
26541
26542  protected void parseTestReportSetupActionComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionComponent res) throws IOException, FHIRFormatError {
26543    parseBackboneElementProperties(json, res);
26544    if (json.has("operation"))
26545      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26546    if (json.has("assert"))
26547      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
26548  }
26549
26550  protected TestReport.SetupActionOperationComponent parseTestReportSetupActionOperationComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26551    TestReport.SetupActionOperationComponent res = new TestReport.SetupActionOperationComponent();
26552    parseTestReportSetupActionOperationComponentProperties(json, owner, res);
26553    return res;
26554  }
26555
26556  protected void parseTestReportSetupActionOperationComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
26557    parseBackboneElementProperties(json, res);
26558    if (json.has("result"))
26559      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
26560    if (json.has("_result"))
26561      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
26562    if (json.has("message"))
26563      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
26564    if (json.has("_message"))
26565      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
26566    if (json.has("detail"))
26567      res.setDetailElement(parseUri(json.get("detail").getAsString()));
26568    if (json.has("_detail"))
26569      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
26570  }
26571
26572  protected TestReport.SetupActionAssertComponent parseTestReportSetupActionAssertComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26573    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
26574    parseTestReportSetupActionAssertComponentProperties(json, owner, res);
26575    return res;
26576  }
26577
26578  protected void parseTestReportSetupActionAssertComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
26579    parseBackboneElementProperties(json, res);
26580    if (json.has("result"))
26581      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
26582    if (json.has("_result"))
26583      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
26584    if (json.has("message"))
26585      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
26586    if (json.has("_message"))
26587      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
26588    if (json.has("detail"))
26589      res.setDetailElement(parseString(json.get("detail").getAsString()));
26590    if (json.has("_detail"))
26591      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
26592  }
26593
26594  protected TestReport.TestReportTestComponent parseTestReportTestReportTestComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26595    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
26596    parseTestReportTestReportTestComponentProperties(json, owner, res);
26597    return res;
26598  }
26599
26600  protected void parseTestReportTestReportTestComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTestComponent res) throws IOException, FHIRFormatError {
26601    parseBackboneElementProperties(json, res);
26602    if (json.has("name"))
26603      res.setNameElement(parseString(json.get("name").getAsString()));
26604    if (json.has("_name"))
26605      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26606    if (json.has("description"))
26607      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26608    if (json.has("_description"))
26609      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26610    if (json.has("action")) {
26611      JsonArray array = json.getAsJsonArray("action");
26612      for (int i = 0; i < array.size(); i++) {
26613        res.getAction().add(parseTestReportTestActionComponent(array.get(i).getAsJsonObject(), owner));
26614      }
26615    };
26616  }
26617
26618  protected TestReport.TestActionComponent parseTestReportTestActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26619    TestReport.TestActionComponent res = new TestReport.TestActionComponent();
26620    parseTestReportTestActionComponentProperties(json, owner, res);
26621    return res;
26622  }
26623
26624  protected void parseTestReportTestActionComponentProperties(JsonObject json, TestReport owner, TestReport.TestActionComponent res) throws IOException, FHIRFormatError {
26625    parseBackboneElementProperties(json, res);
26626    if (json.has("operation"))
26627      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26628    if (json.has("assert"))
26629      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
26630  }
26631
26632  protected TestReport.TestReportTeardownComponent parseTestReportTestReportTeardownComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26633    TestReport.TestReportTeardownComponent res = new TestReport.TestReportTeardownComponent();
26634    parseTestReportTestReportTeardownComponentProperties(json, owner, res);
26635    return res;
26636  }
26637
26638  protected void parseTestReportTestReportTeardownComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTeardownComponent res) throws IOException, FHIRFormatError {
26639    parseBackboneElementProperties(json, res);
26640    if (json.has("action")) {
26641      JsonArray array = json.getAsJsonArray("action");
26642      for (int i = 0; i < array.size(); i++) {
26643        res.getAction().add(parseTestReportTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
26644      }
26645    };
26646  }
26647
26648  protected TestReport.TeardownActionComponent parseTestReportTeardownActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26649    TestReport.TeardownActionComponent res = new TestReport.TeardownActionComponent();
26650    parseTestReportTeardownActionComponentProperties(json, owner, res);
26651    return res;
26652  }
26653
26654  protected void parseTestReportTeardownActionComponentProperties(JsonObject json, TestReport owner, TestReport.TeardownActionComponent res) throws IOException, FHIRFormatError {
26655    parseBackboneElementProperties(json, res);
26656    if (json.has("operation"))
26657      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26658  }
26659
26660  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
26661    TestScript res = new TestScript();
26662    parseTestScriptProperties(json, res);
26663    return res;
26664  }
26665
26666  protected void parseTestScriptProperties(JsonObject json, TestScript res) throws IOException, FHIRFormatError {
26667    parseDomainResourceProperties(json, res);
26668    if (json.has("url"))
26669      res.setUrlElement(parseUri(json.get("url").getAsString()));
26670    if (json.has("_url"))
26671      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
26672    if (json.has("identifier"))
26673      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
26674    if (json.has("version"))
26675      res.setVersionElement(parseString(json.get("version").getAsString()));
26676    if (json.has("_version"))
26677      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
26678    if (json.has("name"))
26679      res.setNameElement(parseString(json.get("name").getAsString()));
26680    if (json.has("_name"))
26681      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26682    if (json.has("title"))
26683      res.setTitleElement(parseString(json.get("title").getAsString()));
26684    if (json.has("_title"))
26685      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
26686    if (json.has("status"))
26687      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
26688    if (json.has("_status"))
26689      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
26690    if (json.has("experimental"))
26691      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
26692    if (json.has("_experimental"))
26693      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
26694    if (json.has("date"))
26695      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26696    if (json.has("_date"))
26697      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
26698    if (json.has("publisher"))
26699      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
26700    if (json.has("_publisher"))
26701      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
26702    if (json.has("contact")) {
26703      JsonArray array = json.getAsJsonArray("contact");
26704      for (int i = 0; i < array.size(); i++) {
26705        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
26706      }
26707    };
26708    if (json.has("description"))
26709      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26710    if (json.has("_description"))
26711      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26712    if (json.has("useContext")) {
26713      JsonArray array = json.getAsJsonArray("useContext");
26714      for (int i = 0; i < array.size(); i++) {
26715        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
26716      }
26717    };
26718    if (json.has("jurisdiction")) {
26719      JsonArray array = json.getAsJsonArray("jurisdiction");
26720      for (int i = 0; i < array.size(); i++) {
26721        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26722      }
26723    };
26724    if (json.has("purpose"))
26725      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
26726    if (json.has("_purpose"))
26727      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
26728    if (json.has("copyright"))
26729      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
26730    if (json.has("_copyright"))
26731      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
26732    if (json.has("origin")) {
26733      JsonArray array = json.getAsJsonArray("origin");
26734      for (int i = 0; i < array.size(); i++) {
26735        res.getOrigin().add(parseTestScriptTestScriptOriginComponent(array.get(i).getAsJsonObject(), res));
26736      }
26737    };
26738    if (json.has("destination")) {
26739      JsonArray array = json.getAsJsonArray("destination");
26740      for (int i = 0; i < array.size(); i++) {
26741        res.getDestination().add(parseTestScriptTestScriptDestinationComponent(array.get(i).getAsJsonObject(), res));
26742      }
26743    };
26744    if (json.has("metadata"))
26745      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), res));
26746    if (json.has("fixture")) {
26747      JsonArray array = json.getAsJsonArray("fixture");
26748      for (int i = 0; i < array.size(); i++) {
26749        res.getFixture().add(parseTestScriptTestScriptFixtureComponent(array.get(i).getAsJsonObject(), res));
26750      }
26751    };
26752    if (json.has("profile")) {
26753      JsonArray array = json.getAsJsonArray("profile");
26754      for (int i = 0; i < array.size(); i++) {
26755        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
26756      }
26757    };
26758    if (json.has("variable")) {
26759      JsonArray array = json.getAsJsonArray("variable");
26760      for (int i = 0; i < array.size(); i++) {
26761        res.getVariable().add(parseTestScriptTestScriptVariableComponent(array.get(i).getAsJsonObject(), res));
26762      }
26763    };
26764    if (json.has("setup"))
26765      res.setSetup(parseTestScriptTestScriptSetupComponent(json.getAsJsonObject("setup"), res));
26766    if (json.has("test")) {
26767      JsonArray array = json.getAsJsonArray("test");
26768      for (int i = 0; i < array.size(); i++) {
26769        res.getTest().add(parseTestScriptTestScriptTestComponent(array.get(i).getAsJsonObject(), res));
26770      }
26771    };
26772    if (json.has("teardown"))
26773      res.setTeardown(parseTestScriptTestScriptTeardownComponent(json.getAsJsonObject("teardown"), res));
26774  }
26775
26776  protected TestScript.TestScriptOriginComponent parseTestScriptTestScriptOriginComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26777    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
26778    parseTestScriptTestScriptOriginComponentProperties(json, owner, res);
26779    return res;
26780  }
26781
26782  protected void parseTestScriptTestScriptOriginComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptOriginComponent res) throws IOException, FHIRFormatError {
26783    parseBackboneElementProperties(json, res);
26784    if (json.has("index"))
26785      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
26786    if (json.has("_index"))
26787      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
26788    if (json.has("profile"))
26789      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
26790  }
26791
26792  protected TestScript.TestScriptDestinationComponent parseTestScriptTestScriptDestinationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26793    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
26794    parseTestScriptTestScriptDestinationComponentProperties(json, owner, res);
26795    return res;
26796  }
26797
26798  protected void parseTestScriptTestScriptDestinationComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptDestinationComponent res) throws IOException, FHIRFormatError {
26799    parseBackboneElementProperties(json, res);
26800    if (json.has("index"))
26801      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
26802    if (json.has("_index"))
26803      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
26804    if (json.has("profile"))
26805      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
26806  }
26807
26808  protected TestScript.TestScriptMetadataComponent parseTestScriptTestScriptMetadataComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26809    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
26810    parseTestScriptTestScriptMetadataComponentProperties(json, owner, res);
26811    return res;
26812  }
26813
26814  protected void parseTestScriptTestScriptMetadataComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataComponent res) throws IOException, FHIRFormatError {
26815    parseBackboneElementProperties(json, res);
26816    if (json.has("link")) {
26817      JsonArray array = json.getAsJsonArray("link");
26818      for (int i = 0; i < array.size(); i++) {
26819        res.getLink().add(parseTestScriptTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject(), owner));
26820      }
26821    };
26822    if (json.has("capability")) {
26823      JsonArray array = json.getAsJsonArray("capability");
26824      for (int i = 0; i < array.size(); i++) {
26825        res.getCapability().add(parseTestScriptTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject(), owner));
26826      }
26827    };
26828  }
26829
26830  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptTestScriptMetadataLinkComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26831    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
26832    parseTestScriptTestScriptMetadataLinkComponentProperties(json, owner, res);
26833    return res;
26834  }
26835
26836  protected void parseTestScriptTestScriptMetadataLinkComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataLinkComponent res) throws IOException, FHIRFormatError {
26837    parseBackboneElementProperties(json, res);
26838    if (json.has("url"))
26839      res.setUrlElement(parseUri(json.get("url").getAsString()));
26840    if (json.has("_url"))
26841      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
26842    if (json.has("description"))
26843      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26844    if (json.has("_description"))
26845      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26846  }
26847
26848  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptTestScriptMetadataCapabilityComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26849    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
26850    parseTestScriptTestScriptMetadataCapabilityComponentProperties(json, owner, res);
26851    return res;
26852  }
26853
26854  protected void parseTestScriptTestScriptMetadataCapabilityComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataCapabilityComponent res) throws IOException, FHIRFormatError {
26855    parseBackboneElementProperties(json, res);
26856    if (json.has("required"))
26857      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
26858    if (json.has("_required"))
26859      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
26860    if (json.has("validated"))
26861      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
26862    if (json.has("_validated"))
26863      parseElementProperties(json.getAsJsonObject("_validated"), res.getValidatedElement());
26864    if (json.has("description"))
26865      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26866    if (json.has("_description"))
26867      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26868    if (json.has("origin")) {
26869      JsonArray array = json.getAsJsonArray("origin");
26870      for (int i = 0; i < array.size(); i++) {
26871        res.getOrigin().add(parseInteger(array.get(i).getAsLong()));
26872      }
26873    };
26874    if (json.has("_origin")) {
26875      JsonArray array = json.getAsJsonArray("_origin");
26876      for (int i = 0; i < array.size(); i++) {
26877        if (i == res.getOrigin().size())
26878          res.getOrigin().add(parseInteger(null));
26879        if (array.get(i) instanceof JsonObject) 
26880          parseElementProperties(array.get(i).getAsJsonObject(), res.getOrigin().get(i));
26881      }
26882    };
26883    if (json.has("destination"))
26884      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
26885    if (json.has("_destination"))
26886      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
26887    if (json.has("link")) {
26888      JsonArray array = json.getAsJsonArray("link");
26889      for (int i = 0; i < array.size(); i++) {
26890        res.getLink().add(parseUri(array.get(i).getAsString()));
26891      }
26892    };
26893    if (json.has("_link")) {
26894      JsonArray array = json.getAsJsonArray("_link");
26895      for (int i = 0; i < array.size(); i++) {
26896        if (i == res.getLink().size())
26897          res.getLink().add(parseUri(null));
26898        if (array.get(i) instanceof JsonObject) 
26899          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
26900      }
26901    };
26902    if (json.has("capabilities"))
26903      res.setCapabilitiesElement(parseCanonical(json.get("capabilities").getAsString()));
26904    if (json.has("_capabilities"))
26905      parseElementProperties(json.getAsJsonObject("_capabilities"), res.getCapabilitiesElement());
26906  }
26907
26908  protected TestScript.TestScriptFixtureComponent parseTestScriptTestScriptFixtureComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26909    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
26910    parseTestScriptTestScriptFixtureComponentProperties(json, owner, res);
26911    return res;
26912  }
26913
26914  protected void parseTestScriptTestScriptFixtureComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptFixtureComponent res) throws IOException, FHIRFormatError {
26915    parseBackboneElementProperties(json, res);
26916    if (json.has("autocreate"))
26917      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
26918    if (json.has("_autocreate"))
26919      parseElementProperties(json.getAsJsonObject("_autocreate"), res.getAutocreateElement());
26920    if (json.has("autodelete"))
26921      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
26922    if (json.has("_autodelete"))
26923      parseElementProperties(json.getAsJsonObject("_autodelete"), res.getAutodeleteElement());
26924    if (json.has("resource"))
26925      res.setResource(parseReference(json.getAsJsonObject("resource")));
26926  }
26927
26928  protected TestScript.TestScriptVariableComponent parseTestScriptTestScriptVariableComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26929    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
26930    parseTestScriptTestScriptVariableComponentProperties(json, owner, res);
26931    return res;
26932  }
26933
26934  protected void parseTestScriptTestScriptVariableComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptVariableComponent res) throws IOException, FHIRFormatError {
26935    parseBackboneElementProperties(json, res);
26936    if (json.has("name"))
26937      res.setNameElement(parseString(json.get("name").getAsString()));
26938    if (json.has("_name"))
26939      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26940    if (json.has("defaultValue"))
26941      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
26942    if (json.has("_defaultValue"))
26943      parseElementProperties(json.getAsJsonObject("_defaultValue"), res.getDefaultValueElement());
26944    if (json.has("description"))
26945      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26946    if (json.has("_description"))
26947      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26948    if (json.has("expression"))
26949      res.setExpressionElement(parseString(json.get("expression").getAsString()));
26950    if (json.has("_expression"))
26951      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
26952    if (json.has("headerField"))
26953      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
26954    if (json.has("_headerField"))
26955      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
26956    if (json.has("hint"))
26957      res.setHintElement(parseString(json.get("hint").getAsString()));
26958    if (json.has("_hint"))
26959      parseElementProperties(json.getAsJsonObject("_hint"), res.getHintElement());
26960    if (json.has("path"))
26961      res.setPathElement(parseString(json.get("path").getAsString()));
26962    if (json.has("_path"))
26963      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
26964    if (json.has("sourceId"))
26965      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
26966    if (json.has("_sourceId"))
26967      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
26968  }
26969
26970  protected TestScript.TestScriptSetupComponent parseTestScriptTestScriptSetupComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26971    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
26972    parseTestScriptTestScriptSetupComponentProperties(json, owner, res);
26973    return res;
26974  }
26975
26976  protected void parseTestScriptTestScriptSetupComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptSetupComponent res) throws IOException, FHIRFormatError {
26977    parseBackboneElementProperties(json, res);
26978    if (json.has("action")) {
26979      JsonArray array = json.getAsJsonArray("action");
26980      for (int i = 0; i < array.size(); i++) {
26981        res.getAction().add(parseTestScriptSetupActionComponent(array.get(i).getAsJsonObject(), owner));
26982      }
26983    };
26984  }
26985
26986  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26987    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
26988    parseTestScriptSetupActionComponentProperties(json, owner, res);
26989    return res;
26990  }
26991
26992  protected void parseTestScriptSetupActionComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionComponent res) throws IOException, FHIRFormatError {
26993    parseBackboneElementProperties(json, res);
26994    if (json.has("operation"))
26995      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26996    if (json.has("assert"))
26997      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
26998  }
26999
27000  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27001    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
27002    parseTestScriptSetupActionOperationComponentProperties(json, owner, res);
27003    return res;
27004  }
27005
27006  protected void parseTestScriptSetupActionOperationComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
27007    parseBackboneElementProperties(json, res);
27008    if (json.has("type"))
27009      res.setType(parseCoding(json.getAsJsonObject("type")));
27010    if (json.has("resource"))
27011      res.setResourceElement(parseCode(json.get("resource").getAsString()));
27012    if (json.has("_resource"))
27013      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
27014    if (json.has("label"))
27015      res.setLabelElement(parseString(json.get("label").getAsString()));
27016    if (json.has("_label"))
27017      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
27018    if (json.has("description"))
27019      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27020    if (json.has("_description"))
27021      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
27022    if (json.has("accept"))
27023      res.setAcceptElement(parseCode(json.get("accept").getAsString()));
27024    if (json.has("_accept"))
27025      parseElementProperties(json.getAsJsonObject("_accept"), res.getAcceptElement());
27026    if (json.has("contentType"))
27027      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
27028    if (json.has("_contentType"))
27029      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
27030    if (json.has("destination"))
27031      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
27032    if (json.has("_destination"))
27033      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
27034    if (json.has("encodeRequestUrl"))
27035      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
27036    if (json.has("_encodeRequestUrl"))
27037      parseElementProperties(json.getAsJsonObject("_encodeRequestUrl"), res.getEncodeRequestUrlElement());
27038    if (json.has("method"))
27039      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
27040    if (json.has("_method"))
27041      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
27042    if (json.has("origin"))
27043      res.setOriginElement(parseInteger(json.get("origin").getAsLong()));
27044    if (json.has("_origin"))
27045      parseElementProperties(json.getAsJsonObject("_origin"), res.getOriginElement());
27046    if (json.has("params"))
27047      res.setParamsElement(parseString(json.get("params").getAsString()));
27048    if (json.has("_params"))
27049      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
27050    if (json.has("requestHeader")) {
27051      JsonArray array = json.getAsJsonArray("requestHeader");
27052      for (int i = 0; i < array.size(); i++) {
27053        res.getRequestHeader().add(parseTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject(), owner));
27054      }
27055    };
27056    if (json.has("requestId"))
27057      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
27058    if (json.has("_requestId"))
27059      parseElementProperties(json.getAsJsonObject("_requestId"), res.getRequestIdElement());
27060    if (json.has("responseId"))
27061      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
27062    if (json.has("_responseId"))
27063      parseElementProperties(json.getAsJsonObject("_responseId"), res.getResponseIdElement());
27064    if (json.has("sourceId"))
27065      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
27066    if (json.has("_sourceId"))
27067      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
27068    if (json.has("targetId"))
27069      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
27070    if (json.has("_targetId"))
27071      parseElementProperties(json.getAsJsonObject("_targetId"), res.getTargetIdElement());
27072    if (json.has("url"))
27073      res.setUrlElement(parseString(json.get("url").getAsString()));
27074    if (json.has("_url"))
27075      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
27076  }
27077
27078  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27079    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
27080    parseTestScriptSetupActionOperationRequestHeaderComponentProperties(json, owner, res);
27081    return res;
27082  }
27083
27084  protected void parseTestScriptSetupActionOperationRequestHeaderComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationRequestHeaderComponent res) throws IOException, FHIRFormatError {
27085    parseBackboneElementProperties(json, res);
27086    if (json.has("field"))
27087      res.setFieldElement(parseString(json.get("field").getAsString()));
27088    if (json.has("_field"))
27089      parseElementProperties(json.getAsJsonObject("_field"), res.getFieldElement());
27090    if (json.has("value"))
27091      res.setValueElement(parseString(json.get("value").getAsString()));
27092    if (json.has("_value"))
27093      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
27094  }
27095
27096  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27097    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
27098    parseTestScriptSetupActionAssertComponentProperties(json, owner, res);
27099    return res;
27100  }
27101
27102  protected void parseTestScriptSetupActionAssertComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
27103    parseBackboneElementProperties(json, res);
27104    if (json.has("label"))
27105      res.setLabelElement(parseString(json.get("label").getAsString()));
27106    if (json.has("_label"))
27107      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
27108    if (json.has("description"))
27109      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27110    if (json.has("_description"))
27111      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
27112    if (json.has("direction"))
27113      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
27114    if (json.has("_direction"))
27115      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
27116    if (json.has("compareToSourceId"))
27117      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
27118    if (json.has("_compareToSourceId"))
27119      parseElementProperties(json.getAsJsonObject("_compareToSourceId"), res.getCompareToSourceIdElement());
27120    if (json.has("compareToSourceExpression"))
27121      res.setCompareToSourceExpressionElement(parseString(json.get("compareToSourceExpression").getAsString()));
27122    if (json.has("_compareToSourceExpression"))
27123      parseElementProperties(json.getAsJsonObject("_compareToSourceExpression"), res.getCompareToSourceExpressionElement());
27124    if (json.has("compareToSourcePath"))
27125      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
27126    if (json.has("_compareToSourcePath"))
27127      parseElementProperties(json.getAsJsonObject("_compareToSourcePath"), res.getCompareToSourcePathElement());
27128    if (json.has("contentType"))
27129      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
27130    if (json.has("_contentType"))
27131      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
27132    if (json.has("expression"))
27133      res.setExpressionElement(parseString(json.get("expression").getAsString()));
27134    if (json.has("_expression"))
27135      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
27136    if (json.has("headerField"))
27137      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
27138    if (json.has("_headerField"))
27139      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
27140    if (json.has("minimumId"))
27141      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
27142    if (json.has("_minimumId"))
27143      parseElementProperties(json.getAsJsonObject("_minimumId"), res.getMinimumIdElement());
27144    if (json.has("navigationLinks"))
27145      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
27146    if (json.has("_navigationLinks"))
27147      parseElementProperties(json.getAsJsonObject("_navigationLinks"), res.getNavigationLinksElement());
27148    if (json.has("operator"))
27149      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
27150    if (json.has("_operator"))
27151      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
27152    if (json.has("path"))
27153      res.setPathElement(parseString(json.get("path").getAsString()));
27154    if (json.has("_path"))
27155      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
27156    if (json.has("requestMethod"))
27157      res.setRequestMethodElement(parseEnumeration(json.get("requestMethod").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
27158    if (json.has("_requestMethod"))
27159      parseElementProperties(json.getAsJsonObject("_requestMethod"), res.getRequestMethodElement());
27160    if (json.has("requestURL"))
27161      res.setRequestURLElement(parseString(json.get("requestURL").getAsString()));
27162    if (json.has("_requestURL"))
27163      parseElementProperties(json.getAsJsonObject("_requestURL"), res.getRequestURLElement());
27164    if (json.has("resource"))
27165      res.setResourceElement(parseCode(json.get("resource").getAsString()));
27166    if (json.has("_resource"))
27167      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
27168    if (json.has("response"))
27169      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
27170    if (json.has("_response"))
27171      parseElementProperties(json.getAsJsonObject("_response"), res.getResponseElement());
27172    if (json.has("responseCode"))
27173      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
27174    if (json.has("_responseCode"))
27175      parseElementProperties(json.getAsJsonObject("_responseCode"), res.getResponseCodeElement());
27176    if (json.has("sourceId"))
27177      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
27178    if (json.has("_sourceId"))
27179      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
27180    if (json.has("validateProfileId"))
27181      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
27182    if (json.has("_validateProfileId"))
27183      parseElementProperties(json.getAsJsonObject("_validateProfileId"), res.getValidateProfileIdElement());
27184    if (json.has("value"))
27185      res.setValueElement(parseString(json.get("value").getAsString()));
27186    if (json.has("_value"))
27187      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
27188    if (json.has("warningOnly"))
27189      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
27190    if (json.has("_warningOnly"))
27191      parseElementProperties(json.getAsJsonObject("_warningOnly"), res.getWarningOnlyElement());
27192  }
27193
27194  protected TestScript.TestScriptTestComponent parseTestScriptTestScriptTestComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27195    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
27196    parseTestScriptTestScriptTestComponentProperties(json, owner, res);
27197    return res;
27198  }
27199
27200  protected void parseTestScriptTestScriptTestComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTestComponent res) throws IOException, FHIRFormatError {
27201    parseBackboneElementProperties(json, res);
27202    if (json.has("name"))
27203      res.setNameElement(parseString(json.get("name").getAsString()));
27204    if (json.has("_name"))
27205      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
27206    if (json.has("description"))
27207      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27208    if (json.has("_description"))
27209      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
27210    if (json.has("action")) {
27211      JsonArray array = json.getAsJsonArray("action");
27212      for (int i = 0; i < array.size(); i++) {
27213        res.getAction().add(parseTestScriptTestActionComponent(array.get(i).getAsJsonObject(), owner));
27214      }
27215    };
27216  }
27217
27218  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27219    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
27220    parseTestScriptTestActionComponentProperties(json, owner, res);
27221    return res;
27222  }
27223
27224  protected void parseTestScriptTestActionComponentProperties(JsonObject json, TestScript owner, TestScript.TestActionComponent res) throws IOException, FHIRFormatError {
27225    parseBackboneElementProperties(json, res);
27226    if (json.has("operation"))
27227      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
27228    if (json.has("assert"))
27229      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
27230  }
27231
27232  protected TestScript.TestScriptTeardownComponent parseTestScriptTestScriptTeardownComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27233    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
27234    parseTestScriptTestScriptTeardownComponentProperties(json, owner, res);
27235    return res;
27236  }
27237
27238  protected void parseTestScriptTestScriptTeardownComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTeardownComponent res) throws IOException, FHIRFormatError {
27239    parseBackboneElementProperties(json, res);
27240    if (json.has("action")) {
27241      JsonArray array = json.getAsJsonArray("action");
27242      for (int i = 0; i < array.size(); i++) {
27243        res.getAction().add(parseTestScriptTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
27244      }
27245    };
27246  }
27247
27248  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27249    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
27250    parseTestScriptTeardownActionComponentProperties(json, owner, res);
27251    return res;
27252  }
27253
27254  protected void parseTestScriptTeardownActionComponentProperties(JsonObject json, TestScript owner, TestScript.TeardownActionComponent res) throws IOException, FHIRFormatError {
27255    parseBackboneElementProperties(json, res);
27256    if (json.has("operation"))
27257      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
27258  }
27259
27260  protected Topic parseTopic(JsonObject json) throws IOException, FHIRFormatError {
27261    Topic res = new Topic();
27262    parseTopicProperties(json, res);
27263    return res;
27264  }
27265
27266  protected void parseTopicProperties(JsonObject json, Topic res) throws IOException, FHIRFormatError {
27267    parseDomainResourceProperties(json, res);
27268    if (json.has("url"))
27269      res.setUrlElement(parseUri(json.get("url").getAsString()));
27270    if (json.has("_url"))
27271      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
27272    if (json.has("identifier")) {
27273      JsonArray array = json.getAsJsonArray("identifier");
27274      for (int i = 0; i < array.size(); i++) {
27275        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
27276      }
27277    };
27278    if (json.has("version"))
27279      res.setVersionElement(parseString(json.get("version").getAsString()));
27280    if (json.has("_version"))
27281      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
27282    if (json.has("title"))
27283      res.setTitleElement(parseString(json.get("title").getAsString()));
27284    if (json.has("_title"))
27285      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
27286    if (json.has("derivedFromCanonical")) {
27287      JsonArray array = json.getAsJsonArray("derivedFromCanonical");
27288      for (int i = 0; i < array.size(); i++) {
27289        res.getDerivedFromCanonical().add(parseCanonical(array.get(i).getAsString()));
27290      }
27291    };
27292    if (json.has("_derivedFromCanonical")) {
27293      JsonArray array = json.getAsJsonArray("_derivedFromCanonical");
27294      for (int i = 0; i < array.size(); i++) {
27295        if (i == res.getDerivedFromCanonical().size())
27296          res.getDerivedFromCanonical().add(parseCanonical(null));
27297        if (array.get(i) instanceof JsonObject) 
27298          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromCanonical().get(i));
27299      }
27300    };
27301    if (json.has("derivedFromUri")) {
27302      JsonArray array = json.getAsJsonArray("derivedFromUri");
27303      for (int i = 0; i < array.size(); i++) {
27304        res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
27305      }
27306    };
27307    if (json.has("_derivedFromUri")) {
27308      JsonArray array = json.getAsJsonArray("_derivedFromUri");
27309      for (int i = 0; i < array.size(); i++) {
27310        if (i == res.getDerivedFromUri().size())
27311          res.getDerivedFromUri().add(parseUri(null));
27312        if (array.get(i) instanceof JsonObject) 
27313          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
27314      }
27315    };
27316    if (json.has("status"))
27317      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
27318    if (json.has("_status"))
27319      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
27320    if (json.has("experimental"))
27321      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
27322    if (json.has("_experimental"))
27323      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
27324    if (json.has("date"))
27325      res.setDateElement(parseDateTime(json.get("date").getAsString()));
27326    if (json.has("_date"))
27327      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
27328    if (json.has("publisher"))
27329      res.setPublisher(parseReference(json.getAsJsonObject("publisher")));
27330    if (json.has("contact")) {
27331      JsonArray array = json.getAsJsonArray("contact");
27332      for (int i = 0; i < array.size(); i++) {
27333        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
27334      }
27335    };
27336    if (json.has("description"))
27337      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
27338    if (json.has("_description"))
27339      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
27340    if (json.has("useContext")) {
27341      JsonArray array = json.getAsJsonArray("useContext");
27342      for (int i = 0; i < array.size(); i++) {
27343        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
27344      }
27345    };
27346    if (json.has("jurisdiction")) {
27347      JsonArray array = json.getAsJsonArray("jurisdiction");
27348      for (int i = 0; i < array.size(); i++) {
27349        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27350      }
27351    };
27352    if (json.has("purpose"))
27353      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
27354    if (json.has("_purpose"))
27355      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
27356    if (json.has("copyright"))
27357      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
27358    if (json.has("_copyright"))
27359      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
27360    if (json.has("approvalDate"))
27361      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
27362    if (json.has("_approvalDate"))
27363      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
27364    if (json.has("lastReviewDate"))
27365      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
27366    if (json.has("_lastReviewDate"))
27367      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
27368    if (json.has("effectivePeriod"))
27369      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
27370    if (json.has("resourceTrigger"))
27371      res.setResourceTrigger(parseTopicTopicResourceTriggerComponent(json.getAsJsonObject("resourceTrigger"), res));
27372    if (json.has("canFilterBy")) {
27373      JsonArray array = json.getAsJsonArray("canFilterBy");
27374      for (int i = 0; i < array.size(); i++) {
27375        res.getCanFilterBy().add(parseTopicTopicCanFilterByComponent(array.get(i).getAsJsonObject(), res));
27376      }
27377    };
27378  }
27379
27380  protected Topic.TopicResourceTriggerComponent parseTopicTopicResourceTriggerComponent(JsonObject json, Topic owner) throws IOException, FHIRFormatError {
27381    Topic.TopicResourceTriggerComponent res = new Topic.TopicResourceTriggerComponent();
27382    parseTopicTopicResourceTriggerComponentProperties(json, owner, res);
27383    return res;
27384  }
27385
27386  protected void parseTopicTopicResourceTriggerComponentProperties(JsonObject json, Topic owner, Topic.TopicResourceTriggerComponent res) throws IOException, FHIRFormatError {
27387    parseBackboneElementProperties(json, res);
27388    if (json.has("description"))
27389      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27390    if (json.has("_description"))
27391      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
27392    if (json.has("resourceType")) {
27393      JsonArray array = json.getAsJsonArray("resourceType");
27394      for (int i = 0; i < array.size(); i++) {
27395        res.getResourceType().add(parseEnumeration(array.get(i).getAsString(), Topic.FHIRType.NULL, new Topic.FHIRTypeEnumFactory()));
27396      }
27397    };
27398    if (json.has("_resourceType")) {
27399      JsonArray array = json.getAsJsonArray("_resourceType");
27400      for (int i = 0; i < array.size(); i++) {
27401        if (i == res.getResourceType().size())
27402          res.getResourceType().add(parseEnumeration(null, Topic.FHIRType.NULL, new Topic.FHIRTypeEnumFactory()));
27403        if (array.get(i) instanceof JsonObject) 
27404          parseElementProperties(array.get(i).getAsJsonObject(), res.getResourceType().get(i));
27405      }
27406    };
27407    if (json.has("methodCriteria")) {
27408      JsonArray array = json.getAsJsonArray("methodCriteria");
27409      for (int i = 0; i < array.size(); i++) {
27410        res.getMethodCriteria().add(parseEnumeration(array.get(i).getAsString(), Topic.MethodCode.NULL, new Topic.MethodCodeEnumFactory()));
27411      }
27412    };
27413    if (json.has("_methodCriteria")) {
27414      JsonArray array = json.getAsJsonArray("_methodCriteria");
27415      for (int i = 0; i < array.size(); i++) {
27416        if (i == res.getMethodCriteria().size())
27417          res.getMethodCriteria().add(parseEnumeration(null, Topic.MethodCode.NULL, new Topic.MethodCodeEnumFactory()));
27418        if (array.get(i) instanceof JsonObject) 
27419          parseElementProperties(array.get(i).getAsJsonObject(), res.getMethodCriteria().get(i));
27420      }
27421    };
27422    if (json.has("queryCriteria"))
27423      res.setQueryCriteria(parseTopicTopicResourceTriggerQueryCriteriaComponent(json.getAsJsonObject("queryCriteria"), owner));
27424    if (json.has("fhirPathCriteria"))
27425      res.setFhirPathCriteriaElement(parseString(json.get("fhirPathCriteria").getAsString()));
27426    if (json.has("_fhirPathCriteria"))
27427      parseElementProperties(json.getAsJsonObject("_fhirPathCriteria"), res.getFhirPathCriteriaElement());
27428  }
27429
27430  protected Topic.TopicResourceTriggerQueryCriteriaComponent parseTopicTopicResourceTriggerQueryCriteriaComponent(JsonObject json, Topic owner) throws IOException, FHIRFormatError {
27431    Topic.TopicResourceTriggerQueryCriteriaComponent res = new Topic.TopicResourceTriggerQueryCriteriaComponent();
27432    parseTopicTopicResourceTriggerQueryCriteriaComponentProperties(json, owner, res);
27433    return res;
27434  }
27435
27436  protected void parseTopicTopicResourceTriggerQueryCriteriaComponentProperties(JsonObject json, Topic owner, Topic.TopicResourceTriggerQueryCriteriaComponent res) throws IOException, FHIRFormatError {
27437    parseBackboneElementProperties(json, res);
27438    if (json.has("previous"))
27439      res.setPreviousElement(parseString(json.get("previous").getAsString()));
27440    if (json.has("_previous"))
27441      parseElementProperties(json.getAsJsonObject("_previous"), res.getPreviousElement());
27442    if (json.has("current"))
27443      res.setCurrentElement(parseString(json.get("current").getAsString()));
27444    if (json.has("_current"))
27445      parseElementProperties(json.getAsJsonObject("_current"), res.getCurrentElement());
27446    if (json.has("requireBoth"))
27447      res.setRequireBothElement(parseBoolean(json.get("requireBoth").getAsBoolean()));
27448    if (json.has("_requireBoth"))
27449      parseElementProperties(json.getAsJsonObject("_requireBoth"), res.getRequireBothElement());
27450  }
27451
27452  protected Topic.TopicCanFilterByComponent parseTopicTopicCanFilterByComponent(JsonObject json, Topic owner) throws IOException, FHIRFormatError {
27453    Topic.TopicCanFilterByComponent res = new Topic.TopicCanFilterByComponent();
27454    parseTopicTopicCanFilterByComponentProperties(json, owner, res);
27455    return res;
27456  }
27457
27458  protected void parseTopicTopicCanFilterByComponentProperties(JsonObject json, Topic owner, Topic.TopicCanFilterByComponent res) throws IOException, FHIRFormatError {
27459    parseBackboneElementProperties(json, res);
27460    if (json.has("name"))
27461      res.setNameElement(parseString(json.get("name").getAsString()));
27462    if (json.has("_name"))
27463      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
27464    if (json.has("matchType")) {
27465      JsonArray array = json.getAsJsonArray("matchType");
27466      for (int i = 0; i < array.size(); i++) {
27467        res.getMatchType().add(parseEnumeration(array.get(i).getAsString(), Topic.TopicFilterByMatchType.NULL, new Topic.TopicFilterByMatchTypeEnumFactory()));
27468      }
27469    };
27470    if (json.has("_matchType")) {
27471      JsonArray array = json.getAsJsonArray("_matchType");
27472      for (int i = 0; i < array.size(); i++) {
27473        if (i == res.getMatchType().size())
27474          res.getMatchType().add(parseEnumeration(null, Topic.TopicFilterByMatchType.NULL, new Topic.TopicFilterByMatchTypeEnumFactory()));
27475        if (array.get(i) instanceof JsonObject) 
27476          parseElementProperties(array.get(i).getAsJsonObject(), res.getMatchType().get(i));
27477  }
27478    };
27479    if (json.has("documentation"))
27480      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
27481    if (json.has("_documentation"))
27482      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
27483  }
27484
27485  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
27486    ValueSet res = new ValueSet();
27487    parseValueSetProperties(json, res);
27488    return res;
27489  }
27490
27491  protected void parseValueSetProperties(JsonObject json, ValueSet res) throws IOException, FHIRFormatError {
27492    parseDomainResourceProperties(json, res);
27493    if (json.has("url"))
27494      res.setUrlElement(parseUri(json.get("url").getAsString()));
27495    if (json.has("_url"))
27496      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
27497    if (json.has("identifier")) {
27498      JsonArray array = json.getAsJsonArray("identifier");
27499      for (int i = 0; i < array.size(); i++) {
27500        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
27501      }
27502    };
27503    if (json.has("version"))
27504      res.setVersionElement(parseString(json.get("version").getAsString()));
27505    if (json.has("_version"))
27506      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
27507    if (json.has("name"))
27508      res.setNameElement(parseString(json.get("name").getAsString()));
27509    if (json.has("_name"))
27510      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
27511    if (json.has("title"))
27512      res.setTitleElement(parseString(json.get("title").getAsString()));
27513    if (json.has("_title"))
27514      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
27515    if (json.has("status"))
27516      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
27517    if (json.has("_status"))
27518      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
27519    if (json.has("experimental"))
27520      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
27521    if (json.has("_experimental"))
27522      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
27523    if (json.has("date"))
27524      res.setDateElement(parseDateTime(json.get("date").getAsString()));
27525    if (json.has("_date"))
27526      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
27527    if (json.has("publisher"))
27528      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
27529    if (json.has("_publisher"))
27530      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
27531    if (json.has("contact")) {
27532      JsonArray array = json.getAsJsonArray("contact");
27533      for (int i = 0; i < array.size(); i++) {
27534        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
27535      }
27536    };
27537    if (json.has("description"))
27538      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
27539    if (json.has("_description"))
27540      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
27541    if (json.has("useContext")) {
27542      JsonArray array = json.getAsJsonArray("useContext");
27543      for (int i = 0; i < array.size(); i++) {
27544        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
27545      }
27546    };
27547    if (json.has("jurisdiction")) {
27548      JsonArray array = json.getAsJsonArray("jurisdiction");
27549      for (int i = 0; i < array.size(); i++) {
27550        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27551      }
27552    };
27553    if (json.has("immutable"))
27554      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
27555    if (json.has("_immutable"))
27556      parseElementProperties(json.getAsJsonObject("_immutable"), res.getImmutableElement());
27557    if (json.has("purpose"))
27558      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
27559    if (json.has("_purpose"))
27560      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
27561    if (json.has("copyright"))
27562      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
27563    if (json.has("_copyright"))
27564      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
27565    if (json.has("compose"))
27566      res.setCompose(parseValueSetValueSetComposeComponent(json.getAsJsonObject("compose"), res));
27567    if (json.has("expansion"))
27568      res.setExpansion(parseValueSetValueSetExpansionComponent(json.getAsJsonObject("expansion"), res));
27569  }
27570
27571  protected ValueSet.ValueSetComposeComponent parseValueSetValueSetComposeComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27572    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
27573    parseValueSetValueSetComposeComponentProperties(json, owner, res);
27574    return res;
27575  }
27576
27577  protected void parseValueSetValueSetComposeComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetComposeComponent res) throws IOException, FHIRFormatError {
27578    parseBackboneElementProperties(json, res);
27579    if (json.has("lockedDate"))
27580      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
27581    if (json.has("_lockedDate"))
27582      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
27583    if (json.has("inactive"))
27584      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
27585    if (json.has("_inactive"))
27586      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
27587    if (json.has("include")) {
27588      JsonArray array = json.getAsJsonArray("include");
27589      for (int i = 0; i < array.size(); i++) {
27590        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
27591      }
27592    };
27593    if (json.has("exclude")) {
27594      JsonArray array = json.getAsJsonArray("exclude");
27595      for (int i = 0; i < array.size(); i++) {
27596        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
27597      }
27598    };
27599    if (json.has("property")) {
27600      JsonArray array = json.getAsJsonArray("property");
27601      for (int i = 0; i < array.size(); i++) {
27602        res.getProperty().add(parseString(array.get(i).getAsString()));
27603      }
27604    };
27605    if (json.has("_property")) {
27606      JsonArray array = json.getAsJsonArray("_property");
27607      for (int i = 0; i < array.size(); i++) {
27608        if (i == res.getProperty().size())
27609          res.getProperty().add(parseString(null));
27610        if (array.get(i) instanceof JsonObject) 
27611          parseElementProperties(array.get(i).getAsJsonObject(), res.getProperty().get(i));
27612      }
27613    };
27614  }
27615
27616  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27617    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
27618    parseValueSetConceptSetComponentProperties(json, owner, res);
27619    return res;
27620  }
27621
27622  protected void parseValueSetConceptSetComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetComponent res) throws IOException, FHIRFormatError {
27623    parseBackboneElementProperties(json, res);
27624    if (json.has("system"))
27625      res.setSystemElement(parseUri(json.get("system").getAsString()));
27626    if (json.has("_system"))
27627      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
27628    if (json.has("version"))
27629      res.setVersionElement(parseString(json.get("version").getAsString()));
27630    if (json.has("_version"))
27631      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
27632    if (json.has("concept")) {
27633      JsonArray array = json.getAsJsonArray("concept");
27634      for (int i = 0; i < array.size(); i++) {
27635        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject(), owner));
27636      }
27637    };
27638    if (json.has("filter")) {
27639      JsonArray array = json.getAsJsonArray("filter");
27640      for (int i = 0; i < array.size(); i++) {
27641        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject(), owner));
27642      }
27643    };
27644    if (json.has("valueSet")) {
27645      JsonArray array = json.getAsJsonArray("valueSet");
27646      for (int i = 0; i < array.size(); i++) {
27647        res.getValueSet().add(parseCanonical(array.get(i).getAsString()));
27648      }
27649    };
27650    if (json.has("_valueSet")) {
27651      JsonArray array = json.getAsJsonArray("_valueSet");
27652      for (int i = 0; i < array.size(); i++) {
27653        if (i == res.getValueSet().size())
27654          res.getValueSet().add(parseCanonical(null));
27655        if (array.get(i) instanceof JsonObject) 
27656          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueSet().get(i));
27657      }
27658    };
27659  }
27660
27661  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27662    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
27663    parseValueSetConceptReferenceComponentProperties(json, owner, res);
27664    return res;
27665  }
27666
27667  protected void parseValueSetConceptReferenceComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceComponent res) throws IOException, FHIRFormatError {
27668    parseBackboneElementProperties(json, res);
27669    if (json.has("code"))
27670      res.setCodeElement(parseCode(json.get("code").getAsString()));
27671    if (json.has("_code"))
27672      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
27673    if (json.has("display"))
27674      res.setDisplayElement(parseString(json.get("display").getAsString()));
27675    if (json.has("_display"))
27676      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
27677    if (json.has("designation")) {
27678      JsonArray array = json.getAsJsonArray("designation");
27679      for (int i = 0; i < array.size(); i++) {
27680        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
27681      }
27682    };
27683  }
27684
27685  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27686    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
27687    parseValueSetConceptReferenceDesignationComponentProperties(json, owner, res);
27688    return res;
27689  }
27690
27691  protected void parseValueSetConceptReferenceDesignationComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceDesignationComponent res) throws IOException, FHIRFormatError {
27692    parseBackboneElementProperties(json, res);
27693    if (json.has("language"))
27694      res.setLanguageElement(parseCode(json.get("language").getAsString()));
27695    if (json.has("_language"))
27696      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
27697    if (json.has("use"))
27698      res.setUse(parseCoding(json.getAsJsonObject("use")));
27699    if (json.has("value"))
27700      res.setValueElement(parseString(json.get("value").getAsString()));
27701    if (json.has("_value"))
27702      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
27703  }
27704
27705  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27706    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
27707    parseValueSetConceptSetFilterComponentProperties(json, owner, res);
27708    return res;
27709  }
27710
27711  protected void parseValueSetConceptSetFilterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetFilterComponent res) throws IOException, FHIRFormatError {
27712    parseBackboneElementProperties(json, res);
27713    if (json.has("property"))
27714      res.setPropertyElement(parseCode(json.get("property").getAsString()));
27715    if (json.has("_property"))
27716      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
27717    if (json.has("op"))
27718      res.setOpElement(parseEnumeration(json.get("op").getAsString(), ValueSet.FilterOperator.NULL, new ValueSet.FilterOperatorEnumFactory()));
27719    if (json.has("_op"))
27720      parseElementProperties(json.getAsJsonObject("_op"), res.getOpElement());
27721    if (json.has("value"))
27722      res.setValueElement(parseString(json.get("value").getAsString()));
27723    if (json.has("_value"))
27724      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
27725  }
27726
27727  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27728    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
27729    parseValueSetValueSetExpansionComponentProperties(json, owner, res);
27730    return res;
27731  }
27732
27733  protected void parseValueSetValueSetExpansionComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionComponent res) throws IOException, FHIRFormatError {
27734    parseBackboneElementProperties(json, res);
27735    if (json.has("identifier"))
27736      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
27737    if (json.has("_identifier"))
27738      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
27739    if (json.has("timestamp"))
27740      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
27741    if (json.has("_timestamp"))
27742      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
27743    if (json.has("total"))
27744      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
27745    if (json.has("_total"))
27746      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
27747    if (json.has("offset"))
27748      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
27749    if (json.has("_offset"))
27750      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
27751    if (json.has("parameter")) {
27752      JsonArray array = json.getAsJsonArray("parameter");
27753      for (int i = 0; i < array.size(); i++) {
27754        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
27755      }
27756    };
27757    if (json.has("property")) {
27758      JsonArray array = json.getAsJsonArray("property");
27759      for (int i = 0; i < array.size(); i++) {
27760        res.getProperty().add(parseValueSetValueSetExpansionPropertyComponent(array.get(i).getAsJsonObject(), owner));
27761      }
27762    };
27763    if (json.has("contains")) {
27764      JsonArray array = json.getAsJsonArray("contains");
27765      for (int i = 0; i < array.size(); i++) {
27766        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
27767      }
27768    };
27769  }
27770
27771  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27772    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
27773    parseValueSetValueSetExpansionParameterComponentProperties(json, owner, res);
27774    return res;
27775  }
27776
27777  protected void parseValueSetValueSetExpansionParameterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionParameterComponent res) throws IOException, FHIRFormatError {
27778    parseBackboneElementProperties(json, res);
27779    if (json.has("name"))
27780      res.setNameElement(parseString(json.get("name").getAsString()));
27781    if (json.has("_name"))
27782      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
27783    Type value = parseType("value", json);
27784    if (value != null)
27785      res.setValue(value);
27786  }
27787
27788  protected ValueSet.ValueSetExpansionPropertyComponent parseValueSetValueSetExpansionPropertyComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27789    ValueSet.ValueSetExpansionPropertyComponent res = new ValueSet.ValueSetExpansionPropertyComponent();
27790    parseValueSetValueSetExpansionPropertyComponentProperties(json, owner, res);
27791    return res;
27792  }
27793
27794  protected void parseValueSetValueSetExpansionPropertyComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionPropertyComponent res) throws IOException, FHIRFormatError {
27795    parseBackboneElementProperties(json, res);
27796    if (json.has("code"))
27797      res.setCodeElement(parseCode(json.get("code").getAsString()));
27798    if (json.has("_code"))
27799      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
27800    if (json.has("uri"))
27801      res.setUriElement(parseUri(json.get("uri").getAsString()));
27802    if (json.has("_uri"))
27803      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
27804  }
27805
27806  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27807    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
27808    parseValueSetValueSetExpansionContainsComponentProperties(json, owner, res);
27809    return res;
27810  }
27811
27812  protected void parseValueSetValueSetExpansionContainsComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionContainsComponent res) throws IOException, FHIRFormatError {
27813    parseBackboneElementProperties(json, res);
27814    if (json.has("system"))
27815      res.setSystemElement(parseUri(json.get("system").getAsString()));
27816    if (json.has("_system"))
27817      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
27818    if (json.has("abstract"))
27819      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
27820    if (json.has("_abstract"))
27821      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
27822    if (json.has("inactive"))
27823      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
27824    if (json.has("_inactive"))
27825      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
27826    if (json.has("version"))
27827      res.setVersionElement(parseString(json.get("version").getAsString()));
27828    if (json.has("_version"))
27829      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
27830    if (json.has("code"))
27831      res.setCodeElement(parseCode(json.get("code").getAsString()));
27832    if (json.has("_code"))
27833      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
27834    if (json.has("display"))
27835      res.setDisplayElement(parseString(json.get("display").getAsString()));
27836    if (json.has("_display"))
27837      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
27838    if (json.has("designation")) {
27839      JsonArray array = json.getAsJsonArray("designation");
27840      for (int i = 0; i < array.size(); i++) {
27841        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
27842      }
27843    };
27844    if (json.has("property")) {
27845      JsonArray array = json.getAsJsonArray("property");
27846      for (int i = 0; i < array.size(); i++) {
27847        res.getProperty().add(parseValueSetConceptPropertyComponent(array.get(i).getAsJsonObject(), owner));
27848      }
27849    };
27850    if (json.has("contains")) {
27851      JsonArray array = json.getAsJsonArray("contains");
27852      for (int i = 0; i < array.size(); i++) {
27853        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
27854      }
27855    };
27856  }
27857
27858  protected ValueSet.ConceptPropertyComponent parseValueSetConceptPropertyComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27859    ValueSet.ConceptPropertyComponent res = new ValueSet.ConceptPropertyComponent();
27860    parseValueSetConceptPropertyComponentProperties(json, owner, res);
27861    return res;
27862  }
27863
27864  protected void parseValueSetConceptPropertyComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
27865    parseBackboneElementProperties(json, res);
27866    if (json.has("code"))
27867      res.setCodeElement(parseCode(json.get("code").getAsString()));
27868    if (json.has("_code"))
27869      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
27870    Type value = parseType("value", json);
27871    if (value != null)
27872      res.setValue(value);
27873  }
27874
27875  protected VerificationResult parseVerificationResult(JsonObject json) throws IOException, FHIRFormatError {
27876    VerificationResult res = new VerificationResult();
27877    parseVerificationResultProperties(json, res);
27878    return res;
27879  }
27880
27881  protected void parseVerificationResultProperties(JsonObject json, VerificationResult res) throws IOException, FHIRFormatError {
27882    parseDomainResourceProperties(json, res);
27883    if (json.has("target")) {
27884      JsonArray array = json.getAsJsonArray("target");
27885      for (int i = 0; i < array.size(); i++) {
27886        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
27887      }
27888    };
27889    if (json.has("targetLocation")) {
27890      JsonArray array = json.getAsJsonArray("targetLocation");
27891      for (int i = 0; i < array.size(); i++) {
27892        res.getTargetLocation().add(parseString(array.get(i).getAsString()));
27893      }
27894    };
27895    if (json.has("_targetLocation")) {
27896      JsonArray array = json.getAsJsonArray("_targetLocation");
27897      for (int i = 0; i < array.size(); i++) {
27898        if (i == res.getTargetLocation().size())
27899          res.getTargetLocation().add(parseString(null));
27900        if (array.get(i) instanceof JsonObject) 
27901          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetLocation().get(i));
27902      }
27903    };
27904    if (json.has("need"))
27905      res.setNeed(parseCodeableConcept(json.getAsJsonObject("need")));
27906    if (json.has("status"))
27907      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VerificationResult.Status.NULL, new VerificationResult.StatusEnumFactory()));
27908    if (json.has("_status"))
27909      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
27910    if (json.has("statusDate"))
27911      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
27912    if (json.has("_statusDate"))
27913      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
27914    if (json.has("validationType"))
27915      res.setValidationType(parseCodeableConcept(json.getAsJsonObject("validationType")));
27916    if (json.has("validationProcess")) {
27917      JsonArray array = json.getAsJsonArray("validationProcess");
27918      for (int i = 0; i < array.size(); i++) {
27919        res.getValidationProcess().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27920      }
27921    };
27922    if (json.has("frequency"))
27923      res.setFrequency(parseTiming(json.getAsJsonObject("frequency")));
27924    if (json.has("lastPerformed"))
27925      res.setLastPerformedElement(parseDateTime(json.get("lastPerformed").getAsString()));
27926    if (json.has("_lastPerformed"))
27927      parseElementProperties(json.getAsJsonObject("_lastPerformed"), res.getLastPerformedElement());
27928    if (json.has("nextScheduled"))
27929      res.setNextScheduledElement(parseDate(json.get("nextScheduled").getAsString()));
27930    if (json.has("_nextScheduled"))
27931      parseElementProperties(json.getAsJsonObject("_nextScheduled"), res.getNextScheduledElement());
27932    if (json.has("failureAction"))
27933      res.setFailureAction(parseCodeableConcept(json.getAsJsonObject("failureAction")));
27934    if (json.has("primarySource")) {
27935      JsonArray array = json.getAsJsonArray("primarySource");
27936      for (int i = 0; i < array.size(); i++) {
27937        res.getPrimarySource().add(parseVerificationResultVerificationResultPrimarySourceComponent(array.get(i).getAsJsonObject(), res));
27938      }
27939    };
27940    if (json.has("attestation"))
27941      res.setAttestation(parseVerificationResultVerificationResultAttestationComponent(json.getAsJsonObject("attestation"), res));
27942    if (json.has("validator")) {
27943      JsonArray array = json.getAsJsonArray("validator");
27944      for (int i = 0; i < array.size(); i++) {
27945        res.getValidator().add(parseVerificationResultVerificationResultValidatorComponent(array.get(i).getAsJsonObject(), res));
27946      }
27947    };
27948  }
27949
27950  protected VerificationResult.VerificationResultPrimarySourceComponent parseVerificationResultVerificationResultPrimarySourceComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
27951    VerificationResult.VerificationResultPrimarySourceComponent res = new VerificationResult.VerificationResultPrimarySourceComponent();
27952    parseVerificationResultVerificationResultPrimarySourceComponentProperties(json, owner, res);
27953    return res;
27954  }
27955
27956  protected void parseVerificationResultVerificationResultPrimarySourceComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultPrimarySourceComponent res) throws IOException, FHIRFormatError {
27957    parseBackboneElementProperties(json, res);
27958    if (json.has("who"))
27959      res.setWho(parseReference(json.getAsJsonObject("who")));
27960    if (json.has("type")) {
27961      JsonArray array = json.getAsJsonArray("type");
27962      for (int i = 0; i < array.size(); i++) {
27963        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27964      }
27965    };
27966    if (json.has("communicationMethod")) {
27967      JsonArray array = json.getAsJsonArray("communicationMethod");
27968      for (int i = 0; i < array.size(); i++) {
27969        res.getCommunicationMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27970      }
27971    };
27972    if (json.has("validationStatus"))
27973      res.setValidationStatus(parseCodeableConcept(json.getAsJsonObject("validationStatus")));
27974    if (json.has("validationDate"))
27975      res.setValidationDateElement(parseDateTime(json.get("validationDate").getAsString()));
27976    if (json.has("_validationDate"))
27977      parseElementProperties(json.getAsJsonObject("_validationDate"), res.getValidationDateElement());
27978    if (json.has("canPushUpdates"))
27979      res.setCanPushUpdates(parseCodeableConcept(json.getAsJsonObject("canPushUpdates")));
27980    if (json.has("pushTypeAvailable")) {
27981      JsonArray array = json.getAsJsonArray("pushTypeAvailable");
27982      for (int i = 0; i < array.size(); i++) {
27983        res.getPushTypeAvailable().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27984      }
27985    };
27986  }
27987
27988  protected VerificationResult.VerificationResultAttestationComponent parseVerificationResultVerificationResultAttestationComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
27989    VerificationResult.VerificationResultAttestationComponent res = new VerificationResult.VerificationResultAttestationComponent();
27990    parseVerificationResultVerificationResultAttestationComponentProperties(json, owner, res);
27991    return res;
27992  }
27993
27994  protected void parseVerificationResultVerificationResultAttestationComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultAttestationComponent res) throws IOException, FHIRFormatError {
27995    parseBackboneElementProperties(json, res);
27996    if (json.has("who"))
27997      res.setWho(parseReference(json.getAsJsonObject("who")));
27998    if (json.has("onBehalfOf"))
27999      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
28000    if (json.has("communicationMethod"))
28001      res.setCommunicationMethod(parseCodeableConcept(json.getAsJsonObject("communicationMethod")));
28002    if (json.has("date"))
28003      res.setDateElement(parseDate(json.get("date").getAsString()));
28004    if (json.has("_date"))
28005      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
28006    if (json.has("sourceIdentityCertificate"))
28007      res.setSourceIdentityCertificateElement(parseString(json.get("sourceIdentityCertificate").getAsString()));
28008    if (json.has("_sourceIdentityCertificate"))
28009      parseElementProperties(json.getAsJsonObject("_sourceIdentityCertificate"), res.getSourceIdentityCertificateElement());
28010    if (json.has("proxyIdentityCertificate"))
28011      res.setProxyIdentityCertificateElement(parseString(json.get("proxyIdentityCertificate").getAsString()));
28012    if (json.has("_proxyIdentityCertificate"))
28013      parseElementProperties(json.getAsJsonObject("_proxyIdentityCertificate"), res.getProxyIdentityCertificateElement());
28014    if (json.has("proxySignature"))
28015      res.setProxySignature(parseSignature(json.getAsJsonObject("proxySignature")));
28016    if (json.has("sourceSignature"))
28017      res.setSourceSignature(parseSignature(json.getAsJsonObject("sourceSignature")));
28018  }
28019
28020  protected VerificationResult.VerificationResultValidatorComponent parseVerificationResultVerificationResultValidatorComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
28021    VerificationResult.VerificationResultValidatorComponent res = new VerificationResult.VerificationResultValidatorComponent();
28022    parseVerificationResultVerificationResultValidatorComponentProperties(json, owner, res);
28023    return res;
28024  }
28025
28026  protected void parseVerificationResultVerificationResultValidatorComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultValidatorComponent res) throws IOException, FHIRFormatError {
28027    parseBackboneElementProperties(json, res);
28028    if (json.has("organization"))
28029      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
28030    if (json.has("identityCertificate"))
28031      res.setIdentityCertificateElement(parseString(json.get("identityCertificate").getAsString()));
28032    if (json.has("_identityCertificate"))
28033      parseElementProperties(json.getAsJsonObject("_identityCertificate"), res.getIdentityCertificateElement());
28034    if (json.has("attestationSignature"))
28035      res.setAttestationSignature(parseSignature(json.getAsJsonObject("attestationSignature")));
28036  }
28037
28038  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
28039    VisionPrescription res = new VisionPrescription();
28040    parseVisionPrescriptionProperties(json, res);
28041    return res;
28042  }
28043
28044  protected void parseVisionPrescriptionProperties(JsonObject json, VisionPrescription res) throws IOException, FHIRFormatError {
28045    parseDomainResourceProperties(json, res);
28046    if (json.has("identifier")) {
28047      JsonArray array = json.getAsJsonArray("identifier");
28048      for (int i = 0; i < array.size(); i++) {
28049        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
28050      }
28051    };
28052    if (json.has("status"))
28053      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VisionPrescription.VisionStatus.NULL, new VisionPrescription.VisionStatusEnumFactory()));
28054    if (json.has("_status"))
28055      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
28056    if (json.has("created"))
28057      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
28058    if (json.has("_created"))
28059      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
28060    if (json.has("patient"))
28061      res.setPatient(parseReference(json.getAsJsonObject("patient")));
28062    if (json.has("encounter"))
28063      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
28064    if (json.has("dateWritten"))
28065      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
28066    if (json.has("_dateWritten"))
28067      parseElementProperties(json.getAsJsonObject("_dateWritten"), res.getDateWrittenElement());
28068    if (json.has("prescriber"))
28069      res.setPrescriber(parseReference(json.getAsJsonObject("prescriber")));
28070    if (json.has("lensSpecification")) {
28071      JsonArray array = json.getAsJsonArray("lensSpecification");
28072      for (int i = 0; i < array.size(); i++) {
28073        res.getLensSpecification().add(parseVisionPrescriptionVisionPrescriptionLensSpecificationComponent(array.get(i).getAsJsonObject(), res));
28074      }
28075    };
28076  }
28077
28078  protected VisionPrescription.VisionPrescriptionLensSpecificationComponent parseVisionPrescriptionVisionPrescriptionLensSpecificationComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
28079    VisionPrescription.VisionPrescriptionLensSpecificationComponent res = new VisionPrescription.VisionPrescriptionLensSpecificationComponent();
28080    parseVisionPrescriptionVisionPrescriptionLensSpecificationComponentProperties(json, owner, res);
28081    return res;
28082  }
28083
28084  protected void parseVisionPrescriptionVisionPrescriptionLensSpecificationComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.VisionPrescriptionLensSpecificationComponent res) throws IOException, FHIRFormatError {
28085    parseBackboneElementProperties(json, res);
28086    if (json.has("product"))
28087      res.setProduct(parseCodeableConcept(json.getAsJsonObject("product")));
28088    if (json.has("eye"))
28089      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
28090    if (json.has("_eye"))
28091      parseElementProperties(json.getAsJsonObject("_eye"), res.getEyeElement());
28092    if (json.has("sphere"))
28093      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
28094    if (json.has("_sphere"))
28095      parseElementProperties(json.getAsJsonObject("_sphere"), res.getSphereElement());
28096    if (json.has("cylinder"))
28097      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
28098    if (json.has("_cylinder"))
28099      parseElementProperties(json.getAsJsonObject("_cylinder"), res.getCylinderElement());
28100    if (json.has("axis"))
28101      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
28102    if (json.has("_axis"))
28103      parseElementProperties(json.getAsJsonObject("_axis"), res.getAxisElement());
28104    if (json.has("prism")) {
28105      JsonArray array = json.getAsJsonArray("prism");
28106      for (int i = 0; i < array.size(); i++) {
28107        res.getPrism().add(parseVisionPrescriptionPrismComponent(array.get(i).getAsJsonObject(), owner));
28108      }
28109    };
28110    if (json.has("add"))
28111      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
28112    if (json.has("_add"))
28113      parseElementProperties(json.getAsJsonObject("_add"), res.getAddElement());
28114    if (json.has("power"))
28115      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
28116    if (json.has("_power"))
28117      parseElementProperties(json.getAsJsonObject("_power"), res.getPowerElement());
28118    if (json.has("backCurve"))
28119      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
28120    if (json.has("_backCurve"))
28121      parseElementProperties(json.getAsJsonObject("_backCurve"), res.getBackCurveElement());
28122    if (json.has("diameter"))
28123      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
28124    if (json.has("_diameter"))
28125      parseElementProperties(json.getAsJsonObject("_diameter"), res.getDiameterElement());
28126    if (json.has("duration"))
28127      res.setDuration(parseQuantity(json.getAsJsonObject("duration")));
28128    if (json.has("color"))
28129      res.setColorElement(parseString(json.get("color").getAsString()));
28130    if (json.has("_color"))
28131      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
28132    if (json.has("brand"))
28133      res.setBrandElement(parseString(json.get("brand").getAsString()));
28134    if (json.has("_brand"))
28135      parseElementProperties(json.getAsJsonObject("_brand"), res.getBrandElement());
28136    if (json.has("note")) {
28137      JsonArray array = json.getAsJsonArray("note");
28138      for (int i = 0; i < array.size(); i++) {
28139        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
28140      }
28141    };
28142  }
28143
28144  protected VisionPrescription.PrismComponent parseVisionPrescriptionPrismComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
28145    VisionPrescription.PrismComponent res = new VisionPrescription.PrismComponent();
28146    parseVisionPrescriptionPrismComponentProperties(json, owner, res);
28147    return res;
28148  }
28149
28150  protected void parseVisionPrescriptionPrismComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.PrismComponent res) throws IOException, FHIRFormatError {
28151    parseBackboneElementProperties(json, res);
28152    if (json.has("amount"))
28153      res.setAmountElement(parseDecimal(json.get("amount").getAsBigDecimal()));
28154    if (json.has("_amount"))
28155      parseElementProperties(json.getAsJsonObject("_amount"), res.getAmountElement());
28156    if (json.has("base"))
28157      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
28158    if (json.has("_base"))
28159      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
28160  }
28161
28162  @Override
28163  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
28164    if (!json.has("resourceType")) {
28165      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
28166    }
28167    String t = json.get("resourceType").getAsString();
28168    if (Utilities.noString(t))
28169      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
28170    if (t.equals("Parameters"))
28171      return parseParameters(json);
28172    else if (t.equals("Account"))
28173      return parseAccount(json);
28174    else if (t.equals("ActivityDefinition"))
28175      return parseActivityDefinition(json);
28176    else if (t.equals("AdministrableProductDefinition"))
28177      return parseAdministrableProductDefinition(json);
28178    else if (t.equals("AdverseEvent"))
28179      return parseAdverseEvent(json);
28180    else if (t.equals("AllergyIntolerance"))
28181      return parseAllergyIntolerance(json);
28182    else if (t.equals("Appointment"))
28183      return parseAppointment(json);
28184    else if (t.equals("AppointmentResponse"))
28185      return parseAppointmentResponse(json);
28186    else if (t.equals("AuditEvent"))
28187      return parseAuditEvent(json);
28188    else if (t.equals("Basic"))
28189      return parseBasic(json);
28190    else if (t.equals("Binary"))
28191      return parseBinary(json);
28192    else if (t.equals("BiologicallyDerivedProduct"))
28193      return parseBiologicallyDerivedProduct(json);
28194    else if (t.equals("BodyStructure"))
28195      return parseBodyStructure(json);
28196    else if (t.equals("Bundle"))
28197      return parseBundle(json);
28198    else if (t.equals("CapabilityStatement"))
28199      return parseCapabilityStatement(json);
28200    else if (t.equals("CapabilityStatement2"))
28201      return parseCapabilityStatement2(json);
28202    else if (t.equals("CarePlan"))
28203      return parseCarePlan(json);
28204    else if (t.equals("CareTeam"))
28205      return parseCareTeam(json);
28206    else if (t.equals("CatalogEntry"))
28207      return parseCatalogEntry(json);
28208    else if (t.equals("ChargeItem"))
28209      return parseChargeItem(json);
28210    else if (t.equals("ChargeItemDefinition"))
28211      return parseChargeItemDefinition(json);
28212    else if (t.equals("Claim"))
28213      return parseClaim(json);
28214    else if (t.equals("ClaimResponse"))
28215      return parseClaimResponse(json);
28216    else if (t.equals("ClinicalImpression"))
28217      return parseClinicalImpression(json);
28218    else if (t.equals("ClinicalUseIssue"))
28219      return parseClinicalUseIssue(json);
28220    else if (t.equals("CodeSystem"))
28221      return parseCodeSystem(json);
28222    else if (t.equals("Communication"))
28223      return parseCommunication(json);
28224    else if (t.equals("CommunicationRequest"))
28225      return parseCommunicationRequest(json);
28226    else if (t.equals("CompartmentDefinition"))
28227      return parseCompartmentDefinition(json);
28228    else if (t.equals("Composition"))
28229      return parseComposition(json);
28230    else if (t.equals("ConceptMap"))
28231      return parseConceptMap(json);
28232    else if (t.equals("Condition"))
28233      return parseCondition(json);
28234    else if (t.equals("ConditionDefinition"))
28235      return parseConditionDefinition(json);
28236    else if (t.equals("Consent"))
28237      return parseConsent(json);
28238    else if (t.equals("Contract"))
28239      return parseContract(json);
28240    else if (t.equals("Coverage"))
28241      return parseCoverage(json);
28242    else if (t.equals("CoverageEligibilityRequest"))
28243      return parseCoverageEligibilityRequest(json);
28244    else if (t.equals("CoverageEligibilityResponse"))
28245      return parseCoverageEligibilityResponse(json);
28246    else if (t.equals("DetectedIssue"))
28247      return parseDetectedIssue(json);
28248    else if (t.equals("Device"))
28249      return parseDevice(json);
28250    else if (t.equals("DeviceDefinition"))
28251      return parseDeviceDefinition(json);
28252    else if (t.equals("DeviceMetric"))
28253      return parseDeviceMetric(json);
28254    else if (t.equals("DeviceRequest"))
28255      return parseDeviceRequest(json);
28256    else if (t.equals("DeviceUseStatement"))
28257      return parseDeviceUseStatement(json);
28258    else if (t.equals("DiagnosticReport"))
28259      return parseDiagnosticReport(json);
28260    else if (t.equals("DocumentManifest"))
28261      return parseDocumentManifest(json);
28262    else if (t.equals("DocumentReference"))
28263      return parseDocumentReference(json);
28264    else if (t.equals("Encounter"))
28265      return parseEncounter(json);
28266    else if (t.equals("Endpoint"))
28267      return parseEndpoint(json);
28268    else if (t.equals("EnrollmentRequest"))
28269      return parseEnrollmentRequest(json);
28270    else if (t.equals("EnrollmentResponse"))
28271      return parseEnrollmentResponse(json);
28272    else if (t.equals("EpisodeOfCare"))
28273      return parseEpisodeOfCare(json);
28274    else if (t.equals("EventDefinition"))
28275      return parseEventDefinition(json);
28276    else if (t.equals("Evidence"))
28277      return parseEvidence(json);
28278    else if (t.equals("EvidenceVariable"))
28279      return parseEvidenceVariable(json);
28280    else if (t.equals("ExampleScenario"))
28281      return parseExampleScenario(json);
28282    else if (t.equals("ExplanationOfBenefit"))
28283      return parseExplanationOfBenefit(json);
28284    else if (t.equals("FamilyMemberHistory"))
28285      return parseFamilyMemberHistory(json);
28286    else if (t.equals("Flag"))
28287      return parseFlag(json);
28288    else if (t.equals("Goal"))
28289      return parseGoal(json);
28290    else if (t.equals("GraphDefinition"))
28291      return parseGraphDefinition(json);
28292    else if (t.equals("Group"))
28293      return parseGroup(json);
28294    else if (t.equals("GuidanceResponse"))
28295      return parseGuidanceResponse(json);
28296    else if (t.equals("HealthcareService"))
28297      return parseHealthcareService(json);
28298    else if (t.equals("ImagingStudy"))
28299      return parseImagingStudy(json);
28300    else if (t.equals("Immunization"))
28301      return parseImmunization(json);
28302    else if (t.equals("ImmunizationEvaluation"))
28303      return parseImmunizationEvaluation(json);
28304    else if (t.equals("ImmunizationRecommendation"))
28305      return parseImmunizationRecommendation(json);
28306    else if (t.equals("ImplementationGuide"))
28307      return parseImplementationGuide(json);
28308    else if (t.equals("Ingredient"))
28309      return parseIngredient(json);
28310    else if (t.equals("InsurancePlan"))
28311      return parseInsurancePlan(json);
28312    else if (t.equals("Invoice"))
28313      return parseInvoice(json);
28314    else if (t.equals("Library"))
28315      return parseLibrary(json);
28316    else if (t.equals("Linkage"))
28317      return parseLinkage(json);
28318    else if (t.equals("List"))
28319      return parseListResource(json);
28320    else if (t.equals("Location"))
28321      return parseLocation(json);
28322    else if (t.equals("ManufacturedItemDefinition"))
28323      return parseManufacturedItemDefinition(json);
28324    else if (t.equals("Measure"))
28325      return parseMeasure(json);
28326    else if (t.equals("MeasureReport"))
28327      return parseMeasureReport(json);
28328    else if (t.equals("Medication"))
28329      return parseMedication(json);
28330    else if (t.equals("MedicationAdministration"))
28331      return parseMedicationAdministration(json);
28332    else if (t.equals("MedicationDispense"))
28333      return parseMedicationDispense(json);
28334    else if (t.equals("MedicationKnowledge"))
28335      return parseMedicationKnowledge(json);
28336    else if (t.equals("MedicationRequest"))
28337      return parseMedicationRequest(json);
28338    else if (t.equals("MedicationUsage"))
28339      return parseMedicationUsage(json);
28340    else if (t.equals("MedicinalProductDefinition"))
28341      return parseMedicinalProductDefinition(json);
28342    else if (t.equals("MessageDefinition"))
28343      return parseMessageDefinition(json);
28344    else if (t.equals("MessageHeader"))
28345      return parseMessageHeader(json);
28346    else if (t.equals("MolecularSequence"))
28347      return parseMolecularSequence(json);
28348    else if (t.equals("NamingSystem"))
28349      return parseNamingSystem(json);
28350    else if (t.equals("NutritionIntake"))
28351      return parseNutritionIntake(json);
28352    else if (t.equals("NutritionOrder"))
28353      return parseNutritionOrder(json);
28354    else if (t.equals("Observation"))
28355      return parseObservation(json);
28356    else if (t.equals("ObservationDefinition"))
28357      return parseObservationDefinition(json);
28358    else if (t.equals("OperationDefinition"))
28359      return parseOperationDefinition(json);
28360    else if (t.equals("OperationOutcome"))
28361      return parseOperationOutcome(json);
28362    else if (t.equals("Organization"))
28363      return parseOrganization(json);
28364    else if (t.equals("OrganizationAffiliation"))
28365      return parseOrganizationAffiliation(json);
28366    else if (t.equals("PackagedProductDefinition"))
28367      return parsePackagedProductDefinition(json);
28368    else if (t.equals("Patient"))
28369      return parsePatient(json);
28370    else if (t.equals("PaymentNotice"))
28371      return parsePaymentNotice(json);
28372    else if (t.equals("PaymentReconciliation"))
28373      return parsePaymentReconciliation(json);
28374    else if (t.equals("Person"))
28375      return parsePerson(json);
28376    else if (t.equals("PlanDefinition"))
28377      return parsePlanDefinition(json);
28378    else if (t.equals("Practitioner"))
28379      return parsePractitioner(json);
28380    else if (t.equals("PractitionerRole"))
28381      return parsePractitionerRole(json);
28382    else if (t.equals("Procedure"))
28383      return parseProcedure(json);
28384    else if (t.equals("Provenance"))
28385      return parseProvenance(json);
28386    else if (t.equals("Questionnaire"))
28387      return parseQuestionnaire(json);
28388    else if (t.equals("QuestionnaireResponse"))
28389      return parseQuestionnaireResponse(json);
28390    else if (t.equals("RegulatedAuthorization"))
28391      return parseRegulatedAuthorization(json);
28392    else if (t.equals("RelatedPerson"))
28393      return parseRelatedPerson(json);
28394    else if (t.equals("RequestGroup"))
28395      return parseRequestGroup(json);
28396    else if (t.equals("ResearchStudy"))
28397      return parseResearchStudy(json);
28398    else if (t.equals("ResearchSubject"))
28399      return parseResearchSubject(json);
28400    else if (t.equals("RiskAssessment"))
28401      return parseRiskAssessment(json);
28402    else if (t.equals("Schedule"))
28403      return parseSchedule(json);
28404    else if (t.equals("SearchParameter"))
28405      return parseSearchParameter(json);
28406    else if (t.equals("ServiceRequest"))
28407      return parseServiceRequest(json);
28408    else if (t.equals("Slot"))
28409      return parseSlot(json);
28410    else if (t.equals("Specimen"))
28411      return parseSpecimen(json);
28412    else if (t.equals("SpecimenDefinition"))
28413      return parseSpecimenDefinition(json);
28414    else if (t.equals("StructureDefinition"))
28415      return parseStructureDefinition(json);
28416    else if (t.equals("StructureMap"))
28417      return parseStructureMap(json);
28418    else if (t.equals("Subscription"))
28419      return parseSubscription(json);
28420    else if (t.equals("Substance"))
28421      return parseSubstance(json);
28422    else if (t.equals("SubstanceDefinition"))
28423      return parseSubstanceDefinition(json);
28424    else if (t.equals("SubstanceNucleicAcid"))
28425      return parseSubstanceNucleicAcid(json);
28426    else if (t.equals("SubstancePolymer"))
28427      return parseSubstancePolymer(json);
28428    else if (t.equals("SubstanceProtein"))
28429      return parseSubstanceProtein(json);
28430    else if (t.equals("SubstanceReferenceInformation"))
28431      return parseSubstanceReferenceInformation(json);
28432    else if (t.equals("SubstanceSourceMaterial"))
28433      return parseSubstanceSourceMaterial(json);
28434    else if (t.equals("SupplyDelivery"))
28435      return parseSupplyDelivery(json);
28436    else if (t.equals("SupplyRequest"))
28437      return parseSupplyRequest(json);
28438    else if (t.equals("Task"))
28439      return parseTask(json);
28440    else if (t.equals("TerminologyCapabilities"))
28441      return parseTerminologyCapabilities(json);
28442    else if (t.equals("TestReport"))
28443      return parseTestReport(json);
28444    else if (t.equals("TestScript"))
28445      return parseTestScript(json);
28446    else if (t.equals("Topic"))
28447      return parseTopic(json);
28448    else if (t.equals("ValueSet"))
28449      return parseValueSet(json);
28450    else if (t.equals("VerificationResult"))
28451      return parseVerificationResult(json);
28452    else if (t.equals("VisionPrescription"))
28453      return parseVisionPrescription(json);
28454    else if (t.equals("Binary"))
28455      return parseBinary(json);
28456    throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
28457  }
28458
28459  protected Type parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
28460    if (json.has(prefix+"Extension"))
28461      return parseExtension(json.getAsJsonObject(prefix+"Extension"));
28462    else if (json.has(prefix+"Narrative"))
28463      return parseNarrative(json.getAsJsonObject(prefix+"Narrative"));
28464    else if (json.has(prefix+"Meta"))
28465      return parseMeta(json.getAsJsonObject(prefix+"Meta"));
28466    else if (json.has(prefix+"Address"))
28467      return parseAddress(json.getAsJsonObject(prefix+"Address"));
28468    else if (json.has(prefix+"Contributor"))
28469      return parseContributor(json.getAsJsonObject(prefix+"Contributor"));
28470    else if (json.has(prefix+"Attachment"))
28471      return parseAttachment(json.getAsJsonObject(prefix+"Attachment"));
28472    else if (json.has(prefix+"Count"))
28473      return parseCount(json.getAsJsonObject(prefix+"Count"));
28474    else if (json.has(prefix+"DataRequirement"))
28475      return parseDataRequirement(json.getAsJsonObject(prefix+"DataRequirement"));
28476    else if (json.has(prefix+"Dosage"))
28477      return parseDosage(json.getAsJsonObject(prefix+"Dosage"));
28478    else if (json.has(prefix+"Money"))
28479      return parseMoney(json.getAsJsonObject(prefix+"Money"));
28480    else if (json.has(prefix+"HumanName"))
28481      return parseHumanName(json.getAsJsonObject(prefix+"HumanName"));
28482    else if (json.has(prefix+"ContactPoint"))
28483      return parseContactPoint(json.getAsJsonObject(prefix+"ContactPoint"));
28484    else if (json.has(prefix+"MarketingStatus"))
28485      return parseMarketingStatus(json.getAsJsonObject(prefix+"MarketingStatus"));
28486    else if (json.has(prefix+"Identifier"))
28487      return parseIdentifier(json.getAsJsonObject(prefix+"Identifier"));
28488    else if (json.has(prefix+"SubstanceAmount"))
28489      return parseSubstanceAmount(json.getAsJsonObject(prefix+"SubstanceAmount"));
28490    else if (json.has(prefix+"Statistic"))
28491      return parseStatistic(json.getAsJsonObject(prefix+"Statistic"));
28492    else if (json.has(prefix+"Coding"))
28493      return parseCoding(json.getAsJsonObject(prefix+"Coding"));
28494    else if (json.has(prefix+"SampledData"))
28495      return parseSampledData(json.getAsJsonObject(prefix+"SampledData"));
28496    else if (json.has(prefix+"Population"))
28497      return parsePopulation(json.getAsJsonObject(prefix+"Population"));
28498    else if (json.has(prefix+"Ratio"))
28499      return parseRatio(json.getAsJsonObject(prefix+"Ratio"));
28500    else if (json.has(prefix+"OrderedDistribution"))
28501      return parseOrderedDistribution(json.getAsJsonObject(prefix+"OrderedDistribution"));
28502    else if (json.has(prefix+"Distance"))
28503      return parseDistance(json.getAsJsonObject(prefix+"Distance"));
28504    else if (json.has(prefix+"Age"))
28505      return parseAge(json.getAsJsonObject(prefix+"Age"));
28506    else if (json.has(prefix+"Reference"))
28507      return parseReference(json.getAsJsonObject(prefix+"Reference"));
28508    else if (json.has(prefix+"TriggerDefinition"))
28509      return parseTriggerDefinition(json.getAsJsonObject(prefix+"TriggerDefinition"));
28510    else if (json.has(prefix+"Quantity"))
28511      return parseQuantity(json.getAsJsonObject(prefix+"Quantity"));
28512    else if (json.has(prefix+"Period"))
28513      return parsePeriod(json.getAsJsonObject(prefix+"Period"));
28514    else if (json.has(prefix+"Duration"))
28515      return parseDuration(json.getAsJsonObject(prefix+"Duration"));
28516    else if (json.has(prefix+"Range"))
28517      return parseRange(json.getAsJsonObject(prefix+"Range"));
28518    else if (json.has(prefix+"RelatedArtifact"))
28519      return parseRelatedArtifact(json.getAsJsonObject(prefix+"RelatedArtifact"));
28520    else if (json.has(prefix+"Annotation"))
28521      return parseAnnotation(json.getAsJsonObject(prefix+"Annotation"));
28522    else if (json.has(prefix+"ProductShelfLife"))
28523      return parseProductShelfLife(json.getAsJsonObject(prefix+"ProductShelfLife"));
28524    else if (json.has(prefix+"ContactDetail"))
28525      return parseContactDetail(json.getAsJsonObject(prefix+"ContactDetail"));
28526    else if (json.has(prefix+"UsageContext"))
28527      return parseUsageContext(json.getAsJsonObject(prefix+"UsageContext"));
28528    else if (json.has(prefix+"Expression"))
28529      return parseExpression(json.getAsJsonObject(prefix+"Expression"));
28530    else if (json.has(prefix+"Signature"))
28531      return parseSignature(json.getAsJsonObject(prefix+"Signature"));
28532    else if (json.has(prefix+"Timing"))
28533      return parseTiming(json.getAsJsonObject(prefix+"Timing"));
28534    else if (json.has(prefix+"ProdCharacteristic"))
28535      return parseProdCharacteristic(json.getAsJsonObject(prefix+"ProdCharacteristic"));
28536    else if (json.has(prefix+"CodeableConcept"))
28537      return parseCodeableConcept(json.getAsJsonObject(prefix+"CodeableConcept"));
28538    else if (json.has(prefix+"ParameterDefinition"))
28539      return parseParameterDefinition(json.getAsJsonObject(prefix+"ParameterDefinition"));
28540    else if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
28541      Type t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
28542      if (json.has("_"+prefix+"Date"))
28543        parseElementProperties(json.getAsJsonObject("_"+prefix+"Date"), t);
28544      return t;
28545    }
28546    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
28547      Type t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
28548      if (json.has("_"+prefix+"DateTime"))
28549        parseElementProperties(json.getAsJsonObject("_"+prefix+"DateTime"), t);
28550      return t;
28551    }
28552    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
28553      Type t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
28554      if (json.has("_"+prefix+"Code"))
28555        parseElementProperties(json.getAsJsonObject("_"+prefix+"Code"), t);
28556      return t;
28557    }
28558    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
28559      Type t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
28560      if (json.has("_"+prefix+"String"))
28561        parseElementProperties(json.getAsJsonObject("_"+prefix+"String"), t);
28562      return t;
28563    }
28564    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
28565      Type t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
28566      if (json.has("_"+prefix+"Integer"))
28567        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
28568      return t;
28569    }
28570    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
28571      Type t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
28572      if (json.has("_"+prefix+"Oid"))
28573        parseElementProperties(json.getAsJsonObject("_"+prefix+"Oid"), t);
28574      return t;
28575    }
28576    else if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical")) {
28577      Type t = json.has(prefix+"Canonical") ? parseCanonical(json.get(prefix+"Canonical").getAsString()) : new CanonicalType();
28578      if (json.has("_"+prefix+"Canonical"))
28579        parseElementProperties(json.getAsJsonObject("_"+prefix+"Canonical"), t);
28580      return t;
28581    }
28582    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
28583      Type t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
28584      if (json.has("_"+prefix+"Uri"))
28585        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uri"), t);
28586      return t;
28587    }
28588    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
28589      Type t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
28590      if (json.has("_"+prefix+"Uuid"))
28591        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uuid"), t);
28592      return t;
28593    }
28594    else if (json.has(prefix+"Url") || json.has("_"+prefix+"Url")) {
28595      Type t = json.has(prefix+"Url") ? parseUrl(json.get(prefix+"Url").getAsString()) : new UrlType();
28596      if (json.has("_"+prefix+"Url"))
28597        parseElementProperties(json.getAsJsonObject("_"+prefix+"Url"), t);
28598      return t;
28599    }
28600    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
28601      Type t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
28602      if (json.has("_"+prefix+"Instant"))
28603        parseElementProperties(json.getAsJsonObject("_"+prefix+"Instant"), t);
28604      return t;
28605    }
28606    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
28607      Type t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
28608      if (json.has("_"+prefix+"Boolean"))
28609        parseElementProperties(json.getAsJsonObject("_"+prefix+"Boolean"), t);
28610      return t;
28611    }
28612    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
28613      Type t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
28614      if (json.has("_"+prefix+"Base64Binary"))
28615        parseElementProperties(json.getAsJsonObject("_"+prefix+"Base64Binary"), t);
28616      return t;
28617    }
28618    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
28619      Type t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
28620      if (json.has("_"+prefix+"UnsignedInt"))
28621        parseElementProperties(json.getAsJsonObject("_"+prefix+"UnsignedInt"), t);
28622      return t;
28623    }
28624    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
28625      Type t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
28626      if (json.has("_"+prefix+"Markdown"))
28627        parseElementProperties(json.getAsJsonObject("_"+prefix+"Markdown"), t);
28628      return t;
28629    }
28630    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
28631      Type t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
28632      if (json.has("_"+prefix+"Time"))
28633        parseElementProperties(json.getAsJsonObject("_"+prefix+"Time"), t);
28634      return t;
28635    }
28636    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
28637      Type t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
28638      if (json.has("_"+prefix+"Id"))
28639        parseElementProperties(json.getAsJsonObject("_"+prefix+"Id"), t);
28640      return t;
28641    }
28642    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
28643      Type t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
28644      if (json.has("_"+prefix+"PositiveInt"))
28645        parseElementProperties(json.getAsJsonObject("_"+prefix+"PositiveInt"), t);
28646      return t;
28647    }
28648    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
28649      Type t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
28650      if (json.has("_"+prefix+"Decimal"))
28651        parseElementProperties(json.getAsJsonObject("_"+prefix+"Decimal"), t);
28652      return t;
28653    }
28654    return null;
28655  }
28656
28657  protected Type parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
28658    if (type.equals("Extension"))
28659      return parseExtension(json);
28660    else if (type.equals("Narrative"))
28661      return parseNarrative(json);
28662    else if (type.equals("Meta"))
28663      return parseMeta(json);
28664    else if (type.equals("Address"))
28665      return parseAddress(json);
28666    else if (type.equals("Contributor"))
28667      return parseContributor(json);
28668    else if (type.equals("Attachment"))
28669      return parseAttachment(json);
28670    else if (type.equals("Count"))
28671      return parseCount(json);
28672    else if (type.equals("DataRequirement"))
28673      return parseDataRequirement(json);
28674    else if (type.equals("Dosage"))
28675      return parseDosage(json);
28676    else if (type.equals("Money"))
28677      return parseMoney(json);
28678    else if (type.equals("HumanName"))
28679      return parseHumanName(json);
28680    else if (type.equals("ContactPoint"))
28681      return parseContactPoint(json);
28682    else if (type.equals("MarketingStatus"))
28683      return parseMarketingStatus(json);
28684    else if (type.equals("Identifier"))
28685      return parseIdentifier(json);
28686    else if (type.equals("SubstanceAmount"))
28687      return parseSubstanceAmount(json);
28688    else if (type.equals("Statistic"))
28689      return parseStatistic(json);
28690    else if (type.equals("Coding"))
28691      return parseCoding(json);
28692    else if (type.equals("SampledData"))
28693      return parseSampledData(json);
28694    else if (type.equals("Population"))
28695      return parsePopulation(json);
28696    else if (type.equals("Ratio"))
28697      return parseRatio(json);
28698    else if (type.equals("OrderedDistribution"))
28699      return parseOrderedDistribution(json);
28700    else if (type.equals("Distance"))
28701      return parseDistance(json);
28702    else if (type.equals("Age"))
28703      return parseAge(json);
28704    else if (type.equals("Reference"))
28705      return parseReference(json);
28706    else if (type.equals("TriggerDefinition"))
28707      return parseTriggerDefinition(json);
28708    else if (type.equals("Quantity"))
28709      return parseQuantity(json);
28710    else if (type.equals("Period"))
28711      return parsePeriod(json);
28712    else if (type.equals("Duration"))
28713      return parseDuration(json);
28714    else if (type.equals("Range"))
28715      return parseRange(json);
28716    else if (type.equals("RelatedArtifact"))
28717      return parseRelatedArtifact(json);
28718    else if (type.equals("Annotation"))
28719      return parseAnnotation(json);
28720    else if (type.equals("ProductShelfLife"))
28721      return parseProductShelfLife(json);
28722    else if (type.equals("ContactDetail"))
28723      return parseContactDetail(json);
28724    else if (type.equals("UsageContext"))
28725      return parseUsageContext(json);
28726    else if (type.equals("Expression"))
28727      return parseExpression(json);
28728    else if (type.equals("Signature"))
28729      return parseSignature(json);
28730    else if (type.equals("Timing"))
28731      return parseTiming(json);
28732    else if (type.equals("ProdCharacteristic"))
28733      return parseProdCharacteristic(json);
28734    else if (type.equals("CodeableConcept"))
28735      return parseCodeableConcept(json);
28736    else if (type.equals("ParameterDefinition"))
28737      return parseParameterDefinition(json);
28738    throw new FHIRFormatError("Unknown Type "+type);
28739  }
28740
28741  protected boolean hasTypeName(JsonObject json, String prefix) {
28742        if (json.has(prefix+"Extension"))
28743      return true;
28744    if (json.has(prefix+"Narrative"))
28745      return true;
28746    if (json.has(prefix+"Meta"))
28747      return true;
28748    if (json.has(prefix+"Address"))
28749      return true;
28750    if (json.has(prefix+"Contributor"))
28751      return true;
28752    if (json.has(prefix+"Attachment"))
28753      return true;
28754    if (json.has(prefix+"Count"))
28755      return true;
28756    if (json.has(prefix+"DataRequirement"))
28757      return true;
28758    if (json.has(prefix+"Dosage"))
28759      return true;
28760    if (json.has(prefix+"Money"))
28761      return true;
28762    if (json.has(prefix+"HumanName"))
28763      return true;
28764    if (json.has(prefix+"ContactPoint"))
28765      return true;
28766    if (json.has(prefix+"MarketingStatus"))
28767      return true;
28768    if (json.has(prefix+"Identifier"))
28769      return true;
28770    if (json.has(prefix+"SubstanceAmount"))
28771      return true;
28772    if (json.has(prefix+"Statistic"))
28773      return true;
28774    if (json.has(prefix+"Coding"))
28775      return true;
28776    if (json.has(prefix+"SampledData"))
28777      return true;
28778    if (json.has(prefix+"Population"))
28779      return true;
28780    if (json.has(prefix+"Ratio"))
28781      return true;
28782    if (json.has(prefix+"OrderedDistribution"))
28783      return true;
28784    if (json.has(prefix+"Distance"))
28785      return true;
28786    if (json.has(prefix+"Age"))
28787      return true;
28788    if (json.has(prefix+"Reference"))
28789      return true;
28790    if (json.has(prefix+"TriggerDefinition"))
28791      return true;
28792    if (json.has(prefix+"Quantity"))
28793      return true;
28794    if (json.has(prefix+"Period"))
28795      return true;
28796    if (json.has(prefix+"Duration"))
28797      return true;
28798    if (json.has(prefix+"Range"))
28799      return true;
28800    if (json.has(prefix+"RelatedArtifact"))
28801      return true;
28802    if (json.has(prefix+"Annotation"))
28803      return true;
28804    if (json.has(prefix+"ProductShelfLife"))
28805      return true;
28806    if (json.has(prefix+"ContactDetail"))
28807      return true;
28808    if (json.has(prefix+"UsageContext"))
28809      return true;
28810    if (json.has(prefix+"Expression"))
28811      return true;
28812    if (json.has(prefix+"Signature"))
28813      return true;
28814    if (json.has(prefix+"Timing"))
28815      return true;
28816    if (json.has(prefix+"ProdCharacteristic"))
28817      return true;
28818    if (json.has(prefix+"CodeableConcept"))
28819      return true;
28820    if (json.has(prefix+"ParameterDefinition"))
28821      return true;
28822    if (json.has(prefix+"Parameters"))
28823      return true;
28824    if (json.has(prefix+"Account"))
28825      return true;
28826    if (json.has(prefix+"ActivityDefinition"))
28827      return true;
28828    if (json.has(prefix+"AdministrableProductDefinition"))
28829      return true;
28830    if (json.has(prefix+"AdverseEvent"))
28831      return true;
28832    if (json.has(prefix+"AllergyIntolerance"))
28833      return true;
28834    if (json.has(prefix+"Appointment"))
28835      return true;
28836    if (json.has(prefix+"AppointmentResponse"))
28837      return true;
28838    if (json.has(prefix+"AuditEvent"))
28839      return true;
28840    if (json.has(prefix+"Basic"))
28841      return true;
28842    if (json.has(prefix+"Binary"))
28843      return true;
28844    if (json.has(prefix+"BiologicallyDerivedProduct"))
28845      return true;
28846    if (json.has(prefix+"BodyStructure"))
28847      return true;
28848    if (json.has(prefix+"Bundle"))
28849      return true;
28850    if (json.has(prefix+"CapabilityStatement"))
28851      return true;
28852    if (json.has(prefix+"CapabilityStatement2"))
28853      return true;
28854    if (json.has(prefix+"CarePlan"))
28855      return true;
28856    if (json.has(prefix+"CareTeam"))
28857      return true;
28858    if (json.has(prefix+"CatalogEntry"))
28859      return true;
28860    if (json.has(prefix+"ChargeItem"))
28861      return true;
28862    if (json.has(prefix+"ChargeItemDefinition"))
28863      return true;
28864    if (json.has(prefix+"Claim"))
28865      return true;
28866    if (json.has(prefix+"ClaimResponse"))
28867      return true;
28868    if (json.has(prefix+"ClinicalImpression"))
28869      return true;
28870    if (json.has(prefix+"ClinicalUseIssue"))
28871      return true;
28872    if (json.has(prefix+"CodeSystem"))
28873      return true;
28874    if (json.has(prefix+"Communication"))
28875      return true;
28876    if (json.has(prefix+"CommunicationRequest"))
28877      return true;
28878    if (json.has(prefix+"CompartmentDefinition"))
28879      return true;
28880    if (json.has(prefix+"Composition"))
28881      return true;
28882    if (json.has(prefix+"ConceptMap"))
28883      return true;
28884    if (json.has(prefix+"Condition"))
28885      return true;
28886    if (json.has(prefix+"ConditionDefinition"))
28887      return true;
28888    if (json.has(prefix+"Consent"))
28889      return true;
28890    if (json.has(prefix+"Contract"))
28891      return true;
28892    if (json.has(prefix+"Coverage"))
28893      return true;
28894    if (json.has(prefix+"CoverageEligibilityRequest"))
28895      return true;
28896    if (json.has(prefix+"CoverageEligibilityResponse"))
28897      return true;
28898    if (json.has(prefix+"DetectedIssue"))
28899      return true;
28900    if (json.has(prefix+"Device"))
28901      return true;
28902    if (json.has(prefix+"DeviceDefinition"))
28903      return true;
28904    if (json.has(prefix+"DeviceMetric"))
28905      return true;
28906    if (json.has(prefix+"DeviceRequest"))
28907      return true;
28908    if (json.has(prefix+"DeviceUseStatement"))
28909      return true;
28910    if (json.has(prefix+"DiagnosticReport"))
28911      return true;
28912    if (json.has(prefix+"DocumentManifest"))
28913      return true;
28914    if (json.has(prefix+"DocumentReference"))
28915      return true;
28916    if (json.has(prefix+"Encounter"))
28917      return true;
28918    if (json.has(prefix+"Endpoint"))
28919      return true;
28920    if (json.has(prefix+"EnrollmentRequest"))
28921      return true;
28922    if (json.has(prefix+"EnrollmentResponse"))
28923      return true;
28924    if (json.has(prefix+"EpisodeOfCare"))
28925      return true;
28926    if (json.has(prefix+"EventDefinition"))
28927      return true;
28928    if (json.has(prefix+"Evidence"))
28929      return true;
28930    if (json.has(prefix+"EvidenceVariable"))
28931      return true;
28932    if (json.has(prefix+"ExampleScenario"))
28933      return true;
28934    if (json.has(prefix+"ExplanationOfBenefit"))
28935      return true;
28936    if (json.has(prefix+"FamilyMemberHistory"))
28937      return true;
28938    if (json.has(prefix+"Flag"))
28939      return true;
28940    if (json.has(prefix+"Goal"))
28941      return true;
28942    if (json.has(prefix+"GraphDefinition"))
28943      return true;
28944    if (json.has(prefix+"Group"))
28945      return true;
28946    if (json.has(prefix+"GuidanceResponse"))
28947      return true;
28948    if (json.has(prefix+"HealthcareService"))
28949      return true;
28950    if (json.has(prefix+"ImagingStudy"))
28951      return true;
28952    if (json.has(prefix+"Immunization"))
28953      return true;
28954    if (json.has(prefix+"ImmunizationEvaluation"))
28955      return true;
28956    if (json.has(prefix+"ImmunizationRecommendation"))
28957      return true;
28958    if (json.has(prefix+"ImplementationGuide"))
28959      return true;
28960    if (json.has(prefix+"Ingredient"))
28961      return true;
28962    if (json.has(prefix+"InsurancePlan"))
28963      return true;
28964    if (json.has(prefix+"Invoice"))
28965      return true;
28966    if (json.has(prefix+"Library"))
28967      return true;
28968    if (json.has(prefix+"Linkage"))
28969      return true;
28970    if (json.has(prefix+"List"))
28971      return true;
28972    if (json.has(prefix+"Location"))
28973      return true;
28974    if (json.has(prefix+"ManufacturedItemDefinition"))
28975      return true;
28976    if (json.has(prefix+"Measure"))
28977      return true;
28978    if (json.has(prefix+"MeasureReport"))
28979      return true;
28980    if (json.has(prefix+"Medication"))
28981      return true;
28982    if (json.has(prefix+"MedicationAdministration"))
28983      return true;
28984    if (json.has(prefix+"MedicationDispense"))
28985      return true;
28986    if (json.has(prefix+"MedicationKnowledge"))
28987      return true;
28988    if (json.has(prefix+"MedicationRequest"))
28989      return true;
28990    if (json.has(prefix+"MedicationUsage"))
28991      return true;
28992    if (json.has(prefix+"MedicinalProductDefinition"))
28993      return true;
28994    if (json.has(prefix+"MessageDefinition"))
28995      return true;
28996    if (json.has(prefix+"MessageHeader"))
28997      return true;
28998    if (json.has(prefix+"MolecularSequence"))
28999      return true;
29000    if (json.has(prefix+"NamingSystem"))
29001      return true;
29002    if (json.has(prefix+"NutritionIntake"))
29003      return true;
29004    if (json.has(prefix+"NutritionOrder"))
29005      return true;
29006    if (json.has(prefix+"Observation"))
29007      return true;
29008    if (json.has(prefix+"ObservationDefinition"))
29009      return true;
29010    if (json.has(prefix+"OperationDefinition"))
29011      return true;
29012    if (json.has(prefix+"OperationOutcome"))
29013      return true;
29014    if (json.has(prefix+"Organization"))
29015      return true;
29016    if (json.has(prefix+"OrganizationAffiliation"))
29017      return true;
29018    if (json.has(prefix+"PackagedProductDefinition"))
29019      return true;
29020    if (json.has(prefix+"Patient"))
29021      return true;
29022    if (json.has(prefix+"PaymentNotice"))
29023      return true;
29024    if (json.has(prefix+"PaymentReconciliation"))
29025      return true;
29026    if (json.has(prefix+"Person"))
29027      return true;
29028    if (json.has(prefix+"PlanDefinition"))
29029      return true;
29030    if (json.has(prefix+"Practitioner"))
29031      return true;
29032    if (json.has(prefix+"PractitionerRole"))
29033      return true;
29034    if (json.has(prefix+"Procedure"))
29035      return true;
29036    if (json.has(prefix+"Provenance"))
29037      return true;
29038    if (json.has(prefix+"Questionnaire"))
29039      return true;
29040    if (json.has(prefix+"QuestionnaireResponse"))
29041      return true;
29042    if (json.has(prefix+"RegulatedAuthorization"))
29043      return true;
29044    if (json.has(prefix+"RelatedPerson"))
29045      return true;
29046    if (json.has(prefix+"RequestGroup"))
29047      return true;
29048    if (json.has(prefix+"ResearchStudy"))
29049      return true;
29050    if (json.has(prefix+"ResearchSubject"))
29051      return true;
29052    if (json.has(prefix+"RiskAssessment"))
29053      return true;
29054    if (json.has(prefix+"Schedule"))
29055      return true;
29056    if (json.has(prefix+"SearchParameter"))
29057      return true;
29058    if (json.has(prefix+"ServiceRequest"))
29059      return true;
29060    if (json.has(prefix+"Slot"))
29061      return true;
29062    if (json.has(prefix+"Specimen"))
29063      return true;
29064    if (json.has(prefix+"SpecimenDefinition"))
29065      return true;
29066    if (json.has(prefix+"StructureDefinition"))
29067      return true;
29068    if (json.has(prefix+"StructureMap"))
29069      return true;
29070    if (json.has(prefix+"Subscription"))
29071      return true;
29072    if (json.has(prefix+"Substance"))
29073      return true;
29074    if (json.has(prefix+"SubstanceDefinition"))
29075      return true;
29076    if (json.has(prefix+"SubstanceNucleicAcid"))
29077      return true;
29078    if (json.has(prefix+"SubstancePolymer"))
29079      return true;
29080    if (json.has(prefix+"SubstanceProtein"))
29081      return true;
29082    if (json.has(prefix+"SubstanceReferenceInformation"))
29083      return true;
29084    if (json.has(prefix+"SubstanceSourceMaterial"))
29085      return true;
29086    if (json.has(prefix+"SupplyDelivery"))
29087      return true;
29088    if (json.has(prefix+"SupplyRequest"))
29089      return true;
29090    if (json.has(prefix+"Task"))
29091      return true;
29092    if (json.has(prefix+"TerminologyCapabilities"))
29093      return true;
29094    if (json.has(prefix+"TestReport"))
29095      return true;
29096    if (json.has(prefix+"TestScript"))
29097      return true;
29098    if (json.has(prefix+"Topic"))
29099      return true;
29100    if (json.has(prefix+"ValueSet"))
29101      return true;
29102    if (json.has(prefix+"VerificationResult"))
29103      return true;
29104    if (json.has(prefix+"VisionPrescription"))
29105      return true;
29106    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
29107      return true;
29108    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
29109      return true;
29110    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
29111      return true;
29112    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
29113      return true;
29114    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
29115      return true;
29116    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
29117      return true;
29118    if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical"))
29119      return true;
29120    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
29121      return true;
29122    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
29123      return true;
29124    if (json.has(prefix+"Url") || json.has("_"+prefix+"Url"))
29125      return true;
29126    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
29127      return true;
29128    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
29129      return true;
29130    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
29131      return true;
29132    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
29133      return true;
29134    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
29135      return true;
29136    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
29137      return true;
29138    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
29139      return true;
29140    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
29141      return true;
29142    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
29143      return true;
29144    return false;
29145  }
29146
29147  protected Type parseAnyType(JsonObject json, String type) throws IOException, FHIRFormatError {
29148    if (type.equals("ElementDefinition"))
29149      return parseElementDefinition(json);
29150    else if (type.equals("DataRequirement"))
29151      return parseDataRequirement(json);
29152    else
29153      return parseType(json, type);
29154  }
29155
29156  protected void composeElement(Element element) throws IOException {
29157    if (element.hasId())
29158      prop("id", element.getId());
29159      if (makeComments(element)) {
29160        openArray("fhir_comments");
29161        for (String s : element.getFormatCommentsPre())
29162          prop(null,  s);
29163        for (String s : element.getFormatCommentsPost())
29164          prop(null,  s);
29165         closeArray();
29166      }
29167    if (element.hasExtension()) {
29168      openArray("extension");
29169      for (Extension e : element.getExtension())
29170        composeExtension(null, e);
29171      closeArray();
29172    }
29173  }
29174
29175  protected void composeBackboneElementInner(BackboneElement element) throws IOException {
29176    composeBackbone(element);
29177  }
29178
29179  protected void composeBackbone(BackboneElement element) throws IOException {
29180    composeElement(element);
29181    if (element.hasModifierExtension()) {
29182      openArray("modifierExtension");
29183      for (Extension e : element.getModifierExtension())
29184        composeExtension(null, e);
29185      closeArray();
29186    }
29187  }
29188
29189  protected void composeBackbone(BackboneType element) throws IOException {
29190    composeElement(element);
29191    if (element.hasModifierExtension()) {
29192      openArray("modifierExtension");
29193      for (Extension e : element.getModifierExtension())
29194        composeExtension(null, e);
29195      closeArray();
29196    }
29197  }
29198
29199  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
29200    if (value != null && value.getValue() != null) {
29201      prop(name, e.toCode(value.getValue()));
29202    } else if (inArray)   
29203      writeNull(name);
29204  }    
29205
29206  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
29207    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29208      open(inArray ? null : "_"+name);
29209      composeElement(value);
29210      close();
29211    } else if (inArray)   
29212      writeNull(name);
29213  }    
29214
29215  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
29216    if (value != null && value.hasValue()) {
29217        prop(name, value.asStringValue());
29218    }    
29219    else if (inArray) 
29220      writeNull(name); 
29221  }    
29222
29223  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
29224    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29225      open(inArray ? null : "_"+name);
29226      composeElement(value);
29227      close();
29228    }
29229    else if (inArray) 
29230      writeNull(name); 
29231  }
29232
29233  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
29234    if (value != null && value.hasValue()) {
29235        prop(name, value.asStringValue());
29236    }    
29237    else if (inArray) 
29238      writeNull(name); 
29239  }    
29240
29241  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
29242    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29243      open(inArray ? null : "_"+name);
29244      composeElement(value);
29245      close();
29246    }
29247    else if (inArray) 
29248      writeNull(name); 
29249  }
29250
29251  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
29252    if (value != null && value.hasValue()) {
29253        prop(name, toString(value.getValue()));
29254    }    
29255    else if (inArray) 
29256      writeNull(name); 
29257  }    
29258
29259  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
29260    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29261      open(inArray ? null : "_"+name);
29262      composeElement(value);
29263      close();
29264    }
29265    else if (inArray) 
29266      writeNull(name); 
29267  }
29268
29269  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
29270    if (value != null && value.hasValue()) {
29271        prop(name, toString(value.getValue()));
29272    }    
29273    else if (inArray) 
29274      writeNull(name); 
29275  }    
29276
29277  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
29278    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29279      open(inArray ? null : "_"+name);
29280      composeElement(value);
29281      close();
29282    }
29283    else if (inArray) 
29284      writeNull(name); 
29285  }
29286
29287  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
29288    if (value != null && value.hasValue()) {
29289        prop(name, Integer.valueOf(value.getValue()));
29290    }    
29291    else if (inArray) 
29292      writeNull(name); 
29293  }    
29294
29295  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
29296    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29297      open(inArray ? null : "_"+name);
29298      composeElement(value);
29299      close();
29300    }
29301    else if (inArray) 
29302      writeNull(name); 
29303  }
29304
29305  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
29306    if (value != null && value.hasValue()) {
29307        prop(name, toString(value.getValue()));
29308    }    
29309    else if (inArray) 
29310      writeNull(name); 
29311  }    
29312
29313  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
29314    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29315      open(inArray ? null : "_"+name);
29316      composeElement(value);
29317      close();
29318    }
29319    else if (inArray) 
29320      writeNull(name); 
29321  }
29322
29323  protected void composeCanonicalCore(String name, CanonicalType value, boolean inArray) throws IOException {
29324    if (value != null && value.hasValue()) {
29325        prop(name, toString(value.getValue()));
29326    }    
29327    else if (inArray) 
29328      writeNull(name); 
29329  }    
29330
29331  protected void composeCanonicalExtras(String name, CanonicalType value, boolean inArray) throws IOException {
29332    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29333      open(inArray ? null : "_"+name);
29334      composeElement(value);
29335      close();
29336    }
29337    else if (inArray) 
29338      writeNull(name); 
29339  }
29340
29341  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
29342    if (value != null && value.hasValue()) {
29343        prop(name, toString(value.getValue()));
29344    }    
29345    else if (inArray) 
29346      writeNull(name); 
29347  }    
29348
29349  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
29350    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29351      open(inArray ? null : "_"+name);
29352      composeElement(value);
29353      close();
29354    }
29355    else if (inArray) 
29356      writeNull(name); 
29357  }
29358
29359  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
29360    if (value != null && value.hasValue()) {
29361        prop(name, toString(value.getValue()));
29362    }    
29363    else if (inArray) 
29364      writeNull(name); 
29365  }    
29366
29367  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
29368    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29369      open(inArray ? null : "_"+name);
29370      composeElement(value);
29371      close();
29372    }
29373    else if (inArray) 
29374      writeNull(name); 
29375  }
29376
29377  protected void composeUrlCore(String name, UrlType value, boolean inArray) throws IOException {
29378    if (value != null && value.hasValue()) {
29379        prop(name, toString(value.getValue()));
29380    }    
29381    else if (inArray) 
29382      writeNull(name); 
29383  }    
29384
29385  protected void composeUrlExtras(String name, UrlType value, boolean inArray) throws IOException {
29386    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29387      open(inArray ? null : "_"+name);
29388      composeElement(value);
29389      close();
29390    }
29391    else if (inArray) 
29392      writeNull(name); 
29393  }
29394
29395  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
29396    if (value != null && value.hasValue()) {
29397        prop(name, value.asStringValue());
29398    }    
29399    else if (inArray) 
29400      writeNull(name); 
29401  }    
29402
29403  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
29404    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29405      open(inArray ? null : "_"+name);
29406      composeElement(value);
29407      close();
29408    }
29409    else if (inArray) 
29410      writeNull(name); 
29411  }
29412
29413  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
29414    if (value != null && value.hasValue()) {
29415        prop(name, value.getValue());
29416    }    
29417    else if (inArray) 
29418      writeNull(name); 
29419  }    
29420
29421  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
29422    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29423      open(inArray ? null : "_"+name);
29424      composeElement(value);
29425      close();
29426    }
29427    else if (inArray) 
29428      writeNull(name); 
29429  }
29430
29431  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
29432    if (value != null && value.hasValue()) {
29433        prop(name, toString(value.getValue()));
29434    }    
29435    else if (inArray) 
29436      writeNull(name); 
29437  }    
29438
29439  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
29440    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29441      open(inArray ? null : "_"+name);
29442      composeElement(value);
29443      close();
29444    }
29445    else if (inArray) 
29446      writeNull(name); 
29447  }
29448
29449  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
29450    if (value != null && value.hasValue()) {
29451        prop(name, Integer.valueOf(value.getValue()));
29452    }    
29453    else if (inArray) 
29454      writeNull(name); 
29455  }    
29456
29457  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
29458    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29459      open(inArray ? null : "_"+name);
29460      composeElement(value);
29461      close();
29462    }
29463    else if (inArray) 
29464      writeNull(name); 
29465  }
29466
29467  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
29468    if (value != null && value.hasValue()) {
29469        prop(name, toString(value.getValue()));
29470    }    
29471    else if (inArray) 
29472      writeNull(name); 
29473  }    
29474
29475  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
29476    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29477      open(inArray ? null : "_"+name);
29478      composeElement(value);
29479      close();
29480    }
29481    else if (inArray) 
29482      writeNull(name); 
29483  }
29484
29485  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
29486    if (value != null && value.hasValue()) {
29487        prop(name, value.asStringValue());
29488    }    
29489    else if (inArray) 
29490      writeNull(name); 
29491  }    
29492
29493  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
29494    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29495      open(inArray ? null : "_"+name);
29496      composeElement(value);
29497      close();
29498    }
29499    else if (inArray) 
29500      writeNull(name); 
29501  }
29502
29503  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
29504    if (value != null && value.hasValue()) {
29505        prop(name, toString(value.getValue()));
29506    }    
29507    else if (inArray) 
29508      writeNull(name); 
29509  }    
29510
29511  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
29512    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29513      open(inArray ? null : "_"+name);
29514      composeElement(value);
29515      close();
29516    }
29517    else if (inArray) 
29518      writeNull(name); 
29519  }
29520
29521  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
29522    if (value != null && value.hasValue()) {
29523        prop(name, Integer.valueOf(value.getValue()));
29524    }    
29525    else if (inArray) 
29526      writeNull(name); 
29527  }    
29528
29529  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
29530    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29531      open(inArray ? null : "_"+name);
29532      composeElement(value);
29533      close();
29534    }
29535    else if (inArray) 
29536      writeNull(name); 
29537  }
29538
29539  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
29540    if (value != null && value.hasValue()) {
29541        prop(name, value.getValue());
29542    }    
29543    else if (inArray) 
29544      writeNull(name); 
29545  }    
29546
29547  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
29548    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29549      open(inArray ? null : "_"+name);
29550      composeElement(value);
29551      close();
29552    }
29553    else if (inArray) 
29554      writeNull(name); 
29555  }
29556
29557  protected void composeExtension(String name, Extension element) throws IOException {
29558    if (element != null) {
29559      open(name);
29560      composeExtensionInner(element);
29561      close();
29562    }
29563  }
29564
29565  protected void composeExtensionInner(Extension element) throws IOException {
29566      composeElement(element);
29567      if (element.hasUrlElement()) {
29568        composeUriCore("url", element.getUrlElement(), false);
29569        composeUriExtras("url", element.getUrlElement(), false);
29570      }
29571      if (element.hasValue()) {
29572        composeType("value", element.getValue());
29573      }
29574  }
29575
29576  protected void composeNarrative(String name, Narrative element) throws IOException {
29577    if (element != null) {
29578      open(name);
29579      composeNarrativeInner(element);
29580      close();
29581    }
29582  }
29583
29584  protected void composeNarrativeInner(Narrative element) throws IOException {
29585      composeElement(element);
29586      if (element.hasStatusElement()) {
29587        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
29588        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
29589      }
29590      if (element.hasDiv()) {
29591        XhtmlNode node = element.getDiv();
29592        if (node.getNsDecl() == null) {
29593          node.attribute("xmlns", XHTML_NS);
29594        }
29595        composeXhtml("div", node);
29596      }
29597  }
29598
29599  protected void composeCount(String name, Count element) throws IOException {
29600    if (element != null) {
29601      open(name);
29602      composeCountInner(element);
29603      close();
29604    }
29605  }
29606
29607  protected void composeCountInner(Count element) throws IOException {
29608      composeQuantityInner(element);
29609  }
29610
29611  protected void composeDosage(String name, Dosage element) throws IOException {
29612    if (element != null) {
29613      open(name);
29614      composeDosageInner(element);
29615      close();
29616    }
29617  }
29618
29619  protected void composeDosageInner(Dosage element) throws IOException {
29620      composeBackbone(element);
29621      if (element.hasSequenceElement()) {
29622        composeIntegerCore("sequence", element.getSequenceElement(), false);
29623        composeIntegerExtras("sequence", element.getSequenceElement(), false);
29624      }
29625      if (element.hasTextElement()) {
29626        composeStringCore("text", element.getTextElement(), false);
29627        composeStringExtras("text", element.getTextElement(), false);
29628      }
29629      if (element.hasAdditionalInstruction()) {
29630        openArray("additionalInstruction");
29631        for (CodeableConcept e : element.getAdditionalInstruction()) 
29632          composeCodeableConcept(null, e);
29633        closeArray();
29634      };
29635      if (element.hasPatientInstructionElement()) {
29636        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
29637        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
29638      }
29639      if (element.hasTiming()) {
29640        composeTiming("timing", element.getTiming());
29641      }
29642      if (element.hasAsNeeded()) {
29643        composeType("asNeeded", element.getAsNeeded());
29644      }
29645      if (element.hasSite()) {
29646        composeCodeableConcept("site", element.getSite());
29647      }
29648      if (element.hasRoute()) {
29649        composeCodeableConcept("route", element.getRoute());
29650      }
29651      if (element.hasMethod()) {
29652        composeCodeableConcept("method", element.getMethod());
29653      }
29654      if (element.hasDoseAndRate()) {
29655        openArray("doseAndRate");
29656        for (Dosage.DosageDoseAndRateComponent e : element.getDoseAndRate()) 
29657          composeDosageDosageDoseAndRateComponent(null, e);
29658        closeArray();
29659      };
29660      if (element.hasMaxDosePerPeriod()) {
29661        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
29662      }
29663      if (element.hasMaxDosePerAdministration()) {
29664        composeQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
29665      }
29666      if (element.hasMaxDosePerLifetime()) {
29667        composeQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
29668      }
29669  }
29670
29671  protected void composeDosageDosageDoseAndRateComponent(String name, Dosage.DosageDoseAndRateComponent element) throws IOException {
29672    if (element != null) {
29673      open(name);
29674      composeDosageDosageDoseAndRateComponentInner(element);
29675      close();
29676    }
29677  }
29678
29679  protected void composeDosageDosageDoseAndRateComponentInner(Dosage.DosageDoseAndRateComponent element) throws IOException {
29680      composeElement(element);
29681      if (element.hasType()) {
29682        composeCodeableConcept("type", element.getType());
29683      }
29684      if (element.hasDose()) {
29685        composeType("dose", element.getDose());
29686      }
29687      if (element.hasRate()) {
29688        composeType("rate", element.getRate());
29689      }
29690  }
29691
29692  protected void composeMarketingStatus(String name, MarketingStatus element) throws IOException {
29693    if (element != null) {
29694      open(name);
29695      composeMarketingStatusInner(element);
29696      close();
29697    }
29698  }
29699
29700  protected void composeMarketingStatusInner(MarketingStatus element) throws IOException {
29701      composeBackbone(element);
29702      if (element.hasCountry()) {
29703        composeCodeableConcept("country", element.getCountry());
29704      }
29705      if (element.hasJurisdiction()) {
29706        composeCodeableConcept("jurisdiction", element.getJurisdiction());
29707      }
29708      if (element.hasStatus()) {
29709        composeCodeableConcept("status", element.getStatus());
29710      }
29711      if (element.hasDateRange()) {
29712        composePeriod("dateRange", element.getDateRange());
29713      }
29714      if (element.hasRestoreDateElement()) {
29715        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
29716        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
29717      }
29718  }
29719
29720  protected void composeSubstanceAmount(String name, SubstanceAmount element) throws IOException {
29721    if (element != null) {
29722      open(name);
29723      composeSubstanceAmountInner(element);
29724      close();
29725    }
29726  }
29727
29728  protected void composeSubstanceAmountInner(SubstanceAmount element) throws IOException {
29729      composeBackbone(element);
29730      if (element.hasAmount()) {
29731        composeType("amount", element.getAmount());
29732      }
29733      if (element.hasAmountType()) {
29734        composeCodeableConcept("amountType", element.getAmountType());
29735      }
29736      if (element.hasAmountTextElement()) {
29737        composeStringCore("amountText", element.getAmountTextElement(), false);
29738        composeStringExtras("amountText", element.getAmountTextElement(), false);
29739      }
29740      if (element.hasReferenceRange()) {
29741        composeSubstanceAmountSubstanceAmountReferenceRangeComponent("referenceRange", element.getReferenceRange());
29742      }
29743  }
29744
29745  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponent(String name, SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
29746    if (element != null) {
29747      open(name);
29748      composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(element);
29749      close();
29750    }
29751  }
29752
29753  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
29754      composeElement(element);
29755      if (element.hasLowLimit()) {
29756        composeQuantity("lowLimit", element.getLowLimit());
29757      }
29758      if (element.hasHighLimit()) {
29759        composeQuantity("highLimit", element.getHighLimit());
29760      }
29761  }
29762
29763  protected void composeStatistic(String name, Statistic element) throws IOException {
29764    if (element != null) {
29765      open(name);
29766      composeStatisticInner(element);
29767      close();
29768    }
29769  }
29770
29771  protected void composeStatisticInner(Statistic element) throws IOException {
29772      composeBackbone(element);
29773      if (element.hasDescriptionElement()) {
29774        composeStringCore("description", element.getDescriptionElement(), false);
29775        composeStringExtras("description", element.getDescriptionElement(), false);
29776      }
29777      if (element.hasNote()) {
29778        openArray("note");
29779        for (Annotation e : element.getNote()) 
29780          composeAnnotation(null, e);
29781        closeArray();
29782      };
29783      if (element.hasStatisticType()) {
29784        composeCodeableConcept("statisticType", element.getStatisticType());
29785      }
29786      if (element.hasQuantity()) {
29787        composeQuantity("quantity", element.getQuantity());
29788      }
29789      if (element.hasSampleSize()) {
29790        composeStatisticStatisticSampleSizeComponent("sampleSize", element.getSampleSize());
29791      }
29792      if (element.hasAttributeEstimate()) {
29793        openArray("attributeEstimate");
29794        for (Statistic.StatisticAttributeEstimateComponent e : element.getAttributeEstimate()) 
29795          composeStatisticStatisticAttributeEstimateComponent(null, e);
29796        closeArray();
29797      };
29798  }
29799
29800  protected void composeStatisticStatisticSampleSizeComponent(String name, Statistic.StatisticSampleSizeComponent element) throws IOException {
29801    if (element != null) {
29802      open(name);
29803      composeStatisticStatisticSampleSizeComponentInner(element);
29804      close();
29805    }
29806  }
29807
29808  protected void composeStatisticStatisticSampleSizeComponentInner(Statistic.StatisticSampleSizeComponent element) throws IOException {
29809      composeElement(element);
29810      if (element.hasDescriptionElement()) {
29811        composeStringCore("description", element.getDescriptionElement(), false);
29812        composeStringExtras("description", element.getDescriptionElement(), false);
29813      }
29814      if (element.hasNote()) {
29815        openArray("note");
29816        for (Annotation e : element.getNote()) 
29817          composeAnnotation(null, e);
29818        closeArray();
29819      };
29820      if (element.hasNumberOfStudiesElement()) {
29821        composeIntegerCore("numberOfStudies", element.getNumberOfStudiesElement(), false);
29822        composeIntegerExtras("numberOfStudies", element.getNumberOfStudiesElement(), false);
29823      }
29824      if (element.hasNumberOfParticipantsElement()) {
29825        composeIntegerCore("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
29826        composeIntegerExtras("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
29827      }
29828      if (element.hasKnownDataCountElement()) {
29829        composeIntegerCore("knownDataCount", element.getKnownDataCountElement(), false);
29830        composeIntegerExtras("knownDataCount", element.getKnownDataCountElement(), false);
29831      }
29832      if (element.hasNumeratorCountElement()) {
29833        composeIntegerCore("numeratorCount", element.getNumeratorCountElement(), false);
29834        composeIntegerExtras("numeratorCount", element.getNumeratorCountElement(), false);
29835      }
29836  }
29837
29838  protected void composeStatisticStatisticAttributeEstimateComponent(String name, Statistic.StatisticAttributeEstimateComponent element) throws IOException {
29839    if (element != null) {
29840      open(name);
29841      composeStatisticStatisticAttributeEstimateComponentInner(element);
29842      close();
29843    }
29844  }
29845
29846  protected void composeStatisticStatisticAttributeEstimateComponentInner(Statistic.StatisticAttributeEstimateComponent element) throws IOException {
29847      composeElement(element);
29848      if (element.hasDescriptionElement()) {
29849        composeStringCore("description", element.getDescriptionElement(), false);
29850        composeStringExtras("description", element.getDescriptionElement(), false);
29851      }
29852      if (element.hasNote()) {
29853        openArray("note");
29854        for (Annotation e : element.getNote()) 
29855          composeAnnotation(null, e);
29856        closeArray();
29857      };
29858      if (element.hasType()) {
29859        composeCodeableConcept("type", element.getType());
29860      }
29861      if (element.hasQuantity()) {
29862        composeQuantity("quantity", element.getQuantity());
29863      }
29864      if (element.hasLevelElement()) {
29865        composeDecimalCore("level", element.getLevelElement(), false);
29866        composeDecimalExtras("level", element.getLevelElement(), false);
29867      }
29868      if (element.hasRange()) {
29869        composeRange("range", element.getRange());
29870      }
29871      if (element.hasEstimateQualifier()) {
29872        openArray("estimateQualifier");
29873        for (Statistic.StatisticAttributeEstimateEstimateQualifierComponent e : element.getEstimateQualifier()) 
29874          composeStatisticStatisticAttributeEstimateEstimateQualifierComponent(null, e);
29875        closeArray();
29876      };
29877  }
29878
29879  protected void composeStatisticStatisticAttributeEstimateEstimateQualifierComponent(String name, Statistic.StatisticAttributeEstimateEstimateQualifierComponent element) throws IOException {
29880    if (element != null) {
29881      open(name);
29882      composeStatisticStatisticAttributeEstimateEstimateQualifierComponentInner(element);
29883      close();
29884    }
29885  }
29886
29887  protected void composeStatisticStatisticAttributeEstimateEstimateQualifierComponentInner(Statistic.StatisticAttributeEstimateEstimateQualifierComponent element) throws IOException {
29888      composeElement(element);
29889      if (element.hasDescriptionElement()) {
29890        composeStringCore("description", element.getDescriptionElement(), false);
29891        composeStringExtras("description", element.getDescriptionElement(), false);
29892      }
29893      if (element.hasNote()) {
29894        openArray("note");
29895        for (Annotation e : element.getNote()) 
29896          composeAnnotation(null, e);
29897        closeArray();
29898      };
29899      if (element.hasType()) {
29900        composeCodeableConcept("type", element.getType());
29901      }
29902      if (element.hasQuantity()) {
29903        composeQuantity("quantity", element.getQuantity());
29904      }
29905      if (element.hasLevelElement()) {
29906        composeDecimalCore("level", element.getLevelElement(), false);
29907        composeDecimalExtras("level", element.getLevelElement(), false);
29908      }
29909      if (element.hasRange()) {
29910        composeRange("range", element.getRange());
29911      }
29912  }
29913
29914  protected void composePopulation(String name, Population element) throws IOException {
29915    if (element != null) {
29916      open(name);
29917      composePopulationInner(element);
29918      close();
29919    }
29920  }
29921
29922  protected void composePopulationInner(Population element) throws IOException {
29923      composeBackbone(element);
29924      if (element.hasAge()) {
29925        composeType("age", element.getAge());
29926      }
29927      if (element.hasGender()) {
29928        composeCodeableConcept("gender", element.getGender());
29929      }
29930      if (element.hasRace()) {
29931        composeCodeableConcept("race", element.getRace());
29932      }
29933      if (element.hasPhysiologicalCondition()) {
29934        composeCodeableConcept("physiologicalCondition", element.getPhysiologicalCondition());
29935      }
29936  }
29937
29938  protected void composeOrderedDistribution(String name, OrderedDistribution element) throws IOException {
29939    if (element != null) {
29940      open(name);
29941      composeOrderedDistributionInner(element);
29942      close();
29943    }
29944  }
29945
29946  protected void composeOrderedDistributionInner(OrderedDistribution element) throws IOException {
29947      composeBackbone(element);
29948      if (element.hasDescriptionElement()) {
29949        composeStringCore("description", element.getDescriptionElement(), false);
29950        composeStringExtras("description", element.getDescriptionElement(), false);
29951      }
29952      if (element.hasNote()) {
29953        openArray("note");
29954        for (Annotation e : element.getNote()) 
29955          composeAnnotation(null, e);
29956        closeArray();
29957      };
29958      if (element.hasNumberOfIntervalsElement()) {
29959        composeIntegerCore("numberOfIntervals", element.getNumberOfIntervalsElement(), false);
29960        composeIntegerExtras("numberOfIntervals", element.getNumberOfIntervalsElement(), false);
29961      }
29962      if (element.hasBottomOfFirstInterval()) {
29963        composeQuantity("bottomOfFirstInterval", element.getBottomOfFirstInterval());
29964      }
29965      if (element.hasInterval()) {
29966        openArray("interval");
29967        for (OrderedDistribution.OrderedDistributionIntervalComponent e : element.getInterval()) 
29968          composeOrderedDistributionOrderedDistributionIntervalComponent(null, e);
29969        closeArray();
29970      };
29971      if (element.hasTopOfInterval()) {
29972        composeQuantity("topOfInterval", element.getTopOfInterval());
29973      }
29974  }
29975
29976  protected void composeOrderedDistributionOrderedDistributionIntervalComponent(String name, OrderedDistribution.OrderedDistributionIntervalComponent element) throws IOException {
29977    if (element != null) {
29978      open(name);
29979      composeOrderedDistributionOrderedDistributionIntervalComponentInner(element);
29980      close();
29981    }
29982  }
29983
29984  protected void composeOrderedDistributionOrderedDistributionIntervalComponentInner(OrderedDistribution.OrderedDistributionIntervalComponent element) throws IOException {
29985      composeElement(element);
29986      if (element.hasRankOrderElement()) {
29987        composeIntegerCore("rankOrder", element.getRankOrderElement(), false);
29988        composeIntegerExtras("rankOrder", element.getRankOrderElement(), false);
29989      }
29990      if (element.hasIntervalStatistic()) {
29991        openArray("intervalStatistic");
29992        for (Statistic e : element.getIntervalStatistic()) 
29993          composeStatistic(null, e);
29994        closeArray();
29995      };
29996  }
29997
29998  protected void composeDistance(String name, Distance element) throws IOException {
29999    if (element != null) {
30000      open(name);
30001      composeDistanceInner(element);
30002      close();
30003    }
30004  }
30005
30006  protected void composeDistanceInner(Distance element) throws IOException {
30007      composeQuantityInner(element);
30008  }
30009
30010  protected void composeAge(String name, Age element) throws IOException {
30011    if (element != null) {
30012      open(name);
30013      composeAgeInner(element);
30014      close();
30015    }
30016  }
30017
30018  protected void composeAgeInner(Age element) throws IOException {
30019      composeQuantityInner(element);
30020  }
30021
30022  protected void composeDuration(String name, Duration element) throws IOException {
30023    if (element != null) {
30024      open(name);
30025      composeDurationInner(element);
30026      close();
30027    }
30028  }
30029
30030  protected void composeDurationInner(Duration element) throws IOException {
30031      composeQuantityInner(element);
30032  }
30033
30034  protected void composeProductShelfLife(String name, ProductShelfLife element) throws IOException {
30035    if (element != null) {
30036      open(name);
30037      composeProductShelfLifeInner(element);
30038      close();
30039    }
30040  }
30041
30042  protected void composeProductShelfLifeInner(ProductShelfLife element) throws IOException {
30043      composeBackbone(element);
30044      if (element.hasIdentifier()) {
30045        composeIdentifier("identifier", element.getIdentifier());
30046      }
30047      if (element.hasType()) {
30048        composeCodeableConcept("type", element.getType());
30049      }
30050      if (element.hasPeriod()) {
30051        composeQuantity("period", element.getPeriod());
30052      }
30053      if (element.hasSpecialPrecautionsForStorage()) {
30054        openArray("specialPrecautionsForStorage");
30055        for (CodeableConcept e : element.getSpecialPrecautionsForStorage()) 
30056          composeCodeableConcept(null, e);
30057        closeArray();
30058      };
30059  }
30060
30061  protected void composeTiming(String name, Timing element) throws IOException {
30062    if (element != null) {
30063      open(name);
30064      composeTimingInner(element);
30065      close();
30066    }
30067  }
30068
30069  protected void composeTimingInner(Timing element) throws IOException {
30070      composeBackbone(element);
30071      if (element.hasEvent()) {
30072        openArray("event");
30073        for (DateTimeType e : element.getEvent()) 
30074          composeDateTimeCore(null, e, true);
30075        closeArray();
30076        if (anyHasExtras(element.getEvent())) {
30077          openArray("_event");
30078          for (DateTimeType e : element.getEvent()) 
30079            composeDateTimeExtras(null, e, true);
30080          closeArray();
30081        }
30082      };
30083      if (element.hasRepeat()) {
30084        composeTimingTimingRepeatComponent("repeat", element.getRepeat());
30085      }
30086      if (element.hasCode()) {
30087        composeCodeableConcept("code", element.getCode());
30088      }
30089  }
30090
30091  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
30092    if (element != null) {
30093      open(name);
30094      composeTimingTimingRepeatComponentInner(element);
30095      close();
30096    }
30097  }
30098
30099  protected void composeTimingTimingRepeatComponentInner(Timing.TimingRepeatComponent element) throws IOException {
30100      composeElement(element);
30101      if (element.hasBounds()) {
30102        composeType("bounds", element.getBounds());
30103      }
30104      if (element.hasCountElement()) {
30105        composePositiveIntCore("count", element.getCountElement(), false);
30106        composePositiveIntExtras("count", element.getCountElement(), false);
30107      }
30108      if (element.hasCountMaxElement()) {
30109        composePositiveIntCore("countMax", element.getCountMaxElement(), false);
30110        composePositiveIntExtras("countMax", element.getCountMaxElement(), false);
30111      }
30112      if (element.hasDurationElement()) {
30113        composeDecimalCore("duration", element.getDurationElement(), false);
30114        composeDecimalExtras("duration", element.getDurationElement(), false);
30115      }
30116      if (element.hasDurationMaxElement()) {
30117        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
30118        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
30119      }
30120      if (element.hasDurationUnitElement()) {
30121        composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
30122        composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
30123      }
30124      if (element.hasFrequencyElement()) {
30125        composePositiveIntCore("frequency", element.getFrequencyElement(), false);
30126        composePositiveIntExtras("frequency", element.getFrequencyElement(), false);
30127      }
30128      if (element.hasFrequencyMaxElement()) {
30129        composePositiveIntCore("frequencyMax", element.getFrequencyMaxElement(), false);
30130        composePositiveIntExtras("frequencyMax", element.getFrequencyMaxElement(), false);
30131      }
30132      if (element.hasPeriodElement()) {
30133        composeDecimalCore("period", element.getPeriodElement(), false);
30134        composeDecimalExtras("period", element.getPeriodElement(), false);
30135      }
30136      if (element.hasPeriodMaxElement()) {
30137        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
30138        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
30139      }
30140      if (element.hasPeriodUnitElement()) {
30141        composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
30142        composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
30143      }
30144      if (element.hasDayOfWeek()) {
30145        openArray("dayOfWeek");
30146        for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
30147          composeEnumerationCore(null, e, new Timing.DayOfWeekEnumFactory(), true);
30148        closeArray();
30149        if (anyHasExtras(element.getDayOfWeek())) {
30150          openArray("_dayOfWeek");
30151          for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
30152            composeEnumerationExtras(null, e, new Timing.DayOfWeekEnumFactory(), true);
30153          closeArray();
30154        }
30155      };
30156      if (element.hasTimeOfDay()) {
30157        openArray("timeOfDay");
30158        for (TimeType e : element.getTimeOfDay()) 
30159          composeTimeCore(null, e, true);
30160        closeArray();
30161        if (anyHasExtras(element.getTimeOfDay())) {
30162          openArray("_timeOfDay");
30163          for (TimeType e : element.getTimeOfDay()) 
30164            composeTimeExtras(null, e, true);
30165          closeArray();
30166        }
30167      };
30168      if (element.hasWhen()) {
30169        openArray("when");
30170        for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
30171          composeEnumerationCore(null, e, new Timing.EventTimingEnumFactory(), true);
30172        closeArray();
30173        if (anyHasExtras(element.getWhen())) {
30174          openArray("_when");
30175          for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
30176            composeEnumerationExtras(null, e, new Timing.EventTimingEnumFactory(), true);
30177          closeArray();
30178        }
30179      };
30180      if (element.hasOffsetElement()) {
30181        composeUnsignedIntCore("offset", element.getOffsetElement(), false);
30182        composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
30183      }
30184  }
30185
30186  protected void composeProdCharacteristic(String name, ProdCharacteristic element) throws IOException {
30187    if (element != null) {
30188      open(name);
30189      composeProdCharacteristicInner(element);
30190      close();
30191    }
30192  }
30193
30194  protected void composeProdCharacteristicInner(ProdCharacteristic element) throws IOException {
30195      composeBackbone(element);
30196      if (element.hasHeight()) {
30197        composeQuantity("height", element.getHeight());
30198      }
30199      if (element.hasWidth()) {
30200        composeQuantity("width", element.getWidth());
30201      }
30202      if (element.hasDepth()) {
30203        composeQuantity("depth", element.getDepth());
30204      }
30205      if (element.hasWeight()) {
30206        composeQuantity("weight", element.getWeight());
30207      }
30208      if (element.hasNominalVolume()) {
30209        composeQuantity("nominalVolume", element.getNominalVolume());
30210      }
30211      if (element.hasExternalDiameter()) {
30212        composeQuantity("externalDiameter", element.getExternalDiameter());
30213      }
30214      if (element.hasShapeElement()) {
30215        composeStringCore("shape", element.getShapeElement(), false);
30216        composeStringExtras("shape", element.getShapeElement(), false);
30217      }
30218      if (element.hasColor()) {
30219        openArray("color");
30220        for (StringType e : element.getColor()) 
30221          composeStringCore(null, e, true);
30222        closeArray();
30223        if (anyHasExtras(element.getColor())) {
30224          openArray("_color");
30225          for (StringType e : element.getColor()) 
30226            composeStringExtras(null, e, true);
30227          closeArray();
30228        }
30229      };
30230      if (element.hasImprint()) {
30231        openArray("imprint");
30232        for (StringType e : element.getImprint()) 
30233          composeStringCore(null, e, true);
30234        closeArray();
30235        if (anyHasExtras(element.getImprint())) {
30236          openArray("_imprint");
30237          for (StringType e : element.getImprint()) 
30238            composeStringExtras(null, e, true);
30239          closeArray();
30240        }
30241      };
30242      if (element.hasImage()) {
30243        openArray("image");
30244        for (Attachment e : element.getImage()) 
30245          composeAttachment(null, e);
30246        closeArray();
30247      };
30248      if (element.hasScoring()) {
30249        composeCodeableConcept("scoring", element.getScoring());
30250      }
30251  }
30252
30253  protected void composeMeta(String name, Meta element) throws IOException {
30254    if (element != null) {
30255      open(name);
30256      composeMetaInner(element);
30257      close();
30258    }
30259  }
30260
30261  protected void composeMetaInner(Meta element) throws IOException {
30262      composeElement(element);
30263      if (element.hasVersionIdElement()) {
30264        composeIdCore("versionId", element.getVersionIdElement(), false);
30265        composeIdExtras("versionId", element.getVersionIdElement(), false);
30266      }
30267      if (element.hasLastUpdatedElement()) {
30268        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
30269        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
30270      }
30271      if (element.hasSourceElement()) {
30272        composeUriCore("source", element.getSourceElement(), false);
30273        composeUriExtras("source", element.getSourceElement(), false);
30274      }
30275      if (element.hasProfile()) {
30276        openArray("profile");
30277        for (CanonicalType e : element.getProfile()) 
30278          composeCanonicalCore(null, e, true);
30279        closeArray();
30280        if (anyHasExtras(element.getProfile())) {
30281          openArray("_profile");
30282          for (CanonicalType e : element.getProfile()) 
30283            composeCanonicalExtras(null, e, true);
30284          closeArray();
30285        }
30286      };
30287      if (element.hasSecurity()) {
30288        openArray("security");
30289        for (Coding e : element.getSecurity()) 
30290          composeCoding(null, e);
30291        closeArray();
30292      };
30293      if (element.hasTag()) {
30294        openArray("tag");
30295        for (Coding e : element.getTag()) 
30296          composeCoding(null, e);
30297        closeArray();
30298      };
30299  }
30300
30301  protected void composeAddress(String name, Address element) throws IOException {
30302    if (element != null) {
30303      open(name);
30304      composeAddressInner(element);
30305      close();
30306    }
30307  }
30308
30309  protected void composeAddressInner(Address element) throws IOException {
30310      composeElement(element);
30311      if (element.hasUseElement()) {
30312        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
30313        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
30314      }
30315      if (element.hasTypeElement()) {
30316        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
30317        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
30318      }
30319      if (element.hasTextElement()) {
30320        composeStringCore("text", element.getTextElement(), false);
30321        composeStringExtras("text", element.getTextElement(), false);
30322      }
30323      if (element.hasLine()) {
30324        openArray("line");
30325        for (StringType e : element.getLine()) 
30326          composeStringCore(null, e, true);
30327        closeArray();
30328        if (anyHasExtras(element.getLine())) {
30329          openArray("_line");
30330          for (StringType e : element.getLine()) 
30331            composeStringExtras(null, e, true);
30332          closeArray();
30333        }
30334      };
30335      if (element.hasCityElement()) {
30336        composeStringCore("city", element.getCityElement(), false);
30337        composeStringExtras("city", element.getCityElement(), false);
30338      }
30339      if (element.hasDistrictElement()) {
30340        composeStringCore("district", element.getDistrictElement(), false);
30341        composeStringExtras("district", element.getDistrictElement(), false);
30342      }
30343      if (element.hasStateElement()) {
30344        composeStringCore("state", element.getStateElement(), false);
30345        composeStringExtras("state", element.getStateElement(), false);
30346      }
30347      if (element.hasPostalCodeElement()) {
30348        composeStringCore("postalCode", element.getPostalCodeElement(), false);
30349        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
30350      }
30351      if (element.hasCountryElement()) {
30352        composeStringCore("country", element.getCountryElement(), false);
30353        composeStringExtras("country", element.getCountryElement(), false);
30354      }
30355      if (element.hasPeriod()) {
30356        composePeriod("period", element.getPeriod());
30357      }
30358  }
30359
30360  protected void composeContributor(String name, Contributor element) throws IOException {
30361    if (element != null) {
30362      open(name);
30363      composeContributorInner(element);
30364      close();
30365    }
30366  }
30367
30368  protected void composeContributorInner(Contributor element) throws IOException {
30369      composeElement(element);
30370      if (element.hasTypeElement()) {
30371        composeEnumerationCore("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
30372        composeEnumerationExtras("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
30373      }
30374      if (element.hasNameElement()) {
30375        composeStringCore("name", element.getNameElement(), false);
30376        composeStringExtras("name", element.getNameElement(), false);
30377      }
30378      if (element.hasContact()) {
30379        openArray("contact");
30380        for (ContactDetail e : element.getContact()) 
30381          composeContactDetail(null, e);
30382        closeArray();
30383      };
30384  }
30385
30386  protected void composeAttachment(String name, Attachment element) throws IOException {
30387    if (element != null) {
30388      open(name);
30389      composeAttachmentInner(element);
30390      close();
30391    }
30392  }
30393
30394  protected void composeAttachmentInner(Attachment element) throws IOException {
30395      composeElement(element);
30396      if (element.hasContentTypeElement()) {
30397        composeCodeCore("contentType", element.getContentTypeElement(), false);
30398        composeCodeExtras("contentType", element.getContentTypeElement(), false);
30399      }
30400      if (element.hasLanguageElement()) {
30401        composeCodeCore("language", element.getLanguageElement(), false);
30402        composeCodeExtras("language", element.getLanguageElement(), false);
30403      }
30404      if (element.hasDataElement()) {
30405        composeBase64BinaryCore("data", element.getDataElement(), false);
30406        composeBase64BinaryExtras("data", element.getDataElement(), false);
30407      }
30408      if (element.hasUrlElement()) {
30409        composeUrlCore("url", element.getUrlElement(), false);
30410        composeUrlExtras("url", element.getUrlElement(), false);
30411      }
30412      if (element.hasSizeElement()) {
30413        composeUnsignedIntCore("size", element.getSizeElement(), false);
30414        composeUnsignedIntExtras("size", element.getSizeElement(), false);
30415      }
30416      if (element.hasHashElement()) {
30417        composeBase64BinaryCore("hash", element.getHashElement(), false);
30418        composeBase64BinaryExtras("hash", element.getHashElement(), false);
30419      }
30420      if (element.hasTitleElement()) {
30421        composeStringCore("title", element.getTitleElement(), false);
30422        composeStringExtras("title", element.getTitleElement(), false);
30423      }
30424      if (element.hasCreationElement()) {
30425        composeDateTimeCore("creation", element.getCreationElement(), false);
30426        composeDateTimeExtras("creation", element.getCreationElement(), false);
30427      }
30428      if (element.hasHeightElement()) {
30429        composePositiveIntCore("height", element.getHeightElement(), false);
30430        composePositiveIntExtras("height", element.getHeightElement(), false);
30431      }
30432      if (element.hasWidthElement()) {
30433        composePositiveIntCore("width", element.getWidthElement(), false);
30434        composePositiveIntExtras("width", element.getWidthElement(), false);
30435      }
30436      if (element.hasFramesElement()) {
30437        composePositiveIntCore("frames", element.getFramesElement(), false);
30438        composePositiveIntExtras("frames", element.getFramesElement(), false);
30439      }
30440      if (element.hasDurationElement()) {
30441        composeDecimalCore("duration", element.getDurationElement(), false);
30442        composeDecimalExtras("duration", element.getDurationElement(), false);
30443      }
30444      if (element.hasPagesElement()) {
30445        composePositiveIntCore("pages", element.getPagesElement(), false);
30446        composePositiveIntExtras("pages", element.getPagesElement(), false);
30447      }
30448  }
30449
30450  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
30451    if (element != null) {
30452      open(name);
30453      composeDataRequirementInner(element);
30454      close();
30455    }
30456  }
30457
30458  protected void composeDataRequirementInner(DataRequirement element) throws IOException {
30459      composeElement(element);
30460      if (element.hasTypeElement()) {
30461        composeCodeCore("type", element.getTypeElement(), false);
30462        composeCodeExtras("type", element.getTypeElement(), false);
30463      }
30464      if (element.hasProfile()) {
30465        openArray("profile");
30466        for (CanonicalType e : element.getProfile()) 
30467          composeCanonicalCore(null, e, true);
30468        closeArray();
30469        if (anyHasExtras(element.getProfile())) {
30470          openArray("_profile");
30471          for (CanonicalType e : element.getProfile()) 
30472            composeCanonicalExtras(null, e, true);
30473          closeArray();
30474        }
30475      };
30476      if (element.hasSubject()) {
30477        composeType("subject", element.getSubject());
30478      }
30479      if (element.hasMustSupport()) {
30480        openArray("mustSupport");
30481        for (StringType e : element.getMustSupport()) 
30482          composeStringCore(null, e, true);
30483        closeArray();
30484        if (anyHasExtras(element.getMustSupport())) {
30485          openArray("_mustSupport");
30486          for (StringType e : element.getMustSupport()) 
30487            composeStringExtras(null, e, true);
30488          closeArray();
30489        }
30490      };
30491      if (element.hasCodeFilter()) {
30492        openArray("codeFilter");
30493        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
30494          composeDataRequirementDataRequirementCodeFilterComponent(null, e);
30495        closeArray();
30496      };
30497      if (element.hasDateFilter()) {
30498        openArray("dateFilter");
30499        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
30500          composeDataRequirementDataRequirementDateFilterComponent(null, e);
30501        closeArray();
30502      };
30503      if (element.hasLimitElement()) {
30504        composePositiveIntCore("limit", element.getLimitElement(), false);
30505        composePositiveIntExtras("limit", element.getLimitElement(), false);
30506      }
30507      if (element.hasSort()) {
30508        openArray("sort");
30509        for (DataRequirement.DataRequirementSortComponent e : element.getSort()) 
30510          composeDataRequirementDataRequirementSortComponent(null, e);
30511        closeArray();
30512      };
30513  }
30514
30515  protected void composeDataRequirementDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
30516    if (element != null) {
30517      open(name);
30518      composeDataRequirementDataRequirementCodeFilterComponentInner(element);
30519      close();
30520    }
30521  }
30522
30523  protected void composeDataRequirementDataRequirementCodeFilterComponentInner(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
30524      composeElement(element);
30525      if (element.hasPathElement()) {
30526        composeStringCore("path", element.getPathElement(), false);
30527        composeStringExtras("path", element.getPathElement(), false);
30528      }
30529      if (element.hasSearchParamElement()) {
30530        composeStringCore("searchParam", element.getSearchParamElement(), false);
30531        composeStringExtras("searchParam", element.getSearchParamElement(), false);
30532      }
30533      if (element.hasValueSetElement()) {
30534        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
30535        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
30536      }
30537      if (element.hasCode()) {
30538        openArray("code");
30539        for (Coding e : element.getCode()) 
30540          composeCoding(null, e);
30541        closeArray();
30542      };
30543  }
30544
30545  protected void composeDataRequirementDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
30546    if (element != null) {
30547      open(name);
30548      composeDataRequirementDataRequirementDateFilterComponentInner(element);
30549      close();
30550    }
30551  }
30552
30553  protected void composeDataRequirementDataRequirementDateFilterComponentInner(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
30554      composeElement(element);
30555      if (element.hasPathElement()) {
30556        composeStringCore("path", element.getPathElement(), false);
30557        composeStringExtras("path", element.getPathElement(), false);
30558      }
30559      if (element.hasSearchParamElement()) {
30560        composeStringCore("searchParam", element.getSearchParamElement(), false);
30561        composeStringExtras("searchParam", element.getSearchParamElement(), false);
30562      }
30563      if (element.hasValue()) {
30564        composeType("value", element.getValue());
30565      }
30566  }
30567
30568  protected void composeDataRequirementDataRequirementSortComponent(String name, DataRequirement.DataRequirementSortComponent element) throws IOException {
30569    if (element != null) {
30570      open(name);
30571      composeDataRequirementDataRequirementSortComponentInner(element);
30572      close();
30573    }
30574  }
30575
30576  protected void composeDataRequirementDataRequirementSortComponentInner(DataRequirement.DataRequirementSortComponent element) throws IOException {
30577      composeElement(element);
30578      if (element.hasPathElement()) {
30579        composeStringCore("path", element.getPathElement(), false);
30580        composeStringExtras("path", element.getPathElement(), false);
30581      }
30582      if (element.hasDirectionElement()) {
30583        composeEnumerationCore("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
30584        composeEnumerationExtras("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
30585      }
30586  }
30587
30588  protected void composeMoney(String name, Money element) throws IOException {
30589    if (element != null) {
30590      open(name);
30591      composeMoneyInner(element);
30592      close();
30593    }
30594  }
30595
30596  protected void composeMoneyInner(Money element) throws IOException {
30597      composeElement(element);
30598      if (element.hasValueElement()) {
30599        composeDecimalCore("value", element.getValueElement(), false);
30600        composeDecimalExtras("value", element.getValueElement(), false);
30601      }
30602      if (element.hasCurrencyElement()) {
30603        composeCodeCore("currency", element.getCurrencyElement(), false);
30604        composeCodeExtras("currency", element.getCurrencyElement(), false);
30605      }
30606  }
30607
30608  protected void composeHumanName(String name, HumanName element) throws IOException {
30609    if (element != null) {
30610      open(name);
30611      composeHumanNameInner(element);
30612      close();
30613    }
30614  }
30615
30616  protected void composeHumanNameInner(HumanName element) throws IOException {
30617      composeElement(element);
30618      if (element.hasUseElement()) {
30619        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
30620        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
30621      }
30622      if (element.hasTextElement()) {
30623        composeStringCore("text", element.getTextElement(), false);
30624        composeStringExtras("text", element.getTextElement(), false);
30625      }
30626      if (element.hasFamilyElement()) {
30627        composeStringCore("family", element.getFamilyElement(), false);
30628        composeStringExtras("family", element.getFamilyElement(), false);
30629      }
30630      if (element.hasGiven()) {
30631        openArray("given");
30632        for (StringType e : element.getGiven()) 
30633          composeStringCore(null, e, true);
30634        closeArray();
30635        if (anyHasExtras(element.getGiven())) {
30636          openArray("_given");
30637          for (StringType e : element.getGiven()) 
30638            composeStringExtras(null, e, true);
30639          closeArray();
30640        }
30641      };
30642      if (element.hasPrefix()) {
30643        openArray("prefix");
30644        for (StringType e : element.getPrefix()) 
30645          composeStringCore(null, e, true);
30646        closeArray();
30647        if (anyHasExtras(element.getPrefix())) {
30648          openArray("_prefix");
30649          for (StringType e : element.getPrefix()) 
30650            composeStringExtras(null, e, true);
30651          closeArray();
30652        }
30653      };
30654      if (element.hasSuffix()) {
30655        openArray("suffix");
30656        for (StringType e : element.getSuffix()) 
30657          composeStringCore(null, e, true);
30658        closeArray();
30659        if (anyHasExtras(element.getSuffix())) {
30660          openArray("_suffix");
30661          for (StringType e : element.getSuffix()) 
30662            composeStringExtras(null, e, true);
30663          closeArray();
30664        }
30665      };
30666      if (element.hasPeriod()) {
30667        composePeriod("period", element.getPeriod());
30668      }
30669  }
30670
30671  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
30672    if (element != null) {
30673      open(name);
30674      composeContactPointInner(element);
30675      close();
30676    }
30677  }
30678
30679  protected void composeContactPointInner(ContactPoint element) throws IOException {
30680      composeElement(element);
30681      if (element.hasSystemElement()) {
30682        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
30683        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
30684      }
30685      if (element.hasValueElement()) {
30686        composeStringCore("value", element.getValueElement(), false);
30687        composeStringExtras("value", element.getValueElement(), false);
30688      }
30689      if (element.hasUseElement()) {
30690        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
30691        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
30692      }
30693      if (element.hasRankElement()) {
30694        composePositiveIntCore("rank", element.getRankElement(), false);
30695        composePositiveIntExtras("rank", element.getRankElement(), false);
30696      }
30697      if (element.hasPeriod()) {
30698        composePeriod("period", element.getPeriod());
30699      }
30700  }
30701
30702  protected void composeIdentifier(String name, Identifier element) throws IOException {
30703    if (element != null) {
30704      open(name);
30705      composeIdentifierInner(element);
30706      close();
30707    }
30708  }
30709
30710  protected void composeIdentifierInner(Identifier element) throws IOException {
30711      composeElement(element);
30712      if (element.hasUseElement()) {
30713        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
30714        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
30715      }
30716      if (element.hasType()) {
30717        composeCodeableConcept("type", element.getType());
30718      }
30719      if (element.hasSystemElement()) {
30720        composeUriCore("system", element.getSystemElement(), false);
30721        composeUriExtras("system", element.getSystemElement(), false);
30722      }
30723      if (element.hasValueElement()) {
30724        composeStringCore("value", element.getValueElement(), false);
30725        composeStringExtras("value", element.getValueElement(), false);
30726      }
30727      if (element.hasPeriod()) {
30728        composePeriod("period", element.getPeriod());
30729      }
30730      if (element.hasAssigner()) {
30731        composeReference("assigner", element.getAssigner());
30732      }
30733  }
30734
30735  protected void composeCoding(String name, Coding element) throws IOException {
30736    if (element != null) {
30737      open(name);
30738      composeCodingInner(element);
30739      close();
30740    }
30741  }
30742
30743  protected void composeCodingInner(Coding element) throws IOException {
30744      composeElement(element);
30745      if (element.hasSystemElement()) {
30746        composeUriCore("system", element.getSystemElement(), false);
30747        composeUriExtras("system", element.getSystemElement(), false);
30748      }
30749      if (element.hasVersionElement()) {
30750        composeStringCore("version", element.getVersionElement(), false);
30751        composeStringExtras("version", element.getVersionElement(), false);
30752      }
30753      if (element.hasCodeElement()) {
30754        composeCodeCore("code", element.getCodeElement(), false);
30755        composeCodeExtras("code", element.getCodeElement(), false);
30756      }
30757      if (element.hasDisplayElement()) {
30758        composeStringCore("display", element.getDisplayElement(), false);
30759        composeStringExtras("display", element.getDisplayElement(), false);
30760      }
30761      if (element.hasUserSelectedElement()) {
30762        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
30763        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
30764      }
30765  }
30766
30767  protected void composeSampledData(String name, SampledData element) throws IOException {
30768    if (element != null) {
30769      open(name);
30770      composeSampledDataInner(element);
30771      close();
30772    }
30773  }
30774
30775  protected void composeSampledDataInner(SampledData element) throws IOException {
30776      composeElement(element);
30777      if (element.hasOrigin()) {
30778        composeQuantity("origin", element.getOrigin());
30779      }
30780      if (element.hasPeriodElement()) {
30781        composeDecimalCore("period", element.getPeriodElement(), false);
30782        composeDecimalExtras("period", element.getPeriodElement(), false);
30783      }
30784      if (element.hasFactorElement()) {
30785        composeDecimalCore("factor", element.getFactorElement(), false);
30786        composeDecimalExtras("factor", element.getFactorElement(), false);
30787      }
30788      if (element.hasLowerLimitElement()) {
30789        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
30790        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
30791      }
30792      if (element.hasUpperLimitElement()) {
30793        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
30794        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
30795      }
30796      if (element.hasDimensionsElement()) {
30797        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
30798        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
30799      }
30800      if (element.hasDataElement()) {
30801        composeStringCore("data", element.getDataElement(), false);
30802        composeStringExtras("data", element.getDataElement(), false);
30803      }
30804  }
30805
30806  protected void composeRatio(String name, Ratio element) throws IOException {
30807    if (element != null) {
30808      open(name);
30809      composeRatioInner(element);
30810      close();
30811    }
30812  }
30813
30814  protected void composeRatioInner(Ratio element) throws IOException {
30815      composeElement(element);
30816      if (element.hasNumerator()) {
30817        composeQuantity("numerator", element.getNumerator());
30818      }
30819      if (element.hasDenominator()) {
30820        composeQuantity("denominator", element.getDenominator());
30821      }
30822  }
30823
30824  protected void composeReference(String name, Reference element) throws IOException {
30825    if (element != null) {
30826      open(name);
30827      composeReferenceInner(element);
30828      close();
30829    }
30830  }
30831
30832  protected void composeReferenceInner(Reference element) throws IOException {
30833      composeElement(element);
30834      if (element.hasReferenceElement()) {
30835        composeStringCore("reference", element.getReferenceElement(), false);
30836        composeStringExtras("reference", element.getReferenceElement(), false);
30837      }
30838      if (element.hasTypeElement()) {
30839        composeUriCore("type", element.getTypeElement(), false);
30840        composeUriExtras("type", element.getTypeElement(), false);
30841      }
30842      if (element.hasIdentifier()) {
30843        composeIdentifier("identifier", element.getIdentifier());
30844      }
30845      if (element.hasDisplayElement()) {
30846        composeStringCore("display", element.getDisplayElement(), false);
30847        composeStringExtras("display", element.getDisplayElement(), false);
30848      }
30849  }
30850
30851  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
30852    if (element != null) {
30853      open(name);
30854      composeTriggerDefinitionInner(element);
30855      close();
30856    }
30857  }
30858
30859  protected void composeTriggerDefinitionInner(TriggerDefinition element) throws IOException {
30860      composeElement(element);
30861      if (element.hasTypeElement()) {
30862        composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
30863        composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
30864      }
30865      if (element.hasNameElement()) {
30866        composeStringCore("name", element.getNameElement(), false);
30867        composeStringExtras("name", element.getNameElement(), false);
30868      }
30869      if (element.hasTiming()) {
30870        composeType("timing", element.getTiming());
30871      }
30872      if (element.hasData()) {
30873        openArray("data");
30874        for (DataRequirement e : element.getData()) 
30875          composeDataRequirement(null, e);
30876        closeArray();
30877      };
30878      if (element.hasCondition()) {
30879        composeExpression("condition", element.getCondition());
30880      }
30881  }
30882
30883  protected void composeQuantity(String name, Quantity element) throws IOException {
30884    if (element != null) {
30885      open(name);
30886      composeQuantityInner(element);
30887      close();
30888    }
30889  }
30890
30891  protected void composeQuantityInner(Quantity element) throws IOException {
30892      composeElement(element);
30893      if (element.hasValueElement()) {
30894        composeDecimalCore("value", element.getValueElement(), false);
30895        composeDecimalExtras("value", element.getValueElement(), false);
30896      }
30897      if (element.hasComparatorElement()) {
30898        composeEnumerationCore("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
30899        composeEnumerationExtras("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
30900      }
30901      if (element.hasUnitElement()) {
30902        composeStringCore("unit", element.getUnitElement(), false);
30903        composeStringExtras("unit", element.getUnitElement(), false);
30904      }
30905      if (element.hasSystemElement()) {
30906        composeUriCore("system", element.getSystemElement(), false);
30907        composeUriExtras("system", element.getSystemElement(), false);
30908      }
30909      if (element.hasCodeElement()) {
30910        composeCodeCore("code", element.getCodeElement(), false);
30911        composeCodeExtras("code", element.getCodeElement(), false);
30912      }
30913  }
30914
30915  protected void composePeriod(String name, Period element) throws IOException {
30916    if (element != null) {
30917      open(name);
30918      composePeriodInner(element);
30919      close();
30920    }
30921  }
30922
30923  protected void composePeriodInner(Period element) throws IOException {
30924      composeElement(element);
30925      if (element.hasStartElement()) {
30926        composeDateTimeCore("start", element.getStartElement(), false);
30927        composeDateTimeExtras("start", element.getStartElement(), false);
30928      }
30929      if (element.hasEndElement()) {
30930        composeDateTimeCore("end", element.getEndElement(), false);
30931        composeDateTimeExtras("end", element.getEndElement(), false);
30932      }
30933  }
30934
30935  protected void composeRange(String name, Range element) throws IOException {
30936    if (element != null) {
30937      open(name);
30938      composeRangeInner(element);
30939      close();
30940    }
30941  }
30942
30943  protected void composeRangeInner(Range element) throws IOException {
30944      composeElement(element);
30945      if (element.hasLow()) {
30946        composeQuantity("low", element.getLow());
30947      }
30948      if (element.hasHigh()) {
30949        composeQuantity("high", element.getHigh());
30950      }
30951  }
30952
30953  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
30954    if (element != null) {
30955      open(name);
30956      composeRelatedArtifactInner(element);
30957      close();
30958    }
30959  }
30960
30961  protected void composeRelatedArtifactInner(RelatedArtifact element) throws IOException {
30962      composeElement(element);
30963      if (element.hasTypeElement()) {
30964        composeEnumerationCore("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
30965        composeEnumerationExtras("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
30966      }
30967      if (element.hasLabelElement()) {
30968        composeStringCore("label", element.getLabelElement(), false);
30969        composeStringExtras("label", element.getLabelElement(), false);
30970      }
30971      if (element.hasDisplayElement()) {
30972        composeStringCore("display", element.getDisplayElement(), false);
30973        composeStringExtras("display", element.getDisplayElement(), false);
30974      }
30975      if (element.hasCitationElement()) {
30976        composeMarkdownCore("citation", element.getCitationElement(), false);
30977        composeMarkdownExtras("citation", element.getCitationElement(), false);
30978      }
30979      if (element.hasUrlElement()) {
30980        composeUrlCore("url", element.getUrlElement(), false);
30981        composeUrlExtras("url", element.getUrlElement(), false);
30982      }
30983      if (element.hasDocument()) {
30984        composeAttachment("document", element.getDocument());
30985      }
30986      if (element.hasResourceElement()) {
30987        composeCanonicalCore("resource", element.getResourceElement(), false);
30988        composeCanonicalExtras("resource", element.getResourceElement(), false);
30989      }
30990  }
30991
30992  protected void composeAnnotation(String name, Annotation element) throws IOException {
30993    if (element != null) {
30994      open(name);
30995      composeAnnotationInner(element);
30996      close();
30997    }
30998  }
30999
31000  protected void composeAnnotationInner(Annotation element) throws IOException {
31001      composeElement(element);
31002      if (element.hasAuthor()) {
31003        composeType("author", element.getAuthor());
31004      }
31005      if (element.hasTimeElement()) {
31006        composeDateTimeCore("time", element.getTimeElement(), false);
31007        composeDateTimeExtras("time", element.getTimeElement(), false);
31008      }
31009      if (element.hasTextElement()) {
31010        composeMarkdownCore("text", element.getTextElement(), false);
31011        composeMarkdownExtras("text", element.getTextElement(), false);
31012      }
31013  }
31014
31015  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
31016    if (element != null) {
31017      open(name);
31018      composeContactDetailInner(element);
31019      close();
31020    }
31021  }
31022
31023  protected void composeContactDetailInner(ContactDetail element) throws IOException {
31024      composeElement(element);
31025      if (element.hasNameElement()) {
31026        composeStringCore("name", element.getNameElement(), false);
31027        composeStringExtras("name", element.getNameElement(), false);
31028      }
31029      if (element.hasTelecom()) {
31030        openArray("telecom");
31031        for (ContactPoint e : element.getTelecom()) 
31032          composeContactPoint(null, e);
31033        closeArray();
31034      };
31035  }
31036
31037  protected void composeUsageContext(String name, UsageContext element) throws IOException {
31038    if (element != null) {
31039      open(name);
31040      composeUsageContextInner(element);
31041      close();
31042    }
31043  }
31044
31045  protected void composeUsageContextInner(UsageContext element) throws IOException {
31046      composeElement(element);
31047      if (element.hasCode()) {
31048        composeCoding("code", element.getCode());
31049      }
31050      if (element.hasValue()) {
31051        composeType("value", element.getValue());
31052      }
31053  }
31054
31055  protected void composeExpression(String name, Expression element) throws IOException {
31056    if (element != null) {
31057      open(name);
31058      composeExpressionInner(element);
31059      close();
31060    }
31061  }
31062
31063  protected void composeExpressionInner(Expression element) throws IOException {
31064      composeElement(element);
31065      if (element.hasDescriptionElement()) {
31066        composeStringCore("description", element.getDescriptionElement(), false);
31067        composeStringExtras("description", element.getDescriptionElement(), false);
31068      }
31069      if (element.hasNameElement()) {
31070        composeIdCore("name", element.getNameElement(), false);
31071        composeIdExtras("name", element.getNameElement(), false);
31072      }
31073      if (element.hasLanguageElement()) {
31074        composeCodeCore("language", element.getLanguageElement(), false);
31075        composeCodeExtras("language", element.getLanguageElement(), false);
31076      }
31077      if (element.hasExpressionElement()) {
31078        composeStringCore("expression", element.getExpressionElement(), false);
31079        composeStringExtras("expression", element.getExpressionElement(), false);
31080      }
31081      if (element.hasReferenceElement()) {
31082        composeUriCore("reference", element.getReferenceElement(), false);
31083        composeUriExtras("reference", element.getReferenceElement(), false);
31084      }
31085  }
31086
31087  protected void composeSignature(String name, Signature element) throws IOException {
31088    if (element != null) {
31089      open(name);
31090      composeSignatureInner(element);
31091      close();
31092    }
31093  }
31094
31095  protected void composeSignatureInner(Signature element) throws IOException {
31096      composeElement(element);
31097      if (element.hasType()) {
31098        openArray("type");
31099        for (Coding e : element.getType()) 
31100          composeCoding(null, e);
31101        closeArray();
31102      };
31103      if (element.hasWhenElement()) {
31104        composeInstantCore("when", element.getWhenElement(), false);
31105        composeInstantExtras("when", element.getWhenElement(), false);
31106      }
31107      if (element.hasWho()) {
31108        composeReference("who", element.getWho());
31109      }
31110      if (element.hasOnBehalfOf()) {
31111        composeReference("onBehalfOf", element.getOnBehalfOf());
31112      }
31113      if (element.hasTargetFormatElement()) {
31114        composeCodeCore("targetFormat", element.getTargetFormatElement(), false);
31115        composeCodeExtras("targetFormat", element.getTargetFormatElement(), false);
31116      }
31117      if (element.hasSigFormatElement()) {
31118        composeCodeCore("sigFormat", element.getSigFormatElement(), false);
31119        composeCodeExtras("sigFormat", element.getSigFormatElement(), false);
31120      }
31121      if (element.hasDataElement()) {
31122        composeBase64BinaryCore("data", element.getDataElement(), false);
31123        composeBase64BinaryExtras("data", element.getDataElement(), false);
31124      }
31125  }
31126
31127  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
31128    if (element != null) {
31129      open(name);
31130      composeCodeableConceptInner(element);
31131      close();
31132    }
31133  }
31134
31135  protected void composeCodeableConceptInner(CodeableConcept element) throws IOException {
31136      composeElement(element);
31137      if (element.hasCoding()) {
31138        openArray("coding");
31139        for (Coding e : element.getCoding()) 
31140          composeCoding(null, e);
31141        closeArray();
31142      };
31143      if (element.hasTextElement()) {
31144        composeStringCore("text", element.getTextElement(), false);
31145        composeStringExtras("text", element.getTextElement(), false);
31146      }
31147  }
31148
31149  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
31150    if (element != null) {
31151      open(name);
31152      composeParameterDefinitionInner(element);
31153      close();
31154    }
31155  }
31156
31157  protected void composeParameterDefinitionInner(ParameterDefinition element) throws IOException {
31158      composeElement(element);
31159      if (element.hasNameElement()) {
31160        composeCodeCore("name", element.getNameElement(), false);
31161        composeCodeExtras("name", element.getNameElement(), false);
31162      }
31163      if (element.hasUseElement()) {
31164        composeEnumerationCore("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
31165        composeEnumerationExtras("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
31166      }
31167      if (element.hasMinElement()) {
31168        composeIntegerCore("min", element.getMinElement(), false);
31169        composeIntegerExtras("min", element.getMinElement(), false);
31170      }
31171      if (element.hasMaxElement()) {
31172        composeStringCore("max", element.getMaxElement(), false);
31173        composeStringExtras("max", element.getMaxElement(), false);
31174      }
31175      if (element.hasDocumentationElement()) {
31176        composeStringCore("documentation", element.getDocumentationElement(), false);
31177        composeStringExtras("documentation", element.getDocumentationElement(), false);
31178      }
31179      if (element.hasTypeElement()) {
31180        composeCodeCore("type", element.getTypeElement(), false);
31181        composeCodeExtras("type", element.getTypeElement(), false);
31182      }
31183      if (element.hasProfileElement()) {
31184        composeCanonicalCore("profile", element.getProfileElement(), false);
31185        composeCanonicalExtras("profile", element.getProfileElement(), false);
31186      }
31187  }
31188
31189  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
31190    if (element != null) {
31191      open(name);
31192      composeElementDefinitionInner(element);
31193      close();
31194    }
31195  }
31196
31197  protected void composeElementDefinitionInner(ElementDefinition element) throws IOException {
31198      composeBackbone(element);
31199      if (element.hasPathElement()) {
31200        composeStringCore("path", element.getPathElement(), false);
31201        composeStringExtras("path", element.getPathElement(), false);
31202      }
31203      if (element.hasRepresentation()) {
31204        openArray("representation");
31205        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
31206          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
31207        closeArray();
31208        if (anyHasExtras(element.getRepresentation())) {
31209          openArray("_representation");
31210          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
31211            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
31212          closeArray();
31213        }
31214      };
31215      if (element.hasSliceNameElement()) {
31216        composeStringCore("sliceName", element.getSliceNameElement(), false);
31217        composeStringExtras("sliceName", element.getSliceNameElement(), false);
31218      }
31219      if (element.hasSliceIsConstrainingElement()) {
31220        composeBooleanCore("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
31221        composeBooleanExtras("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
31222      }
31223      if (element.hasLabelElement()) {
31224        composeStringCore("label", element.getLabelElement(), false);
31225        composeStringExtras("label", element.getLabelElement(), false);
31226      }
31227      if (element.hasCode()) {
31228        openArray("code");
31229        for (Coding e : element.getCode()) 
31230          composeCoding(null, e);
31231        closeArray();
31232      };
31233      if (element.hasSlicing()) {
31234        composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
31235      }
31236      if (element.hasShortElement()) {
31237        composeStringCore("short", element.getShortElement(), false);
31238        composeStringExtras("short", element.getShortElement(), false);
31239      }
31240      if (element.hasDefinitionElement()) {
31241        composeMarkdownCore("definition", element.getDefinitionElement(), false);
31242        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
31243      }
31244      if (element.hasCommentElement()) {
31245        composeMarkdownCore("comment", element.getCommentElement(), false);
31246        composeMarkdownExtras("comment", element.getCommentElement(), false);
31247      }
31248      if (element.hasRequirementsElement()) {
31249        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
31250        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
31251      }
31252      if (element.hasAlias()) {
31253        openArray("alias");
31254        for (StringType e : element.getAlias()) 
31255          composeStringCore(null, e, true);
31256        closeArray();
31257        if (anyHasExtras(element.getAlias())) {
31258          openArray("_alias");
31259          for (StringType e : element.getAlias()) 
31260            composeStringExtras(null, e, true);
31261          closeArray();
31262        }
31263      };
31264      if (element.hasMinElement()) {
31265        composeUnsignedIntCore("min", element.getMinElement(), false);
31266        composeUnsignedIntExtras("min", element.getMinElement(), false);
31267      }
31268      if (element.hasMaxElement()) {
31269        composeStringCore("max", element.getMaxElement(), false);
31270        composeStringExtras("max", element.getMaxElement(), false);
31271      }
31272      if (element.hasBase()) {
31273        composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
31274      }
31275      if (element.hasContentReferenceElement()) {
31276        composeUriCore("contentReference", element.getContentReferenceElement(), false);
31277        composeUriExtras("contentReference", element.getContentReferenceElement(), false);
31278      }
31279      if (element.hasType()) {
31280        openArray("type");
31281        for (ElementDefinition.TypeRefComponent e : element.getType()) 
31282          composeElementDefinitionTypeRefComponent(null, e);
31283        closeArray();
31284      };
31285      if (element.hasDefaultValue()) {
31286        composeType("defaultValue", element.getDefaultValue());
31287      }
31288      if (element.hasMeaningWhenMissingElement()) {
31289        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
31290        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
31291      }
31292      if (element.hasOrderMeaningElement()) {
31293        composeStringCore("orderMeaning", element.getOrderMeaningElement(), false);
31294        composeStringExtras("orderMeaning", element.getOrderMeaningElement(), false);
31295      }
31296      if (element.hasFixed()) {
31297        composeType("fixed", element.getFixed());
31298      }
31299      if (element.hasPattern()) {
31300        composeType("pattern", element.getPattern());
31301      }
31302      if (element.hasExample()) {
31303        openArray("example");
31304        for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample()) 
31305          composeElementDefinitionElementDefinitionExampleComponent(null, e);
31306        closeArray();
31307      };
31308      if (element.hasMinValue()) {
31309        composeType("minValue", element.getMinValue());
31310      }
31311      if (element.hasMaxValue()) {
31312        composeType("maxValue", element.getMaxValue());
31313      }
31314      if (element.hasMaxLengthElement()) {
31315        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
31316        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
31317      }
31318      if (element.hasCondition()) {
31319        openArray("condition");
31320        for (IdType e : element.getCondition()) 
31321          composeIdCore(null, e, true);
31322        closeArray();
31323        if (anyHasExtras(element.getCondition())) {
31324          openArray("_condition");
31325          for (IdType e : element.getCondition()) 
31326            composeIdExtras(null, e, true);
31327          closeArray();
31328        }
31329      };
31330      if (element.hasConstraint()) {
31331        openArray("constraint");
31332        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
31333          composeElementDefinitionElementDefinitionConstraintComponent(null, e);
31334        closeArray();
31335      };
31336      if (element.hasMustSupportElement()) {
31337        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
31338        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
31339      }
31340      if (element.hasIsModifierElement()) {
31341        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
31342        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
31343      }
31344      if (element.hasIsModifierReasonElement()) {
31345        composeStringCore("isModifierReason", element.getIsModifierReasonElement(), false);
31346        composeStringExtras("isModifierReason", element.getIsModifierReasonElement(), false);
31347      }
31348      if (element.hasIsSummaryElement()) {
31349        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
31350        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
31351      }
31352      if (element.hasBinding()) {
31353        composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
31354      }
31355      if (element.hasMapping()) {
31356        openArray("mapping");
31357        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
31358          composeElementDefinitionElementDefinitionMappingComponent(null, e);
31359        closeArray();
31360      };
31361  }
31362
31363  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
31364    if (element != null) {
31365      open(name);
31366      composeElementDefinitionElementDefinitionSlicingComponentInner(element);
31367      close();
31368    }
31369  }
31370
31371  protected void composeElementDefinitionElementDefinitionSlicingComponentInner(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
31372      composeElement(element);
31373      if (element.hasDiscriminator()) {
31374        openArray("discriminator");
31375        for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
31376          composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(null, e);
31377        closeArray();
31378      };
31379      if (element.hasDescriptionElement()) {
31380        composeStringCore("description", element.getDescriptionElement(), false);
31381        composeStringExtras("description", element.getDescriptionElement(), false);
31382      }
31383      if (element.hasOrderedElement()) {
31384        composeBooleanCore("ordered", element.getOrderedElement(), false);
31385        composeBooleanExtras("ordered", element.getOrderedElement(), false);
31386      }
31387      if (element.hasRulesElement()) {
31388        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
31389        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
31390      }
31391  }
31392
31393  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
31394    if (element != null) {
31395      open(name);
31396      composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(element);
31397      close();
31398    }
31399  }
31400
31401  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
31402      composeElement(element);
31403      if (element.hasTypeElement()) {
31404        composeEnumerationCore("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
31405        composeEnumerationExtras("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
31406      }
31407      if (element.hasPathElement()) {
31408        composeStringCore("path", element.getPathElement(), false);
31409        composeStringExtras("path", element.getPathElement(), false);
31410      }
31411  }
31412
31413  protected void composeElementDefinitionElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
31414    if (element != null) {
31415      open(name);
31416      composeElementDefinitionElementDefinitionBaseComponentInner(element);
31417      close();
31418    }
31419  }
31420
31421  protected void composeElementDefinitionElementDefinitionBaseComponentInner(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
31422      composeElement(element);
31423      if (element.hasPathElement()) {
31424        composeStringCore("path", element.getPathElement(), false);
31425        composeStringExtras("path", element.getPathElement(), false);
31426      }
31427      if (element.hasMinElement()) {
31428        composeUnsignedIntCore("min", element.getMinElement(), false);
31429        composeUnsignedIntExtras("min", element.getMinElement(), false);
31430      }
31431      if (element.hasMaxElement()) {
31432        composeStringCore("max", element.getMaxElement(), false);
31433        composeStringExtras("max", element.getMaxElement(), false);
31434      }
31435  }
31436
31437  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
31438    if (element != null) {
31439      open(name);
31440      composeElementDefinitionTypeRefComponentInner(element);
31441      close();
31442    }
31443  }
31444
31445  protected void composeElementDefinitionTypeRefComponentInner(ElementDefinition.TypeRefComponent element) throws IOException {
31446      composeElement(element);
31447      if (element.hasCodeElement()) {
31448        composeUriCore("code", element.getCodeElement(), false);
31449        composeUriExtras("code", element.getCodeElement(), false);
31450      }
31451      if (element.hasProfile()) {
31452        openArray("profile");
31453        for (CanonicalType e : element.getProfile()) 
31454          composeCanonicalCore(null, e, true);
31455        closeArray();
31456        if (anyHasExtras(element.getProfile())) {
31457          openArray("_profile");
31458          for (CanonicalType e : element.getProfile()) 
31459            composeCanonicalExtras(null, e, true);
31460          closeArray();
31461        }
31462      };
31463      if (element.hasTargetProfile()) {
31464        openArray("targetProfile");
31465        for (CanonicalType e : element.getTargetProfile()) 
31466          composeCanonicalCore(null, e, true);
31467        closeArray();
31468        if (anyHasExtras(element.getTargetProfile())) {
31469          openArray("_targetProfile");
31470          for (CanonicalType e : element.getTargetProfile()) 
31471            composeCanonicalExtras(null, e, true);
31472          closeArray();
31473        }
31474      };
31475      if (element.hasAggregation()) {
31476        openArray("aggregation");
31477        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
31478          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
31479        closeArray();
31480        if (anyHasExtras(element.getAggregation())) {
31481          openArray("_aggregation");
31482          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
31483            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
31484          closeArray();
31485        }
31486      };
31487      if (element.hasVersioningElement()) {
31488        composeEnumerationCore("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
31489        composeEnumerationExtras("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
31490      }
31491  }
31492
31493  protected void composeElementDefinitionElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
31494    if (element != null) {
31495      open(name);
31496      composeElementDefinitionElementDefinitionExampleComponentInner(element);
31497      close();
31498    }
31499  }
31500
31501  protected void composeElementDefinitionElementDefinitionExampleComponentInner(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
31502      composeElement(element);
31503      if (element.hasLabelElement()) {
31504        composeStringCore("label", element.getLabelElement(), false);
31505        composeStringExtras("label", element.getLabelElement(), false);
31506      }
31507      if (element.hasValue()) {
31508        composeType("value", element.getValue());
31509      }
31510  }
31511
31512  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
31513    if (element != null) {
31514      open(name);
31515      composeElementDefinitionElementDefinitionConstraintComponentInner(element);
31516      close();
31517    }
31518  }
31519
31520  protected void composeElementDefinitionElementDefinitionConstraintComponentInner(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
31521      composeElement(element);
31522      if (element.hasKeyElement()) {
31523        composeIdCore("key", element.getKeyElement(), false);
31524        composeIdExtras("key", element.getKeyElement(), false);
31525      }
31526      if (element.hasRequirementsElement()) {
31527        composeStringCore("requirements", element.getRequirementsElement(), false);
31528        composeStringExtras("requirements", element.getRequirementsElement(), false);
31529      }
31530      if (element.hasSeverityElement()) {
31531        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
31532        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
31533      }
31534      if (element.hasHumanElement()) {
31535        composeStringCore("human", element.getHumanElement(), false);
31536        composeStringExtras("human", element.getHumanElement(), false);
31537      }
31538      if (element.hasExpressionElement()) {
31539        composeStringCore("expression", element.getExpressionElement(), false);
31540        composeStringExtras("expression", element.getExpressionElement(), false);
31541      }
31542      if (element.hasXpathElement()) {
31543        composeStringCore("xpath", element.getXpathElement(), false);
31544        composeStringExtras("xpath", element.getXpathElement(), false);
31545      }
31546      if (element.hasSourceElement()) {
31547        composeCanonicalCore("source", element.getSourceElement(), false);
31548        composeCanonicalExtras("source", element.getSourceElement(), false);
31549      }
31550  }
31551
31552  protected void composeElementDefinitionElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
31553    if (element != null) {
31554      open(name);
31555      composeElementDefinitionElementDefinitionBindingComponentInner(element);
31556      close();
31557    }
31558  }
31559
31560  protected void composeElementDefinitionElementDefinitionBindingComponentInner(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
31561      composeElement(element);
31562      if (element.hasStrengthElement()) {
31563        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
31564        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
31565      }
31566      if (element.hasDescriptionElement()) {
31567        composeStringCore("description", element.getDescriptionElement(), false);
31568        composeStringExtras("description", element.getDescriptionElement(), false);
31569      }
31570      if (element.hasValueSetElement()) {
31571        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
31572        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
31573      }
31574  }
31575
31576  protected void composeElementDefinitionElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
31577    if (element != null) {
31578      open(name);
31579      composeElementDefinitionElementDefinitionMappingComponentInner(element);
31580      close();
31581    }
31582  }
31583
31584  protected void composeElementDefinitionElementDefinitionMappingComponentInner(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
31585      composeElement(element);
31586      if (element.hasIdentityElement()) {
31587        composeIdCore("identity", element.getIdentityElement(), false);
31588        composeIdExtras("identity", element.getIdentityElement(), false);
31589      }
31590      if (element.hasLanguageElement()) {
31591        composeCodeCore("language", element.getLanguageElement(), false);
31592        composeCodeExtras("language", element.getLanguageElement(), false);
31593      }
31594      if (element.hasMapElement()) {
31595        composeStringCore("map", element.getMapElement(), false);
31596        composeStringExtras("map", element.getMapElement(), false);
31597      }
31598      if (element.hasCommentElement()) {
31599        composeStringCore("comment", element.getCommentElement(), false);
31600        composeStringExtras("comment", element.getCommentElement(), false);
31601      }
31602  }
31603
31604  protected void composeDomainResourceElements(DomainResource element) throws IOException {
31605      composeResourceElements(element);
31606      if (element.hasText()) {
31607        composeNarrative("text", element.getText());
31608      }
31609      if (element.hasContained()) {
31610        openArray("contained");
31611        for (Resource e : element.getContained()) {
31612          open(null);
31613          composeResource(e);
31614          close();
31615        }
31616        closeArray();
31617      };
31618      if (element.hasExtension()) {
31619        openArray("extension");
31620        for (Extension e : element.getExtension()) 
31621          composeExtension(null, e);
31622        closeArray();
31623      };
31624      if (element.hasModifierExtension()) {
31625        openArray("modifierExtension");
31626        for (Extension e : element.getModifierExtension()) 
31627          composeExtension(null, e);
31628        closeArray();
31629      };
31630  }
31631
31632  protected void composeParameters(String name, Parameters element) throws IOException {
31633    if (element != null) {
31634      prop("resourceType", name);
31635      composeParametersInner(element);
31636    }
31637  }
31638
31639  protected void composeParametersInner(Parameters element) throws IOException {
31640      composeResourceElements(element);
31641      if (element.hasParameter()) {
31642        openArray("parameter");
31643        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
31644          composeParametersParametersParameterComponent(null, e);
31645        closeArray();
31646      };
31647  }
31648
31649  protected void composeParametersParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
31650    if (element != null) {
31651      open(name);
31652      composeParametersParametersParameterComponentInner(element);
31653      close();
31654    }
31655  }
31656
31657  protected void composeParametersParametersParameterComponentInner(Parameters.ParametersParameterComponent element) throws IOException {
31658      composeBackbone(element);
31659      if (element.hasNameElement()) {
31660        composeStringCore("name", element.getNameElement(), false);
31661        composeStringExtras("name", element.getNameElement(), false);
31662      }
31663      if (element.hasValue()) {
31664        composeType("value", element.getValue());
31665      }
31666        if (element.hasResource()) {
31667          open("resource");
31668          composeResource(element.getResource());
31669          close();
31670        }
31671      if (element.hasPart()) {
31672        openArray("part");
31673        for (Parameters.ParametersParameterComponent e : element.getPart()) 
31674          composeParametersParametersParameterComponent(null, e);
31675        closeArray();
31676      };
31677  }
31678
31679  protected void composeResourceElements(Resource element) throws IOException {
31680      if (element.hasIdElement()) {
31681        composeIdCore("id", element.getIdElement(), false);
31682        composeIdExtras("id", element.getIdElement(), false);
31683      }
31684      if (element.hasMeta()) {
31685        composeMeta("meta", element.getMeta());
31686      }
31687      if (element.hasImplicitRulesElement()) {
31688        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
31689        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
31690      }
31691      if (element.hasLanguageElement()) {
31692        composeCodeCore("language", element.getLanguageElement(), false);
31693        composeCodeExtras("language", element.getLanguageElement(), false);
31694      }
31695  }
31696
31697  protected void composeAccount(String name, Account element) throws IOException {
31698    if (element != null) {
31699      prop("resourceType", name);
31700      composeAccountInner(element);
31701    }
31702  }
31703
31704  protected void composeAccountInner(Account element) throws IOException {
31705      composeDomainResourceElements(element);
31706      if (element.hasIdentifier()) {
31707        openArray("identifier");
31708        for (Identifier e : element.getIdentifier()) 
31709          composeIdentifier(null, e);
31710        closeArray();
31711      };
31712      if (element.hasStatusElement()) {
31713        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
31714        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
31715      }
31716      if (element.hasType()) {
31717        composeCodeableConcept("type", element.getType());
31718      }
31719      if (element.hasNameElement()) {
31720        composeStringCore("name", element.getNameElement(), false);
31721        composeStringExtras("name", element.getNameElement(), false);
31722      }
31723      if (element.hasSubject()) {
31724        openArray("subject");
31725        for (Reference e : element.getSubject()) 
31726          composeReference(null, e);
31727        closeArray();
31728      };
31729      if (element.hasServicePeriod()) {
31730        composePeriod("servicePeriod", element.getServicePeriod());
31731      }
31732      if (element.hasCoverage()) {
31733        openArray("coverage");
31734        for (Account.CoverageComponent e : element.getCoverage()) 
31735          composeAccountCoverageComponent(null, e);
31736        closeArray();
31737      };
31738      if (element.hasOwner()) {
31739        composeReference("owner", element.getOwner());
31740      }
31741      if (element.hasDescriptionElement()) {
31742        composeStringCore("description", element.getDescriptionElement(), false);
31743        composeStringExtras("description", element.getDescriptionElement(), false);
31744      }
31745      if (element.hasGuarantor()) {
31746        openArray("guarantor");
31747        for (Account.GuarantorComponent e : element.getGuarantor()) 
31748          composeAccountGuarantorComponent(null, e);
31749        closeArray();
31750      };
31751      if (element.hasPartOf()) {
31752        composeReference("partOf", element.getPartOf());
31753      }
31754  }
31755
31756  protected void composeAccountCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
31757    if (element != null) {
31758      open(name);
31759      composeAccountCoverageComponentInner(element);
31760      close();
31761    }
31762  }
31763
31764  protected void composeAccountCoverageComponentInner(Account.CoverageComponent element) throws IOException {
31765      composeBackbone(element);
31766      if (element.hasCoverage()) {
31767        composeReference("coverage", element.getCoverage());
31768      }
31769      if (element.hasPriorityElement()) {
31770        composePositiveIntCore("priority", element.getPriorityElement(), false);
31771        composePositiveIntExtras("priority", element.getPriorityElement(), false);
31772      }
31773  }
31774
31775  protected void composeAccountGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
31776    if (element != null) {
31777      open(name);
31778      composeAccountGuarantorComponentInner(element);
31779      close();
31780    }
31781  }
31782
31783  protected void composeAccountGuarantorComponentInner(Account.GuarantorComponent element) throws IOException {
31784      composeBackbone(element);
31785      if (element.hasParty()) {
31786        composeReference("party", element.getParty());
31787      }
31788      if (element.hasOnHoldElement()) {
31789        composeBooleanCore("onHold", element.getOnHoldElement(), false);
31790        composeBooleanExtras("onHold", element.getOnHoldElement(), false);
31791      }
31792      if (element.hasPeriod()) {
31793        composePeriod("period", element.getPeriod());
31794      }
31795  }
31796
31797  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
31798    if (element != null) {
31799      prop("resourceType", name);
31800      composeActivityDefinitionInner(element);
31801    }
31802  }
31803
31804  protected void composeActivityDefinitionInner(ActivityDefinition element) throws IOException {
31805      composeDomainResourceElements(element);
31806      if (element.hasUrlElement()) {
31807        composeUriCore("url", element.getUrlElement(), false);
31808        composeUriExtras("url", element.getUrlElement(), false);
31809      }
31810      if (element.hasIdentifier()) {
31811        openArray("identifier");
31812        for (Identifier e : element.getIdentifier()) 
31813          composeIdentifier(null, e);
31814        closeArray();
31815      };
31816      if (element.hasVersionElement()) {
31817        composeStringCore("version", element.getVersionElement(), false);
31818        composeStringExtras("version", element.getVersionElement(), false);
31819      }
31820      if (element.hasNameElement()) {
31821        composeStringCore("name", element.getNameElement(), false);
31822        composeStringExtras("name", element.getNameElement(), false);
31823      }
31824      if (element.hasTitleElement()) {
31825        composeStringCore("title", element.getTitleElement(), false);
31826        composeStringExtras("title", element.getTitleElement(), false);
31827      }
31828      if (element.hasSubtitleElement()) {
31829        composeStringCore("subtitle", element.getSubtitleElement(), false);
31830        composeStringExtras("subtitle", element.getSubtitleElement(), false);
31831      }
31832      if (element.hasStatusElement()) {
31833        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31834        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31835      }
31836      if (element.hasExperimentalElement()) {
31837        composeBooleanCore("experimental", element.getExperimentalElement(), false);
31838        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
31839      }
31840      if (element.hasSubject()) {
31841        composeType("subject", element.getSubject());
31842      }
31843      if (element.hasDateElement()) {
31844        composeDateTimeCore("date", element.getDateElement(), false);
31845        composeDateTimeExtras("date", element.getDateElement(), false);
31846      }
31847      if (element.hasPublisherElement()) {
31848        composeStringCore("publisher", element.getPublisherElement(), false);
31849        composeStringExtras("publisher", element.getPublisherElement(), false);
31850      }
31851      if (element.hasContact()) {
31852        openArray("contact");
31853        for (ContactDetail e : element.getContact()) 
31854          composeContactDetail(null, e);
31855        closeArray();
31856      };
31857      if (element.hasDescriptionElement()) {
31858        composeMarkdownCore("description", element.getDescriptionElement(), false);
31859        composeMarkdownExtras("description", element.getDescriptionElement(), false);
31860      }
31861      if (element.hasUseContext()) {
31862        openArray("useContext");
31863        for (UsageContext e : element.getUseContext()) 
31864          composeUsageContext(null, e);
31865        closeArray();
31866      };
31867      if (element.hasJurisdiction()) {
31868        openArray("jurisdiction");
31869        for (CodeableConcept e : element.getJurisdiction()) 
31870          composeCodeableConcept(null, e);
31871        closeArray();
31872      };
31873      if (element.hasPurposeElement()) {
31874        composeMarkdownCore("purpose", element.getPurposeElement(), false);
31875        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
31876      }
31877      if (element.hasUsageElement()) {
31878        composeStringCore("usage", element.getUsageElement(), false);
31879        composeStringExtras("usage", element.getUsageElement(), false);
31880      }
31881      if (element.hasCopyrightElement()) {
31882        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
31883        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
31884      }
31885      if (element.hasApprovalDateElement()) {
31886        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
31887        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
31888      }
31889      if (element.hasLastReviewDateElement()) {
31890        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
31891        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
31892      }
31893      if (element.hasEffectivePeriod()) {
31894        composePeriod("effectivePeriod", element.getEffectivePeriod());
31895      }
31896      if (element.hasTopic()) {
31897        openArray("topic");
31898        for (CodeableConcept e : element.getTopic()) 
31899          composeCodeableConcept(null, e);
31900        closeArray();
31901      };
31902      if (element.hasAuthor()) {
31903        openArray("author");
31904        for (ContactDetail e : element.getAuthor()) 
31905          composeContactDetail(null, e);
31906        closeArray();
31907      };
31908      if (element.hasEditor()) {
31909        openArray("editor");
31910        for (ContactDetail e : element.getEditor()) 
31911          composeContactDetail(null, e);
31912        closeArray();
31913      };
31914      if (element.hasReviewer()) {
31915        openArray("reviewer");
31916        for (ContactDetail e : element.getReviewer()) 
31917          composeContactDetail(null, e);
31918        closeArray();
31919      };
31920      if (element.hasEndorser()) {
31921        openArray("endorser");
31922        for (ContactDetail e : element.getEndorser()) 
31923          composeContactDetail(null, e);
31924        closeArray();
31925      };
31926      if (element.hasRelatedArtifact()) {
31927        openArray("relatedArtifact");
31928        for (RelatedArtifact e : element.getRelatedArtifact()) 
31929          composeRelatedArtifact(null, e);
31930        closeArray();
31931      };
31932      if (element.hasLibrary()) {
31933        openArray("library");
31934        for (CanonicalType e : element.getLibrary()) 
31935          composeCanonicalCore(null, e, true);
31936        closeArray();
31937        if (anyHasExtras(element.getLibrary())) {
31938          openArray("_library");
31939          for (CanonicalType e : element.getLibrary()) 
31940            composeCanonicalExtras(null, e, true);
31941          closeArray();
31942        }
31943      };
31944      if (element.hasKindElement()) {
31945        composeEnumerationCore("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
31946        composeEnumerationExtras("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
31947      }
31948      if (element.hasProfileElement()) {
31949        composeCanonicalCore("profile", element.getProfileElement(), false);
31950        composeCanonicalExtras("profile", element.getProfileElement(), false);
31951      }
31952      if (element.hasCode()) {
31953        composeCodeableConcept("code", element.getCode());
31954      }
31955      if (element.hasIntentElement()) {
31956        composeEnumerationCore("intent", element.getIntentElement(), new ActivityDefinition.RequestIntentEnumFactory(), false);
31957        composeEnumerationExtras("intent", element.getIntentElement(), new ActivityDefinition.RequestIntentEnumFactory(), false);
31958      }
31959      if (element.hasPriorityElement()) {
31960        composeEnumerationCore("priority", element.getPriorityElement(), new ActivityDefinition.RequestPriorityEnumFactory(), false);
31961        composeEnumerationExtras("priority", element.getPriorityElement(), new ActivityDefinition.RequestPriorityEnumFactory(), false);
31962      }
31963      if (element.hasDoNotPerformElement()) {
31964        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
31965        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
31966      }
31967      if (element.hasTiming()) {
31968        composeType("timing", element.getTiming());
31969      }
31970      if (element.hasLocation()) {
31971        composeReference("location", element.getLocation());
31972      }
31973      if (element.hasParticipant()) {
31974        openArray("participant");
31975        for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant()) 
31976          composeActivityDefinitionActivityDefinitionParticipantComponent(null, e);
31977        closeArray();
31978      };
31979      if (element.hasProduct()) {
31980        composeType("product", element.getProduct());
31981      }
31982      if (element.hasQuantity()) {
31983        composeQuantity("quantity", element.getQuantity());
31984      }
31985      if (element.hasDosage()) {
31986        openArray("dosage");
31987        for (Dosage e : element.getDosage()) 
31988          composeDosage(null, e);
31989        closeArray();
31990      };
31991      if (element.hasBodySite()) {
31992        openArray("bodySite");
31993        for (CodeableConcept e : element.getBodySite()) 
31994          composeCodeableConcept(null, e);
31995        closeArray();
31996      };
31997      if (element.hasSpecimenRequirement()) {
31998        openArray("specimenRequirement");
31999        for (Reference e : element.getSpecimenRequirement()) 
32000          composeReference(null, e);
32001        closeArray();
32002      };
32003      if (element.hasObservationRequirement()) {
32004        openArray("observationRequirement");
32005        for (Reference e : element.getObservationRequirement()) 
32006          composeReference(null, e);
32007        closeArray();
32008      };
32009      if (element.hasObservationResultRequirement()) {
32010        openArray("observationResultRequirement");
32011        for (Reference e : element.getObservationResultRequirement()) 
32012          composeReference(null, e);
32013        closeArray();
32014      };
32015      if (element.hasTransformElement()) {
32016        composeCanonicalCore("transform", element.getTransformElement(), false);
32017        composeCanonicalExtras("transform", element.getTransformElement(), false);
32018      }
32019      if (element.hasDynamicValue()) {
32020        openArray("dynamicValue");
32021        for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue()) 
32022          composeActivityDefinitionActivityDefinitionDynamicValueComponent(null, e);
32023        closeArray();
32024      };
32025  }
32026
32027  protected void composeActivityDefinitionActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
32028    if (element != null) {
32029      open(name);
32030      composeActivityDefinitionActivityDefinitionParticipantComponentInner(element);
32031      close();
32032    }
32033  }
32034
32035  protected void composeActivityDefinitionActivityDefinitionParticipantComponentInner(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
32036      composeBackbone(element);
32037      if (element.hasTypeElement()) {
32038        composeEnumerationCore("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
32039        composeEnumerationExtras("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
32040      }
32041      if (element.hasRole()) {
32042        composeCodeableConcept("role", element.getRole());
32043      }
32044  }
32045
32046  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
32047    if (element != null) {
32048      open(name);
32049      composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(element);
32050      close();
32051    }
32052  }
32053
32054  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
32055      composeBackbone(element);
32056      if (element.hasPathElement()) {
32057        composeStringCore("path", element.getPathElement(), false);
32058        composeStringExtras("path", element.getPathElement(), false);
32059      }
32060      if (element.hasExpression()) {
32061        composeExpression("expression", element.getExpression());
32062      }
32063  }
32064
32065  protected void composeAdministrableProductDefinition(String name, AdministrableProductDefinition element) throws IOException {
32066    if (element != null) {
32067      prop("resourceType", name);
32068      composeAdministrableProductDefinitionInner(element);
32069    }
32070  }
32071
32072  protected void composeAdministrableProductDefinitionInner(AdministrableProductDefinition element) throws IOException {
32073      composeDomainResourceElements(element);
32074      if (element.hasIdentifier()) {
32075        openArray("identifier");
32076        for (Identifier e : element.getIdentifier()) 
32077          composeIdentifier(null, e);
32078        closeArray();
32079      };
32080      if (element.hasSubject()) {
32081        openArray("subject");
32082        for (Reference e : element.getSubject()) 
32083          composeReference(null, e);
32084        closeArray();
32085      };
32086      if (element.hasAdministrableDoseForm()) {
32087        composeCodeableConcept("administrableDoseForm", element.getAdministrableDoseForm());
32088      }
32089      if (element.hasUnitOfPresentation()) {
32090        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
32091      }
32092      if (element.hasIngredient()) {
32093        openArray("ingredient");
32094        for (Reference e : element.getIngredient()) 
32095          composeReference(null, e);
32096        closeArray();
32097      };
32098      if (element.hasDevice()) {
32099        openArray("device");
32100        for (Reference e : element.getDevice()) 
32101          composeReference(null, e);
32102        closeArray();
32103      };
32104      if (element.hasCharacteristic()) {
32105        openArray("characteristic");
32106        for (AdministrableProductDefinition.AdministrableProductDefinitionCharacteristicComponent e : element.getCharacteristic()) 
32107          composeAdministrableProductDefinitionAdministrableProductDefinitionCharacteristicComponent(null, e);
32108        closeArray();
32109      };
32110      if (element.hasRouteOfAdministration()) {
32111        openArray("routeOfAdministration");
32112        for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent e : element.getRouteOfAdministration()) 
32113          composeAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationComponent(null, e);
32114        closeArray();
32115      };
32116  }
32117
32118  protected void composeAdministrableProductDefinitionAdministrableProductDefinitionCharacteristicComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionCharacteristicComponent element) throws IOException {
32119    if (element != null) {
32120      open(name);
32121      composeAdministrableProductDefinitionAdministrableProductDefinitionCharacteristicComponentInner(element);
32122      close();
32123    }
32124  }
32125
32126  protected void composeAdministrableProductDefinitionAdministrableProductDefinitionCharacteristicComponentInner(AdministrableProductDefinition.AdministrableProductDefinitionCharacteristicComponent element) throws IOException {
32127      composeBackbone(element);
32128      if (element.hasCode()) {
32129        composeCodeableConcept("code", element.getCode());
32130      }
32131      if (element.hasStatus()) {
32132        composeCodeableConcept("status", element.getStatus());
32133      }
32134  }
32135
32136  protected void composeAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent element) throws IOException {
32137    if (element != null) {
32138      open(name);
32139      composeAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationComponentInner(element);
32140      close();
32141    }
32142  }
32143
32144  protected void composeAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationComponentInner(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent element) throws IOException {
32145      composeBackbone(element);
32146      if (element.hasCode()) {
32147        composeCodeableConcept("code", element.getCode());
32148      }
32149      if (element.hasFirstDose()) {
32150        composeQuantity("firstDose", element.getFirstDose());
32151      }
32152      if (element.hasMaxSingleDose()) {
32153        composeQuantity("maxSingleDose", element.getMaxSingleDose());
32154      }
32155      if (element.hasMaxDosePerDay()) {
32156        composeQuantity("maxDosePerDay", element.getMaxDosePerDay());
32157      }
32158      if (element.hasMaxDosePerTreatmentPeriod()) {
32159        composeRatio("maxDosePerTreatmentPeriod", element.getMaxDosePerTreatmentPeriod());
32160      }
32161      if (element.hasMaxTreatmentPeriod()) {
32162        composeDuration("maxTreatmentPeriod", element.getMaxTreatmentPeriod());
32163      }
32164      if (element.hasTargetSpecies()) {
32165        openArray("targetSpecies");
32166        for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent e : element.getTargetSpecies()) 
32167          composeAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(null, e);
32168        closeArray();
32169      };
32170  }
32171
32172  protected void composeAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
32173    if (element != null) {
32174      open(name);
32175      composeAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentInner(element);
32176      close();
32177    }
32178  }
32179
32180  protected void composeAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentInner(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
32181      composeBackbone(element);
32182      if (element.hasCode()) {
32183        composeCodeableConcept("code", element.getCode());
32184      }
32185      if (element.hasWithdrawalPeriod()) {
32186        openArray("withdrawalPeriod");
32187        for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent e : element.getWithdrawalPeriod()) 
32188          composeAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(null, e);
32189        closeArray();
32190      };
32191  }
32192
32193  protected void composeAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
32194    if (element != null) {
32195      open(name);
32196      composeAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentInner(element);
32197      close();
32198    }
32199  }
32200
32201  protected void composeAdministrableProductDefinitionAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentInner(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
32202      composeBackbone(element);
32203      if (element.hasTissue()) {
32204        composeCodeableConcept("tissue", element.getTissue());
32205      }
32206      if (element.hasValue()) {
32207        composeQuantity("value", element.getValue());
32208      }
32209      if (element.hasSupportingInformationElement()) {
32210        composeStringCore("supportingInformation", element.getSupportingInformationElement(), false);
32211        composeStringExtras("supportingInformation", element.getSupportingInformationElement(), false);
32212      }
32213  }
32214
32215  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
32216    if (element != null) {
32217      prop("resourceType", name);
32218      composeAdverseEventInner(element);
32219    }
32220  }
32221
32222  protected void composeAdverseEventInner(AdverseEvent element) throws IOException {
32223      composeDomainResourceElements(element);
32224      if (element.hasIdentifier()) {
32225        openArray("identifier");
32226        for (Identifier e : element.getIdentifier()) 
32227          composeIdentifier(null, e);
32228        closeArray();
32229      };
32230      if (element.hasStatusElement()) {
32231        composeEnumerationCore("status", element.getStatusElement(), new AdverseEvent.AdverseEventStatusEnumFactory(), false);
32232        composeEnumerationExtras("status", element.getStatusElement(), new AdverseEvent.AdverseEventStatusEnumFactory(), false);
32233      }
32234      if (element.hasActualityElement()) {
32235        composeEnumerationCore("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
32236        composeEnumerationExtras("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
32237      }
32238      if (element.hasCategory()) {
32239        openArray("category");
32240        for (CodeableConcept e : element.getCategory()) 
32241          composeCodeableConcept(null, e);
32242        closeArray();
32243      };
32244      if (element.hasCode()) {
32245        composeCodeableConcept("code", element.getCode());
32246      }
32247      if (element.hasSubject()) {
32248        composeReference("subject", element.getSubject());
32249      }
32250      if (element.hasEncounter()) {
32251        composeReference("encounter", element.getEncounter());
32252      }
32253      if (element.hasOccurrence()) {
32254        composeType("occurrence", element.getOccurrence());
32255      }
32256      if (element.hasDetectedElement()) {
32257        composeDateTimeCore("detected", element.getDetectedElement(), false);
32258        composeDateTimeExtras("detected", element.getDetectedElement(), false);
32259      }
32260      if (element.hasRecordedDateElement()) {
32261        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
32262        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
32263      }
32264      if (element.hasResultingCondition()) {
32265        openArray("resultingCondition");
32266        for (Reference e : element.getResultingCondition()) 
32267          composeReference(null, e);
32268        closeArray();
32269      };
32270      if (element.hasLocation()) {
32271        composeReference("location", element.getLocation());
32272      }
32273      if (element.hasSeriousness()) {
32274        composeCodeableConcept("seriousness", element.getSeriousness());
32275      }
32276      if (element.hasOutcome()) {
32277        composeCodeableConcept("outcome", element.getOutcome());
32278      }
32279      if (element.hasRecorder()) {
32280        composeReference("recorder", element.getRecorder());
32281      }
32282      if (element.hasParticipant()) {
32283        openArray("participant");
32284        for (AdverseEvent.AdverseEventParticipantComponent e : element.getParticipant()) 
32285          composeAdverseEventAdverseEventParticipantComponent(null, e);
32286        closeArray();
32287      };
32288      if (element.hasSuspectEntity()) {
32289        openArray("suspectEntity");
32290        for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
32291          composeAdverseEventAdverseEventSuspectEntityComponent(null, e);
32292        closeArray();
32293      };
32294      if (element.hasSupportingInfo()) {
32295        openArray("supportingInfo");
32296        for (AdverseEvent.AdverseEventSupportingInfoComponent e : element.getSupportingInfo()) 
32297          composeAdverseEventAdverseEventSupportingInfoComponent(null, e);
32298        closeArray();
32299      };
32300      if (element.hasStudy()) {
32301        openArray("study");
32302        for (Reference e : element.getStudy()) 
32303          composeReference(null, e);
32304        closeArray();
32305      };
32306  }
32307
32308  protected void composeAdverseEventAdverseEventParticipantComponent(String name, AdverseEvent.AdverseEventParticipantComponent element) throws IOException {
32309    if (element != null) {
32310      open(name);
32311      composeAdverseEventAdverseEventParticipantComponentInner(element);
32312      close();
32313    }
32314  }
32315
32316  protected void composeAdverseEventAdverseEventParticipantComponentInner(AdverseEvent.AdverseEventParticipantComponent element) throws IOException {
32317      composeBackbone(element);
32318      if (element.hasFunction()) {
32319        composeCodeableConcept("function", element.getFunction());
32320      }
32321      if (element.hasActor()) {
32322        composeReference("actor", element.getActor());
32323      }
32324  }
32325
32326  protected void composeAdverseEventAdverseEventSuspectEntityComponent(String name, AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
32327    if (element != null) {
32328      open(name);
32329      composeAdverseEventAdverseEventSuspectEntityComponentInner(element);
32330      close();
32331    }
32332  }
32333
32334  protected void composeAdverseEventAdverseEventSuspectEntityComponentInner(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
32335      composeBackbone(element);
32336      if (element.hasInstance()) {
32337        composeType("instance", element.getInstance());
32338      }
32339      if (element.hasCausality()) {
32340        composeAdverseEventAdverseEventSuspectEntityCausalityComponent("causality", element.getCausality());
32341      }
32342  }
32343
32344  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponent(String name, AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
32345    if (element != null) {
32346      open(name);
32347      composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(element);
32348      close();
32349    }
32350  }
32351
32352  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
32353      composeBackbone(element);
32354      if (element.hasAssessmentMethod()) {
32355        composeCodeableConcept("assessmentMethod", element.getAssessmentMethod());
32356      }
32357      if (element.hasEntityRelatedness()) {
32358        composeCodeableConcept("entityRelatedness", element.getEntityRelatedness());
32359      }
32360      if (element.hasAuthor()) {
32361        composeReference("author", element.getAuthor());
32362      }
32363  }
32364
32365  protected void composeAdverseEventAdverseEventSupportingInfoComponent(String name, AdverseEvent.AdverseEventSupportingInfoComponent element) throws IOException {
32366    if (element != null) {
32367      open(name);
32368      composeAdverseEventAdverseEventSupportingInfoComponentInner(element);
32369      close();
32370    }
32371  }
32372
32373  protected void composeAdverseEventAdverseEventSupportingInfoComponentInner(AdverseEvent.AdverseEventSupportingInfoComponent element) throws IOException {
32374      composeBackbone(element);
32375      if (element.hasItem()) {
32376        composeReference("item", element.getItem());
32377      }
32378      if (element.hasContributingFactorElement()) {
32379        composeBooleanCore("contributingFactor", element.getContributingFactorElement(), false);
32380        composeBooleanExtras("contributingFactor", element.getContributingFactorElement(), false);
32381      }
32382  }
32383
32384  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
32385    if (element != null) {
32386      prop("resourceType", name);
32387      composeAllergyIntoleranceInner(element);
32388    }
32389  }
32390
32391  protected void composeAllergyIntoleranceInner(AllergyIntolerance element) throws IOException {
32392      composeDomainResourceElements(element);
32393      if (element.hasIdentifier()) {
32394        openArray("identifier");
32395        for (Identifier e : element.getIdentifier()) 
32396          composeIdentifier(null, e);
32397        closeArray();
32398      };
32399      if (element.hasClinicalStatus()) {
32400        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
32401      }
32402      if (element.hasVerificationStatus()) {
32403        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
32404      }
32405      if (element.hasTypeElement()) {
32406        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
32407        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
32408      }
32409      if (element.hasCategory()) {
32410        openArray("category");
32411        for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
32412          composeEnumerationCore(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
32413        closeArray();
32414        if (anyHasExtras(element.getCategory())) {
32415          openArray("_category");
32416          for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
32417            composeEnumerationExtras(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
32418          closeArray();
32419        }
32420      };
32421      if (element.hasCriticalityElement()) {
32422        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
32423        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
32424      }
32425      if (element.hasCode()) {
32426        composeCodeableConcept("code", element.getCode());
32427      }
32428      if (element.hasPatient()) {
32429        composeReference("patient", element.getPatient());
32430      }
32431      if (element.hasEncounter()) {
32432        composeReference("encounter", element.getEncounter());
32433      }
32434      if (element.hasOnset()) {
32435        composeType("onset", element.getOnset());
32436      }
32437      if (element.hasRecordedDateElement()) {
32438        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
32439        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
32440      }
32441      if (element.hasRecorder()) {
32442        composeReference("recorder", element.getRecorder());
32443      }
32444      if (element.hasAsserter()) {
32445        composeReference("asserter", element.getAsserter());
32446      }
32447      if (element.hasLastOccurrenceElement()) {
32448        composeDateTimeCore("lastOccurrence", element.getLastOccurrenceElement(), false);
32449        composeDateTimeExtras("lastOccurrence", element.getLastOccurrenceElement(), false);
32450      }
32451      if (element.hasNote()) {
32452        openArray("note");
32453        for (Annotation e : element.getNote()) 
32454          composeAnnotation(null, e);
32455        closeArray();
32456      };
32457      if (element.hasReaction()) {
32458        openArray("reaction");
32459        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
32460          composeAllergyIntoleranceAllergyIntoleranceReactionComponent(null, e);
32461        closeArray();
32462      };
32463  }
32464
32465  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
32466    if (element != null) {
32467      open(name);
32468      composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(element);
32469      close();
32470    }
32471  }
32472
32473  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
32474      composeBackbone(element);
32475      if (element.hasSubstance()) {
32476        composeCodeableConcept("substance", element.getSubstance());
32477      }
32478      if (element.hasManifestation()) {
32479        openArray("manifestation");
32480        for (CodeableConcept e : element.getManifestation()) 
32481          composeCodeableConcept(null, e);
32482        closeArray();
32483      };
32484      if (element.hasDescriptionElement()) {
32485        composeStringCore("description", element.getDescriptionElement(), false);
32486        composeStringExtras("description", element.getDescriptionElement(), false);
32487      }
32488      if (element.hasOnsetElement()) {
32489        composeDateTimeCore("onset", element.getOnsetElement(), false);
32490        composeDateTimeExtras("onset", element.getOnsetElement(), false);
32491      }
32492      if (element.hasSeverityElement()) {
32493        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
32494        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
32495      }
32496      if (element.hasExposureRoute()) {
32497        composeCodeableConcept("exposureRoute", element.getExposureRoute());
32498      }
32499      if (element.hasNote()) {
32500        openArray("note");
32501        for (Annotation e : element.getNote()) 
32502          composeAnnotation(null, e);
32503        closeArray();
32504      };
32505  }
32506
32507  protected void composeAppointment(String name, Appointment element) throws IOException {
32508    if (element != null) {
32509      prop("resourceType", name);
32510      composeAppointmentInner(element);
32511    }
32512  }
32513
32514  protected void composeAppointmentInner(Appointment element) throws IOException {
32515      composeDomainResourceElements(element);
32516      if (element.hasIdentifier()) {
32517        openArray("identifier");
32518        for (Identifier e : element.getIdentifier()) 
32519          composeIdentifier(null, e);
32520        closeArray();
32521      };
32522      if (element.hasStatusElement()) {
32523        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
32524        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
32525      }
32526      if (element.hasCancelationReason()) {
32527        composeCodeableConcept("cancelationReason", element.getCancelationReason());
32528      }
32529      if (element.hasServiceCategory()) {
32530        openArray("serviceCategory");
32531        for (CodeableConcept e : element.getServiceCategory()) 
32532          composeCodeableConcept(null, e);
32533        closeArray();
32534      };
32535      if (element.hasServiceType()) {
32536        openArray("serviceType");
32537        for (CodeableConcept e : element.getServiceType()) 
32538          composeCodeableConcept(null, e);
32539        closeArray();
32540      };
32541      if (element.hasSpecialty()) {
32542        openArray("specialty");
32543        for (CodeableConcept e : element.getSpecialty()) 
32544          composeCodeableConcept(null, e);
32545        closeArray();
32546      };
32547      if (element.hasAppointmentType()) {
32548        composeCodeableConcept("appointmentType", element.getAppointmentType());
32549      }
32550      if (element.hasReasonCode()) {
32551        openArray("reasonCode");
32552        for (CodeableConcept e : element.getReasonCode()) 
32553          composeCodeableConcept(null, e);
32554        closeArray();
32555      };
32556      if (element.hasReasonReference()) {
32557        openArray("reasonReference");
32558        for (Reference e : element.getReasonReference()) 
32559          composeReference(null, e);
32560        closeArray();
32561      };
32562      if (element.hasPriorityElement()) {
32563        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
32564        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
32565      }
32566      if (element.hasDescriptionElement()) {
32567        composeStringCore("description", element.getDescriptionElement(), false);
32568        composeStringExtras("description", element.getDescriptionElement(), false);
32569      }
32570      if (element.hasSupportingInformation()) {
32571        openArray("supportingInformation");
32572        for (Reference e : element.getSupportingInformation()) 
32573          composeReference(null, e);
32574        closeArray();
32575      };
32576      if (element.hasStartElement()) {
32577        composeInstantCore("start", element.getStartElement(), false);
32578        composeInstantExtras("start", element.getStartElement(), false);
32579      }
32580      if (element.hasEndElement()) {
32581        composeInstantCore("end", element.getEndElement(), false);
32582        composeInstantExtras("end", element.getEndElement(), false);
32583      }
32584      if (element.hasMinutesDurationElement()) {
32585        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
32586        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
32587      }
32588      if (element.hasSlot()) {
32589        openArray("slot");
32590        for (Reference e : element.getSlot()) 
32591          composeReference(null, e);
32592        closeArray();
32593      };
32594      if (element.hasCreatedElement()) {
32595        composeDateTimeCore("created", element.getCreatedElement(), false);
32596        composeDateTimeExtras("created", element.getCreatedElement(), false);
32597      }
32598      if (element.hasCommentElement()) {
32599        composeStringCore("comment", element.getCommentElement(), false);
32600        composeStringExtras("comment", element.getCommentElement(), false);
32601      }
32602      if (element.hasPatientInstructionElement()) {
32603        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
32604        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
32605      }
32606      if (element.hasBasedOn()) {
32607        openArray("basedOn");
32608        for (Reference e : element.getBasedOn()) 
32609          composeReference(null, e);
32610        closeArray();
32611      };
32612      if (element.hasParticipant()) {
32613        openArray("participant");
32614        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
32615          composeAppointmentAppointmentParticipantComponent(null, e);
32616        closeArray();
32617      };
32618      if (element.hasRequestedPeriod()) {
32619        openArray("requestedPeriod");
32620        for (Period e : element.getRequestedPeriod()) 
32621          composePeriod(null, e);
32622        closeArray();
32623      };
32624  }
32625
32626  protected void composeAppointmentAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
32627    if (element != null) {
32628      open(name);
32629      composeAppointmentAppointmentParticipantComponentInner(element);
32630      close();
32631    }
32632  }
32633
32634  protected void composeAppointmentAppointmentParticipantComponentInner(Appointment.AppointmentParticipantComponent element) throws IOException {
32635      composeBackbone(element);
32636      if (element.hasType()) {
32637        openArray("type");
32638        for (CodeableConcept e : element.getType()) 
32639          composeCodeableConcept(null, e);
32640        closeArray();
32641      };
32642      if (element.hasActor()) {
32643        composeReference("actor", element.getActor());
32644      }
32645      if (element.hasRequiredElement()) {
32646        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
32647        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
32648      }
32649      if (element.hasStatusElement()) {
32650        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
32651        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
32652      }
32653      if (element.hasPeriod()) {
32654        composePeriod("period", element.getPeriod());
32655      }
32656  }
32657
32658  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
32659    if (element != null) {
32660      prop("resourceType", name);
32661      composeAppointmentResponseInner(element);
32662    }
32663  }
32664
32665  protected void composeAppointmentResponseInner(AppointmentResponse element) throws IOException {
32666      composeDomainResourceElements(element);
32667      if (element.hasIdentifier()) {
32668        openArray("identifier");
32669        for (Identifier e : element.getIdentifier()) 
32670          composeIdentifier(null, e);
32671        closeArray();
32672      };
32673      if (element.hasAppointment()) {
32674        composeReference("appointment", element.getAppointment());
32675      }
32676      if (element.hasStartElement()) {
32677        composeInstantCore("start", element.getStartElement(), false);
32678        composeInstantExtras("start", element.getStartElement(), false);
32679      }
32680      if (element.hasEndElement()) {
32681        composeInstantCore("end", element.getEndElement(), false);
32682        composeInstantExtras("end", element.getEndElement(), false);
32683      }
32684      if (element.hasParticipantType()) {
32685        openArray("participantType");
32686        for (CodeableConcept e : element.getParticipantType()) 
32687          composeCodeableConcept(null, e);
32688        closeArray();
32689      };
32690      if (element.hasActor()) {
32691        composeReference("actor", element.getActor());
32692      }
32693      if (element.hasParticipantStatusElement()) {
32694        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
32695        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
32696      }
32697      if (element.hasCommentElement()) {
32698        composeStringCore("comment", element.getCommentElement(), false);
32699        composeStringExtras("comment", element.getCommentElement(), false);
32700      }
32701  }
32702
32703  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
32704    if (element != null) {
32705      prop("resourceType", name);
32706      composeAuditEventInner(element);
32707    }
32708  }
32709
32710  protected void composeAuditEventInner(AuditEvent element) throws IOException {
32711      composeDomainResourceElements(element);
32712      if (element.hasType()) {
32713        composeCoding("type", element.getType());
32714      }
32715      if (element.hasSubtype()) {
32716        openArray("subtype");
32717        for (Coding e : element.getSubtype()) 
32718          composeCoding(null, e);
32719        closeArray();
32720      };
32721      if (element.hasActionElement()) {
32722        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
32723        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
32724      }
32725      if (element.hasPeriod()) {
32726        composePeriod("period", element.getPeriod());
32727      }
32728      if (element.hasRecordedElement()) {
32729        composeInstantCore("recorded", element.getRecordedElement(), false);
32730        composeInstantExtras("recorded", element.getRecordedElement(), false);
32731      }
32732      if (element.hasOutcomeElement()) {
32733        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
32734        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
32735      }
32736      if (element.hasOutcomeDescElement()) {
32737        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
32738        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
32739      }
32740      if (element.hasPurposeOfEvent()) {
32741        openArray("purposeOfEvent");
32742        for (CodeableConcept e : element.getPurposeOfEvent()) 
32743          composeCodeableConcept(null, e);
32744        closeArray();
32745      };
32746      if (element.hasAgent()) {
32747        openArray("agent");
32748        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
32749          composeAuditEventAuditEventAgentComponent(null, e);
32750        closeArray();
32751      };
32752      if (element.hasSource()) {
32753        composeAuditEventAuditEventSourceComponent("source", element.getSource());
32754      }
32755      if (element.hasEntity()) {
32756        openArray("entity");
32757        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
32758          composeAuditEventAuditEventEntityComponent(null, e);
32759        closeArray();
32760      };
32761  }
32762
32763  protected void composeAuditEventAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
32764    if (element != null) {
32765      open(name);
32766      composeAuditEventAuditEventAgentComponentInner(element);
32767      close();
32768    }
32769  }
32770
32771  protected void composeAuditEventAuditEventAgentComponentInner(AuditEvent.AuditEventAgentComponent element) throws IOException {
32772      composeBackbone(element);
32773      if (element.hasType()) {
32774        composeCodeableConcept("type", element.getType());
32775      }
32776      if (element.hasRole()) {
32777        openArray("role");
32778        for (CodeableConcept e : element.getRole()) 
32779          composeCodeableConcept(null, e);
32780        closeArray();
32781      };
32782      if (element.hasWho()) {
32783        composeReference("who", element.getWho());
32784      }
32785      if (element.hasAltIdElement()) {
32786        composeStringCore("altId", element.getAltIdElement(), false);
32787        composeStringExtras("altId", element.getAltIdElement(), false);
32788      }
32789      if (element.hasNameElement()) {
32790        composeStringCore("name", element.getNameElement(), false);
32791        composeStringExtras("name", element.getNameElement(), false);
32792      }
32793      if (element.hasRequestorElement()) {
32794        composeBooleanCore("requestor", element.getRequestorElement(), false);
32795        composeBooleanExtras("requestor", element.getRequestorElement(), false);
32796      }
32797      if (element.hasLocation()) {
32798        composeReference("location", element.getLocation());
32799      }
32800      if (element.hasPolicy()) {
32801        openArray("policy");
32802        for (UriType e : element.getPolicy()) 
32803          composeUriCore(null, e, true);
32804        closeArray();
32805        if (anyHasExtras(element.getPolicy())) {
32806          openArray("_policy");
32807          for (UriType e : element.getPolicy()) 
32808            composeUriExtras(null, e, true);
32809          closeArray();
32810        }
32811      };
32812      if (element.hasMedia()) {
32813        composeCoding("media", element.getMedia());
32814      }
32815      if (element.hasNetwork()) {
32816        composeAuditEventAuditEventAgentNetworkComponent("network", element.getNetwork());
32817      }
32818      if (element.hasPurposeOfUse()) {
32819        openArray("purposeOfUse");
32820        for (CodeableConcept e : element.getPurposeOfUse()) 
32821          composeCodeableConcept(null, e);
32822        closeArray();
32823      };
32824  }
32825
32826  protected void composeAuditEventAuditEventAgentNetworkComponent(String name, AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
32827    if (element != null) {
32828      open(name);
32829      composeAuditEventAuditEventAgentNetworkComponentInner(element);
32830      close();
32831    }
32832  }
32833
32834  protected void composeAuditEventAuditEventAgentNetworkComponentInner(AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
32835      composeBackbone(element);
32836      if (element.hasAddressElement()) {
32837        composeStringCore("address", element.getAddressElement(), false);
32838        composeStringExtras("address", element.getAddressElement(), false);
32839      }
32840      if (element.hasTypeElement()) {
32841        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
32842        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
32843      }
32844  }
32845
32846  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
32847    if (element != null) {
32848      open(name);
32849      composeAuditEventAuditEventSourceComponentInner(element);
32850      close();
32851    }
32852  }
32853
32854  protected void composeAuditEventAuditEventSourceComponentInner(AuditEvent.AuditEventSourceComponent element) throws IOException {
32855      composeBackbone(element);
32856      if (element.hasSiteElement()) {
32857        composeStringCore("site", element.getSiteElement(), false);
32858        composeStringExtras("site", element.getSiteElement(), false);
32859      }
32860      if (element.hasObserver()) {
32861        composeReference("observer", element.getObserver());
32862      }
32863      if (element.hasType()) {
32864        openArray("type");
32865        for (Coding e : element.getType()) 
32866          composeCoding(null, e);
32867        closeArray();
32868      };
32869  }
32870
32871  protected void composeAuditEventAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
32872    if (element != null) {
32873      open(name);
32874      composeAuditEventAuditEventEntityComponentInner(element);
32875      close();
32876    }
32877  }
32878
32879  protected void composeAuditEventAuditEventEntityComponentInner(AuditEvent.AuditEventEntityComponent element) throws IOException {
32880      composeBackbone(element);
32881      if (element.hasWhat()) {
32882        composeReference("what", element.getWhat());
32883      }
32884      if (element.hasType()) {
32885        composeCoding("type", element.getType());
32886      }
32887      if (element.hasRole()) {
32888        composeCoding("role", element.getRole());
32889      }
32890      if (element.hasLifecycle()) {
32891        composeCoding("lifecycle", element.getLifecycle());
32892      }
32893      if (element.hasSecurityLabel()) {
32894        openArray("securityLabel");
32895        for (Coding e : element.getSecurityLabel()) 
32896          composeCoding(null, e);
32897        closeArray();
32898      };
32899      if (element.hasNameElement()) {
32900        composeStringCore("name", element.getNameElement(), false);
32901        composeStringExtras("name", element.getNameElement(), false);
32902      }
32903      if (element.hasDescriptionElement()) {
32904        composeStringCore("description", element.getDescriptionElement(), false);
32905        composeStringExtras("description", element.getDescriptionElement(), false);
32906      }
32907      if (element.hasQueryElement()) {
32908        composeBase64BinaryCore("query", element.getQueryElement(), false);
32909        composeBase64BinaryExtras("query", element.getQueryElement(), false);
32910      }
32911      if (element.hasDetail()) {
32912        openArray("detail");
32913        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
32914          composeAuditEventAuditEventEntityDetailComponent(null, e);
32915        closeArray();
32916      };
32917  }
32918
32919  protected void composeAuditEventAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
32920    if (element != null) {
32921      open(name);
32922      composeAuditEventAuditEventEntityDetailComponentInner(element);
32923      close();
32924    }
32925  }
32926
32927  protected void composeAuditEventAuditEventEntityDetailComponentInner(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
32928      composeBackbone(element);
32929      if (element.hasTypeElement()) {
32930        composeStringCore("type", element.getTypeElement(), false);
32931        composeStringExtras("type", element.getTypeElement(), false);
32932      }
32933      if (element.hasValue()) {
32934        composeType("value", element.getValue());
32935      }
32936  }
32937
32938  protected void composeBasic(String name, Basic element) throws IOException {
32939    if (element != null) {
32940      prop("resourceType", name);
32941      composeBasicInner(element);
32942    }
32943  }
32944
32945  protected void composeBasicInner(Basic element) throws IOException {
32946      composeDomainResourceElements(element);
32947      if (element.hasIdentifier()) {
32948        openArray("identifier");
32949        for (Identifier e : element.getIdentifier()) 
32950          composeIdentifier(null, e);
32951        closeArray();
32952      };
32953      if (element.hasCode()) {
32954        composeCodeableConcept("code", element.getCode());
32955      }
32956      if (element.hasSubject()) {
32957        composeReference("subject", element.getSubject());
32958      }
32959      if (element.hasCreatedElement()) {
32960        composeDateCore("created", element.getCreatedElement(), false);
32961        composeDateExtras("created", element.getCreatedElement(), false);
32962      }
32963      if (element.hasAuthor()) {
32964        composeReference("author", element.getAuthor());
32965      }
32966  }
32967
32968  protected void composeBinary(String name, Binary element) throws IOException {
32969    if (element != null) {
32970      prop("resourceType", name);
32971      composeBinaryInner(element);
32972    }
32973  }
32974
32975  protected void composeBinaryInner(Binary element) throws IOException {
32976      composeResourceElements(element);
32977      if (element.hasContentTypeElement()) {
32978        composeCodeCore("contentType", element.getContentTypeElement(), false);
32979        composeCodeExtras("contentType", element.getContentTypeElement(), false);
32980      }
32981      if (element.hasSecurityContext()) {
32982        composeReference("securityContext", element.getSecurityContext());
32983      }
32984      if (element.hasDataElement()) {
32985        composeBase64BinaryCore("data", element.getDataElement(), false);
32986        composeBase64BinaryExtras("data", element.getDataElement(), false);
32987      }
32988  }
32989
32990  protected void composeBiologicallyDerivedProduct(String name, BiologicallyDerivedProduct element) throws IOException {
32991    if (element != null) {
32992      prop("resourceType", name);
32993      composeBiologicallyDerivedProductInner(element);
32994    }
32995  }
32996
32997  protected void composeBiologicallyDerivedProductInner(BiologicallyDerivedProduct element) throws IOException {
32998      composeDomainResourceElements(element);
32999      if (element.hasIdentifier()) {
33000        openArray("identifier");
33001        for (Identifier e : element.getIdentifier()) 
33002          composeIdentifier(null, e);
33003        closeArray();
33004      };
33005      if (element.hasProductCategoryElement()) {
33006        composeEnumerationCore("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
33007        composeEnumerationExtras("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
33008      }
33009      if (element.hasProductCode()) {
33010        composeCodeableConcept("productCode", element.getProductCode());
33011      }
33012      if (element.hasStatusElement()) {
33013        composeEnumerationCore("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
33014        composeEnumerationExtras("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
33015      }
33016      if (element.hasRequest()) {
33017        openArray("request");
33018        for (Reference e : element.getRequest()) 
33019          composeReference(null, e);
33020        closeArray();
33021      };
33022      if (element.hasQuantityElement()) {
33023        composeIntegerCore("quantity", element.getQuantityElement(), false);
33024        composeIntegerExtras("quantity", element.getQuantityElement(), false);
33025      }
33026      if (element.hasParent()) {
33027        openArray("parent");
33028        for (Reference e : element.getParent()) 
33029          composeReference(null, e);
33030        closeArray();
33031      };
33032      if (element.hasCollection()) {
33033        composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent("collection", element.getCollection());
33034      }
33035      if (element.hasProcessing()) {
33036        openArray("processing");
33037        for (BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent e : element.getProcessing()) 
33038          composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(null, e);
33039        closeArray();
33040      };
33041      if (element.hasManipulation()) {
33042        composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent("manipulation", element.getManipulation());
33043      }
33044      if (element.hasStorage()) {
33045        openArray("storage");
33046        for (BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent e : element.getStorage()) 
33047          composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(null, e);
33048        closeArray();
33049      };
33050  }
33051
33052  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
33053    if (element != null) {
33054      open(name);
33055      composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(element);
33056      close();
33057    }
33058  }
33059
33060  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
33061      composeBackbone(element);
33062      if (element.hasCollector()) {
33063        composeReference("collector", element.getCollector());
33064      }
33065      if (element.hasSource()) {
33066        composeReference("source", element.getSource());
33067      }
33068      if (element.hasCollected()) {
33069        composeType("collected", element.getCollected());
33070      }
33071  }
33072
33073  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
33074    if (element != null) {
33075      open(name);
33076      composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(element);
33077      close();
33078    }
33079  }
33080
33081  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
33082      composeBackbone(element);
33083      if (element.hasDescriptionElement()) {
33084        composeStringCore("description", element.getDescriptionElement(), false);
33085        composeStringExtras("description", element.getDescriptionElement(), false);
33086      }
33087      if (element.hasProcedure()) {
33088        composeCodeableConcept("procedure", element.getProcedure());
33089      }
33090      if (element.hasAdditive()) {
33091        composeReference("additive", element.getAdditive());
33092      }
33093      if (element.hasTime()) {
33094        composeType("time", element.getTime());
33095      }
33096  }
33097
33098  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
33099    if (element != null) {
33100      open(name);
33101      composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(element);
33102      close();
33103    }
33104  }
33105
33106  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
33107      composeBackbone(element);
33108      if (element.hasDescriptionElement()) {
33109        composeStringCore("description", element.getDescriptionElement(), false);
33110        composeStringExtras("description", element.getDescriptionElement(), false);
33111      }
33112      if (element.hasTime()) {
33113        composeType("time", element.getTime());
33114      }
33115  }
33116
33117  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
33118    if (element != null) {
33119      open(name);
33120      composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(element);
33121      close();
33122    }
33123  }
33124
33125  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
33126      composeBackbone(element);
33127      if (element.hasDescriptionElement()) {
33128        composeStringCore("description", element.getDescriptionElement(), false);
33129        composeStringExtras("description", element.getDescriptionElement(), false);
33130      }
33131      if (element.hasTemperatureElement()) {
33132        composeDecimalCore("temperature", element.getTemperatureElement(), false);
33133        composeDecimalExtras("temperature", element.getTemperatureElement(), false);
33134      }
33135      if (element.hasScaleElement()) {
33136        composeEnumerationCore("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
33137        composeEnumerationExtras("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
33138      }
33139      if (element.hasDuration()) {
33140        composePeriod("duration", element.getDuration());
33141      }
33142  }
33143
33144  protected void composeBodyStructure(String name, BodyStructure element) throws IOException {
33145    if (element != null) {
33146      prop("resourceType", name);
33147      composeBodyStructureInner(element);
33148    }
33149  }
33150
33151  protected void composeBodyStructureInner(BodyStructure element) throws IOException {
33152      composeDomainResourceElements(element);
33153      if (element.hasIdentifier()) {
33154        openArray("identifier");
33155        for (Identifier e : element.getIdentifier()) 
33156          composeIdentifier(null, e);
33157        closeArray();
33158      };
33159      if (element.hasActiveElement()) {
33160        composeBooleanCore("active", element.getActiveElement(), false);
33161        composeBooleanExtras("active", element.getActiveElement(), false);
33162      }
33163      if (element.hasMorphology()) {
33164        composeCodeableConcept("morphology", element.getMorphology());
33165      }
33166      if (element.hasLocation()) {
33167        composeCodeableConcept("location", element.getLocation());
33168      }
33169      if (element.hasLocationQualifier()) {
33170        openArray("locationQualifier");
33171        for (CodeableConcept e : element.getLocationQualifier()) 
33172          composeCodeableConcept(null, e);
33173        closeArray();
33174      };
33175      if (element.hasDescriptionElement()) {
33176        composeStringCore("description", element.getDescriptionElement(), false);
33177        composeStringExtras("description", element.getDescriptionElement(), false);
33178      }
33179      if (element.hasImage()) {
33180        openArray("image");
33181        for (Attachment e : element.getImage()) 
33182          composeAttachment(null, e);
33183        closeArray();
33184      };
33185      if (element.hasPatient()) {
33186        composeReference("patient", element.getPatient());
33187      }
33188  }
33189
33190  protected void composeBundle(String name, Bundle element) throws IOException {
33191    if (element != null) {
33192      prop("resourceType", name);
33193      composeBundleInner(element);
33194    }
33195  }
33196
33197  protected void composeBundleInner(Bundle element) throws IOException {
33198      composeResourceElements(element);
33199      if (element.hasIdentifier()) {
33200        composeIdentifier("identifier", element.getIdentifier());
33201      }
33202      if (element.hasTypeElement()) {
33203        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
33204        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
33205      }
33206      if (element.hasTimestampElement()) {
33207        composeInstantCore("timestamp", element.getTimestampElement(), false);
33208        composeInstantExtras("timestamp", element.getTimestampElement(), false);
33209      }
33210      if (element.hasTotalElement()) {
33211        composeUnsignedIntCore("total", element.getTotalElement(), false);
33212        composeUnsignedIntExtras("total", element.getTotalElement(), false);
33213      }
33214      if (element.hasLink()) {
33215        openArray("link");
33216        for (Bundle.BundleLinkComponent e : element.getLink()) 
33217          composeBundleBundleLinkComponent(null, e);
33218        closeArray();
33219      };
33220      if (element.hasEntry()) {
33221        openArray("entry");
33222        for (Bundle.BundleEntryComponent e : element.getEntry()) 
33223          composeBundleBundleEntryComponent(null, e);
33224        closeArray();
33225      };
33226      if (element.hasSignature()) {
33227        composeSignature("signature", element.getSignature());
33228      }
33229  }
33230
33231  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
33232    if (element != null) {
33233      open(name);
33234      composeBundleBundleLinkComponentInner(element);
33235      close();
33236    }
33237  }
33238
33239  protected void composeBundleBundleLinkComponentInner(Bundle.BundleLinkComponent element) throws IOException {
33240      composeBackbone(element);
33241      if (element.hasRelationElement()) {
33242        composeStringCore("relation", element.getRelationElement(), false);
33243        composeStringExtras("relation", element.getRelationElement(), false);
33244      }
33245      if (element.hasUrlElement()) {
33246        composeUriCore("url", element.getUrlElement(), false);
33247        composeUriExtras("url", element.getUrlElement(), false);
33248      }
33249  }
33250
33251  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
33252    if (element != null) {
33253      open(name);
33254      composeBundleBundleEntryComponentInner(element);
33255      close();
33256    }
33257  }
33258
33259  protected void composeBundleBundleEntryComponentInner(Bundle.BundleEntryComponent element) throws IOException {
33260      composeBackbone(element);
33261      if (element.hasLink()) {
33262        openArray("link");
33263        for (Bundle.BundleLinkComponent e : element.getLink()) 
33264          composeBundleBundleLinkComponent(null, e);
33265        closeArray();
33266      };
33267      if (element.hasFullUrlElement()) {
33268        composeUriCore("fullUrl", element.getFullUrlElement(), false);
33269        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
33270      }
33271        if (element.hasResource()) {
33272          open("resource");
33273          composeResource(element.getResource());
33274          close();
33275        }
33276      if (element.hasSearch()) {
33277        composeBundleBundleEntrySearchComponent("search", element.getSearch());
33278      }
33279      if (element.hasRequest()) {
33280        composeBundleBundleEntryRequestComponent("request", element.getRequest());
33281      }
33282      if (element.hasResponse()) {
33283        composeBundleBundleEntryResponseComponent("response", element.getResponse());
33284      }
33285  }
33286
33287  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
33288    if (element != null) {
33289      open(name);
33290      composeBundleBundleEntrySearchComponentInner(element);
33291      close();
33292    }
33293  }
33294
33295  protected void composeBundleBundleEntrySearchComponentInner(Bundle.BundleEntrySearchComponent element) throws IOException {
33296      composeBackbone(element);
33297      if (element.hasModeElement()) {
33298        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
33299        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
33300      }
33301      if (element.hasScoreElement()) {
33302        composeDecimalCore("score", element.getScoreElement(), false);
33303        composeDecimalExtras("score", element.getScoreElement(), false);
33304      }
33305  }
33306
33307  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
33308    if (element != null) {
33309      open(name);
33310      composeBundleBundleEntryRequestComponentInner(element);
33311      close();
33312    }
33313  }
33314
33315  protected void composeBundleBundleEntryRequestComponentInner(Bundle.BundleEntryRequestComponent element) throws IOException {
33316      composeBackbone(element);
33317      if (element.hasMethodElement()) {
33318        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
33319        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
33320      }
33321      if (element.hasUrlElement()) {
33322        composeUriCore("url", element.getUrlElement(), false);
33323        composeUriExtras("url", element.getUrlElement(), false);
33324      }
33325      if (element.hasIfNoneMatchElement()) {
33326        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
33327        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
33328      }
33329      if (element.hasIfModifiedSinceElement()) {
33330        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
33331        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
33332      }
33333      if (element.hasIfMatchElement()) {
33334        composeStringCore("ifMatch", element.getIfMatchElement(), false);
33335        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
33336      }
33337      if (element.hasIfNoneExistElement()) {
33338        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
33339        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
33340      }
33341  }
33342
33343  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
33344    if (element != null) {
33345      open(name);
33346      composeBundleBundleEntryResponseComponentInner(element);
33347      close();
33348    }
33349  }
33350
33351  protected void composeBundleBundleEntryResponseComponentInner(Bundle.BundleEntryResponseComponent element) throws IOException {
33352      composeBackbone(element);
33353      if (element.hasStatusElement()) {
33354        composeStringCore("status", element.getStatusElement(), false);
33355        composeStringExtras("status", element.getStatusElement(), false);
33356      }
33357      if (element.hasLocationElement()) {
33358        composeUriCore("location", element.getLocationElement(), false);
33359        composeUriExtras("location", element.getLocationElement(), false);
33360      }
33361      if (element.hasEtagElement()) {
33362        composeStringCore("etag", element.getEtagElement(), false);
33363        composeStringExtras("etag", element.getEtagElement(), false);
33364      }
33365      if (element.hasLastModifiedElement()) {
33366        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
33367        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
33368      }
33369        if (element.hasOutcome()) {
33370          open("outcome");
33371          composeResource(element.getOutcome());
33372          close();
33373        }
33374  }
33375
33376  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
33377    if (element != null) {
33378      prop("resourceType", name);
33379      composeCapabilityStatementInner(element);
33380    }
33381  }
33382
33383  protected void composeCapabilityStatementInner(CapabilityStatement element) throws IOException {
33384      composeDomainResourceElements(element);
33385      if (element.hasUrlElement()) {
33386        composeUriCore("url", element.getUrlElement(), false);
33387        composeUriExtras("url", element.getUrlElement(), false);
33388      }
33389      if (element.hasVersionElement()) {
33390        composeStringCore("version", element.getVersionElement(), false);
33391        composeStringExtras("version", element.getVersionElement(), false);
33392      }
33393      if (element.hasNameElement()) {
33394        composeStringCore("name", element.getNameElement(), false);
33395        composeStringExtras("name", element.getNameElement(), false);
33396      }
33397      if (element.hasTitleElement()) {
33398        composeStringCore("title", element.getTitleElement(), false);
33399        composeStringExtras("title", element.getTitleElement(), false);
33400      }
33401      if (element.hasStatusElement()) {
33402        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33403        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33404      }
33405      if (element.hasExperimentalElement()) {
33406        composeBooleanCore("experimental", element.getExperimentalElement(), false);
33407        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
33408      }
33409      if (element.hasDateElement()) {
33410        composeDateTimeCore("date", element.getDateElement(), false);
33411        composeDateTimeExtras("date", element.getDateElement(), false);
33412      }
33413      if (element.hasPublisherElement()) {
33414        composeStringCore("publisher", element.getPublisherElement(), false);
33415        composeStringExtras("publisher", element.getPublisherElement(), false);
33416      }
33417      if (element.hasContact()) {
33418        openArray("contact");
33419        for (ContactDetail e : element.getContact()) 
33420          composeContactDetail(null, e);
33421        closeArray();
33422      };
33423      if (element.hasDescriptionElement()) {
33424        composeMarkdownCore("description", element.getDescriptionElement(), false);
33425        composeMarkdownExtras("description", element.getDescriptionElement(), false);
33426      }
33427      if (element.hasUseContext()) {
33428        openArray("useContext");
33429        for (UsageContext e : element.getUseContext()) 
33430          composeUsageContext(null, e);
33431        closeArray();
33432      };
33433      if (element.hasJurisdiction()) {
33434        openArray("jurisdiction");
33435        for (CodeableConcept e : element.getJurisdiction()) 
33436          composeCodeableConcept(null, e);
33437        closeArray();
33438      };
33439      if (element.hasPurposeElement()) {
33440        composeMarkdownCore("purpose", element.getPurposeElement(), false);
33441        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
33442      }
33443      if (element.hasCopyrightElement()) {
33444        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
33445        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
33446      }
33447      if (element.hasKindElement()) {
33448        composeEnumerationCore("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
33449        composeEnumerationExtras("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
33450      }
33451      if (element.hasInstantiates()) {
33452        openArray("instantiates");
33453        for (CanonicalType e : element.getInstantiates()) 
33454          composeCanonicalCore(null, e, true);
33455        closeArray();
33456        if (anyHasExtras(element.getInstantiates())) {
33457          openArray("_instantiates");
33458          for (CanonicalType e : element.getInstantiates()) 
33459            composeCanonicalExtras(null, e, true);
33460          closeArray();
33461        }
33462      };
33463      if (element.hasImports()) {
33464        openArray("imports");
33465        for (CanonicalType e : element.getImports()) 
33466          composeCanonicalCore(null, e, true);
33467        closeArray();
33468        if (anyHasExtras(element.getImports())) {
33469          openArray("_imports");
33470          for (CanonicalType e : element.getImports()) 
33471            composeCanonicalExtras(null, e, true);
33472          closeArray();
33473        }
33474      };
33475      if (element.hasSoftware()) {
33476        composeCapabilityStatementCapabilityStatementSoftwareComponent("software", element.getSoftware());
33477      }
33478      if (element.hasImplementation()) {
33479        composeCapabilityStatementCapabilityStatementImplementationComponent("implementation", element.getImplementation());
33480      }
33481      if (element.hasFhirVersionElement()) {
33482        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
33483        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
33484      }
33485      if (element.hasFormat()) {
33486        openArray("format");
33487        for (CodeType e : element.getFormat()) 
33488          composeCodeCore(null, e, true);
33489        closeArray();
33490        if (anyHasExtras(element.getFormat())) {
33491          openArray("_format");
33492          for (CodeType e : element.getFormat()) 
33493            composeCodeExtras(null, e, true);
33494          closeArray();
33495        }
33496      };
33497      if (element.hasPatchFormat()) {
33498        openArray("patchFormat");
33499        for (CodeType e : element.getPatchFormat()) 
33500          composeCodeCore(null, e, true);
33501        closeArray();
33502        if (anyHasExtras(element.getPatchFormat())) {
33503          openArray("_patchFormat");
33504          for (CodeType e : element.getPatchFormat()) 
33505            composeCodeExtras(null, e, true);
33506          closeArray();
33507        }
33508      };
33509      if (element.hasImplementationGuide()) {
33510        openArray("implementationGuide");
33511        for (CanonicalType e : element.getImplementationGuide()) 
33512          composeCanonicalCore(null, e, true);
33513        closeArray();
33514        if (anyHasExtras(element.getImplementationGuide())) {
33515          openArray("_implementationGuide");
33516          for (CanonicalType e : element.getImplementationGuide()) 
33517            composeCanonicalExtras(null, e, true);
33518          closeArray();
33519        }
33520      };
33521      if (element.hasRest()) {
33522        openArray("rest");
33523        for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest()) 
33524          composeCapabilityStatementCapabilityStatementRestComponent(null, e);
33525        closeArray();
33526      };
33527      if (element.hasMessaging()) {
33528        openArray("messaging");
33529        for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
33530          composeCapabilityStatementCapabilityStatementMessagingComponent(null, e);
33531        closeArray();
33532      };
33533      if (element.hasDocument()) {
33534        openArray("document");
33535        for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
33536          composeCapabilityStatementCapabilityStatementDocumentComponent(null, e);
33537        closeArray();
33538      };
33539  }
33540
33541  protected void composeCapabilityStatementCapabilityStatementSoftwareComponent(String name, CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
33542    if (element != null) {
33543      open(name);
33544      composeCapabilityStatementCapabilityStatementSoftwareComponentInner(element);
33545      close();
33546    }
33547  }
33548
33549  protected void composeCapabilityStatementCapabilityStatementSoftwareComponentInner(CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
33550      composeBackbone(element);
33551      if (element.hasNameElement()) {
33552        composeStringCore("name", element.getNameElement(), false);
33553        composeStringExtras("name", element.getNameElement(), false);
33554      }
33555      if (element.hasVersionElement()) {
33556        composeStringCore("version", element.getVersionElement(), false);
33557        composeStringExtras("version", element.getVersionElement(), false);
33558      }
33559      if (element.hasReleaseDateElement()) {
33560        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
33561        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
33562      }
33563  }
33564
33565  protected void composeCapabilityStatementCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
33566    if (element != null) {
33567      open(name);
33568      composeCapabilityStatementCapabilityStatementImplementationComponentInner(element);
33569      close();
33570    }
33571  }
33572
33573  protected void composeCapabilityStatementCapabilityStatementImplementationComponentInner(CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
33574      composeBackbone(element);
33575      if (element.hasDescriptionElement()) {
33576        composeStringCore("description", element.getDescriptionElement(), false);
33577        composeStringExtras("description", element.getDescriptionElement(), false);
33578      }
33579      if (element.hasUrlElement()) {
33580        composeUrlCore("url", element.getUrlElement(), false);
33581        composeUrlExtras("url", element.getUrlElement(), false);
33582      }
33583      if (element.hasCustodian()) {
33584        composeReference("custodian", element.getCustodian());
33585      }
33586  }
33587
33588  protected void composeCapabilityStatementCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
33589    if (element != null) {
33590      open(name);
33591      composeCapabilityStatementCapabilityStatementRestComponentInner(element);
33592      close();
33593    }
33594  }
33595
33596  protected void composeCapabilityStatementCapabilityStatementRestComponentInner(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
33597      composeBackbone(element);
33598      if (element.hasModeElement()) {
33599        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
33600        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
33601      }
33602      if (element.hasDocumentationElement()) {
33603        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33604        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33605      }
33606      if (element.hasSecurity()) {
33607        composeCapabilityStatementCapabilityStatementRestSecurityComponent("security", element.getSecurity());
33608      }
33609      if (element.hasResource()) {
33610        openArray("resource");
33611        for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
33612          composeCapabilityStatementCapabilityStatementRestResourceComponent(null, e);
33613        closeArray();
33614      };
33615      if (element.hasInteraction()) {
33616        openArray("interaction");
33617        for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
33618          composeCapabilityStatementSystemInteractionComponent(null, e);
33619        closeArray();
33620      };
33621      if (element.hasSearchParam()) {
33622        openArray("searchParam");
33623        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
33624          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
33625        closeArray();
33626      };
33627      if (element.hasOperation()) {
33628        openArray("operation");
33629        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
33630          composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
33631        closeArray();
33632      };
33633      if (element.hasCompartment()) {
33634        openArray("compartment");
33635        for (CanonicalType e : element.getCompartment()) 
33636          composeCanonicalCore(null, e, true);
33637        closeArray();
33638        if (anyHasExtras(element.getCompartment())) {
33639          openArray("_compartment");
33640          for (CanonicalType e : element.getCompartment()) 
33641            composeCanonicalExtras(null, e, true);
33642          closeArray();
33643        }
33644      };
33645  }
33646
33647  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
33648    if (element != null) {
33649      open(name);
33650      composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(element);
33651      close();
33652    }
33653  }
33654
33655  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
33656      composeBackbone(element);
33657      if (element.hasCorsElement()) {
33658        composeBooleanCore("cors", element.getCorsElement(), false);
33659        composeBooleanExtras("cors", element.getCorsElement(), false);
33660      }
33661      if (element.hasService()) {
33662        openArray("service");
33663        for (CodeableConcept e : element.getService()) 
33664          composeCodeableConcept(null, e);
33665        closeArray();
33666      };
33667      if (element.hasDescriptionElement()) {
33668        composeMarkdownCore("description", element.getDescriptionElement(), false);
33669        composeMarkdownExtras("description", element.getDescriptionElement(), false);
33670      }
33671  }
33672
33673  protected void composeCapabilityStatementCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
33674    if (element != null) {
33675      open(name);
33676      composeCapabilityStatementCapabilityStatementRestResourceComponentInner(element);
33677      close();
33678    }
33679  }
33680
33681  protected void composeCapabilityStatementCapabilityStatementRestResourceComponentInner(CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
33682      composeBackbone(element);
33683      if (element.hasTypeElement()) {
33684        composeCodeCore("type", element.getTypeElement(), false);
33685        composeCodeExtras("type", element.getTypeElement(), false);
33686      }
33687      if (element.hasProfileElement()) {
33688        composeCanonicalCore("profile", element.getProfileElement(), false);
33689        composeCanonicalExtras("profile", element.getProfileElement(), false);
33690      }
33691      if (element.hasSupportedProfile()) {
33692        openArray("supportedProfile");
33693        for (CanonicalType e : element.getSupportedProfile()) 
33694          composeCanonicalCore(null, e, true);
33695        closeArray();
33696        if (anyHasExtras(element.getSupportedProfile())) {
33697          openArray("_supportedProfile");
33698          for (CanonicalType e : element.getSupportedProfile()) 
33699            composeCanonicalExtras(null, e, true);
33700          closeArray();
33701        }
33702      };
33703      if (element.hasDocumentationElement()) {
33704        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33705        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33706      }
33707      if (element.hasInteraction()) {
33708        openArray("interaction");
33709        for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction()) 
33710          composeCapabilityStatementResourceInteractionComponent(null, e);
33711        closeArray();
33712      };
33713      if (element.hasVersioningElement()) {
33714        composeEnumerationCore("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
33715        composeEnumerationExtras("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
33716      }
33717      if (element.hasReadHistoryElement()) {
33718        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
33719        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
33720      }
33721      if (element.hasUpdateCreateElement()) {
33722        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
33723        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
33724      }
33725      if (element.hasConditionalCreateElement()) {
33726        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
33727        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
33728      }
33729      if (element.hasConditionalReadElement()) {
33730        composeEnumerationCore("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
33731        composeEnumerationExtras("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
33732      }
33733      if (element.hasConditionalUpdateElement()) {
33734        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
33735        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
33736      }
33737      if (element.hasConditionalDeleteElement()) {
33738        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
33739        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
33740      }
33741      if (element.hasReferencePolicy()) {
33742        openArray("referencePolicy");
33743        for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
33744          composeEnumerationCore(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
33745        closeArray();
33746        if (anyHasExtras(element.getReferencePolicy())) {
33747          openArray("_referencePolicy");
33748          for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
33749            composeEnumerationExtras(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
33750          closeArray();
33751        }
33752      };
33753      if (element.hasSearchInclude()) {
33754        openArray("searchInclude");
33755        for (StringType e : element.getSearchInclude()) 
33756          composeStringCore(null, e, true);
33757        closeArray();
33758        if (anyHasExtras(element.getSearchInclude())) {
33759          openArray("_searchInclude");
33760          for (StringType e : element.getSearchInclude()) 
33761            composeStringExtras(null, e, true);
33762          closeArray();
33763        }
33764      };
33765      if (element.hasSearchRevInclude()) {
33766        openArray("searchRevInclude");
33767        for (StringType e : element.getSearchRevInclude()) 
33768          composeStringCore(null, e, true);
33769        closeArray();
33770        if (anyHasExtras(element.getSearchRevInclude())) {
33771          openArray("_searchRevInclude");
33772          for (StringType e : element.getSearchRevInclude()) 
33773            composeStringExtras(null, e, true);
33774          closeArray();
33775        }
33776      };
33777      if (element.hasSearchParam()) {
33778        openArray("searchParam");
33779        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
33780          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
33781        closeArray();
33782      };
33783      if (element.hasOperation()) {
33784        openArray("operation");
33785        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
33786          composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
33787        closeArray();
33788      };
33789  }
33790
33791  protected void composeCapabilityStatementResourceInteractionComponent(String name, CapabilityStatement.ResourceInteractionComponent element) throws IOException {
33792    if (element != null) {
33793      open(name);
33794      composeCapabilityStatementResourceInteractionComponentInner(element);
33795      close();
33796    }
33797  }
33798
33799  protected void composeCapabilityStatementResourceInteractionComponentInner(CapabilityStatement.ResourceInteractionComponent element) throws IOException {
33800      composeBackbone(element);
33801      if (element.hasCodeElement()) {
33802        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
33803        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
33804      }
33805      if (element.hasDocumentationElement()) {
33806        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33807        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33808      }
33809  }
33810
33811  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
33812    if (element != null) {
33813      open(name);
33814      composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(element);
33815      close();
33816    }
33817  }
33818
33819  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
33820      composeBackbone(element);
33821      if (element.hasNameElement()) {
33822        composeStringCore("name", element.getNameElement(), false);
33823        composeStringExtras("name", element.getNameElement(), false);
33824      }
33825      if (element.hasDefinitionElement()) {
33826        composeCanonicalCore("definition", element.getDefinitionElement(), false);
33827        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
33828      }
33829      if (element.hasTypeElement()) {
33830        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
33831        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
33832      }
33833      if (element.hasDocumentationElement()) {
33834        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33835        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33836      }
33837  }
33838
33839  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(String name, CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
33840    if (element != null) {
33841      open(name);
33842      composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(element);
33843      close();
33844    }
33845  }
33846
33847  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
33848      composeBackbone(element);
33849      if (element.hasNameElement()) {
33850        composeStringCore("name", element.getNameElement(), false);
33851        composeStringExtras("name", element.getNameElement(), false);
33852      }
33853      if (element.hasDefinitionElement()) {
33854        composeCanonicalCore("definition", element.getDefinitionElement(), false);
33855        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
33856      }
33857      if (element.hasDocumentationElement()) {
33858        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33859        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33860      }
33861  }
33862
33863  protected void composeCapabilityStatementSystemInteractionComponent(String name, CapabilityStatement.SystemInteractionComponent element) throws IOException {
33864    if (element != null) {
33865      open(name);
33866      composeCapabilityStatementSystemInteractionComponentInner(element);
33867      close();
33868    }
33869  }
33870
33871  protected void composeCapabilityStatementSystemInteractionComponentInner(CapabilityStatement.SystemInteractionComponent element) throws IOException {
33872      composeBackbone(element);
33873      if (element.hasCodeElement()) {
33874        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
33875        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
33876      }
33877      if (element.hasDocumentationElement()) {
33878        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33879        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33880      }
33881  }
33882
33883  protected void composeCapabilityStatementCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
33884    if (element != null) {
33885      open(name);
33886      composeCapabilityStatementCapabilityStatementMessagingComponentInner(element);
33887      close();
33888    }
33889  }
33890
33891  protected void composeCapabilityStatementCapabilityStatementMessagingComponentInner(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
33892      composeBackbone(element);
33893      if (element.hasEndpoint()) {
33894        openArray("endpoint");
33895        for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
33896          composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(null, e);
33897        closeArray();
33898      };
33899      if (element.hasReliableCacheElement()) {
33900        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
33901        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
33902      }
33903      if (element.hasDocumentationElement()) {
33904        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33905        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33906      }
33907      if (element.hasSupportedMessage()) {
33908        openArray("supportedMessage");
33909        for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage()) 
33910          composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(null, e);
33911        closeArray();
33912      };
33913  }
33914
33915  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(String name, CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
33916    if (element != null) {
33917      open(name);
33918      composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(element);
33919      close();
33920    }
33921  }
33922
33923  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
33924      composeBackbone(element);
33925      if (element.hasProtocol()) {
33926        composeCoding("protocol", element.getProtocol());
33927      }
33928      if (element.hasAddressElement()) {
33929        composeUrlCore("address", element.getAddressElement(), false);
33930        composeUrlExtras("address", element.getAddressElement(), false);
33931      }
33932  }
33933
33934  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(String name, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
33935    if (element != null) {
33936      open(name);
33937      composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(element);
33938      close();
33939    }
33940  }
33941
33942  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
33943      composeBackbone(element);
33944      if (element.hasModeElement()) {
33945        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
33946        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
33947      }
33948      if (element.hasDefinitionElement()) {
33949        composeCanonicalCore("definition", element.getDefinitionElement(), false);
33950        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
33951      }
33952  }
33953
33954  protected void composeCapabilityStatementCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
33955    if (element != null) {
33956      open(name);
33957      composeCapabilityStatementCapabilityStatementDocumentComponentInner(element);
33958      close();
33959    }
33960  }
33961
33962  protected void composeCapabilityStatementCapabilityStatementDocumentComponentInner(CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
33963      composeBackbone(element);
33964      if (element.hasModeElement()) {
33965        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
33966        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
33967      }
33968      if (element.hasDocumentationElement()) {
33969        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33970        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33971      }
33972      if (element.hasProfileElement()) {
33973        composeCanonicalCore("profile", element.getProfileElement(), false);
33974        composeCanonicalExtras("profile", element.getProfileElement(), false);
33975      }
33976  }
33977
33978  protected void composeCapabilityStatement2(String name, CapabilityStatement2 element) throws IOException {
33979    if (element != null) {
33980      prop("resourceType", name);
33981      composeCapabilityStatement2Inner(element);
33982    }
33983  }
33984
33985  protected void composeCapabilityStatement2Inner(CapabilityStatement2 element) throws IOException {
33986      composeDomainResourceElements(element);
33987      if (element.hasUrlElement()) {
33988        composeUriCore("url", element.getUrlElement(), false);
33989        composeUriExtras("url", element.getUrlElement(), false);
33990      }
33991      if (element.hasVersionElement()) {
33992        composeStringCore("version", element.getVersionElement(), false);
33993        composeStringExtras("version", element.getVersionElement(), false);
33994      }
33995      if (element.hasNameElement()) {
33996        composeStringCore("name", element.getNameElement(), false);
33997        composeStringExtras("name", element.getNameElement(), false);
33998      }
33999      if (element.hasTitleElement()) {
34000        composeStringCore("title", element.getTitleElement(), false);
34001        composeStringExtras("title", element.getTitleElement(), false);
34002      }
34003      if (element.hasStatusElement()) {
34004        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34005        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34006      }
34007      if (element.hasExperimentalElement()) {
34008        composeBooleanCore("experimental", element.getExperimentalElement(), false);
34009        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
34010      }
34011      if (element.hasDateElement()) {
34012        composeDateTimeCore("date", element.getDateElement(), false);
34013        composeDateTimeExtras("date", element.getDateElement(), false);
34014      }
34015      if (element.hasPublisherElement()) {
34016        composeStringCore("publisher", element.getPublisherElement(), false);
34017        composeStringExtras("publisher", element.getPublisherElement(), false);
34018      }
34019      if (element.hasContact()) {
34020        openArray("contact");
34021        for (ContactDetail e : element.getContact()) 
34022          composeContactDetail(null, e);
34023        closeArray();
34024      };
34025      if (element.hasDescriptionElement()) {
34026        composeMarkdownCore("description", element.getDescriptionElement(), false);
34027        composeMarkdownExtras("description", element.getDescriptionElement(), false);
34028      }
34029      if (element.hasUseContext()) {
34030        openArray("useContext");
34031        for (UsageContext e : element.getUseContext()) 
34032          composeUsageContext(null, e);
34033        closeArray();
34034      };
34035      if (element.hasJurisdiction()) {
34036        openArray("jurisdiction");
34037        for (CodeableConcept e : element.getJurisdiction()) 
34038          composeCodeableConcept(null, e);
34039        closeArray();
34040      };
34041      if (element.hasPurposeElement()) {
34042        composeMarkdownCore("purpose", element.getPurposeElement(), false);
34043        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
34044      }
34045      if (element.hasCopyrightElement()) {
34046        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
34047        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
34048      }
34049      if (element.hasKindElement()) {
34050        composeEnumerationCore("kind", element.getKindElement(), new CapabilityStatement2.CapabilityStatement2KindEnumFactory(), false);
34051        composeEnumerationExtras("kind", element.getKindElement(), new CapabilityStatement2.CapabilityStatement2KindEnumFactory(), false);
34052      }
34053      if (element.hasInstantiates()) {
34054        openArray("instantiates");
34055        for (CanonicalType e : element.getInstantiates()) 
34056          composeCanonicalCore(null, e, true);
34057        closeArray();
34058        if (anyHasExtras(element.getInstantiates())) {
34059          openArray("_instantiates");
34060          for (CanonicalType e : element.getInstantiates()) 
34061            composeCanonicalExtras(null, e, true);
34062          closeArray();
34063        }
34064      };
34065      if (element.hasImports()) {
34066        openArray("imports");
34067        for (CanonicalType e : element.getImports()) 
34068          composeCanonicalCore(null, e, true);
34069        closeArray();
34070        if (anyHasExtras(element.getImports())) {
34071          openArray("_imports");
34072          for (CanonicalType e : element.getImports()) 
34073            composeCanonicalExtras(null, e, true);
34074          closeArray();
34075        }
34076      };
34077      if (element.hasSoftware()) {
34078        composeCapabilityStatement2CapabilityStatement2SoftwareComponent("software", element.getSoftware());
34079      }
34080      if (element.hasImplementation()) {
34081        composeCapabilityStatement2CapabilityStatement2ImplementationComponent("implementation", element.getImplementation());
34082      }
34083      if (element.hasFhirVersionElement()) {
34084        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
34085        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
34086      }
34087      if (element.hasFormat()) {
34088        openArray("format");
34089        for (CodeType e : element.getFormat()) 
34090          composeCodeCore(null, e, true);
34091        closeArray();
34092        if (anyHasExtras(element.getFormat())) {
34093          openArray("_format");
34094          for (CodeType e : element.getFormat()) 
34095            composeCodeExtras(null, e, true);
34096          closeArray();
34097        }
34098      };
34099      if (element.hasPatchFormat()) {
34100        openArray("patchFormat");
34101        for (CodeType e : element.getPatchFormat()) 
34102          composeCodeCore(null, e, true);
34103        closeArray();
34104        if (anyHasExtras(element.getPatchFormat())) {
34105          openArray("_patchFormat");
34106          for (CodeType e : element.getPatchFormat()) 
34107            composeCodeExtras(null, e, true);
34108          closeArray();
34109        }
34110      };
34111      if (element.hasImplementationGuide()) {
34112        openArray("implementationGuide");
34113        for (CanonicalType e : element.getImplementationGuide()) 
34114          composeCanonicalCore(null, e, true);
34115        closeArray();
34116        if (anyHasExtras(element.getImplementationGuide())) {
34117          openArray("_implementationGuide");
34118          for (CanonicalType e : element.getImplementationGuide()) 
34119            composeCanonicalExtras(null, e, true);
34120          closeArray();
34121        }
34122      };
34123      if (element.hasRest()) {
34124        openArray("rest");
34125        for (CapabilityStatement2.CapabilityStatement2RestComponent e : element.getRest()) 
34126          composeCapabilityStatement2CapabilityStatement2RestComponent(null, e);
34127        closeArray();
34128      };
34129  }
34130
34131  protected void composeCapabilityStatement2CapabilityStatement2SoftwareComponent(String name, CapabilityStatement2.CapabilityStatement2SoftwareComponent element) throws IOException {
34132    if (element != null) {
34133      open(name);
34134      composeCapabilityStatement2CapabilityStatement2SoftwareComponentInner(element);
34135      close();
34136    }
34137  }
34138
34139  protected void composeCapabilityStatement2CapabilityStatement2SoftwareComponentInner(CapabilityStatement2.CapabilityStatement2SoftwareComponent element) throws IOException {
34140      composeBackbone(element);
34141      if (element.hasNameElement()) {
34142        composeStringCore("name", element.getNameElement(), false);
34143        composeStringExtras("name", element.getNameElement(), false);
34144      }
34145      if (element.hasVersionElement()) {
34146        composeStringCore("version", element.getVersionElement(), false);
34147        composeStringExtras("version", element.getVersionElement(), false);
34148      }
34149      if (element.hasReleaseDateElement()) {
34150        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
34151        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
34152      }
34153  }
34154
34155  protected void composeCapabilityStatement2CapabilityStatement2ImplementationComponent(String name, CapabilityStatement2.CapabilityStatement2ImplementationComponent element) throws IOException {
34156    if (element != null) {
34157      open(name);
34158      composeCapabilityStatement2CapabilityStatement2ImplementationComponentInner(element);
34159      close();
34160    }
34161  }
34162
34163  protected void composeCapabilityStatement2CapabilityStatement2ImplementationComponentInner(CapabilityStatement2.CapabilityStatement2ImplementationComponent element) throws IOException {
34164      composeBackbone(element);
34165      if (element.hasDescriptionElement()) {
34166        composeStringCore("description", element.getDescriptionElement(), false);
34167        composeStringExtras("description", element.getDescriptionElement(), false);
34168      }
34169      if (element.hasUrlElement()) {
34170        composeUrlCore("url", element.getUrlElement(), false);
34171        composeUrlExtras("url", element.getUrlElement(), false);
34172      }
34173      if (element.hasCustodian()) {
34174        composeReference("custodian", element.getCustodian());
34175      }
34176  }
34177
34178  protected void composeCapabilityStatement2CapabilityStatement2RestComponent(String name, CapabilityStatement2.CapabilityStatement2RestComponent element) throws IOException {
34179    if (element != null) {
34180      open(name);
34181      composeCapabilityStatement2CapabilityStatement2RestComponentInner(element);
34182      close();
34183    }
34184  }
34185
34186  protected void composeCapabilityStatement2CapabilityStatement2RestComponentInner(CapabilityStatement2.CapabilityStatement2RestComponent element) throws IOException {
34187      composeBackbone(element);
34188      if (element.hasModeElement()) {
34189        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement2.RestfulCapabilityModeEnumFactory(), false);
34190        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement2.RestfulCapabilityModeEnumFactory(), false);
34191      }
34192      if (element.hasDocumentationElement()) {
34193        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34194        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34195      }
34196      if (element.hasResource()) {
34197        openArray("resource");
34198        for (CapabilityStatement2.CapabilityStatement2RestResourceComponent e : element.getResource()) 
34199          composeCapabilityStatement2CapabilityStatement2RestResourceComponent(null, e);
34200        closeArray();
34201      };
34202      if (element.hasInteraction()) {
34203        openArray("interaction");
34204        for (CapabilityStatement2.SystemInteractionComponent e : element.getInteraction()) 
34205          composeCapabilityStatement2SystemInteractionComponent(null, e);
34206        closeArray();
34207      };
34208      if (element.hasSearchParam()) {
34209        openArray("searchParam");
34210        for (CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent e : element.getSearchParam()) 
34211          composeCapabilityStatement2CapabilityStatement2RestResourceSearchParamComponent(null, e);
34212        closeArray();
34213      };
34214      if (element.hasOperation()) {
34215        openArray("operation");
34216        for (CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent e : element.getOperation()) 
34217          composeCapabilityStatement2CapabilityStatement2RestResourceOperationComponent(null, e);
34218        closeArray();
34219      };
34220      if (element.hasCompartment()) {
34221        openArray("compartment");
34222        for (CanonicalType e : element.getCompartment()) 
34223          composeCanonicalCore(null, e, true);
34224        closeArray();
34225        if (anyHasExtras(element.getCompartment())) {
34226          openArray("_compartment");
34227          for (CanonicalType e : element.getCompartment()) 
34228            composeCanonicalExtras(null, e, true);
34229          closeArray();
34230        }
34231      };
34232  }
34233
34234  protected void composeCapabilityStatement2CapabilityStatement2RestResourceComponent(String name, CapabilityStatement2.CapabilityStatement2RestResourceComponent element) throws IOException {
34235    if (element != null) {
34236      open(name);
34237      composeCapabilityStatement2CapabilityStatement2RestResourceComponentInner(element);
34238      close();
34239    }
34240  }
34241
34242  protected void composeCapabilityStatement2CapabilityStatement2RestResourceComponentInner(CapabilityStatement2.CapabilityStatement2RestResourceComponent element) throws IOException {
34243      composeBackbone(element);
34244      if (element.hasTypeElement()) {
34245        composeCodeCore("type", element.getTypeElement(), false);
34246        composeCodeExtras("type", element.getTypeElement(), false);
34247      }
34248      if (element.hasProfileElement()) {
34249        composeCanonicalCore("profile", element.getProfileElement(), false);
34250        composeCanonicalExtras("profile", element.getProfileElement(), false);
34251      }
34252      if (element.hasSupportedProfile()) {
34253        openArray("supportedProfile");
34254        for (CanonicalType e : element.getSupportedProfile()) 
34255          composeCanonicalCore(null, e, true);
34256        closeArray();
34257        if (anyHasExtras(element.getSupportedProfile())) {
34258          openArray("_supportedProfile");
34259          for (CanonicalType e : element.getSupportedProfile()) 
34260            composeCanonicalExtras(null, e, true);
34261          closeArray();
34262        }
34263      };
34264      if (element.hasDocumentationElement()) {
34265        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34266        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34267      }
34268      if (element.hasInteraction()) {
34269        openArray("interaction");
34270        for (CapabilityStatement2.ResourceInteractionComponent e : element.getInteraction()) 
34271          composeCapabilityStatement2ResourceInteractionComponent(null, e);
34272        closeArray();
34273      };
34274      if (element.hasSearchParam()) {
34275        openArray("searchParam");
34276        for (CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent e : element.getSearchParam()) 
34277          composeCapabilityStatement2CapabilityStatement2RestResourceSearchParamComponent(null, e);
34278        closeArray();
34279      };
34280      if (element.hasOperation()) {
34281        openArray("operation");
34282        for (CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent e : element.getOperation()) 
34283          composeCapabilityStatement2CapabilityStatement2RestResourceOperationComponent(null, e);
34284        closeArray();
34285      };
34286  }
34287
34288  protected void composeCapabilityStatement2ResourceInteractionComponent(String name, CapabilityStatement2.ResourceInteractionComponent element) throws IOException {
34289    if (element != null) {
34290      open(name);
34291      composeCapabilityStatement2ResourceInteractionComponentInner(element);
34292      close();
34293    }
34294  }
34295
34296  protected void composeCapabilityStatement2ResourceInteractionComponentInner(CapabilityStatement2.ResourceInteractionComponent element) throws IOException {
34297      composeBackbone(element);
34298      if (element.hasCodeElement()) {
34299        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement2.TypeRestfulInteractionEnumFactory(), false);
34300        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement2.TypeRestfulInteractionEnumFactory(), false);
34301      }
34302      if (element.hasDocumentationElement()) {
34303        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34304        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34305      }
34306  }
34307
34308  protected void composeCapabilityStatement2CapabilityStatement2RestResourceSearchParamComponent(String name, CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent element) throws IOException {
34309    if (element != null) {
34310      open(name);
34311      composeCapabilityStatement2CapabilityStatement2RestResourceSearchParamComponentInner(element);
34312      close();
34313    }
34314  }
34315
34316  protected void composeCapabilityStatement2CapabilityStatement2RestResourceSearchParamComponentInner(CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent element) throws IOException {
34317      composeBackbone(element);
34318      if (element.hasNameElement()) {
34319        composeStringCore("name", element.getNameElement(), false);
34320        composeStringExtras("name", element.getNameElement(), false);
34321      }
34322      if (element.hasDefinitionElement()) {
34323        composeCanonicalCore("definition", element.getDefinitionElement(), false);
34324        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
34325      }
34326      if (element.hasTypeElement()) {
34327        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
34328        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
34329      }
34330      if (element.hasDocumentationElement()) {
34331        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34332        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34333      }
34334  }
34335
34336  protected void composeCapabilityStatement2CapabilityStatement2RestResourceOperationComponent(String name, CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent element) throws IOException {
34337    if (element != null) {
34338      open(name);
34339      composeCapabilityStatement2CapabilityStatement2RestResourceOperationComponentInner(element);
34340      close();
34341    }
34342  }
34343
34344  protected void composeCapabilityStatement2CapabilityStatement2RestResourceOperationComponentInner(CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent element) throws IOException {
34345      composeBackbone(element);
34346      if (element.hasNameElement()) {
34347        composeStringCore("name", element.getNameElement(), false);
34348        composeStringExtras("name", element.getNameElement(), false);
34349      }
34350      if (element.hasDefinitionElement()) {
34351        composeCanonicalCore("definition", element.getDefinitionElement(), false);
34352        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
34353      }
34354      if (element.hasDocumentationElement()) {
34355        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34356        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34357      }
34358  }
34359
34360  protected void composeCapabilityStatement2SystemInteractionComponent(String name, CapabilityStatement2.SystemInteractionComponent element) throws IOException {
34361    if (element != null) {
34362      open(name);
34363      composeCapabilityStatement2SystemInteractionComponentInner(element);
34364      close();
34365    }
34366  }
34367
34368  protected void composeCapabilityStatement2SystemInteractionComponentInner(CapabilityStatement2.SystemInteractionComponent element) throws IOException {
34369      composeBackbone(element);
34370      if (element.hasCodeElement()) {
34371        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement2.SystemRestfulInteractionEnumFactory(), false);
34372        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement2.SystemRestfulInteractionEnumFactory(), false);
34373      }
34374      if (element.hasDocumentationElement()) {
34375        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34376        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34377      }
34378  }
34379
34380  protected void composeCarePlan(String name, CarePlan element) throws IOException {
34381    if (element != null) {
34382      prop("resourceType", name);
34383      composeCarePlanInner(element);
34384    }
34385  }
34386
34387  protected void composeCarePlanInner(CarePlan element) throws IOException {
34388      composeDomainResourceElements(element);
34389      if (element.hasIdentifier()) {
34390        openArray("identifier");
34391        for (Identifier e : element.getIdentifier()) 
34392          composeIdentifier(null, e);
34393        closeArray();
34394      };
34395      if (element.hasInstantiatesCanonical()) {
34396        openArray("instantiatesCanonical");
34397        for (CanonicalType e : element.getInstantiatesCanonical()) 
34398          composeCanonicalCore(null, e, true);
34399        closeArray();
34400        if (anyHasExtras(element.getInstantiatesCanonical())) {
34401          openArray("_instantiatesCanonical");
34402          for (CanonicalType e : element.getInstantiatesCanonical()) 
34403            composeCanonicalExtras(null, e, true);
34404          closeArray();
34405        }
34406      };
34407      if (element.hasInstantiatesUri()) {
34408        openArray("instantiatesUri");
34409        for (UriType e : element.getInstantiatesUri()) 
34410          composeUriCore(null, e, true);
34411        closeArray();
34412        if (anyHasExtras(element.getInstantiatesUri())) {
34413          openArray("_instantiatesUri");
34414          for (UriType e : element.getInstantiatesUri()) 
34415            composeUriExtras(null, e, true);
34416          closeArray();
34417        }
34418      };
34419      if (element.hasBasedOn()) {
34420        openArray("basedOn");
34421        for (Reference e : element.getBasedOn()) 
34422          composeReference(null, e);
34423        closeArray();
34424      };
34425      if (element.hasReplaces()) {
34426        openArray("replaces");
34427        for (Reference e : element.getReplaces()) 
34428          composeReference(null, e);
34429        closeArray();
34430      };
34431      if (element.hasPartOf()) {
34432        openArray("partOf");
34433        for (Reference e : element.getPartOf()) 
34434          composeReference(null, e);
34435        closeArray();
34436      };
34437      if (element.hasStatusElement()) {
34438        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
34439        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
34440      }
34441      if (element.hasIntentElement()) {
34442        composeEnumerationCore("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
34443        composeEnumerationExtras("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
34444      }
34445      if (element.hasCategory()) {
34446        openArray("category");
34447        for (CodeableConcept e : element.getCategory()) 
34448          composeCodeableConcept(null, e);
34449        closeArray();
34450      };
34451      if (element.hasTitleElement()) {
34452        composeStringCore("title", element.getTitleElement(), false);
34453        composeStringExtras("title", element.getTitleElement(), false);
34454      }
34455      if (element.hasDescriptionElement()) {
34456        composeStringCore("description", element.getDescriptionElement(), false);
34457        composeStringExtras("description", element.getDescriptionElement(), false);
34458      }
34459      if (element.hasSubject()) {
34460        composeReference("subject", element.getSubject());
34461      }
34462      if (element.hasEncounter()) {
34463        composeReference("encounter", element.getEncounter());
34464      }
34465      if (element.hasPeriod()) {
34466        composePeriod("period", element.getPeriod());
34467      }
34468      if (element.hasCreatedElement()) {
34469        composeDateTimeCore("created", element.getCreatedElement(), false);
34470        composeDateTimeExtras("created", element.getCreatedElement(), false);
34471      }
34472      if (element.hasAuthor()) {
34473        composeReference("author", element.getAuthor());
34474      }
34475      if (element.hasContributor()) {
34476        openArray("contributor");
34477        for (Reference e : element.getContributor()) 
34478          composeReference(null, e);
34479        closeArray();
34480      };
34481      if (element.hasCareTeam()) {
34482        openArray("careTeam");
34483        for (Reference e : element.getCareTeam()) 
34484          composeReference(null, e);
34485        closeArray();
34486      };
34487      if (element.hasAddressesCode()) {
34488        openArray("addressesCode");
34489        for (CodeableConcept e : element.getAddressesCode()) 
34490          composeCodeableConcept(null, e);
34491        closeArray();
34492      };
34493      if (element.hasAddressesReference()) {
34494        openArray("addressesReference");
34495        for (Reference e : element.getAddressesReference()) 
34496          composeReference(null, e);
34497        closeArray();
34498      };
34499      if (element.hasSupportingInfo()) {
34500        openArray("supportingInfo");
34501        for (Reference e : element.getSupportingInfo()) 
34502          composeReference(null, e);
34503        closeArray();
34504      };
34505      if (element.hasGoal()) {
34506        openArray("goal");
34507        for (Reference e : element.getGoal()) 
34508          composeReference(null, e);
34509        closeArray();
34510      };
34511      if (element.hasActivity()) {
34512        openArray("activity");
34513        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
34514          composeCarePlanCarePlanActivityComponent(null, e);
34515        closeArray();
34516      };
34517      if (element.hasNote()) {
34518        openArray("note");
34519        for (Annotation e : element.getNote()) 
34520          composeAnnotation(null, e);
34521        closeArray();
34522      };
34523  }
34524
34525  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
34526    if (element != null) {
34527      open(name);
34528      composeCarePlanCarePlanActivityComponentInner(element);
34529      close();
34530    }
34531  }
34532
34533  protected void composeCarePlanCarePlanActivityComponentInner(CarePlan.CarePlanActivityComponent element) throws IOException {
34534      composeBackbone(element);
34535      if (element.hasOutcomeCodeableConcept()) {
34536        openArray("outcomeCodeableConcept");
34537        for (CodeableConcept e : element.getOutcomeCodeableConcept()) 
34538          composeCodeableConcept(null, e);
34539        closeArray();
34540      };
34541      if (element.hasOutcomeReference()) {
34542        openArray("outcomeReference");
34543        for (Reference e : element.getOutcomeReference()) 
34544          composeReference(null, e);
34545        closeArray();
34546      };
34547      if (element.hasProgress()) {
34548        openArray("progress");
34549        for (Annotation e : element.getProgress()) 
34550          composeAnnotation(null, e);
34551        closeArray();
34552      };
34553      if (element.hasReference()) {
34554        composeReference("reference", element.getReference());
34555      }
34556      if (element.hasDetail()) {
34557        composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
34558      }
34559  }
34560
34561  protected void composeCarePlanCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
34562    if (element != null) {
34563      open(name);
34564      composeCarePlanCarePlanActivityDetailComponentInner(element);
34565      close();
34566    }
34567  }
34568
34569  protected void composeCarePlanCarePlanActivityDetailComponentInner(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
34570      composeBackbone(element);
34571      if (element.hasKindElement()) {
34572        composeEnumerationCore("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
34573        composeEnumerationExtras("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
34574      }
34575      if (element.hasInstantiatesCanonical()) {
34576        openArray("instantiatesCanonical");
34577        for (CanonicalType e : element.getInstantiatesCanonical()) 
34578          composeCanonicalCore(null, e, true);
34579        closeArray();
34580        if (anyHasExtras(element.getInstantiatesCanonical())) {
34581          openArray("_instantiatesCanonical");
34582          for (CanonicalType e : element.getInstantiatesCanonical()) 
34583            composeCanonicalExtras(null, e, true);
34584          closeArray();
34585        }
34586      };
34587      if (element.hasInstantiatesUri()) {
34588        openArray("instantiatesUri");
34589        for (UriType e : element.getInstantiatesUri()) 
34590          composeUriCore(null, e, true);
34591        closeArray();
34592        if (anyHasExtras(element.getInstantiatesUri())) {
34593          openArray("_instantiatesUri");
34594          for (UriType e : element.getInstantiatesUri()) 
34595            composeUriExtras(null, e, true);
34596          closeArray();
34597        }
34598      };
34599      if (element.hasCode()) {
34600        composeCodeableConcept("code", element.getCode());
34601      }
34602      if (element.hasReasonCode()) {
34603        openArray("reasonCode");
34604        for (CodeableConcept e : element.getReasonCode()) 
34605          composeCodeableConcept(null, e);
34606        closeArray();
34607      };
34608      if (element.hasReasonReference()) {
34609        openArray("reasonReference");
34610        for (Reference e : element.getReasonReference()) 
34611          composeReference(null, e);
34612        closeArray();
34613      };
34614      if (element.hasGoal()) {
34615        openArray("goal");
34616        for (Reference e : element.getGoal()) 
34617          composeReference(null, e);
34618        closeArray();
34619      };
34620      if (element.hasStatusElement()) {
34621        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
34622        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
34623      }
34624      if (element.hasStatusReason()) {
34625        composeCodeableConcept("statusReason", element.getStatusReason());
34626      }
34627      if (element.hasDoNotPerformElement()) {
34628        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
34629        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
34630      }
34631      if (element.hasScheduled()) {
34632        composeType("scheduled", element.getScheduled());
34633      }
34634      if (element.hasLocation()) {
34635        composeReference("location", element.getLocation());
34636      }
34637      if (element.hasReported()) {
34638        composeType("reported", element.getReported());
34639      }
34640      if (element.hasPerformer()) {
34641        openArray("performer");
34642        for (Reference e : element.getPerformer()) 
34643          composeReference(null, e);
34644        closeArray();
34645      };
34646      if (element.hasProduct()) {
34647        composeType("product", element.getProduct());
34648      }
34649      if (element.hasDailyAmount()) {
34650        composeQuantity("dailyAmount", element.getDailyAmount());
34651      }
34652      if (element.hasQuantity()) {
34653        composeQuantity("quantity", element.getQuantity());
34654      }
34655      if (element.hasDescriptionElement()) {
34656        composeStringCore("description", element.getDescriptionElement(), false);
34657        composeStringExtras("description", element.getDescriptionElement(), false);
34658      }
34659  }
34660
34661  protected void composeCareTeam(String name, CareTeam element) throws IOException {
34662    if (element != null) {
34663      prop("resourceType", name);
34664      composeCareTeamInner(element);
34665    }
34666  }
34667
34668  protected void composeCareTeamInner(CareTeam element) throws IOException {
34669      composeDomainResourceElements(element);
34670      if (element.hasIdentifier()) {
34671        openArray("identifier");
34672        for (Identifier e : element.getIdentifier()) 
34673          composeIdentifier(null, e);
34674        closeArray();
34675      };
34676      if (element.hasStatusElement()) {
34677        composeEnumerationCore("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
34678        composeEnumerationExtras("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
34679      }
34680      if (element.hasCategory()) {
34681        openArray("category");
34682        for (CodeableConcept e : element.getCategory()) 
34683          composeCodeableConcept(null, e);
34684        closeArray();
34685      };
34686      if (element.hasNameElement()) {
34687        composeStringCore("name", element.getNameElement(), false);
34688        composeStringExtras("name", element.getNameElement(), false);
34689      }
34690      if (element.hasSubject()) {
34691        composeReference("subject", element.getSubject());
34692      }
34693      if (element.hasPeriod()) {
34694        composePeriod("period", element.getPeriod());
34695      }
34696      if (element.hasParticipant()) {
34697        openArray("participant");
34698        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
34699          composeCareTeamCareTeamParticipantComponent(null, e);
34700        closeArray();
34701      };
34702      if (element.hasReasonCode()) {
34703        openArray("reasonCode");
34704        for (CodeableConcept e : element.getReasonCode()) 
34705          composeCodeableConcept(null, e);
34706        closeArray();
34707      };
34708      if (element.hasReasonReference()) {
34709        openArray("reasonReference");
34710        for (Reference e : element.getReasonReference()) 
34711          composeReference(null, e);
34712        closeArray();
34713      };
34714      if (element.hasManagingOrganization()) {
34715        openArray("managingOrganization");
34716        for (Reference e : element.getManagingOrganization()) 
34717          composeReference(null, e);
34718        closeArray();
34719      };
34720      if (element.hasTelecom()) {
34721        openArray("telecom");
34722        for (ContactPoint e : element.getTelecom()) 
34723          composeContactPoint(null, e);
34724        closeArray();
34725      };
34726      if (element.hasNote()) {
34727        openArray("note");
34728        for (Annotation e : element.getNote()) 
34729          composeAnnotation(null, e);
34730        closeArray();
34731      };
34732  }
34733
34734  protected void composeCareTeamCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
34735    if (element != null) {
34736      open(name);
34737      composeCareTeamCareTeamParticipantComponentInner(element);
34738      close();
34739    }
34740  }
34741
34742  protected void composeCareTeamCareTeamParticipantComponentInner(CareTeam.CareTeamParticipantComponent element) throws IOException {
34743      composeBackbone(element);
34744      if (element.hasRole()) {
34745        composeCodeableConcept("role", element.getRole());
34746      }
34747      if (element.hasMember()) {
34748        composeReference("member", element.getMember());
34749      }
34750      if (element.hasOnBehalfOf()) {
34751        composeReference("onBehalfOf", element.getOnBehalfOf());
34752      }
34753      if (element.hasCoverage()) {
34754        composeType("coverage", element.getCoverage());
34755      }
34756  }
34757
34758  protected void composeCatalogEntry(String name, CatalogEntry element) throws IOException {
34759    if (element != null) {
34760      prop("resourceType", name);
34761      composeCatalogEntryInner(element);
34762    }
34763  }
34764
34765  protected void composeCatalogEntryInner(CatalogEntry element) throws IOException {
34766      composeDomainResourceElements(element);
34767      if (element.hasIdentifier()) {
34768        openArray("identifier");
34769        for (Identifier e : element.getIdentifier()) 
34770          composeIdentifier(null, e);
34771        closeArray();
34772      };
34773      if (element.hasNameElement()) {
34774        composeStringCore("name", element.getNameElement(), false);
34775        composeStringExtras("name", element.getNameElement(), false);
34776      }
34777      if (element.hasTypeElement()) {
34778        composeEnumerationCore("type", element.getTypeElement(), new CatalogEntry.CatalogEntryTypeEnumFactory(), false);
34779        composeEnumerationExtras("type", element.getTypeElement(), new CatalogEntry.CatalogEntryTypeEnumFactory(), false);
34780      }
34781      if (element.hasStatusElement()) {
34782        composeEnumerationCore("status", element.getStatusElement(), new CatalogEntry.CatalogEntryStatusEnumFactory(), false);
34783        composeEnumerationExtras("status", element.getStatusElement(), new CatalogEntry.CatalogEntryStatusEnumFactory(), false);
34784      }
34785      if (element.hasEffectivePeriod()) {
34786        composePeriod("effectivePeriod", element.getEffectivePeriod());
34787      }
34788      if (element.hasOrderableElement()) {
34789        composeBooleanCore("orderable", element.getOrderableElement(), false);
34790        composeBooleanExtras("orderable", element.getOrderableElement(), false);
34791      }
34792      if (element.hasReferencedItem()) {
34793        composeReference("referencedItem", element.getReferencedItem());
34794      }
34795      if (element.hasRelatedEntry()) {
34796        openArray("relatedEntry");
34797        for (CatalogEntry.CatalogEntryRelatedEntryComponent e : element.getRelatedEntry()) 
34798          composeCatalogEntryCatalogEntryRelatedEntryComponent(null, e);
34799        closeArray();
34800      };
34801      if (element.hasUpdatedBy()) {
34802        composeReference("updatedBy", element.getUpdatedBy());
34803      }
34804      if (element.hasNote()) {
34805        openArray("note");
34806        for (Annotation e : element.getNote()) 
34807          composeAnnotation(null, e);
34808        closeArray();
34809      };
34810      if (element.hasEstimatedDuration()) {
34811        composeDuration("estimatedDuration", element.getEstimatedDuration());
34812      }
34813      if (element.hasBillingCode()) {
34814        openArray("billingCode");
34815        for (CodeableConcept e : element.getBillingCode()) 
34816          composeCodeableConcept(null, e);
34817        closeArray();
34818      };
34819      if (element.hasBillingSummaryElement()) {
34820        composeStringCore("billingSummary", element.getBillingSummaryElement(), false);
34821        composeStringExtras("billingSummary", element.getBillingSummaryElement(), false);
34822      }
34823      if (element.hasScheduleSummaryElement()) {
34824        composeStringCore("scheduleSummary", element.getScheduleSummaryElement(), false);
34825        composeStringExtras("scheduleSummary", element.getScheduleSummaryElement(), false);
34826      }
34827      if (element.hasLimitationSummaryElement()) {
34828        composeStringCore("limitationSummary", element.getLimitationSummaryElement(), false);
34829        composeStringExtras("limitationSummary", element.getLimitationSummaryElement(), false);
34830      }
34831      if (element.hasRegulatorySummaryElement()) {
34832        composeStringCore("regulatorySummary", element.getRegulatorySummaryElement(), false);
34833        composeStringExtras("regulatorySummary", element.getRegulatorySummaryElement(), false);
34834      }
34835  }
34836
34837  protected void composeCatalogEntryCatalogEntryRelatedEntryComponent(String name, CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
34838    if (element != null) {
34839      open(name);
34840      composeCatalogEntryCatalogEntryRelatedEntryComponentInner(element);
34841      close();
34842    }
34843  }
34844
34845  protected void composeCatalogEntryCatalogEntryRelatedEntryComponentInner(CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
34846      composeBackbone(element);
34847      if (element.hasRelationshipElement()) {
34848        composeEnumerationCore("relationship", element.getRelationshipElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
34849        composeEnumerationExtras("relationship", element.getRelationshipElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
34850      }
34851      if (element.hasTarget()) {
34852        composeReference("target", element.getTarget());
34853      }
34854  }
34855
34856  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
34857    if (element != null) {
34858      prop("resourceType", name);
34859      composeChargeItemInner(element);
34860    }
34861  }
34862
34863  protected void composeChargeItemInner(ChargeItem element) throws IOException {
34864      composeDomainResourceElements(element);
34865      if (element.hasIdentifier()) {
34866        openArray("identifier");
34867        for (Identifier e : element.getIdentifier()) 
34868          composeIdentifier(null, e);
34869        closeArray();
34870      };
34871      if (element.hasDefinitionUri()) {
34872        openArray("definitionUri");
34873        for (UriType e : element.getDefinitionUri()) 
34874          composeUriCore(null, e, true);
34875        closeArray();
34876        if (anyHasExtras(element.getDefinitionUri())) {
34877          openArray("_definitionUri");
34878          for (UriType e : element.getDefinitionUri()) 
34879            composeUriExtras(null, e, true);
34880          closeArray();
34881        }
34882      };
34883      if (element.hasDefinitionCanonical()) {
34884        openArray("definitionCanonical");
34885        for (CanonicalType e : element.getDefinitionCanonical()) 
34886          composeCanonicalCore(null, e, true);
34887        closeArray();
34888        if (anyHasExtras(element.getDefinitionCanonical())) {
34889          openArray("_definitionCanonical");
34890          for (CanonicalType e : element.getDefinitionCanonical()) 
34891            composeCanonicalExtras(null, e, true);
34892          closeArray();
34893        }
34894      };
34895      if (element.hasStatusElement()) {
34896        composeEnumerationCore("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
34897        composeEnumerationExtras("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
34898      }
34899      if (element.hasPartOf()) {
34900        openArray("partOf");
34901        for (Reference e : element.getPartOf()) 
34902          composeReference(null, e);
34903        closeArray();
34904      };
34905      if (element.hasCode()) {
34906        composeCodeableConcept("code", element.getCode());
34907      }
34908      if (element.hasSubject()) {
34909        composeReference("subject", element.getSubject());
34910      }
34911      if (element.hasContext()) {
34912        composeReference("context", element.getContext());
34913      }
34914      if (element.hasOccurrence()) {
34915        composeType("occurrence", element.getOccurrence());
34916      }
34917      if (element.hasPerformer()) {
34918        openArray("performer");
34919        for (ChargeItem.ChargeItemPerformerComponent e : element.getPerformer()) 
34920          composeChargeItemChargeItemPerformerComponent(null, e);
34921        closeArray();
34922      };
34923      if (element.hasPerformingOrganization()) {
34924        composeReference("performingOrganization", element.getPerformingOrganization());
34925      }
34926      if (element.hasRequestingOrganization()) {
34927        composeReference("requestingOrganization", element.getRequestingOrganization());
34928      }
34929      if (element.hasCostCenter()) {
34930        composeReference("costCenter", element.getCostCenter());
34931      }
34932      if (element.hasQuantity()) {
34933        composeQuantity("quantity", element.getQuantity());
34934      }
34935      if (element.hasBodysite()) {
34936        openArray("bodysite");
34937        for (CodeableConcept e : element.getBodysite()) 
34938          composeCodeableConcept(null, e);
34939        closeArray();
34940      };
34941      if (element.hasFactorOverrideElement()) {
34942        composeDecimalCore("factorOverride", element.getFactorOverrideElement(), false);
34943        composeDecimalExtras("factorOverride", element.getFactorOverrideElement(), false);
34944      }
34945      if (element.hasPriceOverride()) {
34946        composeMoney("priceOverride", element.getPriceOverride());
34947      }
34948      if (element.hasOverrideReasonElement()) {
34949        composeStringCore("overrideReason", element.getOverrideReasonElement(), false);
34950        composeStringExtras("overrideReason", element.getOverrideReasonElement(), false);
34951      }
34952      if (element.hasEnterer()) {
34953        composeReference("enterer", element.getEnterer());
34954      }
34955      if (element.hasEnteredDateElement()) {
34956        composeDateTimeCore("enteredDate", element.getEnteredDateElement(), false);
34957        composeDateTimeExtras("enteredDate", element.getEnteredDateElement(), false);
34958      }
34959      if (element.hasReason()) {
34960        openArray("reason");
34961        for (CodeableConcept e : element.getReason()) 
34962          composeCodeableConcept(null, e);
34963        closeArray();
34964      };
34965      if (element.hasService()) {
34966        openArray("service");
34967        for (Reference e : element.getService()) 
34968          composeReference(null, e);
34969        closeArray();
34970      };
34971      if (element.hasProduct()) {
34972        composeType("product", element.getProduct());
34973      }
34974      if (element.hasAccount()) {
34975        openArray("account");
34976        for (Reference e : element.getAccount()) 
34977          composeReference(null, e);
34978        closeArray();
34979      };
34980      if (element.hasNote()) {
34981        openArray("note");
34982        for (Annotation e : element.getNote()) 
34983          composeAnnotation(null, e);
34984        closeArray();
34985      };
34986      if (element.hasSupportingInformation()) {
34987        openArray("supportingInformation");
34988        for (Reference e : element.getSupportingInformation()) 
34989          composeReference(null, e);
34990        closeArray();
34991      };
34992  }
34993
34994  protected void composeChargeItemChargeItemPerformerComponent(String name, ChargeItem.ChargeItemPerformerComponent element) throws IOException {
34995    if (element != null) {
34996      open(name);
34997      composeChargeItemChargeItemPerformerComponentInner(element);
34998      close();
34999    }
35000  }
35001
35002  protected void composeChargeItemChargeItemPerformerComponentInner(ChargeItem.ChargeItemPerformerComponent element) throws IOException {
35003      composeBackbone(element);
35004      if (element.hasFunction()) {
35005        composeCodeableConcept("function", element.getFunction());
35006      }
35007      if (element.hasActor()) {
35008        composeReference("actor", element.getActor());
35009      }
35010  }
35011
35012  protected void composeChargeItemDefinition(String name, ChargeItemDefinition element) throws IOException {
35013    if (element != null) {
35014      prop("resourceType", name);
35015      composeChargeItemDefinitionInner(element);
35016    }
35017  }
35018
35019  protected void composeChargeItemDefinitionInner(ChargeItemDefinition element) throws IOException {
35020      composeDomainResourceElements(element);
35021      if (element.hasUrlElement()) {
35022        composeUriCore("url", element.getUrlElement(), false);
35023        composeUriExtras("url", element.getUrlElement(), false);
35024      }
35025      if (element.hasIdentifier()) {
35026        openArray("identifier");
35027        for (Identifier e : element.getIdentifier()) 
35028          composeIdentifier(null, e);
35029        closeArray();
35030      };
35031      if (element.hasVersionElement()) {
35032        composeStringCore("version", element.getVersionElement(), false);
35033        composeStringExtras("version", element.getVersionElement(), false);
35034      }
35035      if (element.hasTitleElement()) {
35036        composeStringCore("title", element.getTitleElement(), false);
35037        composeStringExtras("title", element.getTitleElement(), false);
35038      }
35039      if (element.hasDerivedFromUri()) {
35040        openArray("derivedFromUri");
35041        for (UriType e : element.getDerivedFromUri()) 
35042          composeUriCore(null, e, true);
35043        closeArray();
35044        if (anyHasExtras(element.getDerivedFromUri())) {
35045          openArray("_derivedFromUri");
35046          for (UriType e : element.getDerivedFromUri()) 
35047            composeUriExtras(null, e, true);
35048          closeArray();
35049        }
35050      };
35051      if (element.hasPartOf()) {
35052        openArray("partOf");
35053        for (CanonicalType e : element.getPartOf()) 
35054          composeCanonicalCore(null, e, true);
35055        closeArray();
35056        if (anyHasExtras(element.getPartOf())) {
35057          openArray("_partOf");
35058          for (CanonicalType e : element.getPartOf()) 
35059            composeCanonicalExtras(null, e, true);
35060          closeArray();
35061        }
35062      };
35063      if (element.hasReplaces()) {
35064        openArray("replaces");
35065        for (CanonicalType e : element.getReplaces()) 
35066          composeCanonicalCore(null, e, true);
35067        closeArray();
35068        if (anyHasExtras(element.getReplaces())) {
35069          openArray("_replaces");
35070          for (CanonicalType e : element.getReplaces()) 
35071            composeCanonicalExtras(null, e, true);
35072          closeArray();
35073        }
35074      };
35075      if (element.hasStatusElement()) {
35076        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35077        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35078      }
35079      if (element.hasExperimentalElement()) {
35080        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35081        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35082      }
35083      if (element.hasDateElement()) {
35084        composeDateTimeCore("date", element.getDateElement(), false);
35085        composeDateTimeExtras("date", element.getDateElement(), false);
35086      }
35087      if (element.hasPublisherElement()) {
35088        composeStringCore("publisher", element.getPublisherElement(), false);
35089        composeStringExtras("publisher", element.getPublisherElement(), false);
35090      }
35091      if (element.hasContact()) {
35092        openArray("contact");
35093        for (ContactDetail e : element.getContact()) 
35094          composeContactDetail(null, e);
35095        closeArray();
35096      };
35097      if (element.hasDescriptionElement()) {
35098        composeMarkdownCore("description", element.getDescriptionElement(), false);
35099        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35100      }
35101      if (element.hasUseContext()) {
35102        openArray("useContext");
35103        for (UsageContext e : element.getUseContext()) 
35104          composeUsageContext(null, e);
35105        closeArray();
35106      };
35107      if (element.hasJurisdiction()) {
35108        openArray("jurisdiction");
35109        for (CodeableConcept e : element.getJurisdiction()) 
35110          composeCodeableConcept(null, e);
35111        closeArray();
35112      };
35113      if (element.hasCopyrightElement()) {
35114        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35115        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35116      }
35117      if (element.hasApprovalDateElement()) {
35118        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
35119        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
35120      }
35121      if (element.hasLastReviewDateElement()) {
35122        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
35123        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
35124      }
35125      if (element.hasEffectivePeriod()) {
35126        composePeriod("effectivePeriod", element.getEffectivePeriod());
35127      }
35128      if (element.hasCode()) {
35129        composeCodeableConcept("code", element.getCode());
35130      }
35131      if (element.hasInstance()) {
35132        openArray("instance");
35133        for (Reference e : element.getInstance()) 
35134          composeReference(null, e);
35135        closeArray();
35136      };
35137      if (element.hasApplicability()) {
35138        openArray("applicability");
35139        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
35140          composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(null, e);
35141        closeArray();
35142      };
35143      if (element.hasPropertyGroup()) {
35144        openArray("propertyGroup");
35145        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent e : element.getPropertyGroup()) 
35146          composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(null, e);
35147        closeArray();
35148      };
35149  }
35150
35151  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(String name, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
35152    if (element != null) {
35153      open(name);
35154      composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentInner(element);
35155      close();
35156    }
35157  }
35158
35159  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentInner(ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
35160      composeBackbone(element);
35161      if (element.hasDescriptionElement()) {
35162        composeStringCore("description", element.getDescriptionElement(), false);
35163        composeStringExtras("description", element.getDescriptionElement(), false);
35164      }
35165      if (element.hasLanguageElement()) {
35166        composeStringCore("language", element.getLanguageElement(), false);
35167        composeStringExtras("language", element.getLanguageElement(), false);
35168      }
35169      if (element.hasExpressionElement()) {
35170        composeStringCore("expression", element.getExpressionElement(), false);
35171        composeStringExtras("expression", element.getExpressionElement(), false);
35172      }
35173  }
35174
35175  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
35176    if (element != null) {
35177      open(name);
35178      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentInner(element);
35179      close();
35180    }
35181  }
35182
35183  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentInner(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
35184      composeBackbone(element);
35185      if (element.hasApplicability()) {
35186        openArray("applicability");
35187        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
35188          composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(null, e);
35189        closeArray();
35190      };
35191      if (element.hasPriceComponent()) {
35192        openArray("priceComponent");
35193        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent e : element.getPriceComponent()) 
35194          composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(null, e);
35195        closeArray();
35196      };
35197  }
35198
35199  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
35200    if (element != null) {
35201      open(name);
35202      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentInner(element);
35203      close();
35204    }
35205  }
35206
35207  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentInner(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
35208      composeBackbone(element);
35209      if (element.hasTypeElement()) {
35210        composeEnumerationCore("type", element.getTypeElement(), new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory(), false);
35211        composeEnumerationExtras("type", element.getTypeElement(), new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory(), false);
35212      }
35213      if (element.hasCode()) {
35214        composeCodeableConcept("code", element.getCode());
35215      }
35216      if (element.hasFactorElement()) {
35217        composeDecimalCore("factor", element.getFactorElement(), false);
35218        composeDecimalExtras("factor", element.getFactorElement(), false);
35219      }
35220      if (element.hasAmount()) {
35221        composeMoney("amount", element.getAmount());
35222      }
35223  }
35224
35225  protected void composeClaim(String name, Claim element) throws IOException {
35226    if (element != null) {
35227      prop("resourceType", name);
35228      composeClaimInner(element);
35229    }
35230  }
35231
35232  protected void composeClaimInner(Claim element) throws IOException {
35233      composeDomainResourceElements(element);
35234      if (element.hasIdentifier()) {
35235        openArray("identifier");
35236        for (Identifier e : element.getIdentifier()) 
35237          composeIdentifier(null, e);
35238        closeArray();
35239      };
35240      if (element.hasStatusElement()) {
35241        composeEnumerationCore("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
35242        composeEnumerationExtras("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
35243      }
35244      if (element.hasType()) {
35245        composeCodeableConcept("type", element.getType());
35246      }
35247      if (element.hasSubType()) {
35248        composeCodeableConcept("subType", element.getSubType());
35249      }
35250      if (element.hasUseElement()) {
35251        composeEnumerationCore("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
35252        composeEnumerationExtras("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
35253      }
35254      if (element.hasPatient()) {
35255        composeReference("patient", element.getPatient());
35256      }
35257      if (element.hasBillablePeriod()) {
35258        composePeriod("billablePeriod", element.getBillablePeriod());
35259      }
35260      if (element.hasCreatedElement()) {
35261        composeDateTimeCore("created", element.getCreatedElement(), false);
35262        composeDateTimeExtras("created", element.getCreatedElement(), false);
35263      }
35264      if (element.hasEnterer()) {
35265        composeReference("enterer", element.getEnterer());
35266      }
35267      if (element.hasInsurer()) {
35268        composeReference("insurer", element.getInsurer());
35269      }
35270      if (element.hasProvider()) {
35271        composeReference("provider", element.getProvider());
35272      }
35273      if (element.hasPriority()) {
35274        composeCodeableConcept("priority", element.getPriority());
35275      }
35276      if (element.hasFundsReserve()) {
35277        composeCodeableConcept("fundsReserve", element.getFundsReserve());
35278      }
35279      if (element.hasRelated()) {
35280        openArray("related");
35281        for (Claim.RelatedClaimComponent e : element.getRelated()) 
35282          composeClaimRelatedClaimComponent(null, e);
35283        closeArray();
35284      };
35285      if (element.hasPrescription()) {
35286        composeReference("prescription", element.getPrescription());
35287      }
35288      if (element.hasOriginalPrescription()) {
35289        composeReference("originalPrescription", element.getOriginalPrescription());
35290      }
35291      if (element.hasPayee()) {
35292        composeClaimPayeeComponent("payee", element.getPayee());
35293      }
35294      if (element.hasReferral()) {
35295        composeReference("referral", element.getReferral());
35296      }
35297      if (element.hasFacility()) {
35298        composeReference("facility", element.getFacility());
35299      }
35300      if (element.hasCareTeam()) {
35301        openArray("careTeam");
35302        for (Claim.CareTeamComponent e : element.getCareTeam()) 
35303          composeClaimCareTeamComponent(null, e);
35304        closeArray();
35305      };
35306      if (element.hasSupportingInfo()) {
35307        openArray("supportingInfo");
35308        for (Claim.SupportingInformationComponent e : element.getSupportingInfo()) 
35309          composeClaimSupportingInformationComponent(null, e);
35310        closeArray();
35311      };
35312      if (element.hasDiagnosis()) {
35313        openArray("diagnosis");
35314        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
35315          composeClaimDiagnosisComponent(null, e);
35316        closeArray();
35317      };
35318      if (element.hasProcedure()) {
35319        openArray("procedure");
35320        for (Claim.ProcedureComponent e : element.getProcedure()) 
35321          composeClaimProcedureComponent(null, e);
35322        closeArray();
35323      };
35324      if (element.hasInsurance()) {
35325        openArray("insurance");
35326        for (Claim.InsuranceComponent e : element.getInsurance()) 
35327          composeClaimInsuranceComponent(null, e);
35328        closeArray();
35329      };
35330      if (element.hasAccident()) {
35331        composeClaimAccidentComponent("accident", element.getAccident());
35332      }
35333      if (element.hasItem()) {
35334        openArray("item");
35335        for (Claim.ItemComponent e : element.getItem()) 
35336          composeClaimItemComponent(null, e);
35337        closeArray();
35338      };
35339      if (element.hasTotal()) {
35340        composeMoney("total", element.getTotal());
35341      }
35342  }
35343
35344  protected void composeClaimRelatedClaimComponent(String name, Claim.RelatedClaimComponent element) throws IOException {
35345    if (element != null) {
35346      open(name);
35347      composeClaimRelatedClaimComponentInner(element);
35348      close();
35349    }
35350  }
35351
35352  protected void composeClaimRelatedClaimComponentInner(Claim.RelatedClaimComponent element) throws IOException {
35353      composeBackbone(element);
35354      if (element.hasClaim()) {
35355        composeReference("claim", element.getClaim());
35356      }
35357      if (element.hasRelationship()) {
35358        composeCodeableConcept("relationship", element.getRelationship());
35359      }
35360      if (element.hasReference()) {
35361        composeIdentifier("reference", element.getReference());
35362      }
35363  }
35364
35365  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
35366    if (element != null) {
35367      open(name);
35368      composeClaimPayeeComponentInner(element);
35369      close();
35370    }
35371  }
35372
35373  protected void composeClaimPayeeComponentInner(Claim.PayeeComponent element) throws IOException {
35374      composeBackbone(element);
35375      if (element.hasType()) {
35376        composeCodeableConcept("type", element.getType());
35377      }
35378      if (element.hasParty()) {
35379        composeReference("party", element.getParty());
35380      }
35381  }
35382
35383  protected void composeClaimCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
35384    if (element != null) {
35385      open(name);
35386      composeClaimCareTeamComponentInner(element);
35387      close();
35388    }
35389  }
35390
35391  protected void composeClaimCareTeamComponentInner(Claim.CareTeamComponent element) throws IOException {
35392      composeBackbone(element);
35393      if (element.hasSequenceElement()) {
35394        composePositiveIntCore("sequence", element.getSequenceElement(), false);
35395        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
35396      }
35397      if (element.hasProvider()) {
35398        composeReference("provider", element.getProvider());
35399      }
35400      if (element.hasResponsibleElement()) {
35401        composeBooleanCore("responsible", element.getResponsibleElement(), false);
35402        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
35403      }
35404      if (element.hasRole()) {
35405        composeCodeableConcept("role", element.getRole());
35406      }
35407      if (element.hasQualification()) {
35408        composeCodeableConcept("qualification", element.getQualification());
35409      }
35410  }
35411
35412  protected void composeClaimSupportingInformationComponent(String name, Claim.SupportingInformationComponent element) throws IOException {
35413    if (element != null) {
35414      open(name);
35415      composeClaimSupportingInformationComponentInner(element);
35416      close();
35417    }
35418  }
35419
35420  protected void composeClaimSupportingInformationComponentInner(Claim.SupportingInformationComponent element) throws IOException {
35421      composeBackbone(element);
35422      if (element.hasSequenceElement()) {
35423        composePositiveIntCore("sequence", element.getSequenceElement(), false);
35424        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
35425      }
35426      if (element.hasCategory()) {
35427        composeCodeableConcept("category", element.getCategory());
35428      }
35429      if (element.hasCode()) {
35430        composeCodeableConcept("code", element.getCode());
35431      }
35432      if (element.hasTiming()) {
35433        composeType("timing", element.getTiming());
35434      }
35435      if (element.hasValue()) {
35436        composeType("value", element.getValue());
35437      }
35438      if (element.hasReason()) {
35439        composeCodeableConcept("reason", element.getReason());
35440      }
35441  }
35442
35443  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
35444    if (element != null) {
35445      open(name);
35446      composeClaimDiagnosisComponentInner(element);
35447      close();
35448    }
35449  }
35450
35451  protected void composeClaimDiagnosisComponentInner(Claim.DiagnosisComponent element) throws IOException {
35452      composeBackbone(element);
35453      if (element.hasSequenceElement()) {
35454        composePositiveIntCore("sequence", element.getSequenceElement(), false);
35455        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
35456      }
35457      if (element.hasDiagnosis()) {
35458        composeType("diagnosis", element.getDiagnosis());
35459      }
35460      if (element.hasType()) {
35461        openArray("type");
35462        for (CodeableConcept e : element.getType()) 
35463          composeCodeableConcept(null, e);
35464        closeArray();
35465      };
35466      if (element.hasOnAdmission()) {
35467        composeCodeableConcept("onAdmission", element.getOnAdmission());
35468      }
35469      if (element.hasPackageCode()) {
35470        composeCodeableConcept("packageCode", element.getPackageCode());
35471      }
35472  }
35473
35474  protected void composeClaimProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
35475    if (element != null) {
35476      open(name);
35477      composeClaimProcedureComponentInner(element);
35478      close();
35479    }
35480  }
35481
35482  protected void composeClaimProcedureComponentInner(Claim.ProcedureComponent element) throws IOException {
35483      composeBackbone(element);
35484      if (element.hasSequenceElement()) {
35485        composePositiveIntCore("sequence", element.getSequenceElement(), false);
35486        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
35487      }
35488      if (element.hasType()) {
35489        openArray("type");
35490        for (CodeableConcept e : element.getType()) 
35491          composeCodeableConcept(null, e);
35492        closeArray();
35493      };
35494      if (element.hasDateElement()) {
35495        composeDateTimeCore("date", element.getDateElement(), false);
35496        composeDateTimeExtras("date", element.getDateElement(), false);
35497      }
35498      if (element.hasProcedure()) {
35499        composeType("procedure", element.getProcedure());
35500      }
35501      if (element.hasUdi()) {
35502        openArray("udi");
35503        for (Reference e : element.getUdi()) 
35504          composeReference(null, e);
35505        closeArray();
35506      };
35507  }
35508
35509  protected void composeClaimInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
35510    if (element != null) {
35511      open(name);
35512      composeClaimInsuranceComponentInner(element);
35513      close();
35514    }
35515  }
35516
35517  protected void composeClaimInsuranceComponentInner(Claim.InsuranceComponent element) throws IOException {
35518      composeBackbone(element);
35519      if (element.hasSequenceElement()) {
35520        composePositiveIntCore("sequence", element.getSequenceElement(), false);
35521        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
35522      }
35523      if (element.hasFocalElement()) {
35524        composeBooleanCore("focal", element.getFocalElement(), false);
35525        composeBooleanExtras("focal", element.getFocalElement(), false);
35526      }
35527      if (element.hasIdentifier()) {
35528        composeIdentifier("identifier", element.getIdentifier());
35529      }
35530      if (element.hasCoverage()) {
35531        composeReference("coverage", element.getCoverage());
35532      }
35533      if (element.hasBusinessArrangementElement()) {
35534        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
35535        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
35536      }
35537      if (element.hasPreAuthRef()) {
35538        openArray("preAuthRef");
35539        for (StringType e : element.getPreAuthRef()) 
35540          composeStringCore(null, e, true);
35541        closeArray();
35542        if (anyHasExtras(element.getPreAuthRef())) {
35543          openArray("_preAuthRef");
35544          for (StringType e : element.getPreAuthRef()) 
35545            composeStringExtras(null, e, true);
35546          closeArray();
35547        }
35548      };
35549      if (element.hasClaimResponse()) {
35550        composeReference("claimResponse", element.getClaimResponse());
35551      }
35552  }
35553
35554  protected void composeClaimAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
35555    if (element != null) {
35556      open(name);
35557      composeClaimAccidentComponentInner(element);
35558      close();
35559    }
35560  }
35561
35562  protected void composeClaimAccidentComponentInner(Claim.AccidentComponent element) throws IOException {
35563      composeBackbone(element);
35564      if (element.hasDateElement()) {
35565        composeDateCore("date", element.getDateElement(), false);
35566        composeDateExtras("date", element.getDateElement(), false);
35567      }
35568      if (element.hasType()) {
35569        composeCodeableConcept("type", element.getType());
35570      }
35571      if (element.hasLocation()) {
35572        composeType("location", element.getLocation());
35573      }
35574  }
35575
35576  protected void composeClaimItemComponent(String name, Claim.ItemComponent element) throws IOException {
35577    if (element != null) {
35578      open(name);
35579      composeClaimItemComponentInner(element);
35580      close();
35581    }
35582  }
35583
35584  protected void composeClaimItemComponentInner(Claim.ItemComponent element) throws IOException {
35585      composeBackbone(element);
35586      if (element.hasSequenceElement()) {
35587        composePositiveIntCore("sequence", element.getSequenceElement(), false);
35588        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
35589      }
35590      if (element.hasCareTeamSequence()) {
35591        openArray("careTeamSequence");
35592        for (PositiveIntType e : element.getCareTeamSequence()) 
35593          composePositiveIntCore(null, e, true);
35594        closeArray();
35595        if (anyHasExtras(element.getCareTeamSequence())) {
35596          openArray("_careTeamSequence");
35597          for (PositiveIntType e : element.getCareTeamSequence()) 
35598            composePositiveIntExtras(null, e, true);
35599          closeArray();
35600        }
35601      };
35602      if (element.hasDiagnosisSequence()) {
35603        openArray("diagnosisSequence");
35604        for (PositiveIntType e : element.getDiagnosisSequence()) 
35605          composePositiveIntCore(null, e, true);
35606        closeArray();
35607        if (anyHasExtras(element.getDiagnosisSequence())) {
35608          openArray("_diagnosisSequence");
35609          for (PositiveIntType e : element.getDiagnosisSequence()) 
35610            composePositiveIntExtras(null, e, true);
35611          closeArray();
35612        }
35613      };
35614      if (element.hasProcedureSequence()) {
35615        openArray("procedureSequence");
35616        for (PositiveIntType e : element.getProcedureSequence()) 
35617          composePositiveIntCore(null, e, true);
35618        closeArray();
35619        if (anyHasExtras(element.getProcedureSequence())) {
35620          openArray("_procedureSequence");
35621          for (PositiveIntType e : element.getProcedureSequence()) 
35622            composePositiveIntExtras(null, e, true);
35623          closeArray();
35624        }
35625      };
35626      if (element.hasInformationSequence()) {
35627        openArray("informationSequence");
35628        for (PositiveIntType e : element.getInformationSequence()) 
35629          composePositiveIntCore(null, e, true);
35630        closeArray();
35631        if (anyHasExtras(element.getInformationSequence())) {
35632          openArray("_informationSequence");
35633          for (PositiveIntType e : element.getInformationSequence()) 
35634            composePositiveIntExtras(null, e, true);
35635          closeArray();
35636        }
35637      };
35638      if (element.hasRevenue()) {
35639        composeCodeableConcept("revenue", element.getRevenue());
35640      }
35641      if (element.hasCategory()) {
35642        composeCodeableConcept("category", element.getCategory());
35643      }
35644      if (element.hasProductOrService()) {
35645        composeCodeableConcept("productOrService", element.getProductOrService());
35646      }
35647      if (element.hasModifier()) {
35648        openArray("modifier");
35649        for (CodeableConcept e : element.getModifier()) 
35650          composeCodeableConcept(null, e);
35651        closeArray();
35652      };
35653      if (element.hasProgramCode()) {
35654        openArray("programCode");
35655        for (CodeableConcept e : element.getProgramCode()) 
35656          composeCodeableConcept(null, e);
35657        closeArray();
35658      };
35659      if (element.hasServiced()) {
35660        composeType("serviced", element.getServiced());
35661      }
35662      if (element.hasLocation()) {
35663        composeType("location", element.getLocation());
35664      }
35665      if (element.hasQuantity()) {
35666        composeQuantity("quantity", element.getQuantity());
35667      }
35668      if (element.hasUnitPrice()) {
35669        composeMoney("unitPrice", element.getUnitPrice());
35670      }
35671      if (element.hasFactorElement()) {
35672        composeDecimalCore("factor", element.getFactorElement(), false);
35673        composeDecimalExtras("factor", element.getFactorElement(), false);
35674      }
35675      if (element.hasNet()) {
35676        composeMoney("net", element.getNet());
35677      }
35678      if (element.hasUdi()) {
35679        openArray("udi");
35680        for (Reference e : element.getUdi()) 
35681          composeReference(null, e);
35682        closeArray();
35683      };
35684      if (element.hasBodySite()) {
35685        composeCodeableConcept("bodySite", element.getBodySite());
35686      }
35687      if (element.hasSubSite()) {
35688        openArray("subSite");
35689        for (CodeableConcept e : element.getSubSite()) 
35690          composeCodeableConcept(null, e);
35691        closeArray();
35692      };
35693      if (element.hasEncounter()) {
35694        openArray("encounter");
35695        for (Reference e : element.getEncounter()) 
35696          composeReference(null, e);
35697        closeArray();
35698      };
35699      if (element.hasDetail()) {
35700        openArray("detail");
35701        for (Claim.DetailComponent e : element.getDetail()) 
35702          composeClaimDetailComponent(null, e);
35703        closeArray();
35704      };
35705  }
35706
35707  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
35708    if (element != null) {
35709      open(name);
35710      composeClaimDetailComponentInner(element);
35711      close();
35712    }
35713  }
35714
35715  protected void composeClaimDetailComponentInner(Claim.DetailComponent element) throws IOException {
35716      composeBackbone(element);
35717      if (element.hasSequenceElement()) {
35718        composePositiveIntCore("sequence", element.getSequenceElement(), false);
35719        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
35720      }
35721      if (element.hasRevenue()) {
35722        composeCodeableConcept("revenue", element.getRevenue());
35723      }
35724      if (element.hasCategory()) {
35725        composeCodeableConcept("category", element.getCategory());
35726      }
35727      if (element.hasProductOrService()) {
35728        composeCodeableConcept("productOrService", element.getProductOrService());
35729      }
35730      if (element.hasModifier()) {
35731        openArray("modifier");
35732        for (CodeableConcept e : element.getModifier()) 
35733          composeCodeableConcept(null, e);
35734        closeArray();
35735      };
35736      if (element.hasProgramCode()) {
35737        openArray("programCode");
35738        for (CodeableConcept e : element.getProgramCode()) 
35739          composeCodeableConcept(null, e);
35740        closeArray();
35741      };
35742      if (element.hasQuantity()) {
35743        composeQuantity("quantity", element.getQuantity());
35744      }
35745      if (element.hasUnitPrice()) {
35746        composeMoney("unitPrice", element.getUnitPrice());
35747      }
35748      if (element.hasFactorElement()) {
35749        composeDecimalCore("factor", element.getFactorElement(), false);
35750        composeDecimalExtras("factor", element.getFactorElement(), false);
35751      }
35752      if (element.hasNet()) {
35753        composeMoney("net", element.getNet());
35754      }
35755      if (element.hasUdi()) {
35756        openArray("udi");
35757        for (Reference e : element.getUdi()) 
35758          composeReference(null, e);
35759        closeArray();
35760      };
35761      if (element.hasSubDetail()) {
35762        openArray("subDetail");
35763        for (Claim.SubDetailComponent e : element.getSubDetail()) 
35764          composeClaimSubDetailComponent(null, e);
35765        closeArray();
35766      };
35767  }
35768
35769  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
35770    if (element != null) {
35771      open(name);
35772      composeClaimSubDetailComponentInner(element);
35773      close();
35774    }
35775  }
35776
35777  protected void composeClaimSubDetailComponentInner(Claim.SubDetailComponent element) throws IOException {
35778      composeBackbone(element);
35779      if (element.hasSequenceElement()) {
35780        composePositiveIntCore("sequence", element.getSequenceElement(), false);
35781        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
35782      }
35783      if (element.hasRevenue()) {
35784        composeCodeableConcept("revenue", element.getRevenue());
35785      }
35786      if (element.hasCategory()) {
35787        composeCodeableConcept("category", element.getCategory());
35788      }
35789      if (element.hasProductOrService()) {
35790        composeCodeableConcept("productOrService", element.getProductOrService());
35791      }
35792      if (element.hasModifier()) {
35793        openArray("modifier");
35794        for (CodeableConcept e : element.getModifier()) 
35795          composeCodeableConcept(null, e);
35796        closeArray();
35797      };
35798      if (element.hasProgramCode()) {
35799        openArray("programCode");
35800        for (CodeableConcept e : element.getProgramCode()) 
35801          composeCodeableConcept(null, e);
35802        closeArray();
35803      };
35804      if (element.hasQuantity()) {
35805        composeQuantity("quantity", element.getQuantity());
35806      }
35807      if (element.hasUnitPrice()) {
35808        composeMoney("unitPrice", element.getUnitPrice());
35809      }
35810      if (element.hasFactorElement()) {
35811        composeDecimalCore("factor", element.getFactorElement(), false);
35812        composeDecimalExtras("factor", element.getFactorElement(), false);
35813      }
35814      if (element.hasNet()) {
35815        composeMoney("net", element.getNet());
35816      }
35817      if (element.hasUdi()) {
35818        openArray("udi");
35819        for (Reference e : element.getUdi()) 
35820          composeReference(null, e);
35821        closeArray();
35822      };
35823  }
35824
35825  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
35826    if (element != null) {
35827      prop("resourceType", name);
35828      composeClaimResponseInner(element);
35829    }
35830  }
35831
35832  protected void composeClaimResponseInner(ClaimResponse element) throws IOException {
35833      composeDomainResourceElements(element);
35834      if (element.hasIdentifier()) {
35835        openArray("identifier");
35836        for (Identifier e : element.getIdentifier()) 
35837          composeIdentifier(null, e);
35838        closeArray();
35839      };
35840      if (element.hasStatusElement()) {
35841        composeEnumerationCore("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
35842        composeEnumerationExtras("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
35843      }
35844      if (element.hasType()) {
35845        composeCodeableConcept("type", element.getType());
35846      }
35847      if (element.hasSubType()) {
35848        composeCodeableConcept("subType", element.getSubType());
35849      }
35850      if (element.hasUseElement()) {
35851        composeEnumerationCore("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
35852        composeEnumerationExtras("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
35853      }
35854      if (element.hasPatient()) {
35855        composeReference("patient", element.getPatient());
35856      }
35857      if (element.hasCreatedElement()) {
35858        composeDateTimeCore("created", element.getCreatedElement(), false);
35859        composeDateTimeExtras("created", element.getCreatedElement(), false);
35860      }
35861      if (element.hasInsurer()) {
35862        composeReference("insurer", element.getInsurer());
35863      }
35864      if (element.hasRequestor()) {
35865        composeReference("requestor", element.getRequestor());
35866      }
35867      if (element.hasRequest()) {
35868        composeReference("request", element.getRequest());
35869      }
35870      if (element.hasOutcomeElement()) {
35871        composeEnumerationCore("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(), false);
35872        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(), false);
35873      }
35874      if (element.hasDispositionElement()) {
35875        composeStringCore("disposition", element.getDispositionElement(), false);
35876        composeStringExtras("disposition", element.getDispositionElement(), false);
35877      }
35878      if (element.hasPreAuthRefElement()) {
35879        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
35880        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
35881      }
35882      if (element.hasPreAuthPeriod()) {
35883        composePeriod("preAuthPeriod", element.getPreAuthPeriod());
35884      }
35885      if (element.hasPayeeType()) {
35886        composeCodeableConcept("payeeType", element.getPayeeType());
35887      }
35888      if (element.hasItem()) {
35889        openArray("item");
35890        for (ClaimResponse.ItemComponent e : element.getItem()) 
35891          composeClaimResponseItemComponent(null, e);
35892        closeArray();
35893      };
35894      if (element.hasAddItem()) {
35895        openArray("addItem");
35896        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
35897          composeClaimResponseAddedItemComponent(null, e);
35898        closeArray();
35899      };
35900      if (element.hasAdjudication()) {
35901        openArray("adjudication");
35902        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
35903          composeClaimResponseAdjudicationComponent(null, e);
35904        closeArray();
35905      };
35906      if (element.hasTotal()) {
35907        openArray("total");
35908        for (ClaimResponse.TotalComponent e : element.getTotal()) 
35909          composeClaimResponseTotalComponent(null, e);
35910        closeArray();
35911      };
35912      if (element.hasPayment()) {
35913        composeClaimResponsePaymentComponent("payment", element.getPayment());
35914      }
35915      if (element.hasFundsReserve()) {
35916        composeCodeableConcept("fundsReserve", element.getFundsReserve());
35917      }
35918      if (element.hasFormCode()) {
35919        composeCodeableConcept("formCode", element.getFormCode());
35920      }
35921      if (element.hasForm()) {
35922        composeAttachment("form", element.getForm());
35923      }
35924      if (element.hasProcessNote()) {
35925        openArray("processNote");
35926        for (ClaimResponse.NoteComponent e : element.getProcessNote()) 
35927          composeClaimResponseNoteComponent(null, e);
35928        closeArray();
35929      };
35930      if (element.hasCommunicationRequest()) {
35931        openArray("communicationRequest");
35932        for (Reference e : element.getCommunicationRequest()) 
35933          composeReference(null, e);
35934        closeArray();
35935      };
35936      if (element.hasInsurance()) {
35937        openArray("insurance");
35938        for (ClaimResponse.InsuranceComponent e : element.getInsurance()) 
35939          composeClaimResponseInsuranceComponent(null, e);
35940        closeArray();
35941      };
35942      if (element.hasError()) {
35943        openArray("error");
35944        for (ClaimResponse.ErrorComponent e : element.getError()) 
35945          composeClaimResponseErrorComponent(null, e);
35946        closeArray();
35947      };
35948  }
35949
35950  protected void composeClaimResponseItemComponent(String name, ClaimResponse.ItemComponent element) throws IOException {
35951    if (element != null) {
35952      open(name);
35953      composeClaimResponseItemComponentInner(element);
35954      close();
35955    }
35956  }
35957
35958  protected void composeClaimResponseItemComponentInner(ClaimResponse.ItemComponent element) throws IOException {
35959      composeBackbone(element);
35960      if (element.hasItemSequenceElement()) {
35961        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
35962        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
35963      }
35964      if (element.hasNoteNumber()) {
35965        openArray("noteNumber");
35966        for (PositiveIntType e : element.getNoteNumber()) 
35967          composePositiveIntCore(null, e, true);
35968        closeArray();
35969        if (anyHasExtras(element.getNoteNumber())) {
35970          openArray("_noteNumber");
35971          for (PositiveIntType e : element.getNoteNumber()) 
35972            composePositiveIntExtras(null, e, true);
35973          closeArray();
35974        }
35975      };
35976      if (element.hasAdjudication()) {
35977        openArray("adjudication");
35978        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
35979          composeClaimResponseAdjudicationComponent(null, e);
35980        closeArray();
35981      };
35982      if (element.hasDetail()) {
35983        openArray("detail");
35984        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
35985          composeClaimResponseItemDetailComponent(null, e);
35986        closeArray();
35987      };
35988  }
35989
35990  protected void composeClaimResponseAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element) throws IOException {
35991    if (element != null) {
35992      open(name);
35993      composeClaimResponseAdjudicationComponentInner(element);
35994      close();
35995    }
35996  }
35997
35998  protected void composeClaimResponseAdjudicationComponentInner(ClaimResponse.AdjudicationComponent element) throws IOException {
35999      composeBackbone(element);
36000      if (element.hasCategory()) {
36001        composeCodeableConcept("category", element.getCategory());
36002      }
36003      if (element.hasReason()) {
36004        composeCodeableConcept("reason", element.getReason());
36005      }
36006      if (element.hasAmount()) {
36007        composeMoney("amount", element.getAmount());
36008      }
36009      if (element.hasValueElement()) {
36010        composeDecimalCore("value", element.getValueElement(), false);
36011        composeDecimalExtras("value", element.getValueElement(), false);
36012      }
36013  }
36014
36015  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
36016    if (element != null) {
36017      open(name);
36018      composeClaimResponseItemDetailComponentInner(element);
36019      close();
36020    }
36021  }
36022
36023  protected void composeClaimResponseItemDetailComponentInner(ClaimResponse.ItemDetailComponent element) throws IOException {
36024      composeBackbone(element);
36025      if (element.hasDetailSequenceElement()) {
36026        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
36027        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
36028      }
36029      if (element.hasNoteNumber()) {
36030        openArray("noteNumber");
36031        for (PositiveIntType e : element.getNoteNumber()) 
36032          composePositiveIntCore(null, e, true);
36033        closeArray();
36034        if (anyHasExtras(element.getNoteNumber())) {
36035          openArray("_noteNumber");
36036          for (PositiveIntType e : element.getNoteNumber()) 
36037            composePositiveIntExtras(null, e, true);
36038          closeArray();
36039        }
36040      };
36041      if (element.hasAdjudication()) {
36042        openArray("adjudication");
36043        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
36044          composeClaimResponseAdjudicationComponent(null, e);
36045        closeArray();
36046      };
36047      if (element.hasSubDetail()) {
36048        openArray("subDetail");
36049        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
36050          composeClaimResponseSubDetailComponent(null, e);
36051        closeArray();
36052      };
36053  }
36054
36055  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
36056    if (element != null) {
36057      open(name);
36058      composeClaimResponseSubDetailComponentInner(element);
36059      close();
36060    }
36061  }
36062
36063  protected void composeClaimResponseSubDetailComponentInner(ClaimResponse.SubDetailComponent element) throws IOException {
36064      composeBackbone(element);
36065      if (element.hasSubDetailSequenceElement()) {
36066        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
36067        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
36068      }
36069      if (element.hasNoteNumber()) {
36070        openArray("noteNumber");
36071        for (PositiveIntType e : element.getNoteNumber()) 
36072          composePositiveIntCore(null, e, true);
36073        closeArray();
36074        if (anyHasExtras(element.getNoteNumber())) {
36075          openArray("_noteNumber");
36076          for (PositiveIntType e : element.getNoteNumber()) 
36077            composePositiveIntExtras(null, e, true);
36078          closeArray();
36079        }
36080      };
36081      if (element.hasAdjudication()) {
36082        openArray("adjudication");
36083        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
36084          composeClaimResponseAdjudicationComponent(null, e);
36085        closeArray();
36086      };
36087  }
36088
36089  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
36090    if (element != null) {
36091      open(name);
36092      composeClaimResponseAddedItemComponentInner(element);
36093      close();
36094    }
36095  }
36096
36097  protected void composeClaimResponseAddedItemComponentInner(ClaimResponse.AddedItemComponent element) throws IOException {
36098      composeBackbone(element);
36099      if (element.hasItemSequence()) {
36100        openArray("itemSequence");
36101        for (PositiveIntType e : element.getItemSequence()) 
36102          composePositiveIntCore(null, e, true);
36103        closeArray();
36104        if (anyHasExtras(element.getItemSequence())) {
36105          openArray("_itemSequence");
36106          for (PositiveIntType e : element.getItemSequence()) 
36107            composePositiveIntExtras(null, e, true);
36108          closeArray();
36109        }
36110      };
36111      if (element.hasDetailSequence()) {
36112        openArray("detailSequence");
36113        for (PositiveIntType e : element.getDetailSequence()) 
36114          composePositiveIntCore(null, e, true);
36115        closeArray();
36116        if (anyHasExtras(element.getDetailSequence())) {
36117          openArray("_detailSequence");
36118          for (PositiveIntType e : element.getDetailSequence()) 
36119            composePositiveIntExtras(null, e, true);
36120          closeArray();
36121        }
36122      };
36123      if (element.hasSubdetailSequence()) {
36124        openArray("subdetailSequence");
36125        for (PositiveIntType e : element.getSubdetailSequence()) 
36126          composePositiveIntCore(null, e, true);
36127        closeArray();
36128        if (anyHasExtras(element.getSubdetailSequence())) {
36129          openArray("_subdetailSequence");
36130          for (PositiveIntType e : element.getSubdetailSequence()) 
36131            composePositiveIntExtras(null, e, true);
36132          closeArray();
36133        }
36134      };
36135      if (element.hasProvider()) {
36136        openArray("provider");
36137        for (Reference e : element.getProvider()) 
36138          composeReference(null, e);
36139        closeArray();
36140      };
36141      if (element.hasProductOrService()) {
36142        composeCodeableConcept("productOrService", element.getProductOrService());
36143      }
36144      if (element.hasModifier()) {
36145        openArray("modifier");
36146        for (CodeableConcept e : element.getModifier()) 
36147          composeCodeableConcept(null, e);
36148        closeArray();
36149      };
36150      if (element.hasProgramCode()) {
36151        openArray("programCode");
36152        for (CodeableConcept e : element.getProgramCode()) 
36153          composeCodeableConcept(null, e);
36154        closeArray();
36155      };
36156      if (element.hasServiced()) {
36157        composeType("serviced", element.getServiced());
36158      }
36159      if (element.hasLocation()) {
36160        composeType("location", element.getLocation());
36161      }
36162      if (element.hasQuantity()) {
36163        composeQuantity("quantity", element.getQuantity());
36164      }
36165      if (element.hasUnitPrice()) {
36166        composeMoney("unitPrice", element.getUnitPrice());
36167      }
36168      if (element.hasFactorElement()) {
36169        composeDecimalCore("factor", element.getFactorElement(), false);
36170        composeDecimalExtras("factor", element.getFactorElement(), false);
36171      }
36172      if (element.hasNet()) {
36173        composeMoney("net", element.getNet());
36174      }
36175      if (element.hasBodySite()) {
36176        composeCodeableConcept("bodySite", element.getBodySite());
36177      }
36178      if (element.hasSubSite()) {
36179        openArray("subSite");
36180        for (CodeableConcept e : element.getSubSite()) 
36181          composeCodeableConcept(null, e);
36182        closeArray();
36183      };
36184      if (element.hasNoteNumber()) {
36185        openArray("noteNumber");
36186        for (PositiveIntType e : element.getNoteNumber()) 
36187          composePositiveIntCore(null, e, true);
36188        closeArray();
36189        if (anyHasExtras(element.getNoteNumber())) {
36190          openArray("_noteNumber");
36191          for (PositiveIntType e : element.getNoteNumber()) 
36192            composePositiveIntExtras(null, e, true);
36193          closeArray();
36194        }
36195      };
36196      if (element.hasAdjudication()) {
36197        openArray("adjudication");
36198        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
36199          composeClaimResponseAdjudicationComponent(null, e);
36200        closeArray();
36201      };
36202      if (element.hasDetail()) {
36203        openArray("detail");
36204        for (ClaimResponse.AddedItemDetailComponent e : element.getDetail()) 
36205          composeClaimResponseAddedItemDetailComponent(null, e);
36206        closeArray();
36207      };
36208  }
36209
36210  protected void composeClaimResponseAddedItemDetailComponent(String name, ClaimResponse.AddedItemDetailComponent element) throws IOException {
36211    if (element != null) {
36212      open(name);
36213      composeClaimResponseAddedItemDetailComponentInner(element);
36214      close();
36215    }
36216  }
36217
36218  protected void composeClaimResponseAddedItemDetailComponentInner(ClaimResponse.AddedItemDetailComponent element) throws IOException {
36219      composeBackbone(element);
36220      if (element.hasProductOrService()) {
36221        composeCodeableConcept("productOrService", element.getProductOrService());
36222      }
36223      if (element.hasModifier()) {
36224        openArray("modifier");
36225        for (CodeableConcept e : element.getModifier()) 
36226          composeCodeableConcept(null, e);
36227        closeArray();
36228      };
36229      if (element.hasQuantity()) {
36230        composeQuantity("quantity", element.getQuantity());
36231      }
36232      if (element.hasUnitPrice()) {
36233        composeMoney("unitPrice", element.getUnitPrice());
36234      }
36235      if (element.hasFactorElement()) {
36236        composeDecimalCore("factor", element.getFactorElement(), false);
36237        composeDecimalExtras("factor", element.getFactorElement(), false);
36238      }
36239      if (element.hasNet()) {
36240        composeMoney("net", element.getNet());
36241      }
36242      if (element.hasNoteNumber()) {
36243        openArray("noteNumber");
36244        for (PositiveIntType e : element.getNoteNumber()) 
36245          composePositiveIntCore(null, e, true);
36246        closeArray();
36247        if (anyHasExtras(element.getNoteNumber())) {
36248          openArray("_noteNumber");
36249          for (PositiveIntType e : element.getNoteNumber()) 
36250            composePositiveIntExtras(null, e, true);
36251          closeArray();
36252        }
36253      };
36254      if (element.hasAdjudication()) {
36255        openArray("adjudication");
36256        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
36257          composeClaimResponseAdjudicationComponent(null, e);
36258        closeArray();
36259      };
36260      if (element.hasSubDetail()) {
36261        openArray("subDetail");
36262        for (ClaimResponse.AddedItemSubDetailComponent e : element.getSubDetail()) 
36263          composeClaimResponseAddedItemSubDetailComponent(null, e);
36264        closeArray();
36265      };
36266  }
36267
36268  protected void composeClaimResponseAddedItemSubDetailComponent(String name, ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
36269    if (element != null) {
36270      open(name);
36271      composeClaimResponseAddedItemSubDetailComponentInner(element);
36272      close();
36273    }
36274  }
36275
36276  protected void composeClaimResponseAddedItemSubDetailComponentInner(ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
36277      composeBackbone(element);
36278      if (element.hasProductOrService()) {
36279        composeCodeableConcept("productOrService", element.getProductOrService());
36280      }
36281      if (element.hasModifier()) {
36282        openArray("modifier");
36283        for (CodeableConcept e : element.getModifier()) 
36284          composeCodeableConcept(null, e);
36285        closeArray();
36286      };
36287      if (element.hasQuantity()) {
36288        composeQuantity("quantity", element.getQuantity());
36289      }
36290      if (element.hasUnitPrice()) {
36291        composeMoney("unitPrice", element.getUnitPrice());
36292      }
36293      if (element.hasFactorElement()) {
36294        composeDecimalCore("factor", element.getFactorElement(), false);
36295        composeDecimalExtras("factor", element.getFactorElement(), false);
36296      }
36297      if (element.hasNet()) {
36298        composeMoney("net", element.getNet());
36299      }
36300      if (element.hasNoteNumber()) {
36301        openArray("noteNumber");
36302        for (PositiveIntType e : element.getNoteNumber()) 
36303          composePositiveIntCore(null, e, true);
36304        closeArray();
36305        if (anyHasExtras(element.getNoteNumber())) {
36306          openArray("_noteNumber");
36307          for (PositiveIntType e : element.getNoteNumber()) 
36308            composePositiveIntExtras(null, e, true);
36309          closeArray();
36310        }
36311      };
36312      if (element.hasAdjudication()) {
36313        openArray("adjudication");
36314        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
36315          composeClaimResponseAdjudicationComponent(null, e);
36316        closeArray();
36317      };
36318  }
36319
36320  protected void composeClaimResponseTotalComponent(String name, ClaimResponse.TotalComponent element) throws IOException {
36321    if (element != null) {
36322      open(name);
36323      composeClaimResponseTotalComponentInner(element);
36324      close();
36325    }
36326  }
36327
36328  protected void composeClaimResponseTotalComponentInner(ClaimResponse.TotalComponent element) throws IOException {
36329      composeBackbone(element);
36330      if (element.hasCategory()) {
36331        composeCodeableConcept("category", element.getCategory());
36332      }
36333      if (element.hasAmount()) {
36334        composeMoney("amount", element.getAmount());
36335      }
36336  }
36337
36338  protected void composeClaimResponsePaymentComponent(String name, ClaimResponse.PaymentComponent element) throws IOException {
36339    if (element != null) {
36340      open(name);
36341      composeClaimResponsePaymentComponentInner(element);
36342      close();
36343    }
36344  }
36345
36346  protected void composeClaimResponsePaymentComponentInner(ClaimResponse.PaymentComponent element) throws IOException {
36347      composeBackbone(element);
36348      if (element.hasType()) {
36349        composeCodeableConcept("type", element.getType());
36350      }
36351      if (element.hasAdjustment()) {
36352        composeMoney("adjustment", element.getAdjustment());
36353      }
36354      if (element.hasAdjustmentReason()) {
36355        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
36356      }
36357      if (element.hasDateElement()) {
36358        composeDateCore("date", element.getDateElement(), false);
36359        composeDateExtras("date", element.getDateElement(), false);
36360      }
36361      if (element.hasAmount()) {
36362        composeMoney("amount", element.getAmount());
36363      }
36364      if (element.hasIdentifier()) {
36365        composeIdentifier("identifier", element.getIdentifier());
36366      }
36367  }
36368
36369  protected void composeClaimResponseNoteComponent(String name, ClaimResponse.NoteComponent element) throws IOException {
36370    if (element != null) {
36371      open(name);
36372      composeClaimResponseNoteComponentInner(element);
36373      close();
36374    }
36375  }
36376
36377  protected void composeClaimResponseNoteComponentInner(ClaimResponse.NoteComponent element) throws IOException {
36378      composeBackbone(element);
36379      if (element.hasNumberElement()) {
36380        composePositiveIntCore("number", element.getNumberElement(), false);
36381        composePositiveIntExtras("number", element.getNumberElement(), false);
36382      }
36383      if (element.hasTypeElement()) {
36384        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
36385        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
36386      }
36387      if (element.hasTextElement()) {
36388        composeStringCore("text", element.getTextElement(), false);
36389        composeStringExtras("text", element.getTextElement(), false);
36390      }
36391      if (element.hasLanguage()) {
36392        composeCodeableConcept("language", element.getLanguage());
36393      }
36394  }
36395
36396  protected void composeClaimResponseInsuranceComponent(String name, ClaimResponse.InsuranceComponent element) throws IOException {
36397    if (element != null) {
36398      open(name);
36399      composeClaimResponseInsuranceComponentInner(element);
36400      close();
36401    }
36402  }
36403
36404  protected void composeClaimResponseInsuranceComponentInner(ClaimResponse.InsuranceComponent element) throws IOException {
36405      composeBackbone(element);
36406      if (element.hasSequenceElement()) {
36407        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36408        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36409      }
36410      if (element.hasFocalElement()) {
36411        composeBooleanCore("focal", element.getFocalElement(), false);
36412        composeBooleanExtras("focal", element.getFocalElement(), false);
36413      }
36414      if (element.hasCoverage()) {
36415        composeReference("coverage", element.getCoverage());
36416      }
36417      if (element.hasBusinessArrangementElement()) {
36418        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
36419        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
36420      }
36421      if (element.hasClaimResponse()) {
36422        composeReference("claimResponse", element.getClaimResponse());
36423      }
36424  }
36425
36426  protected void composeClaimResponseErrorComponent(String name, ClaimResponse.ErrorComponent element) throws IOException {
36427    if (element != null) {
36428      open(name);
36429      composeClaimResponseErrorComponentInner(element);
36430      close();
36431    }
36432  }
36433
36434  protected void composeClaimResponseErrorComponentInner(ClaimResponse.ErrorComponent element) throws IOException {
36435      composeBackbone(element);
36436      if (element.hasItemSequenceElement()) {
36437        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
36438        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
36439      }
36440      if (element.hasDetailSequenceElement()) {
36441        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
36442        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
36443      }
36444      if (element.hasSubDetailSequenceElement()) {
36445        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
36446        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
36447      }
36448      if (element.hasCode()) {
36449        composeCodeableConcept("code", element.getCode());
36450      }
36451  }
36452
36453  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
36454    if (element != null) {
36455      prop("resourceType", name);
36456      composeClinicalImpressionInner(element);
36457    }
36458  }
36459
36460  protected void composeClinicalImpressionInner(ClinicalImpression element) throws IOException {
36461      composeDomainResourceElements(element);
36462      if (element.hasIdentifier()) {
36463        openArray("identifier");
36464        for (Identifier e : element.getIdentifier()) 
36465          composeIdentifier(null, e);
36466        closeArray();
36467      };
36468      if (element.hasStatusElement()) {
36469        composeEnumerationCore("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
36470        composeEnumerationExtras("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
36471      }
36472      if (element.hasStatusReason()) {
36473        composeCodeableConcept("statusReason", element.getStatusReason());
36474      }
36475      if (element.hasCode()) {
36476        composeCodeableConcept("code", element.getCode());
36477      }
36478      if (element.hasDescriptionElement()) {
36479        composeStringCore("description", element.getDescriptionElement(), false);
36480        composeStringExtras("description", element.getDescriptionElement(), false);
36481      }
36482      if (element.hasSubject()) {
36483        composeReference("subject", element.getSubject());
36484      }
36485      if (element.hasEncounter()) {
36486        composeReference("encounter", element.getEncounter());
36487      }
36488      if (element.hasEffective()) {
36489        composeType("effective", element.getEffective());
36490      }
36491      if (element.hasDateElement()) {
36492        composeDateTimeCore("date", element.getDateElement(), false);
36493        composeDateTimeExtras("date", element.getDateElement(), false);
36494      }
36495      if (element.hasPerformer()) {
36496        composeReference("performer", element.getPerformer());
36497      }
36498      if (element.hasPrevious()) {
36499        composeReference("previous", element.getPrevious());
36500      }
36501      if (element.hasProblem()) {
36502        openArray("problem");
36503        for (Reference e : element.getProblem()) 
36504          composeReference(null, e);
36505        closeArray();
36506      };
36507      if (element.hasProtocol()) {
36508        openArray("protocol");
36509        for (UriType e : element.getProtocol()) 
36510          composeUriCore(null, e, true);
36511        closeArray();
36512        if (anyHasExtras(element.getProtocol())) {
36513          openArray("_protocol");
36514          for (UriType e : element.getProtocol()) 
36515            composeUriExtras(null, e, true);
36516          closeArray();
36517        }
36518      };
36519      if (element.hasSummaryElement()) {
36520        composeStringCore("summary", element.getSummaryElement(), false);
36521        composeStringExtras("summary", element.getSummaryElement(), false);
36522      }
36523      if (element.hasFinding()) {
36524        openArray("finding");
36525        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
36526          composeClinicalImpressionClinicalImpressionFindingComponent(null, e);
36527        closeArray();
36528      };
36529      if (element.hasPrognosisCodeableConcept()) {
36530        openArray("prognosisCodeableConcept");
36531        for (CodeableConcept e : element.getPrognosisCodeableConcept()) 
36532          composeCodeableConcept(null, e);
36533        closeArray();
36534      };
36535      if (element.hasPrognosisReference()) {
36536        openArray("prognosisReference");
36537        for (Reference e : element.getPrognosisReference()) 
36538          composeReference(null, e);
36539        closeArray();
36540      };
36541      if (element.hasSupportingInfo()) {
36542        openArray("supportingInfo");
36543        for (Reference e : element.getSupportingInfo()) 
36544          composeReference(null, e);
36545        closeArray();
36546      };
36547      if (element.hasNote()) {
36548        openArray("note");
36549        for (Annotation e : element.getNote()) 
36550          composeAnnotation(null, e);
36551        closeArray();
36552      };
36553  }
36554
36555  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
36556    if (element != null) {
36557      open(name);
36558      composeClinicalImpressionClinicalImpressionFindingComponentInner(element);
36559      close();
36560    }
36561  }
36562
36563  protected void composeClinicalImpressionClinicalImpressionFindingComponentInner(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
36564      composeBackbone(element);
36565      if (element.hasItemCodeableConcept()) {
36566        composeCodeableConcept("itemCodeableConcept", element.getItemCodeableConcept());
36567      }
36568      if (element.hasItemReference()) {
36569        composeReference("itemReference", element.getItemReference());
36570      }
36571      if (element.hasBasisElement()) {
36572        composeStringCore("basis", element.getBasisElement(), false);
36573        composeStringExtras("basis", element.getBasisElement(), false);
36574      }
36575  }
36576
36577  protected void composeClinicalUseIssue(String name, ClinicalUseIssue element) throws IOException {
36578    if (element != null) {
36579      prop("resourceType", name);
36580      composeClinicalUseIssueInner(element);
36581    }
36582  }
36583
36584  protected void composeClinicalUseIssueInner(ClinicalUseIssue element) throws IOException {
36585      composeDomainResourceElements(element);
36586      if (element.hasIdentifier()) {
36587        openArray("identifier");
36588        for (Identifier e : element.getIdentifier()) 
36589          composeIdentifier(null, e);
36590        closeArray();
36591      };
36592      if (element.hasTypeElement()) {
36593        composeEnumerationCore("type", element.getTypeElement(), new ClinicalUseIssue.ClinicalUseIssueTypeEnumFactory(), false);
36594        composeEnumerationExtras("type", element.getTypeElement(), new ClinicalUseIssue.ClinicalUseIssueTypeEnumFactory(), false);
36595      }
36596      if (element.hasSubject()) {
36597        openArray("subject");
36598        for (Reference e : element.getSubject()) 
36599          composeReference(null, e);
36600        closeArray();
36601      };
36602      if (element.hasStatus()) {
36603        composeCodeableConcept("status", element.getStatus());
36604      }
36605      if (element.hasDescriptionElement()) {
36606        composeStringCore("description", element.getDescriptionElement(), false);
36607        composeStringExtras("description", element.getDescriptionElement(), false);
36608      }
36609      if (element.hasContraindication()) {
36610        composeClinicalUseIssueClinicalUseIssueContraindicationComponent("contraindication", element.getContraindication());
36611      }
36612      if (element.hasIndication()) {
36613        composeClinicalUseIssueClinicalUseIssueIndicationComponent("indication", element.getIndication());
36614      }
36615      if (element.hasInteraction()) {
36616        composeClinicalUseIssueClinicalUseIssueInteractionComponent("interaction", element.getInteraction());
36617      }
36618      if (element.hasPopulation()) {
36619        openArray("population");
36620        for (Population e : element.getPopulation()) 
36621          composePopulation(null, e);
36622        closeArray();
36623      };
36624      if (element.hasUndesirableEffect()) {
36625        composeClinicalUseIssueClinicalUseIssueUndesirableEffectComponent("undesirableEffect", element.getUndesirableEffect());
36626      }
36627  }
36628
36629  protected void composeClinicalUseIssueClinicalUseIssueContraindicationComponent(String name, ClinicalUseIssue.ClinicalUseIssueContraindicationComponent element) throws IOException {
36630    if (element != null) {
36631      open(name);
36632      composeClinicalUseIssueClinicalUseIssueContraindicationComponentInner(element);
36633      close();
36634    }
36635  }
36636
36637  protected void composeClinicalUseIssueClinicalUseIssueContraindicationComponentInner(ClinicalUseIssue.ClinicalUseIssueContraindicationComponent element) throws IOException {
36638      composeBackbone(element);
36639      if (element.hasDiseaseSymptomProcedure()) {
36640        composeCodeableConcept("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
36641      }
36642      if (element.hasDiseaseStatus()) {
36643        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
36644  }
36645      if (element.hasComorbidity()) {
36646        openArray("comorbidity");
36647        for (CodeableConcept e : element.getComorbidity()) 
36648          composeCodeableConcept(null, e);
36649        closeArray();
36650      };
36651      if (element.hasIndication()) {
36652        openArray("indication");
36653        for (Reference e : element.getIndication()) 
36654          composeReference(null, e);
36655        closeArray();
36656      };
36657      if (element.hasOtherTherapy()) {
36658        openArray("otherTherapy");
36659        for (ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
36660          composeClinicalUseIssueClinicalUseIssueContraindicationOtherTherapyComponent(null, e);
36661        closeArray();
36662      };
36663  }
36664
36665  protected void composeClinicalUseIssueClinicalUseIssueContraindicationOtherTherapyComponent(String name, ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent element) throws IOException {
36666    if (element != null) {
36667      open(name);
36668      composeClinicalUseIssueClinicalUseIssueContraindicationOtherTherapyComponentInner(element);
36669      close();
36670    }
36671  }
36672
36673  protected void composeClinicalUseIssueClinicalUseIssueContraindicationOtherTherapyComponentInner(ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent element) throws IOException {
36674      composeBackbone(element);
36675      if (element.hasTherapyRelationshipType()) {
36676        composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
36677      }
36678      if (element.hasMedication()) {
36679        composeType("medication", element.getMedication());
36680      }
36681  }
36682
36683  protected void composeClinicalUseIssueClinicalUseIssueIndicationComponent(String name, ClinicalUseIssue.ClinicalUseIssueIndicationComponent element) throws IOException {
36684    if (element != null) {
36685      open(name);
36686      composeClinicalUseIssueClinicalUseIssueIndicationComponentInner(element);
36687      close();
36688    }
36689  }
36690
36691  protected void composeClinicalUseIssueClinicalUseIssueIndicationComponentInner(ClinicalUseIssue.ClinicalUseIssueIndicationComponent element) throws IOException {
36692      composeBackbone(element);
36693      if (element.hasDiseaseSymptomProcedure()) {
36694        composeCodeableConcept("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
36695      }
36696      if (element.hasDiseaseStatus()) {
36697        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
36698      }
36699      if (element.hasComorbidity()) {
36700        openArray("comorbidity");
36701        for (CodeableConcept e : element.getComorbidity()) 
36702          composeCodeableConcept(null, e);
36703        closeArray();
36704      };
36705      if (element.hasIntendedEffect()) {
36706        composeCodeableConcept("intendedEffect", element.getIntendedEffect());
36707      }
36708      if (element.hasDuration()) {
36709        composeQuantity("duration", element.getDuration());
36710      }
36711      if (element.hasUndesirableEffect()) {
36712        openArray("undesirableEffect");
36713        for (Reference e : element.getUndesirableEffect()) 
36714          composeReference(null, e);
36715        closeArray();
36716      };
36717      if (element.hasOtherTherapy()) {
36718        openArray("otherTherapy");
36719        for (ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
36720          composeClinicalUseIssueClinicalUseIssueContraindicationOtherTherapyComponent(null, e);
36721        closeArray();
36722      };
36723  }
36724
36725  protected void composeClinicalUseIssueClinicalUseIssueInteractionComponent(String name, ClinicalUseIssue.ClinicalUseIssueInteractionComponent element) throws IOException {
36726    if (element != null) {
36727      open(name);
36728      composeClinicalUseIssueClinicalUseIssueInteractionComponentInner(element);
36729      close();
36730    }
36731  }
36732
36733  protected void composeClinicalUseIssueClinicalUseIssueInteractionComponentInner(ClinicalUseIssue.ClinicalUseIssueInteractionComponent element) throws IOException {
36734      composeBackbone(element);
36735      if (element.hasInteractant()) {
36736        openArray("interactant");
36737        for (ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent e : element.getInteractant()) 
36738          composeClinicalUseIssueClinicalUseIssueInteractionInteractantComponent(null, e);
36739        closeArray();
36740      };
36741      if (element.hasType()) {
36742        composeCodeableConcept("type", element.getType());
36743      }
36744      if (element.hasEffect()) {
36745        composeCodeableConcept("effect", element.getEffect());
36746      }
36747      if (element.hasIncidence()) {
36748        composeCodeableConcept("incidence", element.getIncidence());
36749      }
36750      if (element.hasManagement()) {
36751        composeCodeableConcept("management", element.getManagement());
36752      }
36753  }
36754
36755  protected void composeClinicalUseIssueClinicalUseIssueInteractionInteractantComponent(String name, ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent element) throws IOException {
36756    if (element != null) {
36757      open(name);
36758      composeClinicalUseIssueClinicalUseIssueInteractionInteractantComponentInner(element);
36759      close();
36760    }
36761  }
36762
36763  protected void composeClinicalUseIssueClinicalUseIssueInteractionInteractantComponentInner(ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent element) throws IOException {
36764      composeBackbone(element);
36765      if (element.hasItem()) {
36766        composeType("item", element.getItem());
36767      }
36768  }
36769
36770  protected void composeClinicalUseIssueClinicalUseIssueUndesirableEffectComponent(String name, ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent element) throws IOException {
36771    if (element != null) {
36772      open(name);
36773      composeClinicalUseIssueClinicalUseIssueUndesirableEffectComponentInner(element);
36774      close();
36775    }
36776  }
36777
36778  protected void composeClinicalUseIssueClinicalUseIssueUndesirableEffectComponentInner(ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent element) throws IOException {
36779      composeBackbone(element);
36780      if (element.hasSymptomConditionEffect()) {
36781        composeCodeableConcept("symptomConditionEffect", element.getSymptomConditionEffect());
36782      }
36783      if (element.hasClassification()) {
36784        composeCodeableConcept("classification", element.getClassification());
36785      }
36786      if (element.hasFrequencyOfOccurrence()) {
36787        composeCodeableConcept("frequencyOfOccurrence", element.getFrequencyOfOccurrence());
36788      }
36789  }
36790
36791  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
36792    if (element != null) {
36793      prop("resourceType", name);
36794      composeCodeSystemInner(element);
36795    }
36796  }
36797
36798  protected void composeCodeSystemInner(CodeSystem element) throws IOException {
36799      composeDomainResourceElements(element);
36800      if (element.hasUrlElement()) {
36801        composeUriCore("url", element.getUrlElement(), false);
36802        composeUriExtras("url", element.getUrlElement(), false);
36803      }
36804      if (element.hasIdentifier()) {
36805        openArray("identifier");
36806        for (Identifier e : element.getIdentifier()) 
36807          composeIdentifier(null, e);
36808        closeArray();
36809      };
36810      if (element.hasVersionElement()) {
36811        composeStringCore("version", element.getVersionElement(), false);
36812        composeStringExtras("version", element.getVersionElement(), false);
36813      }
36814      if (element.hasNameElement()) {
36815        composeStringCore("name", element.getNameElement(), false);
36816        composeStringExtras("name", element.getNameElement(), false);
36817      }
36818      if (element.hasTitleElement()) {
36819        composeStringCore("title", element.getTitleElement(), false);
36820        composeStringExtras("title", element.getTitleElement(), false);
36821      }
36822      if (element.hasStatusElement()) {
36823        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
36824        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
36825      }
36826      if (element.hasExperimentalElement()) {
36827        composeBooleanCore("experimental", element.getExperimentalElement(), false);
36828        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
36829      }
36830      if (element.hasDateElement()) {
36831        composeDateTimeCore("date", element.getDateElement(), false);
36832        composeDateTimeExtras("date", element.getDateElement(), false);
36833      }
36834      if (element.hasPublisherElement()) {
36835        composeStringCore("publisher", element.getPublisherElement(), false);
36836        composeStringExtras("publisher", element.getPublisherElement(), false);
36837      }
36838      if (element.hasContact()) {
36839        openArray("contact");
36840        for (ContactDetail e : element.getContact()) 
36841          composeContactDetail(null, e);
36842        closeArray();
36843      };
36844      if (element.hasDescriptionElement()) {
36845        composeMarkdownCore("description", element.getDescriptionElement(), false);
36846        composeMarkdownExtras("description", element.getDescriptionElement(), false);
36847      }
36848      if (element.hasUseContext()) {
36849        openArray("useContext");
36850        for (UsageContext e : element.getUseContext()) 
36851          composeUsageContext(null, e);
36852        closeArray();
36853      };
36854      if (element.hasJurisdiction()) {
36855        openArray("jurisdiction");
36856        for (CodeableConcept e : element.getJurisdiction()) 
36857          composeCodeableConcept(null, e);
36858        closeArray();
36859      };
36860      if (element.hasPurposeElement()) {
36861        composeMarkdownCore("purpose", element.getPurposeElement(), false);
36862        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
36863      }
36864      if (element.hasCopyrightElement()) {
36865        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
36866        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
36867      }
36868      if (element.hasCaseSensitiveElement()) {
36869        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
36870        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
36871      }
36872      if (element.hasValueSetElement()) {
36873        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
36874        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
36875      }
36876      if (element.hasHierarchyMeaningElement()) {
36877        composeEnumerationCore("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
36878        composeEnumerationExtras("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
36879      }
36880      if (element.hasCompositionalElement()) {
36881        composeBooleanCore("compositional", element.getCompositionalElement(), false);
36882        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
36883      }
36884      if (element.hasVersionNeededElement()) {
36885        composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
36886        composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
36887      }
36888      if (element.hasContentElement()) {
36889        composeEnumerationCore("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
36890        composeEnumerationExtras("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
36891      }
36892      if (element.hasSupplementsElement()) {
36893        composeCanonicalCore("supplements", element.getSupplementsElement(), false);
36894        composeCanonicalExtras("supplements", element.getSupplementsElement(), false);
36895      }
36896      if (element.hasCountElement()) {
36897        composeUnsignedIntCore("count", element.getCountElement(), false);
36898        composeUnsignedIntExtras("count", element.getCountElement(), false);
36899      }
36900      if (element.hasFilter()) {
36901        openArray("filter");
36902        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
36903          composeCodeSystemCodeSystemFilterComponent(null, e);
36904        closeArray();
36905      };
36906      if (element.hasProperty()) {
36907        openArray("property");
36908        for (CodeSystem.PropertyComponent e : element.getProperty()) 
36909          composeCodeSystemPropertyComponent(null, e);
36910        closeArray();
36911      };
36912      if (element.hasConcept()) {
36913        openArray("concept");
36914        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
36915          composeCodeSystemConceptDefinitionComponent(null, e);
36916        closeArray();
36917      };
36918  }
36919
36920  protected void composeCodeSystemCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
36921    if (element != null) {
36922      open(name);
36923      composeCodeSystemCodeSystemFilterComponentInner(element);
36924      close();
36925    }
36926  }
36927
36928  protected void composeCodeSystemCodeSystemFilterComponentInner(CodeSystem.CodeSystemFilterComponent element) throws IOException {
36929      composeBackbone(element);
36930      if (element.hasCodeElement()) {
36931        composeCodeCore("code", element.getCodeElement(), false);
36932        composeCodeExtras("code", element.getCodeElement(), false);
36933      }
36934      if (element.hasDescriptionElement()) {
36935        composeStringCore("description", element.getDescriptionElement(), false);
36936        composeStringExtras("description", element.getDescriptionElement(), false);
36937      }
36938      if (element.hasOperator()) {
36939        openArray("operator");
36940        for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
36941          composeEnumerationCore(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
36942        closeArray();
36943        if (anyHasExtras(element.getOperator())) {
36944          openArray("_operator");
36945          for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
36946            composeEnumerationExtras(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
36947          closeArray();
36948      }
36949      };
36950      if (element.hasValueElement()) {
36951        composeStringCore("value", element.getValueElement(), false);
36952        composeStringExtras("value", element.getValueElement(), false);
36953      }
36954  }
36955
36956  protected void composeCodeSystemPropertyComponent(String name, CodeSystem.PropertyComponent element) throws IOException {
36957    if (element != null) {
36958      open(name);
36959      composeCodeSystemPropertyComponentInner(element);
36960      close();
36961    }
36962  }
36963
36964  protected void composeCodeSystemPropertyComponentInner(CodeSystem.PropertyComponent element) throws IOException {
36965      composeBackbone(element);
36966      if (element.hasCodeElement()) {
36967        composeCodeCore("code", element.getCodeElement(), false);
36968        composeCodeExtras("code", element.getCodeElement(), false);
36969      }
36970      if (element.hasUriElement()) {
36971        composeUriCore("uri", element.getUriElement(), false);
36972        composeUriExtras("uri", element.getUriElement(), false);
36973      }
36974      if (element.hasDescriptionElement()) {
36975        composeStringCore("description", element.getDescriptionElement(), false);
36976        composeStringExtras("description", element.getDescriptionElement(), false);
36977      }
36978      if (element.hasTypeElement()) {
36979        composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
36980        composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
36981      }
36982  }
36983
36984  protected void composeCodeSystemConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
36985    if (element != null) {
36986      open(name);
36987      composeCodeSystemConceptDefinitionComponentInner(element);
36988      close();
36989    }
36990  }
36991
36992  protected void composeCodeSystemConceptDefinitionComponentInner(CodeSystem.ConceptDefinitionComponent element) throws IOException {
36993      composeBackbone(element);
36994      if (element.hasCodeElement()) {
36995        composeCodeCore("code", element.getCodeElement(), false);
36996        composeCodeExtras("code", element.getCodeElement(), false);
36997      }
36998      if (element.hasDisplayElement()) {
36999        composeStringCore("display", element.getDisplayElement(), false);
37000        composeStringExtras("display", element.getDisplayElement(), false);
37001      }
37002      if (element.hasDefinitionElement()) {
37003        composeStringCore("definition", element.getDefinitionElement(), false);
37004        composeStringExtras("definition", element.getDefinitionElement(), false);
37005      }
37006      if (element.hasDesignation()) {
37007        openArray("designation");
37008        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
37009          composeCodeSystemConceptDefinitionDesignationComponent(null, e);
37010        closeArray();
37011      };
37012      if (element.hasProperty()) {
37013        openArray("property");
37014        for (CodeSystem.ConceptPropertyComponent e : element.getProperty()) 
37015          composeCodeSystemConceptPropertyComponent(null, e);
37016        closeArray();
37017      };
37018      if (element.hasConcept()) {
37019        openArray("concept");
37020        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
37021          composeCodeSystemConceptDefinitionComponent(null, e);
37022        closeArray();
37023      };
37024  }
37025
37026  protected void composeCodeSystemConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
37027    if (element != null) {
37028      open(name);
37029      composeCodeSystemConceptDefinitionDesignationComponentInner(element);
37030      close();
37031    }
37032  }
37033
37034  protected void composeCodeSystemConceptDefinitionDesignationComponentInner(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
37035      composeBackbone(element);
37036      if (element.hasLanguageElement()) {
37037        composeCodeCore("language", element.getLanguageElement(), false);
37038        composeCodeExtras("language", element.getLanguageElement(), false);
37039      }
37040      if (element.hasUse()) {
37041        composeCoding("use", element.getUse());
37042      }
37043      if (element.hasValueElement()) {
37044        composeStringCore("value", element.getValueElement(), false);
37045        composeStringExtras("value", element.getValueElement(), false);
37046      }
37047  }
37048
37049  protected void composeCodeSystemConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element) throws IOException {
37050    if (element != null) {
37051      open(name);
37052      composeCodeSystemConceptPropertyComponentInner(element);
37053      close();
37054    }
37055  }
37056
37057  protected void composeCodeSystemConceptPropertyComponentInner(CodeSystem.ConceptPropertyComponent element) throws IOException {
37058      composeBackbone(element);
37059      if (element.hasCodeElement()) {
37060        composeCodeCore("code", element.getCodeElement(), false);
37061        composeCodeExtras("code", element.getCodeElement(), false);
37062      }
37063      if (element.hasValue()) {
37064        composeType("value", element.getValue());
37065      }
37066  }
37067
37068  protected void composeCommunication(String name, Communication element) throws IOException {
37069    if (element != null) {
37070      prop("resourceType", name);
37071      composeCommunicationInner(element);
37072    }
37073  }
37074
37075  protected void composeCommunicationInner(Communication element) throws IOException {
37076      composeDomainResourceElements(element);
37077      if (element.hasIdentifier()) {
37078        openArray("identifier");
37079        for (Identifier e : element.getIdentifier()) 
37080          composeIdentifier(null, e);
37081        closeArray();
37082      };
37083      if (element.hasInstantiatesCanonical()) {
37084        openArray("instantiatesCanonical");
37085        for (CanonicalType e : element.getInstantiatesCanonical()) 
37086          composeCanonicalCore(null, e, true);
37087        closeArray();
37088        if (anyHasExtras(element.getInstantiatesCanonical())) {
37089          openArray("_instantiatesCanonical");
37090          for (CanonicalType e : element.getInstantiatesCanonical()) 
37091            composeCanonicalExtras(null, e, true);
37092          closeArray();
37093        }
37094      };
37095      if (element.hasInstantiatesUri()) {
37096        openArray("instantiatesUri");
37097        for (UriType e : element.getInstantiatesUri()) 
37098          composeUriCore(null, e, true);
37099        closeArray();
37100        if (anyHasExtras(element.getInstantiatesUri())) {
37101          openArray("_instantiatesUri");
37102          for (UriType e : element.getInstantiatesUri()) 
37103            composeUriExtras(null, e, true);
37104          closeArray();
37105        }
37106      };
37107      if (element.hasBasedOn()) {
37108        openArray("basedOn");
37109        for (Reference e : element.getBasedOn()) 
37110          composeReference(null, e);
37111        closeArray();
37112      };
37113      if (element.hasPartOf()) {
37114        openArray("partOf");
37115        for (Reference e : element.getPartOf()) 
37116          composeReference(null, e);
37117        closeArray();
37118      };
37119      if (element.hasInResponseTo()) {
37120        openArray("inResponseTo");
37121        for (Reference e : element.getInResponseTo()) 
37122          composeReference(null, e);
37123        closeArray();
37124      };
37125      if (element.hasStatusElement()) {
37126        composeEnumerationCore("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
37127        composeEnumerationExtras("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
37128      }
37129      if (element.hasStatusReason()) {
37130        composeCodeableConcept("statusReason", element.getStatusReason());
37131      }
37132      if (element.hasCategory()) {
37133        openArray("category");
37134        for (CodeableConcept e : element.getCategory()) 
37135          composeCodeableConcept(null, e);
37136        closeArray();
37137      };
37138      if (element.hasPriorityElement()) {
37139        composeEnumerationCore("priority", element.getPriorityElement(), new Communication.CommunicationPriorityEnumFactory(), false);
37140        composeEnumerationExtras("priority", element.getPriorityElement(), new Communication.CommunicationPriorityEnumFactory(), false);
37141      }
37142      if (element.hasMedium()) {
37143        openArray("medium");
37144        for (CodeableConcept e : element.getMedium()) 
37145          composeCodeableConcept(null, e);
37146        closeArray();
37147      };
37148      if (element.hasSubject()) {
37149        composeReference("subject", element.getSubject());
37150      }
37151      if (element.hasTopic()) {
37152        composeCodeableConcept("topic", element.getTopic());
37153      }
37154      if (element.hasAbout()) {
37155        openArray("about");
37156        for (Reference e : element.getAbout()) 
37157          composeReference(null, e);
37158        closeArray();
37159      };
37160      if (element.hasEncounter()) {
37161        composeReference("encounter", element.getEncounter());
37162      }
37163      if (element.hasSentElement()) {
37164        composeDateTimeCore("sent", element.getSentElement(), false);
37165        composeDateTimeExtras("sent", element.getSentElement(), false);
37166      }
37167      if (element.hasReceivedElement()) {
37168        composeDateTimeCore("received", element.getReceivedElement(), false);
37169        composeDateTimeExtras("received", element.getReceivedElement(), false);
37170      }
37171      if (element.hasRecipient()) {
37172        openArray("recipient");
37173        for (Reference e : element.getRecipient()) 
37174          composeReference(null, e);
37175        closeArray();
37176      };
37177      if (element.hasSender()) {
37178        composeReference("sender", element.getSender());
37179      }
37180      if (element.hasReasonCode()) {
37181        openArray("reasonCode");
37182        for (CodeableConcept e : element.getReasonCode()) 
37183          composeCodeableConcept(null, e);
37184        closeArray();
37185      };
37186      if (element.hasReasonReference()) {
37187        openArray("reasonReference");
37188        for (Reference e : element.getReasonReference()) 
37189          composeReference(null, e);
37190        closeArray();
37191      };
37192      if (element.hasPayload()) {
37193        openArray("payload");
37194        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
37195          composeCommunicationCommunicationPayloadComponent(null, e);
37196        closeArray();
37197      };
37198      if (element.hasNote()) {
37199        openArray("note");
37200        for (Annotation e : element.getNote()) 
37201          composeAnnotation(null, e);
37202        closeArray();
37203      };
37204  }
37205
37206  protected void composeCommunicationCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
37207    if (element != null) {
37208      open(name);
37209      composeCommunicationCommunicationPayloadComponentInner(element);
37210      close();
37211    }
37212      }
37213
37214  protected void composeCommunicationCommunicationPayloadComponentInner(Communication.CommunicationPayloadComponent element) throws IOException {
37215      composeBackbone(element);
37216      if (element.hasContent()) {
37217        composeType("content", element.getContent());
37218      }
37219  }
37220
37221  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
37222    if (element != null) {
37223      prop("resourceType", name);
37224      composeCommunicationRequestInner(element);
37225    }
37226  }
37227
37228  protected void composeCommunicationRequestInner(CommunicationRequest element) throws IOException {
37229      composeDomainResourceElements(element);
37230      if (element.hasIdentifier()) {
37231        openArray("identifier");
37232        for (Identifier e : element.getIdentifier()) 
37233          composeIdentifier(null, e);
37234        closeArray();
37235      };
37236      if (element.hasBasedOn()) {
37237        openArray("basedOn");
37238        for (Reference e : element.getBasedOn()) 
37239          composeReference(null, e);
37240        closeArray();
37241      };
37242      if (element.hasReplaces()) {
37243        openArray("replaces");
37244        for (Reference e : element.getReplaces()) 
37245          composeReference(null, e);
37246        closeArray();
37247      };
37248      if (element.hasGroupIdentifier()) {
37249        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
37250      }
37251      if (element.hasStatusElement()) {
37252        composeEnumerationCore("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
37253        composeEnumerationExtras("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
37254      }
37255      if (element.hasStatusReason()) {
37256        composeCodeableConcept("statusReason", element.getStatusReason());
37257      }
37258      if (element.hasCategory()) {
37259        openArray("category");
37260        for (CodeableConcept e : element.getCategory()) 
37261          composeCodeableConcept(null, e);
37262        closeArray();
37263      };
37264      if (element.hasPriorityElement()) {
37265        composeEnumerationCore("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
37266        composeEnumerationExtras("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
37267      }
37268      if (element.hasDoNotPerformElement()) {
37269        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
37270        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
37271      }
37272      if (element.hasMedium()) {
37273        openArray("medium");
37274        for (CodeableConcept e : element.getMedium()) 
37275          composeCodeableConcept(null, e);
37276        closeArray();
37277      };
37278      if (element.hasSubject()) {
37279        composeReference("subject", element.getSubject());
37280      }
37281      if (element.hasAbout()) {
37282        openArray("about");
37283        for (Reference e : element.getAbout()) 
37284          composeReference(null, e);
37285        closeArray();
37286      };
37287      if (element.hasEncounter()) {
37288        composeReference("encounter", element.getEncounter());
37289      }
37290      if (element.hasPayload()) {
37291        openArray("payload");
37292        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
37293          composeCommunicationRequestCommunicationRequestPayloadComponent(null, e);
37294        closeArray();
37295      };
37296      if (element.hasOccurrence()) {
37297        composeType("occurrence", element.getOccurrence());
37298      }
37299      if (element.hasAuthoredOnElement()) {
37300        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
37301        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
37302      }
37303      if (element.hasRequester()) {
37304        composeReference("requester", element.getRequester());
37305      }
37306      if (element.hasRecipient()) {
37307        openArray("recipient");
37308        for (Reference e : element.getRecipient()) 
37309          composeReference(null, e);
37310        closeArray();
37311      };
37312      if (element.hasInformationProvider()) {
37313        openArray("informationProvider");
37314        for (Reference e : element.getInformationProvider()) 
37315          composeReference(null, e);
37316        closeArray();
37317      };
37318      if (element.hasReasonCode()) {
37319        openArray("reasonCode");
37320        for (CodeableConcept e : element.getReasonCode()) 
37321          composeCodeableConcept(null, e);
37322        closeArray();
37323      };
37324      if (element.hasReasonReference()) {
37325        openArray("reasonReference");
37326        for (Reference e : element.getReasonReference()) 
37327          composeReference(null, e);
37328        closeArray();
37329      };
37330      if (element.hasNote()) {
37331        openArray("note");
37332        for (Annotation e : element.getNote()) 
37333          composeAnnotation(null, e);
37334        closeArray();
37335      };
37336  }
37337
37338  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
37339    if (element != null) {
37340      open(name);
37341      composeCommunicationRequestCommunicationRequestPayloadComponentInner(element);
37342      close();
37343    }
37344  }
37345
37346  protected void composeCommunicationRequestCommunicationRequestPayloadComponentInner(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
37347      composeBackbone(element);
37348      if (element.hasContent()) {
37349        composeType("content", element.getContent());
37350      }
37351  }
37352
37353  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
37354    if (element != null) {
37355      prop("resourceType", name);
37356      composeCompartmentDefinitionInner(element);
37357    }
37358  }
37359
37360  protected void composeCompartmentDefinitionInner(CompartmentDefinition element) throws IOException {
37361      composeDomainResourceElements(element);
37362      if (element.hasUrlElement()) {
37363        composeUriCore("url", element.getUrlElement(), false);
37364        composeUriExtras("url", element.getUrlElement(), false);
37365      }
37366      if (element.hasVersionElement()) {
37367        composeStringCore("version", element.getVersionElement(), false);
37368        composeStringExtras("version", element.getVersionElement(), false);
37369      }
37370      if (element.hasNameElement()) {
37371        composeStringCore("name", element.getNameElement(), false);
37372        composeStringExtras("name", element.getNameElement(), false);
37373      }
37374      if (element.hasStatusElement()) {
37375        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37376        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37377      }
37378      if (element.hasExperimentalElement()) {
37379        composeBooleanCore("experimental", element.getExperimentalElement(), false);
37380        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
37381      }
37382      if (element.hasDateElement()) {
37383        composeDateTimeCore("date", element.getDateElement(), false);
37384        composeDateTimeExtras("date", element.getDateElement(), false);
37385      }
37386      if (element.hasPublisherElement()) {
37387        composeStringCore("publisher", element.getPublisherElement(), false);
37388        composeStringExtras("publisher", element.getPublisherElement(), false);
37389      }
37390      if (element.hasContact()) {
37391        openArray("contact");
37392        for (ContactDetail e : element.getContact()) 
37393          composeContactDetail(null, e);
37394        closeArray();
37395      };
37396      if (element.hasDescriptionElement()) {
37397        composeMarkdownCore("description", element.getDescriptionElement(), false);
37398        composeMarkdownExtras("description", element.getDescriptionElement(), false);
37399      }
37400      if (element.hasUseContext()) {
37401        openArray("useContext");
37402        for (UsageContext e : element.getUseContext()) 
37403          composeUsageContext(null, e);
37404        closeArray();
37405      };
37406      if (element.hasPurposeElement()) {
37407        composeMarkdownCore("purpose", element.getPurposeElement(), false);
37408        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
37409      }
37410      if (element.hasCodeElement()) {
37411        composeEnumerationCore("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
37412        composeEnumerationExtras("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
37413    }
37414      if (element.hasSearchElement()) {
37415        composeBooleanCore("search", element.getSearchElement(), false);
37416        composeBooleanExtras("search", element.getSearchElement(), false);
37417  }
37418      if (element.hasResource()) {
37419        openArray("resource");
37420        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
37421          composeCompartmentDefinitionCompartmentDefinitionResourceComponent(null, e);
37422        closeArray();
37423      };
37424  }
37425
37426  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
37427    if (element != null) {
37428      open(name);
37429      composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(element);
37430      close();
37431    }
37432  }
37433
37434  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
37435      composeBackbone(element);
37436      if (element.hasCodeElement()) {
37437        composeCodeCore("code", element.getCodeElement(), false);
37438        composeCodeExtras("code", element.getCodeElement(), false);
37439      }
37440      if (element.hasParam()) {
37441        openArray("param");
37442        for (StringType e : element.getParam()) 
37443          composeStringCore(null, e, true);
37444        closeArray();
37445        if (anyHasExtras(element.getParam())) {
37446          openArray("_param");
37447          for (StringType e : element.getParam()) 
37448            composeStringExtras(null, e, true);
37449        closeArray();
37450        }
37451      };
37452      if (element.hasDocumentationElement()) {
37453        composeStringCore("documentation", element.getDocumentationElement(), false);
37454        composeStringExtras("documentation", element.getDocumentationElement(), false);
37455      }
37456  }
37457
37458  protected void composeComposition(String name, Composition element) throws IOException {
37459    if (element != null) {
37460      prop("resourceType", name);
37461      composeCompositionInner(element);
37462    }
37463  }
37464
37465  protected void composeCompositionInner(Composition element) throws IOException {
37466      composeDomainResourceElements(element);
37467      if (element.hasIdentifier()) {
37468        composeIdentifier("identifier", element.getIdentifier());
37469      }
37470      if (element.hasStatusElement()) {
37471        composeEnumerationCore("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
37472        composeEnumerationExtras("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
37473      }
37474      if (element.hasType()) {
37475        composeCodeableConcept("type", element.getType());
37476      }
37477      if (element.hasCategory()) {
37478        openArray("category");
37479        for (CodeableConcept e : element.getCategory()) 
37480          composeCodeableConcept(null, e);
37481        closeArray();
37482      };
37483      if (element.hasSubject()) {
37484        composeReference("subject", element.getSubject());
37485      }
37486      if (element.hasEncounter()) {
37487        composeReference("encounter", element.getEncounter());
37488      }
37489      if (element.hasDateElement()) {
37490        composeDateTimeCore("date", element.getDateElement(), false);
37491        composeDateTimeExtras("date", element.getDateElement(), false);
37492      }
37493      if (element.hasAuthor()) {
37494        openArray("author");
37495        for (Reference e : element.getAuthor()) 
37496          composeReference(null, e);
37497        closeArray();
37498      };
37499      if (element.hasTitleElement()) {
37500        composeStringCore("title", element.getTitleElement(), false);
37501        composeStringExtras("title", element.getTitleElement(), false);
37502      }
37503      if (element.hasConfidentialityElement()) {
37504        composeEnumerationCore("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
37505        composeEnumerationExtras("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
37506      }
37507      if (element.hasAttester()) {
37508        openArray("attester");
37509        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
37510          composeCompositionCompositionAttesterComponent(null, e);
37511        closeArray();
37512      };
37513      if (element.hasCustodian()) {
37514        composeReference("custodian", element.getCustodian());
37515      }
37516      if (element.hasRelatesTo()) {
37517        openArray("relatesTo");
37518        for (Composition.CompositionRelatesToComponent e : element.getRelatesTo()) 
37519          composeCompositionCompositionRelatesToComponent(null, e);
37520        closeArray();
37521      };
37522      if (element.hasEvent()) {
37523        openArray("event");
37524        for (Composition.CompositionEventComponent e : element.getEvent()) 
37525          composeCompositionCompositionEventComponent(null, e);
37526        closeArray();
37527      };
37528      if (element.hasSection()) {
37529        openArray("section");
37530        for (Composition.SectionComponent e : element.getSection()) 
37531          composeCompositionSectionComponent(null, e);
37532        closeArray();
37533      };
37534  }
37535
37536  protected void composeCompositionCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
37537    if (element != null) {
37538      open(name);
37539      composeCompositionCompositionAttesterComponentInner(element);
37540      close();
37541    }
37542  }
37543
37544  protected void composeCompositionCompositionAttesterComponentInner(Composition.CompositionAttesterComponent element) throws IOException {
37545      composeBackbone(element);
37546      if (element.hasModeElement()) {
37547        composeEnumerationCore("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
37548        composeEnumerationExtras("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
37549      }
37550      if (element.hasTimeElement()) {
37551        composeDateTimeCore("time", element.getTimeElement(), false);
37552        composeDateTimeExtras("time", element.getTimeElement(), false);
37553      }
37554      if (element.hasParty()) {
37555        composeReference("party", element.getParty());
37556      }
37557  }
37558
37559  protected void composeCompositionCompositionRelatesToComponent(String name, Composition.CompositionRelatesToComponent element) throws IOException {
37560    if (element != null) {
37561      open(name);
37562      composeCompositionCompositionRelatesToComponentInner(element);
37563      close();
37564    }
37565  }
37566
37567  protected void composeCompositionCompositionRelatesToComponentInner(Composition.CompositionRelatesToComponent element) throws IOException {
37568      composeBackbone(element);
37569      if (element.hasCodeElement()) {
37570        composeEnumerationCore("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
37571        composeEnumerationExtras("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
37572      }
37573      if (element.hasTarget()) {
37574        composeType("target", element.getTarget());
37575      }
37576  }
37577
37578  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
37579    if (element != null) {
37580      open(name);
37581      composeCompositionCompositionEventComponentInner(element);
37582      close();
37583    }
37584  }
37585
37586  protected void composeCompositionCompositionEventComponentInner(Composition.CompositionEventComponent element) throws IOException {
37587      composeBackbone(element);
37588      if (element.hasCode()) {
37589        openArray("code");
37590        for (CodeableConcept e : element.getCode()) 
37591          composeCodeableConcept(null, e);
37592        closeArray();
37593      };
37594      if (element.hasPeriod()) {
37595        composePeriod("period", element.getPeriod());
37596      }
37597      if (element.hasDetail()) {
37598        openArray("detail");
37599        for (Reference e : element.getDetail()) 
37600          composeReference(null, e);
37601        closeArray();
37602      };
37603  }
37604
37605  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element) throws IOException {
37606    if (element != null) {
37607      open(name);
37608      composeCompositionSectionComponentInner(element);
37609      close();
37610    }
37611  }
37612
37613  protected void composeCompositionSectionComponentInner(Composition.SectionComponent element) throws IOException {
37614      composeBackbone(element);
37615      if (element.hasTitleElement()) {
37616        composeStringCore("title", element.getTitleElement(), false);
37617        composeStringExtras("title", element.getTitleElement(), false);
37618      }
37619      if (element.hasCode()) {
37620        composeCodeableConcept("code", element.getCode());
37621      }
37622      if (element.hasAuthor()) {
37623        openArray("author");
37624        for (Reference e : element.getAuthor()) 
37625          composeReference(null, e);
37626        closeArray();
37627      };
37628      if (element.hasFocus()) {
37629        composeReference("focus", element.getFocus());
37630  }
37631      if (element.hasText()) {
37632        composeNarrative("text", element.getText());
37633    }
37634      if (element.hasModeElement()) {
37635        composeEnumerationCore("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
37636        composeEnumerationExtras("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
37637  }
37638      if (element.hasOrderedBy()) {
37639        composeCodeableConcept("orderedBy", element.getOrderedBy());
37640      }
37641      if (element.hasEntry()) {
37642        openArray("entry");
37643        for (Reference e : element.getEntry()) 
37644          composeReference(null, e);
37645        closeArray();
37646      };
37647      if (element.hasEmptyReason()) {
37648        composeCodeableConcept("emptyReason", element.getEmptyReason());
37649      }
37650      if (element.hasSection()) {
37651        openArray("section");
37652        for (Composition.SectionComponent e : element.getSection()) 
37653          composeCompositionSectionComponent(null, e);
37654        closeArray();
37655      };
37656  }
37657
37658  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
37659    if (element != null) {
37660      prop("resourceType", name);
37661      composeConceptMapInner(element);
37662    }
37663  }
37664
37665  protected void composeConceptMapInner(ConceptMap element) throws IOException {
37666      composeDomainResourceElements(element);
37667      if (element.hasUrlElement()) {
37668        composeUriCore("url", element.getUrlElement(), false);
37669        composeUriExtras("url", element.getUrlElement(), false);
37670      }
37671      if (element.hasIdentifier()) {
37672        composeIdentifier("identifier", element.getIdentifier());
37673      }
37674      if (element.hasVersionElement()) {
37675        composeStringCore("version", element.getVersionElement(), false);
37676        composeStringExtras("version", element.getVersionElement(), false);
37677      }
37678      if (element.hasNameElement()) {
37679        composeStringCore("name", element.getNameElement(), false);
37680        composeStringExtras("name", element.getNameElement(), false);
37681      }
37682      if (element.hasTitleElement()) {
37683        composeStringCore("title", element.getTitleElement(), false);
37684        composeStringExtras("title", element.getTitleElement(), false);
37685      }
37686      if (element.hasStatusElement()) {
37687        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37688        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37689      }
37690      if (element.hasExperimentalElement()) {
37691        composeBooleanCore("experimental", element.getExperimentalElement(), false);
37692        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
37693        }
37694      if (element.hasDateElement()) {
37695        composeDateTimeCore("date", element.getDateElement(), false);
37696        composeDateTimeExtras("date", element.getDateElement(), false);
37697      }
37698      if (element.hasPublisherElement()) {
37699        composeStringCore("publisher", element.getPublisherElement(), false);
37700        composeStringExtras("publisher", element.getPublisherElement(), false);
37701      }
37702      if (element.hasContact()) {
37703        openArray("contact");
37704        for (ContactDetail e : element.getContact()) 
37705          composeContactDetail(null, e);
37706        closeArray();
37707      };
37708      if (element.hasDescriptionElement()) {
37709        composeMarkdownCore("description", element.getDescriptionElement(), false);
37710        composeMarkdownExtras("description", element.getDescriptionElement(), false);
37711      }
37712      if (element.hasUseContext()) {
37713        openArray("useContext");
37714        for (UsageContext e : element.getUseContext()) 
37715          composeUsageContext(null, e);
37716        closeArray();
37717      };
37718      if (element.hasJurisdiction()) {
37719        openArray("jurisdiction");
37720        for (CodeableConcept e : element.getJurisdiction()) 
37721          composeCodeableConcept(null, e);
37722        closeArray();
37723      };
37724      if (element.hasPurposeElement()) {
37725        composeMarkdownCore("purpose", element.getPurposeElement(), false);
37726        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
37727      }
37728      if (element.hasCopyrightElement()) {
37729        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
37730        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
37731      }
37732      if (element.hasSource()) {
37733        composeType("source", element.getSource());
37734      }
37735      if (element.hasTarget()) {
37736        composeType("target", element.getTarget());
37737      }
37738      if (element.hasGroup()) {
37739        openArray("group");
37740        for (ConceptMap.ConceptMapGroupComponent e : element.getGroup()) 
37741          composeConceptMapConceptMapGroupComponent(null, e);
37742        closeArray();
37743      };
37744  }
37745
37746  protected void composeConceptMapConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
37747    if (element != null) {
37748      open(name);
37749      composeConceptMapConceptMapGroupComponentInner(element);
37750      close();
37751    }
37752  }
37753
37754  protected void composeConceptMapConceptMapGroupComponentInner(ConceptMap.ConceptMapGroupComponent element) throws IOException {
37755      composeBackbone(element);
37756      if (element.hasSourceElement()) {
37757        composeUriCore("source", element.getSourceElement(), false);
37758        composeUriExtras("source", element.getSourceElement(), false);
37759      }
37760      if (element.hasSourceVersionElement()) {
37761        composeStringCore("sourceVersion", element.getSourceVersionElement(), false);
37762        composeStringExtras("sourceVersion", element.getSourceVersionElement(), false);
37763      }
37764      if (element.hasTargetElement()) {
37765        composeUriCore("target", element.getTargetElement(), false);
37766        composeUriExtras("target", element.getTargetElement(), false);
37767      }
37768      if (element.hasTargetVersionElement()) {
37769        composeStringCore("targetVersion", element.getTargetVersionElement(), false);
37770        composeStringExtras("targetVersion", element.getTargetVersionElement(), false);
37771      }
37772      if (element.hasElement()) {
37773        openArray("element");
37774        for (ConceptMap.SourceElementComponent e : element.getElement()) 
37775          composeConceptMapSourceElementComponent(null, e);
37776        closeArray();
37777      };
37778      if (element.hasUnmapped()) {
37779        composeConceptMapConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
37780      }
37781  }
37782
37783  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
37784    if (element != null) {
37785      open(name);
37786      composeConceptMapSourceElementComponentInner(element);
37787      close();
37788    }
37789  }
37790
37791  protected void composeConceptMapSourceElementComponentInner(ConceptMap.SourceElementComponent element) throws IOException {
37792      composeBackbone(element);
37793      if (element.hasCodeElement()) {
37794        composeCodeCore("code", element.getCodeElement(), false);
37795        composeCodeExtras("code", element.getCodeElement(), false);
37796      }
37797      if (element.hasDisplayElement()) {
37798        composeStringCore("display", element.getDisplayElement(), false);
37799        composeStringExtras("display", element.getDisplayElement(), false);
37800        }
37801      if (element.hasNoMapElement()) {
37802        composeBooleanCore("noMap", element.getNoMapElement(), false);
37803        composeBooleanExtras("noMap", element.getNoMapElement(), false);
37804      }
37805      if (element.hasTarget()) {
37806        openArray("target");
37807        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
37808          composeConceptMapTargetElementComponent(null, e);
37809        closeArray();
37810      };
37811  }
37812
37813  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
37814    if (element != null) {
37815      open(name);
37816      composeConceptMapTargetElementComponentInner(element);
37817      close();
37818    }
37819  }
37820
37821  protected void composeConceptMapTargetElementComponentInner(ConceptMap.TargetElementComponent element) throws IOException {
37822      composeBackbone(element);
37823      if (element.hasCodeElement()) {
37824        composeCodeCore("code", element.getCodeElement(), false);
37825        composeCodeExtras("code", element.getCodeElement(), false);
37826      }
37827      if (element.hasDisplayElement()) {
37828        composeStringCore("display", element.getDisplayElement(), false);
37829        composeStringExtras("display", element.getDisplayElement(), false);
37830      }
37831      if (element.hasRelationshipElement()) {
37832        composeEnumerationCore("relationship", element.getRelationshipElement(), new Enumerations.ConceptMapRelationshipEnumFactory(), false);
37833        composeEnumerationExtras("relationship", element.getRelationshipElement(), new Enumerations.ConceptMapRelationshipEnumFactory(), false);
37834      }
37835      if (element.hasCommentElement()) {
37836        composeStringCore("comment", element.getCommentElement(), false);
37837        composeStringExtras("comment", element.getCommentElement(), false);
37838      }
37839      if (element.hasDependsOn()) {
37840        openArray("dependsOn");
37841        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
37842          composeConceptMapOtherElementComponent(null, e);
37843          closeArray();
37844      };
37845      if (element.hasProduct()) {
37846        openArray("product");
37847        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
37848          composeConceptMapOtherElementComponent(null, e);
37849        closeArray();
37850      };
37851  }
37852
37853  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
37854    if (element != null) {
37855      open(name);
37856      composeConceptMapOtherElementComponentInner(element);
37857      close();
37858    }
37859  }
37860
37861  protected void composeConceptMapOtherElementComponentInner(ConceptMap.OtherElementComponent element) throws IOException {
37862      composeBackbone(element);
37863      if (element.hasPropertyElement()) {
37864        composeUriCore("property", element.getPropertyElement(), false);
37865        composeUriExtras("property", element.getPropertyElement(), false);
37866      }
37867      if (element.hasSystemElement()) {
37868        composeCanonicalCore("system", element.getSystemElement(), false);
37869        composeCanonicalExtras("system", element.getSystemElement(), false);
37870      }
37871      if (element.hasValueElement()) {
37872        composeStringCore("value", element.getValueElement(), false);
37873        composeStringExtras("value", element.getValueElement(), false);
37874      }
37875      if (element.hasDisplayElement()) {
37876        composeStringCore("display", element.getDisplayElement(), false);
37877        composeStringExtras("display", element.getDisplayElement(), false);
37878      }
37879  }
37880
37881  protected void composeConceptMapConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
37882    if (element != null) {
37883      open(name);
37884      composeConceptMapConceptMapGroupUnmappedComponentInner(element);
37885      close();
37886    }
37887  }
37888
37889  protected void composeConceptMapConceptMapGroupUnmappedComponentInner(ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
37890      composeBackbone(element);
37891      if (element.hasModeElement()) {
37892        composeEnumerationCore("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
37893        composeEnumerationExtras("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
37894      }
37895      if (element.hasCodeElement()) {
37896        composeCodeCore("code", element.getCodeElement(), false);
37897        composeCodeExtras("code", element.getCodeElement(), false);
37898      }
37899      if (element.hasDisplayElement()) {
37900        composeStringCore("display", element.getDisplayElement(), false);
37901        composeStringExtras("display", element.getDisplayElement(), false);
37902      }
37903      if (element.hasUrlElement()) {
37904        composeCanonicalCore("url", element.getUrlElement(), false);
37905        composeCanonicalExtras("url", element.getUrlElement(), false);
37906      }
37907  }
37908
37909  protected void composeCondition(String name, Condition element) throws IOException {
37910    if (element != null) {
37911      prop("resourceType", name);
37912      composeConditionInner(element);
37913    }
37914  }
37915
37916  protected void composeConditionInner(Condition element) throws IOException {
37917      composeDomainResourceElements(element);
37918      if (element.hasIdentifier()) {
37919        openArray("identifier");
37920        for (Identifier e : element.getIdentifier()) 
37921          composeIdentifier(null, e);
37922        closeArray();
37923      };
37924      if (element.hasClinicalStatus()) {
37925        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
37926      }
37927      if (element.hasVerificationStatus()) {
37928        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
37929      }
37930      if (element.hasCategory()) {
37931        openArray("category");
37932        for (CodeableConcept e : element.getCategory()) 
37933          composeCodeableConcept(null, e);
37934        closeArray();
37935      };
37936      if (element.hasSeverity()) {
37937        composeCodeableConcept("severity", element.getSeverity());
37938      }
37939      if (element.hasCode()) {
37940        composeCodeableConcept("code", element.getCode());
37941      }
37942      if (element.hasBodySite()) {
37943        openArray("bodySite");
37944        for (CodeableConcept e : element.getBodySite()) 
37945          composeCodeableConcept(null, e);
37946        closeArray();
37947      };
37948      if (element.hasSubject()) {
37949        composeReference("subject", element.getSubject());
37950      }
37951      if (element.hasEncounter()) {
37952        composeReference("encounter", element.getEncounter());
37953      }
37954      if (element.hasOnset()) {
37955        composeType("onset", element.getOnset());
37956      }
37957      if (element.hasAbatement()) {
37958        composeType("abatement", element.getAbatement());
37959      }
37960      if (element.hasRecordedDateElement()) {
37961        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
37962        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
37963      }
37964      if (element.hasRecorder()) {
37965        composeReference("recorder", element.getRecorder());
37966      }
37967      if (element.hasAsserter()) {
37968        composeReference("asserter", element.getAsserter());
37969        }
37970      if (element.hasStage()) {
37971        openArray("stage");
37972        for (Condition.ConditionStageComponent e : element.getStage()) 
37973          composeConditionConditionStageComponent(null, e);
37974        closeArray();
37975      };
37976      if (element.hasEvidence()) {
37977        openArray("evidence");
37978        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
37979          composeConditionConditionEvidenceComponent(null, e);
37980          closeArray();
37981      };
37982      if (element.hasNote()) {
37983        openArray("note");
37984        for (Annotation e : element.getNote()) 
37985          composeAnnotation(null, e);
37986        closeArray();
37987      };
37988  }
37989
37990  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
37991    if (element != null) {
37992      open(name);
37993      composeConditionConditionStageComponentInner(element);
37994      close();
37995    }
37996  }
37997
37998  protected void composeConditionConditionStageComponentInner(Condition.ConditionStageComponent element) throws IOException {
37999      composeBackbone(element);
38000      if (element.hasSummary()) {
38001        composeCodeableConcept("summary", element.getSummary());
38002      }
38003      if (element.hasAssessment()) {
38004        openArray("assessment");
38005        for (Reference e : element.getAssessment()) 
38006          composeReference(null, e);
38007        closeArray();
38008      };
38009      if (element.hasType()) {
38010        composeCodeableConcept("type", element.getType());
38011      }
38012  }
38013
38014  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
38015    if (element != null) {
38016      open(name);
38017      composeConditionConditionEvidenceComponentInner(element);
38018      close();
38019    }
38020  }
38021
38022  protected void composeConditionConditionEvidenceComponentInner(Condition.ConditionEvidenceComponent element) throws IOException {
38023      composeBackbone(element);
38024      if (element.hasCode()) {
38025        openArray("code");
38026        for (CodeableConcept e : element.getCode()) 
38027          composeCodeableConcept(null, e);
38028          closeArray();
38029      };
38030      if (element.hasDetail()) {
38031        openArray("detail");
38032        for (Reference e : element.getDetail()) 
38033          composeReference(null, e);
38034          closeArray();
38035      };
38036  }
38037
38038  protected void composeConditionDefinition(String name, ConditionDefinition element) throws IOException {
38039    if (element != null) {
38040      prop("resourceType", name);
38041      composeConditionDefinitionInner(element);
38042    }
38043  }
38044
38045  protected void composeConditionDefinitionInner(ConditionDefinition element) throws IOException {
38046      composeDomainResourceElements(element);
38047      if (element.hasUrlElement()) {
38048        composeUriCore("url", element.getUrlElement(), false);
38049        composeUriExtras("url", element.getUrlElement(), false);
38050      }
38051      if (element.hasIdentifier()) {
38052        openArray("identifier");
38053        for (Identifier e : element.getIdentifier()) 
38054          composeIdentifier(null, e);
38055        closeArray();
38056      };
38057      if (element.hasVersionElement()) {
38058        composeStringCore("version", element.getVersionElement(), false);
38059        composeStringExtras("version", element.getVersionElement(), false);
38060      }
38061      if (element.hasNameElement()) {
38062        composeStringCore("name", element.getNameElement(), false);
38063        composeStringExtras("name", element.getNameElement(), false);
38064      }
38065      if (element.hasTitleElement()) {
38066        composeStringCore("title", element.getTitleElement(), false);
38067        composeStringExtras("title", element.getTitleElement(), false);
38068      }
38069      if (element.hasSubtitleElement()) {
38070        composeStringCore("subtitle", element.getSubtitleElement(), false);
38071        composeStringExtras("subtitle", element.getSubtitleElement(), false);
38072      }
38073      if (element.hasStatusElement()) {
38074        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38075        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38076      }
38077      if (element.hasExperimentalElement()) {
38078        composeBooleanCore("experimental", element.getExperimentalElement(), false);
38079        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38080        }
38081      if (element.hasDateElement()) {
38082        composeDateTimeCore("date", element.getDateElement(), false);
38083        composeDateTimeExtras("date", element.getDateElement(), false);
38084      }
38085      if (element.hasPublisherElement()) {
38086        composeStringCore("publisher", element.getPublisherElement(), false);
38087        composeStringExtras("publisher", element.getPublisherElement(), false);
38088      }
38089      if (element.hasContact()) {
38090        openArray("contact");
38091        for (ContactDetail e : element.getContact()) 
38092          composeContactDetail(null, e);
38093          closeArray();
38094      };
38095      if (element.hasDescriptionElement()) {
38096        composeMarkdownCore("description", element.getDescriptionElement(), false);
38097        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38098      }
38099      if (element.hasUseContext()) {
38100        openArray("useContext");
38101        for (UsageContext e : element.getUseContext()) 
38102          composeUsageContext(null, e);
38103        closeArray();
38104      };
38105      if (element.hasJurisdiction()) {
38106        openArray("jurisdiction");
38107        for (CodeableConcept e : element.getJurisdiction()) 
38108          composeCodeableConcept(null, e);
38109        closeArray();
38110      };
38111      if (element.hasCode()) {
38112        composeCodeableConcept("code", element.getCode());
38113      }
38114      if (element.hasSeverity()) {
38115        composeCodeableConcept("severity", element.getSeverity());
38116      }
38117      if (element.hasBodySite()) {
38118        composeCodeableConcept("bodySite", element.getBodySite());
38119      }
38120      if (element.hasStage()) {
38121        composeCodeableConcept("stage", element.getStage());
38122      }
38123      if (element.hasHasSeverityElement()) {
38124        composeBooleanCore("hasSeverity", element.getHasSeverityElement(), false);
38125        composeBooleanExtras("hasSeverity", element.getHasSeverityElement(), false);
38126      }
38127      if (element.hasHasBodySiteElement()) {
38128        composeBooleanCore("hasBodySite", element.getHasBodySiteElement(), false);
38129        composeBooleanExtras("hasBodySite", element.getHasBodySiteElement(), false);
38130      }
38131      if (element.hasHasStageElement()) {
38132        composeBooleanCore("hasStage", element.getHasStageElement(), false);
38133        composeBooleanExtras("hasStage", element.getHasStageElement(), false);
38134      }
38135      if (element.hasDefinition()) {
38136        openArray("definition");
38137        for (UriType e : element.getDefinition()) 
38138          composeUriCore(null, e, true);
38139        closeArray();
38140        if (anyHasExtras(element.getDefinition())) {
38141          openArray("_definition");
38142          for (UriType e : element.getDefinition()) 
38143            composeUriExtras(null, e, true);
38144          closeArray();
38145        }
38146      };
38147      if (element.hasObservation()) {
38148        openArray("observation");
38149        for (ConditionDefinition.ConditionDefinitionObservationComponent e : element.getObservation()) 
38150          composeConditionDefinitionConditionDefinitionObservationComponent(null, e);
38151        closeArray();
38152      };
38153      if (element.hasMedication()) {
38154        openArray("medication");
38155        for (ConditionDefinition.ConditionDefinitionMedicationComponent e : element.getMedication()) 
38156          composeConditionDefinitionConditionDefinitionMedicationComponent(null, e);
38157        closeArray();
38158      };
38159      if (element.hasPrecondition()) {
38160        openArray("precondition");
38161        for (ConditionDefinition.ConditionDefinitionPreconditionComponent e : element.getPrecondition()) 
38162          composeConditionDefinitionConditionDefinitionPreconditionComponent(null, e);
38163          closeArray();
38164      };
38165      if (element.hasTeam()) {
38166        openArray("team");
38167        for (Reference e : element.getTeam()) 
38168          composeReference(null, e);
38169          closeArray();
38170      };
38171      if (element.hasQuestionnaire()) {
38172        openArray("questionnaire");
38173        for (ConditionDefinition.ConditionDefinitionQuestionnaireComponent e : element.getQuestionnaire()) 
38174          composeConditionDefinitionConditionDefinitionQuestionnaireComponent(null, e);
38175        closeArray();
38176      };
38177      if (element.hasPlan()) {
38178        openArray("plan");
38179        for (ConditionDefinition.ConditionDefinitionPlanComponent e : element.getPlan()) 
38180          composeConditionDefinitionConditionDefinitionPlanComponent(null, e);
38181          closeArray();
38182      };
38183  }
38184
38185  protected void composeConditionDefinitionConditionDefinitionObservationComponent(String name, ConditionDefinition.ConditionDefinitionObservationComponent element) throws IOException {
38186    if (element != null) {
38187      open(name);
38188      composeConditionDefinitionConditionDefinitionObservationComponentInner(element);
38189      close();
38190    }
38191  }
38192
38193  protected void composeConditionDefinitionConditionDefinitionObservationComponentInner(ConditionDefinition.ConditionDefinitionObservationComponent element) throws IOException {
38194      composeBackbone(element);
38195      if (element.hasCategory()) {
38196        composeCodeableConcept("category", element.getCategory());
38197      }
38198      if (element.hasCode()) {
38199        composeCodeableConcept("code", element.getCode());
38200      }
38201  }
38202
38203  protected void composeConditionDefinitionConditionDefinitionMedicationComponent(String name, ConditionDefinition.ConditionDefinitionMedicationComponent element) throws IOException {
38204    if (element != null) {
38205      open(name);
38206      composeConditionDefinitionConditionDefinitionMedicationComponentInner(element);
38207      close();
38208    }
38209  }
38210
38211  protected void composeConditionDefinitionConditionDefinitionMedicationComponentInner(ConditionDefinition.ConditionDefinitionMedicationComponent element) throws IOException {
38212      composeBackbone(element);
38213      if (element.hasCategory()) {
38214        composeCodeableConcept("category", element.getCategory());
38215      }
38216      if (element.hasCode()) {
38217        composeCodeableConcept("code", element.getCode());
38218      }
38219  }
38220
38221  protected void composeConditionDefinitionConditionDefinitionPreconditionComponent(String name, ConditionDefinition.ConditionDefinitionPreconditionComponent element) throws IOException {
38222    if (element != null) {
38223      open(name);
38224      composeConditionDefinitionConditionDefinitionPreconditionComponentInner(element);
38225      close();
38226    }
38227  }
38228
38229  protected void composeConditionDefinitionConditionDefinitionPreconditionComponentInner(ConditionDefinition.ConditionDefinitionPreconditionComponent element) throws IOException {
38230      composeBackbone(element);
38231      if (element.hasTypeElement()) {
38232        composeEnumerationCore("type", element.getTypeElement(), new ConditionDefinition.ConditionPreconditionTypeEnumFactory(), false);
38233        composeEnumerationExtras("type", element.getTypeElement(), new ConditionDefinition.ConditionPreconditionTypeEnumFactory(), false);
38234      }
38235      if (element.hasCode()) {
38236        composeCodeableConcept("code", element.getCode());
38237      }
38238      if (element.hasValue()) {
38239        composeType("value", element.getValue());
38240      }
38241  }
38242
38243  protected void composeConditionDefinitionConditionDefinitionQuestionnaireComponent(String name, ConditionDefinition.ConditionDefinitionQuestionnaireComponent element) throws IOException {
38244    if (element != null) {
38245      open(name);
38246      composeConditionDefinitionConditionDefinitionQuestionnaireComponentInner(element);
38247      close();
38248    }
38249  }
38250
38251  protected void composeConditionDefinitionConditionDefinitionQuestionnaireComponentInner(ConditionDefinition.ConditionDefinitionQuestionnaireComponent element) throws IOException {
38252      composeBackbone(element);
38253      if (element.hasPurposeElement()) {
38254        composeEnumerationCore("purpose", element.getPurposeElement(), new ConditionDefinition.ConditionQuestionnairePurposeEnumFactory(), false);
38255        composeEnumerationExtras("purpose", element.getPurposeElement(), new ConditionDefinition.ConditionQuestionnairePurposeEnumFactory(), false);
38256      }
38257      if (element.hasReference()) {
38258        composeReference("reference", element.getReference());
38259      }
38260  }
38261
38262  protected void composeConditionDefinitionConditionDefinitionPlanComponent(String name, ConditionDefinition.ConditionDefinitionPlanComponent element) throws IOException {
38263    if (element != null) {
38264      open(name);
38265      composeConditionDefinitionConditionDefinitionPlanComponentInner(element);
38266      close();
38267    }
38268  }
38269
38270  protected void composeConditionDefinitionConditionDefinitionPlanComponentInner(ConditionDefinition.ConditionDefinitionPlanComponent element) throws IOException {
38271      composeBackbone(element);
38272      if (element.hasRole()) {
38273        composeCodeableConcept("role", element.getRole());
38274      }
38275      if (element.hasReference()) {
38276        composeReference("reference", element.getReference());
38277      }
38278  }
38279
38280  protected void composeConsent(String name, Consent element) throws IOException {
38281    if (element != null) {
38282      prop("resourceType", name);
38283      composeConsentInner(element);
38284    }
38285  }
38286
38287  protected void composeConsentInner(Consent element) throws IOException {
38288      composeDomainResourceElements(element);
38289      if (element.hasIdentifier()) {
38290        openArray("identifier");
38291        for (Identifier e : element.getIdentifier()) 
38292          composeIdentifier(null, e);
38293        closeArray();
38294      };
38295      if (element.hasStatusElement()) {
38296        composeEnumerationCore("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
38297        composeEnumerationExtras("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
38298      }
38299      if (element.hasScope()) {
38300        composeCodeableConcept("scope", element.getScope());
38301      }
38302      if (element.hasCategory()) {
38303        openArray("category");
38304        for (CodeableConcept e : element.getCategory()) 
38305          composeCodeableConcept(null, e);
38306        closeArray();
38307      };
38308      if (element.hasPatient()) {
38309        composeReference("patient", element.getPatient());
38310      }
38311      if (element.hasDateTimeElement()) {
38312        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
38313        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
38314      }
38315      if (element.hasPerformer()) {
38316        openArray("performer");
38317        for (Reference e : element.getPerformer()) 
38318          composeReference(null, e);
38319        closeArray();
38320      };
38321      if (element.hasOrganization()) {
38322        openArray("organization");
38323        for (Reference e : element.getOrganization()) 
38324          composeReference(null, e);
38325        closeArray();
38326      };
38327      if (element.hasSourceAttachment()) {
38328        openArray("sourceAttachment");
38329        for (Attachment e : element.getSourceAttachment()) 
38330          composeAttachment(null, e);
38331        closeArray();
38332      };
38333      if (element.hasSourceReference()) {
38334        openArray("sourceReference");
38335        for (Reference e : element.getSourceReference()) 
38336          composeReference(null, e);
38337        closeArray();
38338      };
38339      if (element.hasPolicy()) {
38340        openArray("policy");
38341        for (Consent.ConsentPolicyComponent e : element.getPolicy()) 
38342          composeConsentConsentPolicyComponent(null, e);
38343        closeArray();
38344      };
38345      if (element.hasPolicyRule()) {
38346        composeCodeableConcept("policyRule", element.getPolicyRule());
38347      }
38348      if (element.hasVerification()) {
38349        openArray("verification");
38350        for (Consent.ConsentVerificationComponent e : element.getVerification()) 
38351          composeConsentConsentVerificationComponent(null, e);
38352        closeArray();
38353      };
38354      if (element.hasProvision()) {
38355        composeConsentprovisionComponent("provision", element.getProvision());
38356      }
38357  }
38358
38359  protected void composeConsentConsentPolicyComponent(String name, Consent.ConsentPolicyComponent element) throws IOException {
38360    if (element != null) {
38361      open(name);
38362      composeConsentConsentPolicyComponentInner(element);
38363      close();
38364    }
38365  }
38366
38367  protected void composeConsentConsentPolicyComponentInner(Consent.ConsentPolicyComponent element) throws IOException {
38368      composeBackbone(element);
38369      if (element.hasAuthorityElement()) {
38370        composeUriCore("authority", element.getAuthorityElement(), false);
38371        composeUriExtras("authority", element.getAuthorityElement(), false);
38372      }
38373      if (element.hasUriElement()) {
38374        composeUriCore("uri", element.getUriElement(), false);
38375        composeUriExtras("uri", element.getUriElement(), false);
38376      }
38377  }
38378
38379  protected void composeConsentConsentVerificationComponent(String name, Consent.ConsentVerificationComponent element) throws IOException {
38380    if (element != null) {
38381      open(name);
38382      composeConsentConsentVerificationComponentInner(element);
38383      close();
38384    }
38385  }
38386
38387  protected void composeConsentConsentVerificationComponentInner(Consent.ConsentVerificationComponent element) throws IOException {
38388      composeBackbone(element);
38389      if (element.hasVerifiedElement()) {
38390        composeBooleanCore("verified", element.getVerifiedElement(), false);
38391        composeBooleanExtras("verified", element.getVerifiedElement(), false);
38392      }
38393      if (element.hasVerifiedWith()) {
38394        composeReference("verifiedWith", element.getVerifiedWith());
38395      }
38396      if (element.hasVerificationDateElement()) {
38397        composeDateTimeCore("verificationDate", element.getVerificationDateElement(), false);
38398        composeDateTimeExtras("verificationDate", element.getVerificationDateElement(), false);
38399      }
38400  }
38401
38402  protected void composeConsentprovisionComponent(String name, Consent.provisionComponent element) throws IOException {
38403    if (element != null) {
38404      open(name);
38405      composeConsentprovisionComponentInner(element);
38406      close();
38407    }
38408  }
38409
38410  protected void composeConsentprovisionComponentInner(Consent.provisionComponent element) throws IOException {
38411      composeBackbone(element);
38412      if (element.hasTypeElement()) {
38413        composeEnumerationCore("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
38414        composeEnumerationExtras("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
38415      }
38416      if (element.hasPeriod()) {
38417        composePeriod("period", element.getPeriod());
38418      }
38419      if (element.hasActor()) {
38420        openArray("actor");
38421        for (Consent.provisionActorComponent e : element.getActor()) 
38422          composeConsentprovisionActorComponent(null, e);
38423        closeArray();
38424      };
38425      if (element.hasAction()) {
38426        openArray("action");
38427        for (CodeableConcept e : element.getAction()) 
38428          composeCodeableConcept(null, e);
38429        closeArray();
38430      };
38431      if (element.hasSecurityLabel()) {
38432        openArray("securityLabel");
38433        for (Coding e : element.getSecurityLabel()) 
38434          composeCoding(null, e);
38435        closeArray();
38436      };
38437      if (element.hasPurpose()) {
38438        openArray("purpose");
38439        for (Coding e : element.getPurpose()) 
38440          composeCoding(null, e);
38441        closeArray();
38442      };
38443      if (element.hasClass_()) {
38444        openArray("class");
38445        for (Coding e : element.getClass_()) 
38446          composeCoding(null, e);
38447          closeArray();
38448      };
38449      if (element.hasCode()) {
38450        openArray("code");
38451        for (CodeableConcept e : element.getCode()) 
38452          composeCodeableConcept(null, e);
38453        closeArray();
38454      };
38455      if (element.hasDataPeriod()) {
38456        composePeriod("dataPeriod", element.getDataPeriod());
38457      }
38458      if (element.hasData()) {
38459        openArray("data");
38460        for (Consent.provisionDataComponent e : element.getData()) 
38461          composeConsentprovisionDataComponent(null, e);
38462        closeArray();
38463      };
38464      if (element.hasProvision()) {
38465        openArray("provision");
38466        for (Consent.provisionComponent e : element.getProvision()) 
38467          composeConsentprovisionComponent(null, e);
38468        closeArray();
38469      };
38470  }
38471
38472  protected void composeConsentprovisionActorComponent(String name, Consent.provisionActorComponent element) throws IOException {
38473    if (element != null) {
38474      open(name);
38475      composeConsentprovisionActorComponentInner(element);
38476      close();
38477    }
38478  }
38479
38480  protected void composeConsentprovisionActorComponentInner(Consent.provisionActorComponent element) throws IOException {
38481      composeBackbone(element);
38482      if (element.hasRole()) {
38483        composeCodeableConcept("role", element.getRole());
38484        }
38485      if (element.hasReference()) {
38486        composeReference("reference", element.getReference());
38487      }
38488  }
38489
38490  protected void composeConsentprovisionDataComponent(String name, Consent.provisionDataComponent element) throws IOException {
38491    if (element != null) {
38492      open(name);
38493      composeConsentprovisionDataComponentInner(element);
38494      close();
38495    }
38496  }
38497
38498  protected void composeConsentprovisionDataComponentInner(Consent.provisionDataComponent element) throws IOException {
38499      composeBackbone(element);
38500      if (element.hasMeaningElement()) {
38501        composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
38502        composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
38503      }
38504      if (element.hasReference()) {
38505        composeReference("reference", element.getReference());
38506      }
38507  }
38508
38509  protected void composeContract(String name, Contract element) throws IOException {
38510    if (element != null) {
38511      prop("resourceType", name);
38512      composeContractInner(element);
38513    }
38514  }
38515
38516  protected void composeContractInner(Contract element) throws IOException {
38517      composeDomainResourceElements(element);
38518      if (element.hasIdentifier()) {
38519        openArray("identifier");
38520        for (Identifier e : element.getIdentifier()) 
38521          composeIdentifier(null, e);
38522        closeArray();
38523      };
38524      if (element.hasUrlElement()) {
38525        composeUriCore("url", element.getUrlElement(), false);
38526        composeUriExtras("url", element.getUrlElement(), false);
38527      }
38528      if (element.hasVersionElement()) {
38529        composeStringCore("version", element.getVersionElement(), false);
38530        composeStringExtras("version", element.getVersionElement(), false);
38531      }
38532      if (element.hasStatusElement()) {
38533        composeEnumerationCore("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
38534        composeEnumerationExtras("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
38535      }
38536      if (element.hasLegalState()) {
38537        composeCodeableConcept("legalState", element.getLegalState());
38538      }
38539      if (element.hasInstantiatesCanonical()) {
38540        composeReference("instantiatesCanonical", element.getInstantiatesCanonical());
38541      }
38542      if (element.hasInstantiatesUriElement()) {
38543        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
38544        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
38545      }
38546      if (element.hasContentDerivative()) {
38547        composeCodeableConcept("contentDerivative", element.getContentDerivative());
38548      }
38549      if (element.hasIssuedElement()) {
38550        composeDateTimeCore("issued", element.getIssuedElement(), false);
38551        composeDateTimeExtras("issued", element.getIssuedElement(), false);
38552      }
38553      if (element.hasApplies()) {
38554        composePeriod("applies", element.getApplies());
38555      }
38556      if (element.hasExpirationType()) {
38557        composeCodeableConcept("expirationType", element.getExpirationType());
38558      }
38559      if (element.hasSubject()) {
38560        openArray("subject");
38561        for (Reference e : element.getSubject()) 
38562          composeReference(null, e);
38563        closeArray();
38564      };
38565      if (element.hasAuthority()) {
38566        openArray("authority");
38567        for (Reference e : element.getAuthority()) 
38568          composeReference(null, e);
38569        closeArray();
38570      };
38571      if (element.hasDomain()) {
38572        openArray("domain");
38573        for (Reference e : element.getDomain()) 
38574          composeReference(null, e);
38575        closeArray();
38576      };
38577      if (element.hasSite()) {
38578        openArray("site");
38579        for (Reference e : element.getSite()) 
38580          composeReference(null, e);
38581          closeArray();
38582      };
38583      if (element.hasNameElement()) {
38584        composeStringCore("name", element.getNameElement(), false);
38585        composeStringExtras("name", element.getNameElement(), false);
38586      }
38587      if (element.hasTitleElement()) {
38588        composeStringCore("title", element.getTitleElement(), false);
38589        composeStringExtras("title", element.getTitleElement(), false);
38590      }
38591      if (element.hasSubtitleElement()) {
38592        composeStringCore("subtitle", element.getSubtitleElement(), false);
38593        composeStringExtras("subtitle", element.getSubtitleElement(), false);
38594      }
38595      if (element.hasAlias()) {
38596        openArray("alias");
38597        for (StringType e : element.getAlias()) 
38598          composeStringCore(null, e, true);
38599        closeArray();
38600        if (anyHasExtras(element.getAlias())) {
38601          openArray("_alias");
38602          for (StringType e : element.getAlias()) 
38603            composeStringExtras(null, e, true);
38604          closeArray();
38605      }
38606      };
38607      if (element.hasAuthor()) {
38608        composeReference("author", element.getAuthor());
38609      }
38610      if (element.hasScope()) {
38611        composeCodeableConcept("scope", element.getScope());
38612      }
38613      if (element.hasTopic()) {
38614        composeType("topic", element.getTopic());
38615      }
38616      if (element.hasType()) {
38617        composeCodeableConcept("type", element.getType());
38618      }
38619      if (element.hasSubType()) {
38620        openArray("subType");
38621        for (CodeableConcept e : element.getSubType()) 
38622          composeCodeableConcept(null, e);
38623        closeArray();
38624      };
38625      if (element.hasContentDefinition()) {
38626        composeContractContentDefinitionComponent("contentDefinition", element.getContentDefinition());
38627      }
38628      if (element.hasTerm()) {
38629        openArray("term");
38630        for (Contract.TermComponent e : element.getTerm()) 
38631          composeContractTermComponent(null, e);
38632        closeArray();
38633      };
38634      if (element.hasSupportingInfo()) {
38635        openArray("supportingInfo");
38636        for (Reference e : element.getSupportingInfo()) 
38637          composeReference(null, e);
38638        closeArray();
38639      };
38640      if (element.hasRelevantHistory()) {
38641        openArray("relevantHistory");
38642        for (Reference e : element.getRelevantHistory()) 
38643          composeReference(null, e);
38644        closeArray();
38645      };
38646      if (element.hasSigner()) {
38647        openArray("signer");
38648        for (Contract.SignatoryComponent e : element.getSigner()) 
38649          composeContractSignatoryComponent(null, e);
38650        closeArray();
38651      };
38652      if (element.hasFriendly()) {
38653        openArray("friendly");
38654        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
38655          composeContractFriendlyLanguageComponent(null, e);
38656        closeArray();
38657      };
38658      if (element.hasLegal()) {
38659        openArray("legal");
38660        for (Contract.LegalLanguageComponent e : element.getLegal()) 
38661          composeContractLegalLanguageComponent(null, e);
38662        closeArray();
38663      };
38664      if (element.hasRule()) {
38665        openArray("rule");
38666        for (Contract.ComputableLanguageComponent e : element.getRule()) 
38667          composeContractComputableLanguageComponent(null, e);
38668        closeArray();
38669      };
38670      if (element.hasLegallyBinding()) {
38671        composeType("legallyBinding", element.getLegallyBinding());
38672      }
38673  }
38674
38675  protected void composeContractContentDefinitionComponent(String name, Contract.ContentDefinitionComponent element) throws IOException {
38676    if (element != null) {
38677      open(name);
38678      composeContractContentDefinitionComponentInner(element);
38679      close();
38680    }
38681  }
38682
38683  protected void composeContractContentDefinitionComponentInner(Contract.ContentDefinitionComponent element) throws IOException {
38684      composeBackbone(element);
38685      if (element.hasType()) {
38686        composeCodeableConcept("type", element.getType());
38687      }
38688      if (element.hasSubType()) {
38689        composeCodeableConcept("subType", element.getSubType());
38690      }
38691      if (element.hasPublisher()) {
38692        composeReference("publisher", element.getPublisher());
38693      }
38694      if (element.hasPublicationDateElement()) {
38695        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
38696        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
38697      }
38698      if (element.hasPublicationStatusElement()) {
38699        composeEnumerationCore("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractPublicationStatusEnumFactory(), false);
38700        composeEnumerationExtras("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractPublicationStatusEnumFactory(), false);
38701      }
38702      if (element.hasCopyrightElement()) {
38703        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
38704        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
38705      }
38706  }
38707
38708  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
38709    if (element != null) {
38710      open(name);
38711      composeContractTermComponentInner(element);
38712      close();
38713    }
38714  }
38715
38716  protected void composeContractTermComponentInner(Contract.TermComponent element) throws IOException {
38717      composeBackbone(element);
38718      if (element.hasIdentifier()) {
38719        composeIdentifier("identifier", element.getIdentifier());
38720      }
38721      if (element.hasIssuedElement()) {
38722        composeDateTimeCore("issued", element.getIssuedElement(), false);
38723        composeDateTimeExtras("issued", element.getIssuedElement(), false);
38724      }
38725      if (element.hasApplies()) {
38726        composePeriod("applies", element.getApplies());
38727      }
38728      if (element.hasTopic()) {
38729        composeType("topic", element.getTopic());
38730      }
38731      if (element.hasType()) {
38732        composeCodeableConcept("type", element.getType());
38733      }
38734      if (element.hasSubType()) {
38735        composeCodeableConcept("subType", element.getSubType());
38736      }
38737      if (element.hasTextElement()) {
38738        composeStringCore("text", element.getTextElement(), false);
38739        composeStringExtras("text", element.getTextElement(), false);
38740      }
38741      if (element.hasSecurityLabel()) {
38742        openArray("securityLabel");
38743        for (Contract.SecurityLabelComponent e : element.getSecurityLabel()) 
38744          composeContractSecurityLabelComponent(null, e);
38745        closeArray();
38746      };
38747      if (element.hasOffer()) {
38748        composeContractContractOfferComponent("offer", element.getOffer());
38749      }
38750      if (element.hasAsset()) {
38751        openArray("asset");
38752        for (Contract.ContractAssetComponent e : element.getAsset()) 
38753          composeContractContractAssetComponent(null, e);
38754        closeArray();
38755      };
38756      if (element.hasAction()) {
38757        openArray("action");
38758        for (Contract.ActionComponent e : element.getAction()) 
38759          composeContractActionComponent(null, e);
38760        closeArray();
38761      };
38762      if (element.hasGroup()) {
38763        openArray("group");
38764        for (Contract.TermComponent e : element.getGroup()) 
38765          composeContractTermComponent(null, e);
38766        closeArray();
38767      };
38768  }
38769
38770  protected void composeContractSecurityLabelComponent(String name, Contract.SecurityLabelComponent element) throws IOException {
38771    if (element != null) {
38772      open(name);
38773      composeContractSecurityLabelComponentInner(element);
38774      close();
38775    }
38776  }
38777
38778  protected void composeContractSecurityLabelComponentInner(Contract.SecurityLabelComponent element) throws IOException {
38779      composeBackbone(element);
38780      if (element.hasNumber()) {
38781        openArray("number");
38782        for (UnsignedIntType e : element.getNumber()) 
38783          composeUnsignedIntCore(null, e, true);
38784        closeArray();
38785        if (anyHasExtras(element.getNumber())) {
38786          openArray("_number");
38787          for (UnsignedIntType e : element.getNumber()) 
38788            composeUnsignedIntExtras(null, e, true);
38789          closeArray();
38790      }
38791      };
38792      if (element.hasClassification()) {
38793        composeCoding("classification", element.getClassification());
38794      }
38795      if (element.hasCategory()) {
38796        openArray("category");
38797        for (Coding e : element.getCategory()) 
38798          composeCoding(null, e);
38799        closeArray();
38800      };
38801      if (element.hasControl()) {
38802        openArray("control");
38803        for (Coding e : element.getControl()) 
38804          composeCoding(null, e);
38805        closeArray();
38806      };
38807  }
38808
38809  protected void composeContractContractOfferComponent(String name, Contract.ContractOfferComponent element) throws IOException {
38810    if (element != null) {
38811      open(name);
38812      composeContractContractOfferComponentInner(element);
38813      close();
38814    }
38815  }
38816
38817  protected void composeContractContractOfferComponentInner(Contract.ContractOfferComponent element) throws IOException {
38818      composeBackbone(element);
38819      if (element.hasIdentifier()) {
38820        openArray("identifier");
38821        for (Identifier e : element.getIdentifier()) 
38822          composeIdentifier(null, e);
38823        closeArray();
38824      };
38825      if (element.hasParty()) {
38826        openArray("party");
38827        for (Contract.ContractPartyComponent e : element.getParty()) 
38828          composeContractContractPartyComponent(null, e);
38829        closeArray();
38830      };
38831      if (element.hasTopic()) {
38832        composeReference("topic", element.getTopic());
38833      }
38834      if (element.hasType()) {
38835        composeCodeableConcept("type", element.getType());
38836      }
38837      if (element.hasDecision()) {
38838        composeCodeableConcept("decision", element.getDecision());
38839      }
38840      if (element.hasDecisionMode()) {
38841        openArray("decisionMode");
38842        for (CodeableConcept e : element.getDecisionMode()) 
38843          composeCodeableConcept(null, e);
38844        closeArray();
38845      };
38846      if (element.hasAnswer()) {
38847        openArray("answer");
38848        for (Contract.AnswerComponent e : element.getAnswer()) 
38849          composeContractAnswerComponent(null, e);
38850        closeArray();
38851      };
38852      if (element.hasTextElement()) {
38853        composeStringCore("text", element.getTextElement(), false);
38854        composeStringExtras("text", element.getTextElement(), false);
38855      }
38856      if (element.hasLinkId()) {
38857        openArray("linkId");
38858        for (StringType e : element.getLinkId()) 
38859          composeStringCore(null, e, true);
38860        closeArray();
38861        if (anyHasExtras(element.getLinkId())) {
38862          openArray("_linkId");
38863          for (StringType e : element.getLinkId()) 
38864            composeStringExtras(null, e, true);
38865          closeArray();
38866      }
38867      };
38868      if (element.hasSecurityLabelNumber()) {
38869        openArray("securityLabelNumber");
38870        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
38871          composeUnsignedIntCore(null, e, true);
38872        closeArray();
38873        if (anyHasExtras(element.getSecurityLabelNumber())) {
38874          openArray("_securityLabelNumber");
38875          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
38876            composeUnsignedIntExtras(null, e, true);
38877          closeArray();
38878      }
38879      };
38880  }
38881
38882  protected void composeContractContractPartyComponent(String name, Contract.ContractPartyComponent element) throws IOException {
38883    if (element != null) {
38884      open(name);
38885      composeContractContractPartyComponentInner(element);
38886      close();
38887    }
38888  }
38889
38890  protected void composeContractContractPartyComponentInner(Contract.ContractPartyComponent element) throws IOException {
38891      composeBackbone(element);
38892      if (element.hasReference()) {
38893        openArray("reference");
38894        for (Reference e : element.getReference()) 
38895          composeReference(null, e);
38896        closeArray();
38897      };
38898      if (element.hasRole()) {
38899        composeCodeableConcept("role", element.getRole());
38900      }
38901  }
38902
38903  protected void composeContractAnswerComponent(String name, Contract.AnswerComponent element) throws IOException {
38904    if (element != null) {
38905      open(name);
38906      composeContractAnswerComponentInner(element);
38907      close();
38908    }
38909  }
38910
38911  protected void composeContractAnswerComponentInner(Contract.AnswerComponent element) throws IOException {
38912      composeBackbone(element);
38913      if (element.hasValue()) {
38914        composeType("value", element.getValue());
38915      }
38916  }
38917
38918  protected void composeContractContractAssetComponent(String name, Contract.ContractAssetComponent element) throws IOException {
38919    if (element != null) {
38920      open(name);
38921      composeContractContractAssetComponentInner(element);
38922      close();
38923    }
38924  }
38925
38926  protected void composeContractContractAssetComponentInner(Contract.ContractAssetComponent element) throws IOException {
38927      composeBackbone(element);
38928      if (element.hasScope()) {
38929        composeCodeableConcept("scope", element.getScope());
38930      }
38931      if (element.hasType()) {
38932        openArray("type");
38933        for (CodeableConcept e : element.getType()) 
38934          composeCodeableConcept(null, e);
38935        closeArray();
38936      };
38937      if (element.hasTypeReference()) {
38938        openArray("typeReference");
38939        for (Reference e : element.getTypeReference()) 
38940          composeReference(null, e);
38941        closeArray();
38942      };
38943      if (element.hasSubtype()) {
38944        openArray("subtype");
38945        for (CodeableConcept e : element.getSubtype()) 
38946          composeCodeableConcept(null, e);
38947        closeArray();
38948      };
38949      if (element.hasRelationship()) {
38950        composeCoding("relationship", element.getRelationship());
38951      }
38952      if (element.hasContext()) {
38953        openArray("context");
38954        for (Contract.AssetContextComponent e : element.getContext()) 
38955          composeContractAssetContextComponent(null, e);
38956        closeArray();
38957      };
38958      if (element.hasConditionElement()) {
38959        composeStringCore("condition", element.getConditionElement(), false);
38960        composeStringExtras("condition", element.getConditionElement(), false);
38961      }
38962      if (element.hasPeriodType()) {
38963        openArray("periodType");
38964        for (CodeableConcept e : element.getPeriodType()) 
38965          composeCodeableConcept(null, e);
38966        closeArray();
38967      };
38968      if (element.hasPeriod()) {
38969        openArray("period");
38970        for (Period e : element.getPeriod()) 
38971          composePeriod(null, e);
38972        closeArray();
38973      };
38974      if (element.hasUsePeriod()) {
38975        openArray("usePeriod");
38976        for (Period e : element.getUsePeriod()) 
38977          composePeriod(null, e);
38978        closeArray();
38979      };
38980      if (element.hasTextElement()) {
38981        composeStringCore("text", element.getTextElement(), false);
38982        composeStringExtras("text", element.getTextElement(), false);
38983      }
38984      if (element.hasLinkId()) {
38985        openArray("linkId");
38986        for (StringType e : element.getLinkId()) 
38987          composeStringCore(null, e, true);
38988        closeArray();
38989        if (anyHasExtras(element.getLinkId())) {
38990          openArray("_linkId");
38991          for (StringType e : element.getLinkId()) 
38992            composeStringExtras(null, e, true);
38993          closeArray();
38994      }
38995      };
38996      if (element.hasAnswer()) {
38997        openArray("answer");
38998        for (Contract.AnswerComponent e : element.getAnswer()) 
38999          composeContractAnswerComponent(null, e);
39000        closeArray();
39001      };
39002      if (element.hasSecurityLabelNumber()) {
39003        openArray("securityLabelNumber");
39004        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
39005          composeUnsignedIntCore(null, e, true);
39006        closeArray();
39007        if (anyHasExtras(element.getSecurityLabelNumber())) {
39008          openArray("_securityLabelNumber");
39009          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
39010            composeUnsignedIntExtras(null, e, true);
39011          closeArray();
39012      }
39013      };
39014      if (element.hasValuedItem()) {
39015        openArray("valuedItem");
39016        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
39017          composeContractValuedItemComponent(null, e);
39018        closeArray();
39019      };
39020  }
39021
39022  protected void composeContractAssetContextComponent(String name, Contract.AssetContextComponent element) throws IOException {
39023    if (element != null) {
39024      open(name);
39025      composeContractAssetContextComponentInner(element);
39026      close();
39027    }
39028  }
39029
39030  protected void composeContractAssetContextComponentInner(Contract.AssetContextComponent element) throws IOException {
39031      composeBackbone(element);
39032      if (element.hasReference()) {
39033        composeReference("reference", element.getReference());
39034      }
39035      if (element.hasCode()) {
39036        openArray("code");
39037        for (CodeableConcept e : element.getCode()) 
39038          composeCodeableConcept(null, e);
39039        closeArray();
39040      };
39041      if (element.hasTextElement()) {
39042        composeStringCore("text", element.getTextElement(), false);
39043        composeStringExtras("text", element.getTextElement(), false);
39044      }
39045  }
39046
39047  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
39048    if (element != null) {
39049      open(name);
39050      composeContractValuedItemComponentInner(element);
39051      close();
39052    }
39053  }
39054
39055  protected void composeContractValuedItemComponentInner(Contract.ValuedItemComponent element) throws IOException {
39056      composeBackbone(element);
39057      if (element.hasEntity()) {
39058        composeType("entity", element.getEntity());
39059      }
39060      if (element.hasIdentifier()) {
39061        composeIdentifier("identifier", element.getIdentifier());
39062      }
39063      if (element.hasEffectiveTimeElement()) {
39064        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
39065        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
39066      }
39067      if (element.hasQuantity()) {
39068        composeQuantity("quantity", element.getQuantity());
39069  }
39070      if (element.hasUnitPrice()) {
39071        composeMoney("unitPrice", element.getUnitPrice());
39072    }
39073      if (element.hasFactorElement()) {
39074        composeDecimalCore("factor", element.getFactorElement(), false);
39075        composeDecimalExtras("factor", element.getFactorElement(), false);
39076  }
39077      if (element.hasPointsElement()) {
39078        composeDecimalCore("points", element.getPointsElement(), false);
39079        composeDecimalExtras("points", element.getPointsElement(), false);
39080      }
39081      if (element.hasNet()) {
39082        composeMoney("net", element.getNet());
39083      }
39084      if (element.hasPaymentElement()) {
39085        composeStringCore("payment", element.getPaymentElement(), false);
39086        composeStringExtras("payment", element.getPaymentElement(), false);
39087  }
39088      if (element.hasPaymentDateElement()) {
39089        composeDateTimeCore("paymentDate", element.getPaymentDateElement(), false);
39090        composeDateTimeExtras("paymentDate", element.getPaymentDateElement(), false);
39091    }
39092      if (element.hasResponsible()) {
39093        composeReference("responsible", element.getResponsible());
39094  }
39095      if (element.hasRecipient()) {
39096        composeReference("recipient", element.getRecipient());
39097      }
39098      if (element.hasLinkId()) {
39099        openArray("linkId");
39100        for (StringType e : element.getLinkId()) 
39101          composeStringCore(null, e, true);
39102        closeArray();
39103        if (anyHasExtras(element.getLinkId())) {
39104          openArray("_linkId");
39105          for (StringType e : element.getLinkId()) 
39106            composeStringExtras(null, e, true);
39107          closeArray();
39108      }
39109      };
39110      if (element.hasSecurityLabelNumber()) {
39111        openArray("securityLabelNumber");
39112        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
39113          composeUnsignedIntCore(null, e, true);
39114        closeArray();
39115        if (anyHasExtras(element.getSecurityLabelNumber())) {
39116          openArray("_securityLabelNumber");
39117          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
39118            composeUnsignedIntExtras(null, e, true);
39119          closeArray();
39120      }
39121      };
39122  }
39123
39124  protected void composeContractActionComponent(String name, Contract.ActionComponent element) throws IOException {
39125    if (element != null) {
39126      open(name);
39127      composeContractActionComponentInner(element);
39128      close();
39129    }
39130  }
39131
39132  protected void composeContractActionComponentInner(Contract.ActionComponent element) throws IOException {
39133      composeBackbone(element);
39134      if (element.hasDoNotPerformElement()) {
39135        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
39136        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
39137      }
39138      if (element.hasType()) {
39139        composeCodeableConcept("type", element.getType());
39140      }
39141      if (element.hasSubject()) {
39142        openArray("subject");
39143        for (Contract.ActionSubjectComponent e : element.getSubject()) 
39144          composeContractActionSubjectComponent(null, e);
39145        closeArray();
39146      };
39147      if (element.hasIntent()) {
39148        composeCodeableConcept("intent", element.getIntent());
39149      }
39150      if (element.hasLinkId()) {
39151        openArray("linkId");
39152        for (StringType e : element.getLinkId()) 
39153          composeStringCore(null, e, true);
39154        closeArray();
39155        if (anyHasExtras(element.getLinkId())) {
39156          openArray("_linkId");
39157          for (StringType e : element.getLinkId()) 
39158            composeStringExtras(null, e, true);
39159        closeArray();
39160        }
39161      };
39162      if (element.hasStatus()) {
39163        composeCodeableConcept("status", element.getStatus());
39164  }
39165      if (element.hasContext()) {
39166        composeReference("context", element.getContext());
39167      }
39168      if (element.hasContextLinkId()) {
39169        openArray("contextLinkId");
39170        for (StringType e : element.getContextLinkId()) 
39171          composeStringCore(null, e, true);
39172        closeArray();
39173        if (anyHasExtras(element.getContextLinkId())) {
39174          openArray("_contextLinkId");
39175          for (StringType e : element.getContextLinkId()) 
39176            composeStringExtras(null, e, true);
39177          closeArray();
39178    }
39179      };
39180      if (element.hasOccurrence()) {
39181        composeType("occurrence", element.getOccurrence());
39182  }
39183      if (element.hasRequester()) {
39184        openArray("requester");
39185        for (Reference e : element.getRequester()) 
39186          composeReference(null, e);
39187        closeArray();
39188      };
39189      if (element.hasRequesterLinkId()) {
39190        openArray("requesterLinkId");
39191        for (StringType e : element.getRequesterLinkId()) 
39192          composeStringCore(null, e, true);
39193        closeArray();
39194        if (anyHasExtras(element.getRequesterLinkId())) {
39195          openArray("_requesterLinkId");
39196          for (StringType e : element.getRequesterLinkId()) 
39197            composeStringExtras(null, e, true);
39198        closeArray();
39199        }
39200      };
39201      if (element.hasPerformerType()) {
39202        openArray("performerType");
39203        for (CodeableConcept e : element.getPerformerType()) 
39204          composeCodeableConcept(null, e);
39205        closeArray();
39206      };
39207      if (element.hasPerformerRole()) {
39208        composeCodeableConcept("performerRole", element.getPerformerRole());
39209      }
39210      if (element.hasPerformer()) {
39211        composeReference("performer", element.getPerformer());
39212      }
39213      if (element.hasPerformerLinkId()) {
39214        openArray("performerLinkId");
39215        for (StringType e : element.getPerformerLinkId()) 
39216          composeStringCore(null, e, true);
39217        closeArray();
39218        if (anyHasExtras(element.getPerformerLinkId())) {
39219          openArray("_performerLinkId");
39220          for (StringType e : element.getPerformerLinkId()) 
39221            composeStringExtras(null, e, true);
39222          closeArray();
39223        }
39224      };
39225      if (element.hasReasonCode()) {
39226        openArray("reasonCode");
39227        for (CodeableConcept e : element.getReasonCode()) 
39228          composeCodeableConcept(null, e);
39229        closeArray();
39230      };
39231      if (element.hasReasonReference()) {
39232        openArray("reasonReference");
39233        for (Reference e : element.getReasonReference()) 
39234          composeReference(null, e);
39235        closeArray();
39236      };
39237      if (element.hasReason()) {
39238        openArray("reason");
39239        for (StringType e : element.getReason()) 
39240          composeStringCore(null, e, true);
39241        closeArray();
39242        if (anyHasExtras(element.getReason())) {
39243          openArray("_reason");
39244          for (StringType e : element.getReason()) 
39245            composeStringExtras(null, e, true);
39246          closeArray();
39247      }
39248      };
39249      if (element.hasReasonLinkId()) {
39250        openArray("reasonLinkId");
39251        for (StringType e : element.getReasonLinkId()) 
39252          composeStringCore(null, e, true);
39253        closeArray();
39254        if (anyHasExtras(element.getReasonLinkId())) {
39255          openArray("_reasonLinkId");
39256          for (StringType e : element.getReasonLinkId()) 
39257            composeStringExtras(null, e, true);
39258        closeArray();
39259      }
39260      };
39261      if (element.hasNote()) {
39262        openArray("note");
39263        for (Annotation e : element.getNote()) 
39264          composeAnnotation(null, e);
39265        closeArray();
39266      };
39267      if (element.hasSecurityLabelNumber()) {
39268        openArray("securityLabelNumber");
39269        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
39270          composeUnsignedIntCore(null, e, true);
39271        closeArray();
39272        if (anyHasExtras(element.getSecurityLabelNumber())) {
39273          openArray("_securityLabelNumber");
39274          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
39275            composeUnsignedIntExtras(null, e, true);
39276          closeArray();
39277      }
39278      };
39279  }
39280
39281  protected void composeContractActionSubjectComponent(String name, Contract.ActionSubjectComponent element) throws IOException {
39282    if (element != null) {
39283      open(name);
39284      composeContractActionSubjectComponentInner(element);
39285      close();
39286    }
39287  }
39288
39289  protected void composeContractActionSubjectComponentInner(Contract.ActionSubjectComponent element) throws IOException {
39290      composeBackbone(element);
39291      if (element.hasReference()) {
39292        openArray("reference");
39293        for (Reference e : element.getReference()) 
39294          composeReference(null, e);
39295        closeArray();
39296      };
39297      if (element.hasRole()) {
39298        composeCodeableConcept("role", element.getRole());
39299      }
39300  }
39301
39302  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
39303    if (element != null) {
39304      open(name);
39305      composeContractSignatoryComponentInner(element);
39306      close();
39307    }
39308  }
39309
39310  protected void composeContractSignatoryComponentInner(Contract.SignatoryComponent element) throws IOException {
39311      composeBackbone(element);
39312      if (element.hasType()) {
39313        composeCoding("type", element.getType());
39314      }
39315      if (element.hasParty()) {
39316        composeReference("party", element.getParty());
39317      }
39318      if (element.hasSignature()) {
39319        openArray("signature");
39320        for (Signature e : element.getSignature()) 
39321          composeSignature(null, e);
39322        closeArray();
39323      };
39324  }
39325
39326  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
39327    if (element != null) {
39328      open(name);
39329      composeContractFriendlyLanguageComponentInner(element);
39330      close();
39331    }
39332  }
39333
39334  protected void composeContractFriendlyLanguageComponentInner(Contract.FriendlyLanguageComponent element) throws IOException {
39335      composeBackbone(element);
39336      if (element.hasContent()) {
39337        composeType("content", element.getContent());
39338      }
39339  }
39340
39341  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
39342    if (element != null) {
39343      open(name);
39344      composeContractLegalLanguageComponentInner(element);
39345      close();
39346    }
39347  }
39348
39349  protected void composeContractLegalLanguageComponentInner(Contract.LegalLanguageComponent element) throws IOException {
39350      composeBackbone(element);
39351      if (element.hasContent()) {
39352        composeType("content", element.getContent());
39353      }
39354  }
39355
39356  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
39357    if (element != null) {
39358      open(name);
39359      composeContractComputableLanguageComponentInner(element);
39360      close();
39361    }
39362  }
39363
39364  protected void composeContractComputableLanguageComponentInner(Contract.ComputableLanguageComponent element) throws IOException {
39365      composeBackbone(element);
39366      if (element.hasContent()) {
39367        composeType("content", element.getContent());
39368      }
39369  }
39370
39371  protected void composeCoverage(String name, Coverage element) throws IOException {
39372    if (element != null) {
39373      prop("resourceType", name);
39374      composeCoverageInner(element);
39375    }
39376  }
39377
39378  protected void composeCoverageInner(Coverage element) throws IOException {
39379      composeDomainResourceElements(element);
39380      if (element.hasIdentifier()) {
39381        openArray("identifier");
39382        for (Identifier e : element.getIdentifier()) 
39383          composeIdentifier(null, e);
39384        closeArray();
39385      };
39386      if (element.hasStatusElement()) {
39387        composeEnumerationCore("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
39388        composeEnumerationExtras("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
39389      }
39390      if (element.hasType()) {
39391        composeCodeableConcept("type", element.getType());
39392      }
39393      if (element.hasPolicyHolder()) {
39394        composeReference("policyHolder", element.getPolicyHolder());
39395      }
39396      if (element.hasSubscriber()) {
39397        composeReference("subscriber", element.getSubscriber());
39398      }
39399      if (element.hasSubscriberId()) {
39400        composeIdentifier("subscriberId", element.getSubscriberId());
39401      }
39402      if (element.hasBeneficiary()) {
39403        composeReference("beneficiary", element.getBeneficiary());
39404      }
39405      if (element.hasDependentElement()) {
39406        composeStringCore("dependent", element.getDependentElement(), false);
39407        composeStringExtras("dependent", element.getDependentElement(), false);
39408      }
39409      if (element.hasRelationship()) {
39410        composeCodeableConcept("relationship", element.getRelationship());
39411      }
39412      if (element.hasPeriod()) {
39413        composePeriod("period", element.getPeriod());
39414      }
39415      if (element.hasPayor()) {
39416        openArray("payor");
39417        for (Reference e : element.getPayor()) 
39418          composeReference(null, e);
39419        closeArray();
39420      };
39421      if (element.hasClass_()) {
39422        openArray("class");
39423        for (Coverage.ClassComponent e : element.getClass_()) 
39424          composeCoverageClassComponent(null, e);
39425        closeArray();
39426      };
39427      if (element.hasOrderElement()) {
39428        composePositiveIntCore("order", element.getOrderElement(), false);
39429        composePositiveIntExtras("order", element.getOrderElement(), false);
39430      }
39431      if (element.hasNetworkElement()) {
39432        composeStringCore("network", element.getNetworkElement(), false);
39433        composeStringExtras("network", element.getNetworkElement(), false);
39434      }
39435      if (element.hasCostToBeneficiary()) {
39436        openArray("costToBeneficiary");
39437        for (Coverage.CostToBeneficiaryComponent e : element.getCostToBeneficiary()) 
39438          composeCoverageCostToBeneficiaryComponent(null, e);
39439        closeArray();
39440      };
39441      if (element.hasSubrogationElement()) {
39442        composeBooleanCore("subrogation", element.getSubrogationElement(), false);
39443        composeBooleanExtras("subrogation", element.getSubrogationElement(), false);
39444      }
39445      if (element.hasContract()) {
39446        openArray("contract");
39447        for (Reference e : element.getContract()) 
39448          composeReference(null, e);
39449        closeArray();
39450      };
39451  }
39452
39453  protected void composeCoverageClassComponent(String name, Coverage.ClassComponent element) throws IOException {
39454    if (element != null) {
39455      open(name);
39456      composeCoverageClassComponentInner(element);
39457      close();
39458    }
39459  }
39460
39461  protected void composeCoverageClassComponentInner(Coverage.ClassComponent element) throws IOException {
39462      composeBackbone(element);
39463      if (element.hasType()) {
39464        composeCodeableConcept("type", element.getType());
39465      }
39466      if (element.hasValueElement()) {
39467        composeStringCore("value", element.getValueElement(), false);
39468        composeStringExtras("value", element.getValueElement(), false);
39469      }
39470      if (element.hasNameElement()) {
39471        composeStringCore("name", element.getNameElement(), false);
39472        composeStringExtras("name", element.getNameElement(), false);
39473      }
39474  }
39475
39476  protected void composeCoverageCostToBeneficiaryComponent(String name, Coverage.CostToBeneficiaryComponent element) throws IOException {
39477    if (element != null) {
39478      open(name);
39479      composeCoverageCostToBeneficiaryComponentInner(element);
39480      close();
39481    }
39482  }
39483
39484  protected void composeCoverageCostToBeneficiaryComponentInner(Coverage.CostToBeneficiaryComponent element) throws IOException {
39485      composeBackbone(element);
39486      if (element.hasType()) {
39487        composeCodeableConcept("type", element.getType());
39488      }
39489      if (element.hasValue()) {
39490        composeType("value", element.getValue());
39491      }
39492      if (element.hasException()) {
39493        openArray("exception");
39494        for (Coverage.ExemptionComponent e : element.getException()) 
39495          composeCoverageExemptionComponent(null, e);
39496        closeArray();
39497      };
39498  }
39499
39500  protected void composeCoverageExemptionComponent(String name, Coverage.ExemptionComponent element) throws IOException {
39501    if (element != null) {
39502      open(name);
39503      composeCoverageExemptionComponentInner(element);
39504      close();
39505    }
39506  }
39507
39508  protected void composeCoverageExemptionComponentInner(Coverage.ExemptionComponent element) throws IOException {
39509      composeBackbone(element);
39510      if (element.hasType()) {
39511        composeCodeableConcept("type", element.getType());
39512      }
39513      if (element.hasPeriod()) {
39514        composePeriod("period", element.getPeriod());
39515      }
39516  }
39517
39518  protected void composeCoverageEligibilityRequest(String name, CoverageEligibilityRequest element) throws IOException {
39519    if (element != null) {
39520      prop("resourceType", name);
39521      composeCoverageEligibilityRequestInner(element);
39522    }
39523  }
39524
39525  protected void composeCoverageEligibilityRequestInner(CoverageEligibilityRequest element) throws IOException {
39526      composeDomainResourceElements(element);
39527      if (element.hasIdentifier()) {
39528        openArray("identifier");
39529        for (Identifier e : element.getIdentifier()) 
39530          composeIdentifier(null, e);
39531        closeArray();
39532      };
39533      if (element.hasStatusElement()) {
39534        composeEnumerationCore("status", element.getStatusElement(), new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
39535        composeEnumerationExtras("status", element.getStatusElement(), new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
39536      }
39537      if (element.hasPriority()) {
39538        composeCodeableConcept("priority", element.getPriority());
39539      }
39540      if (element.hasPurpose()) {
39541        openArray("purpose");
39542        for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
39543          composeEnumerationCore(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
39544        closeArray();
39545        if (anyHasExtras(element.getPurpose())) {
39546          openArray("_purpose");
39547          for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
39548            composeEnumerationExtras(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
39549          closeArray();
39550        }
39551      };
39552      if (element.hasPatient()) {
39553        composeReference("patient", element.getPatient());
39554      }
39555      if (element.hasServiced()) {
39556        composeType("serviced", element.getServiced());
39557      }
39558      if (element.hasCreatedElement()) {
39559        composeDateTimeCore("created", element.getCreatedElement(), false);
39560        composeDateTimeExtras("created", element.getCreatedElement(), false);
39561      }
39562      if (element.hasEnterer()) {
39563        composeReference("enterer", element.getEnterer());
39564      }
39565      if (element.hasProvider()) {
39566        composeReference("provider", element.getProvider());
39567      }
39568      if (element.hasInsurer()) {
39569        composeReference("insurer", element.getInsurer());
39570      }
39571      if (element.hasFacility()) {
39572        composeReference("facility", element.getFacility());
39573      }
39574      if (element.hasSupportingInfo()) {
39575        openArray("supportingInfo");
39576        for (CoverageEligibilityRequest.SupportingInformationComponent e : element.getSupportingInfo()) 
39577          composeCoverageEligibilityRequestSupportingInformationComponent(null, e);
39578          closeArray();
39579      };
39580      if (element.hasInsurance()) {
39581        openArray("insurance");
39582        for (CoverageEligibilityRequest.InsuranceComponent e : element.getInsurance()) 
39583          composeCoverageEligibilityRequestInsuranceComponent(null, e);
39584        closeArray();
39585      };
39586      if (element.hasItem()) {
39587        openArray("item");
39588        for (CoverageEligibilityRequest.DetailsComponent e : element.getItem()) 
39589          composeCoverageEligibilityRequestDetailsComponent(null, e);
39590        closeArray();
39591      };
39592      }
39593
39594  protected void composeCoverageEligibilityRequestSupportingInformationComponent(String name, CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
39595    if (element != null) {
39596      open(name);
39597      composeCoverageEligibilityRequestSupportingInformationComponentInner(element);
39598      close();
39599    }
39600  }
39601
39602  protected void composeCoverageEligibilityRequestSupportingInformationComponentInner(CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
39603      composeBackbone(element);
39604      if (element.hasSequenceElement()) {
39605        composePositiveIntCore("sequence", element.getSequenceElement(), false);
39606        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
39607      }
39608      if (element.hasInformation()) {
39609        composeReference("information", element.getInformation());
39610      }
39611      if (element.hasAppliesToAllElement()) {
39612        composeBooleanCore("appliesToAll", element.getAppliesToAllElement(), false);
39613        composeBooleanExtras("appliesToAll", element.getAppliesToAllElement(), false);
39614      }
39615      }
39616
39617  protected void composeCoverageEligibilityRequestInsuranceComponent(String name, CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
39618    if (element != null) {
39619      open(name);
39620      composeCoverageEligibilityRequestInsuranceComponentInner(element);
39621      close();
39622      }
39623      }
39624
39625  protected void composeCoverageEligibilityRequestInsuranceComponentInner(CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
39626      composeBackbone(element);
39627      if (element.hasFocalElement()) {
39628        composeBooleanCore("focal", element.getFocalElement(), false);
39629        composeBooleanExtras("focal", element.getFocalElement(), false);
39630      }
39631      if (element.hasCoverage()) {
39632        composeReference("coverage", element.getCoverage());
39633      }
39634      if (element.hasBusinessArrangementElement()) {
39635        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
39636        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
39637      }
39638      }
39639
39640  protected void composeCoverageEligibilityRequestDetailsComponent(String name, CoverageEligibilityRequest.DetailsComponent element) throws IOException {
39641    if (element != null) {
39642      open(name);
39643      composeCoverageEligibilityRequestDetailsComponentInner(element);
39644      close();
39645      }
39646      }
39647
39648  protected void composeCoverageEligibilityRequestDetailsComponentInner(CoverageEligibilityRequest.DetailsComponent element) throws IOException {
39649      composeBackbone(element);
39650      if (element.hasSupportingInfoSequence()) {
39651        openArray("supportingInfoSequence");
39652        for (PositiveIntType e : element.getSupportingInfoSequence()) 
39653          composePositiveIntCore(null, e, true);
39654        closeArray();
39655        if (anyHasExtras(element.getSupportingInfoSequence())) {
39656          openArray("_supportingInfoSequence");
39657          for (PositiveIntType e : element.getSupportingInfoSequence()) 
39658            composePositiveIntExtras(null, e, true);
39659        closeArray();
39660        }
39661      };
39662      if (element.hasCategory()) {
39663        composeCodeableConcept("category", element.getCategory());
39664      }
39665      if (element.hasProductOrService()) {
39666        composeCodeableConcept("productOrService", element.getProductOrService());
39667      }
39668      if (element.hasModifier()) {
39669        openArray("modifier");
39670        for (CodeableConcept e : element.getModifier()) 
39671          composeCodeableConcept(null, e);
39672        closeArray();
39673      };
39674      if (element.hasProvider()) {
39675        composeReference("provider", element.getProvider());
39676      }
39677      if (element.hasQuantity()) {
39678        composeQuantity("quantity", element.getQuantity());
39679      }
39680      if (element.hasUnitPrice()) {
39681        composeMoney("unitPrice", element.getUnitPrice());
39682      }
39683      if (element.hasFacility()) {
39684        composeReference("facility", element.getFacility());
39685      }
39686      if (element.hasDiagnosis()) {
39687        openArray("diagnosis");
39688        for (CoverageEligibilityRequest.DiagnosisComponent e : element.getDiagnosis()) 
39689          composeCoverageEligibilityRequestDiagnosisComponent(null, e);
39690        closeArray();
39691      };
39692      if (element.hasDetail()) {
39693        openArray("detail");
39694        for (Reference e : element.getDetail()) 
39695          composeReference(null, e);
39696        closeArray();
39697      };
39698  }
39699
39700  protected void composeCoverageEligibilityRequestDiagnosisComponent(String name, CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
39701    if (element != null) {
39702      open(name);
39703      composeCoverageEligibilityRequestDiagnosisComponentInner(element);
39704      close();
39705    }
39706  }
39707
39708  protected void composeCoverageEligibilityRequestDiagnosisComponentInner(CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
39709      composeBackbone(element);
39710      if (element.hasDiagnosis()) {
39711        composeType("diagnosis", element.getDiagnosis());
39712      }
39713  }
39714
39715  protected void composeCoverageEligibilityResponse(String name, CoverageEligibilityResponse element) throws IOException {
39716    if (element != null) {
39717      prop("resourceType", name);
39718      composeCoverageEligibilityResponseInner(element);
39719    }
39720  }
39721
39722  protected void composeCoverageEligibilityResponseInner(CoverageEligibilityResponse element) throws IOException {
39723      composeDomainResourceElements(element);
39724      if (element.hasIdentifier()) {
39725        openArray("identifier");
39726        for (Identifier e : element.getIdentifier()) 
39727          composeIdentifier(null, e);
39728        closeArray();
39729      };
39730      if (element.hasStatusElement()) {
39731        composeEnumerationCore("status", element.getStatusElement(), new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
39732        composeEnumerationExtras("status", element.getStatusElement(), new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
39733      }
39734      if (element.hasPurpose()) {
39735        openArray("purpose");
39736        for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
39737          composeEnumerationCore(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
39738        closeArray();
39739        if (anyHasExtras(element.getPurpose())) {
39740          openArray("_purpose");
39741          for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
39742            composeEnumerationExtras(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
39743        closeArray();
39744        }
39745      };
39746      if (element.hasPatient()) {
39747        composeReference("patient", element.getPatient());
39748      }
39749      if (element.hasServiced()) {
39750        composeType("serviced", element.getServiced());
39751      }
39752      if (element.hasCreatedElement()) {
39753        composeDateTimeCore("created", element.getCreatedElement(), false);
39754        composeDateTimeExtras("created", element.getCreatedElement(), false);
39755      }
39756      if (element.hasRequestor()) {
39757        composeReference("requestor", element.getRequestor());
39758      }
39759      if (element.hasRequest()) {
39760        composeReference("request", element.getRequest());
39761      }
39762      if (element.hasOutcomeElement()) {
39763        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
39764        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
39765      }
39766      if (element.hasDispositionElement()) {
39767        composeStringCore("disposition", element.getDispositionElement(), false);
39768        composeStringExtras("disposition", element.getDispositionElement(), false);
39769      }
39770      if (element.hasInsurer()) {
39771        composeReference("insurer", element.getInsurer());
39772      }
39773      if (element.hasInsurance()) {
39774        openArray("insurance");
39775        for (CoverageEligibilityResponse.InsuranceComponent e : element.getInsurance()) 
39776          composeCoverageEligibilityResponseInsuranceComponent(null, e);
39777        closeArray();
39778      };
39779      if (element.hasPreAuthRefElement()) {
39780        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
39781        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
39782      }
39783      if (element.hasForm()) {
39784        composeCodeableConcept("form", element.getForm());
39785      }
39786      if (element.hasError()) {
39787        openArray("error");
39788        for (CoverageEligibilityResponse.ErrorsComponent e : element.getError()) 
39789          composeCoverageEligibilityResponseErrorsComponent(null, e);
39790        closeArray();
39791      };
39792  }
39793
39794  protected void composeCoverageEligibilityResponseInsuranceComponent(String name, CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
39795    if (element != null) {
39796      open(name);
39797      composeCoverageEligibilityResponseInsuranceComponentInner(element);
39798      close();
39799    }
39800  }
39801
39802  protected void composeCoverageEligibilityResponseInsuranceComponentInner(CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
39803      composeBackbone(element);
39804      if (element.hasCoverage()) {
39805        composeReference("coverage", element.getCoverage());
39806      }
39807      if (element.hasInforceElement()) {
39808        composeBooleanCore("inforce", element.getInforceElement(), false);
39809        composeBooleanExtras("inforce", element.getInforceElement(), false);
39810      }
39811      if (element.hasBenefitPeriod()) {
39812        composePeriod("benefitPeriod", element.getBenefitPeriod());
39813      }
39814      if (element.hasItem()) {
39815        openArray("item");
39816        for (CoverageEligibilityResponse.ItemsComponent e : element.getItem()) 
39817          composeCoverageEligibilityResponseItemsComponent(null, e);
39818        closeArray();
39819      };
39820      }
39821
39822  protected void composeCoverageEligibilityResponseItemsComponent(String name, CoverageEligibilityResponse.ItemsComponent element) throws IOException {
39823    if (element != null) {
39824      open(name);
39825      composeCoverageEligibilityResponseItemsComponentInner(element);
39826      close();
39827    }
39828  }
39829
39830  protected void composeCoverageEligibilityResponseItemsComponentInner(CoverageEligibilityResponse.ItemsComponent element) throws IOException {
39831      composeBackbone(element);
39832      if (element.hasCategory()) {
39833        composeCodeableConcept("category", element.getCategory());
39834      }
39835      if (element.hasProductOrService()) {
39836        composeCodeableConcept("productOrService", element.getProductOrService());
39837      }
39838      if (element.hasModifier()) {
39839        openArray("modifier");
39840        for (CodeableConcept e : element.getModifier()) 
39841          composeCodeableConcept(null, e);
39842        closeArray();
39843      };
39844      if (element.hasProvider()) {
39845        composeReference("provider", element.getProvider());
39846      }
39847      if (element.hasExcludedElement()) {
39848        composeBooleanCore("excluded", element.getExcludedElement(), false);
39849        composeBooleanExtras("excluded", element.getExcludedElement(), false);
39850      }
39851      if (element.hasNameElement()) {
39852        composeStringCore("name", element.getNameElement(), false);
39853        composeStringExtras("name", element.getNameElement(), false);
39854      }
39855      if (element.hasDescriptionElement()) {
39856        composeStringCore("description", element.getDescriptionElement(), false);
39857        composeStringExtras("description", element.getDescriptionElement(), false);
39858      }
39859      if (element.hasNetwork()) {
39860        composeCodeableConcept("network", element.getNetwork());
39861      }
39862      if (element.hasUnit()) {
39863        composeCodeableConcept("unit", element.getUnit());
39864      }
39865      if (element.hasTerm()) {
39866        composeCodeableConcept("term", element.getTerm());
39867      }
39868      if (element.hasBenefit()) {
39869        openArray("benefit");
39870        for (CoverageEligibilityResponse.BenefitComponent e : element.getBenefit()) 
39871          composeCoverageEligibilityResponseBenefitComponent(null, e);
39872        closeArray();
39873      };
39874      if (element.hasAuthorizationRequiredElement()) {
39875        composeBooleanCore("authorizationRequired", element.getAuthorizationRequiredElement(), false);
39876        composeBooleanExtras("authorizationRequired", element.getAuthorizationRequiredElement(), false);
39877      }
39878      if (element.hasAuthorizationSupporting()) {
39879        openArray("authorizationSupporting");
39880        for (CodeableConcept e : element.getAuthorizationSupporting()) 
39881          composeCodeableConcept(null, e);
39882        closeArray();
39883      };
39884      if (element.hasAuthorizationUrlElement()) {
39885        composeUriCore("authorizationUrl", element.getAuthorizationUrlElement(), false);
39886        composeUriExtras("authorizationUrl", element.getAuthorizationUrlElement(), false);
39887      }
39888  }
39889
39890  protected void composeCoverageEligibilityResponseBenefitComponent(String name, CoverageEligibilityResponse.BenefitComponent element) throws IOException {
39891    if (element != null) {
39892      open(name);
39893      composeCoverageEligibilityResponseBenefitComponentInner(element);
39894      close();
39895    }
39896  }
39897
39898  protected void composeCoverageEligibilityResponseBenefitComponentInner(CoverageEligibilityResponse.BenefitComponent element) throws IOException {
39899      composeBackbone(element);
39900      if (element.hasType()) {
39901        composeCodeableConcept("type", element.getType());
39902      }
39903      if (element.hasAllowed()) {
39904        composeType("allowed", element.getAllowed());
39905      }
39906      if (element.hasUsed()) {
39907        composeType("used", element.getUsed());
39908      }
39909  }
39910
39911  protected void composeCoverageEligibilityResponseErrorsComponent(String name, CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
39912    if (element != null) {
39913      open(name);
39914      composeCoverageEligibilityResponseErrorsComponentInner(element);
39915      close();
39916    }
39917  }
39918
39919  protected void composeCoverageEligibilityResponseErrorsComponentInner(CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
39920      composeBackbone(element);
39921      if (element.hasCode()) {
39922        composeCodeableConcept("code", element.getCode());
39923      }
39924  }
39925
39926  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
39927    if (element != null) {
39928      prop("resourceType", name);
39929      composeDetectedIssueInner(element);
39930    }
39931  }
39932
39933  protected void composeDetectedIssueInner(DetectedIssue element) throws IOException {
39934      composeDomainResourceElements(element);
39935      if (element.hasIdentifier()) {
39936        openArray("identifier");
39937        for (Identifier e : element.getIdentifier()) 
39938          composeIdentifier(null, e);
39939        closeArray();
39940      };
39941      if (element.hasStatusElement()) {
39942        composeEnumerationCore("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
39943        composeEnumerationExtras("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
39944      }
39945      if (element.hasCode()) {
39946        composeCodeableConcept("code", element.getCode());
39947      }
39948      if (element.hasSeverityElement()) {
39949        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
39950        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
39951      }
39952      if (element.hasPatient()) {
39953        composeReference("patient", element.getPatient());
39954      }
39955      if (element.hasIdentified()) {
39956        composeType("identified", element.getIdentified());
39957      }
39958      if (element.hasAuthor()) {
39959        composeReference("author", element.getAuthor());
39960      }
39961      if (element.hasImplicated()) {
39962        openArray("implicated");
39963        for (Reference e : element.getImplicated()) 
39964          composeReference(null, e);
39965        closeArray();
39966      };
39967      if (element.hasEvidence()) {
39968        openArray("evidence");
39969        for (DetectedIssue.DetectedIssueEvidenceComponent e : element.getEvidence()) 
39970          composeDetectedIssueDetectedIssueEvidenceComponent(null, e);
39971        closeArray();
39972      };
39973      if (element.hasDetailElement()) {
39974        composeStringCore("detail", element.getDetailElement(), false);
39975        composeStringExtras("detail", element.getDetailElement(), false);
39976      }
39977      if (element.hasReferenceElement()) {
39978        composeUriCore("reference", element.getReferenceElement(), false);
39979        composeUriExtras("reference", element.getReferenceElement(), false);
39980      }
39981      if (element.hasMitigation()) {
39982        openArray("mitigation");
39983        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
39984          composeDetectedIssueDetectedIssueMitigationComponent(null, e);
39985        closeArray();
39986      };
39987  }
39988
39989  protected void composeDetectedIssueDetectedIssueEvidenceComponent(String name, DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
39990    if (element != null) {
39991      open(name);
39992      composeDetectedIssueDetectedIssueEvidenceComponentInner(element);
39993      close();
39994    }
39995  }
39996
39997  protected void composeDetectedIssueDetectedIssueEvidenceComponentInner(DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
39998      composeBackbone(element);
39999      if (element.hasCode()) {
40000        openArray("code");
40001        for (CodeableConcept e : element.getCode()) 
40002          composeCodeableConcept(null, e);
40003        closeArray();
40004      };
40005      if (element.hasDetail()) {
40006        openArray("detail");
40007        for (Reference e : element.getDetail()) 
40008          composeReference(null, e);
40009        closeArray();
40010      };
40011  }
40012
40013  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
40014    if (element != null) {
40015      open(name);
40016      composeDetectedIssueDetectedIssueMitigationComponentInner(element);
40017      close();
40018    }
40019  }
40020
40021  protected void composeDetectedIssueDetectedIssueMitigationComponentInner(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
40022      composeBackbone(element);
40023      if (element.hasAction()) {
40024        composeCodeableConcept("action", element.getAction());
40025      }
40026      if (element.hasDateElement()) {
40027        composeDateTimeCore("date", element.getDateElement(), false);
40028        composeDateTimeExtras("date", element.getDateElement(), false);
40029      }
40030      if (element.hasAuthor()) {
40031        composeReference("author", element.getAuthor());
40032      }
40033  }
40034
40035  protected void composeDevice(String name, Device element) throws IOException {
40036    if (element != null) {
40037      prop("resourceType", name);
40038      composeDeviceInner(element);
40039    }
40040  }
40041
40042  protected void composeDeviceInner(Device element) throws IOException {
40043      composeDomainResourceElements(element);
40044      if (element.hasIdentifier()) {
40045        openArray("identifier");
40046        for (Identifier e : element.getIdentifier()) 
40047          composeIdentifier(null, e);
40048        closeArray();
40049      };
40050      if (element.hasDefinition()) {
40051        composeReference("definition", element.getDefinition());
40052      }
40053      if (element.hasUdiCarrier()) {
40054        openArray("udiCarrier");
40055        for (Device.DeviceUdiCarrierComponent e : element.getUdiCarrier()) 
40056          composeDeviceDeviceUdiCarrierComponent(null, e);
40057        closeArray();
40058      };
40059      if (element.hasStatusElement()) {
40060        composeEnumerationCore("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
40061        composeEnumerationExtras("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
40062      }
40063      if (element.hasStatusReason()) {
40064        openArray("statusReason");
40065        for (CodeableConcept e : element.getStatusReason()) 
40066          composeCodeableConcept(null, e);
40067        closeArray();
40068      };
40069      if (element.hasDistinctIdentifierElement()) {
40070        composeStringCore("distinctIdentifier", element.getDistinctIdentifierElement(), false);
40071        composeStringExtras("distinctIdentifier", element.getDistinctIdentifierElement(), false);
40072      }
40073      if (element.hasManufacturerElement()) {
40074        composeStringCore("manufacturer", element.getManufacturerElement(), false);
40075        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
40076      }
40077      if (element.hasManufactureDateElement()) {
40078        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
40079        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
40080      }
40081      if (element.hasExpirationDateElement()) {
40082        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
40083        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
40084      }
40085      if (element.hasLotNumberElement()) {
40086        composeStringCore("lotNumber", element.getLotNumberElement(), false);
40087        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
40088      }
40089      if (element.hasSerialNumberElement()) {
40090        composeStringCore("serialNumber", element.getSerialNumberElement(), false);
40091        composeStringExtras("serialNumber", element.getSerialNumberElement(), false);
40092      }
40093      if (element.hasDeviceName()) {
40094        openArray("deviceName");
40095        for (Device.DeviceDeviceNameComponent e : element.getDeviceName()) 
40096          composeDeviceDeviceDeviceNameComponent(null, e);
40097        closeArray();
40098      };
40099      if (element.hasModelNumberElement()) {
40100        composeStringCore("modelNumber", element.getModelNumberElement(), false);
40101        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
40102      }
40103      if (element.hasPartNumberElement()) {
40104        composeStringCore("partNumber", element.getPartNumberElement(), false);
40105        composeStringExtras("partNumber", element.getPartNumberElement(), false);
40106      }
40107      if (element.hasType()) {
40108        composeCodeableConcept("type", element.getType());
40109      }
40110      if (element.hasSpecialization()) {
40111        openArray("specialization");
40112        for (Device.DeviceSpecializationComponent e : element.getSpecialization()) 
40113          composeDeviceDeviceSpecializationComponent(null, e);
40114        closeArray();
40115      };
40116      if (element.hasVersion()) {
40117        openArray("version");
40118        for (Device.DeviceVersionComponent e : element.getVersion()) 
40119          composeDeviceDeviceVersionComponent(null, e);
40120        closeArray();
40121      };
40122      if (element.hasProperty()) {
40123        openArray("property");
40124        for (Device.DevicePropertyComponent e : element.getProperty()) 
40125          composeDeviceDevicePropertyComponent(null, e);
40126        closeArray();
40127      };
40128      if (element.hasPatient()) {
40129        composeReference("patient", element.getPatient());
40130      }
40131      if (element.hasOwner()) {
40132        composeReference("owner", element.getOwner());
40133      }
40134      if (element.hasContact()) {
40135        openArray("contact");
40136        for (ContactPoint e : element.getContact()) 
40137          composeContactPoint(null, e);
40138        closeArray();
40139      };
40140      if (element.hasLocation()) {
40141        composeReference("location", element.getLocation());
40142      }
40143      if (element.hasUrlElement()) {
40144        composeUriCore("url", element.getUrlElement(), false);
40145        composeUriExtras("url", element.getUrlElement(), false);
40146      }
40147      if (element.hasNote()) {
40148        openArray("note");
40149        for (Annotation e : element.getNote()) 
40150          composeAnnotation(null, e);
40151        closeArray();
40152      };
40153      if (element.hasSafety()) {
40154        openArray("safety");
40155        for (CodeableConcept e : element.getSafety()) 
40156          composeCodeableConcept(null, e);
40157        closeArray();
40158      };
40159      if (element.hasParent()) {
40160        composeReference("parent", element.getParent());
40161      }
40162  }
40163
40164  protected void composeDeviceDeviceUdiCarrierComponent(String name, Device.DeviceUdiCarrierComponent element) throws IOException {
40165    if (element != null) {
40166      open(name);
40167      composeDeviceDeviceUdiCarrierComponentInner(element);
40168      close();
40169    }
40170  }
40171
40172  protected void composeDeviceDeviceUdiCarrierComponentInner(Device.DeviceUdiCarrierComponent element) throws IOException {
40173      composeBackbone(element);
40174      if (element.hasDeviceIdentifierElement()) {
40175        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
40176        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
40177      }
40178      if (element.hasIssuerElement()) {
40179        composeUriCore("issuer", element.getIssuerElement(), false);
40180        composeUriExtras("issuer", element.getIssuerElement(), false);
40181      }
40182      if (element.hasJurisdictionElement()) {
40183        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
40184        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
40185      }
40186      if (element.hasCarrierAIDCElement()) {
40187        composeBase64BinaryCore("carrierAIDC", element.getCarrierAIDCElement(), false);
40188        composeBase64BinaryExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
40189      }
40190      if (element.hasCarrierHRFElement()) {
40191        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
40192        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
40193      }
40194      if (element.hasEntryTypeElement()) {
40195        composeEnumerationCore("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
40196        composeEnumerationExtras("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
40197      }
40198  }
40199
40200  protected void composeDeviceDeviceDeviceNameComponent(String name, Device.DeviceDeviceNameComponent element) throws IOException {
40201    if (element != null) {
40202      open(name);
40203      composeDeviceDeviceDeviceNameComponentInner(element);
40204      close();
40205    }
40206  }
40207
40208  protected void composeDeviceDeviceDeviceNameComponentInner(Device.DeviceDeviceNameComponent element) throws IOException {
40209      composeBackbone(element);
40210      if (element.hasNameElement()) {
40211        composeStringCore("name", element.getNameElement(), false);
40212        composeStringExtras("name", element.getNameElement(), false);
40213      }
40214      if (element.hasTypeElement()) {
40215        composeEnumerationCore("type", element.getTypeElement(), new Device.DeviceNameTypeEnumFactory(), false);
40216        composeEnumerationExtras("type", element.getTypeElement(), new Device.DeviceNameTypeEnumFactory(), false);
40217      }
40218  }
40219
40220  protected void composeDeviceDeviceSpecializationComponent(String name, Device.DeviceSpecializationComponent element) throws IOException {
40221    if (element != null) {
40222      open(name);
40223      composeDeviceDeviceSpecializationComponentInner(element);
40224      close();
40225    }
40226  }
40227
40228  protected void composeDeviceDeviceSpecializationComponentInner(Device.DeviceSpecializationComponent element) throws IOException {
40229      composeBackbone(element);
40230      if (element.hasSystemType()) {
40231        composeCodeableConcept("systemType", element.getSystemType());
40232      }
40233      if (element.hasVersionElement()) {
40234        composeStringCore("version", element.getVersionElement(), false);
40235        composeStringExtras("version", element.getVersionElement(), false);
40236      }
40237  }
40238
40239  protected void composeDeviceDeviceVersionComponent(String name, Device.DeviceVersionComponent element) throws IOException {
40240    if (element != null) {
40241      open(name);
40242      composeDeviceDeviceVersionComponentInner(element);
40243      close();
40244    }
40245  }
40246
40247  protected void composeDeviceDeviceVersionComponentInner(Device.DeviceVersionComponent element) throws IOException {
40248      composeBackbone(element);
40249      if (element.hasType()) {
40250        composeCodeableConcept("type", element.getType());
40251      }
40252      if (element.hasComponent()) {
40253        composeIdentifier("component", element.getComponent());
40254      }
40255      if (element.hasValueElement()) {
40256        composeStringCore("value", element.getValueElement(), false);
40257        composeStringExtras("value", element.getValueElement(), false);
40258      }
40259  }
40260
40261  protected void composeDeviceDevicePropertyComponent(String name, Device.DevicePropertyComponent element) throws IOException {
40262    if (element != null) {
40263      open(name);
40264      composeDeviceDevicePropertyComponentInner(element);
40265      close();
40266    }
40267  }
40268
40269  protected void composeDeviceDevicePropertyComponentInner(Device.DevicePropertyComponent element) throws IOException {
40270      composeBackbone(element);
40271      if (element.hasType()) {
40272        composeCodeableConcept("type", element.getType());
40273      }
40274      if (element.hasValueQuantity()) {
40275        openArray("valueQuantity");
40276        for (Quantity e : element.getValueQuantity()) 
40277          composeQuantity(null, e);
40278        closeArray();
40279      };
40280      if (element.hasValueCode()) {
40281        openArray("valueCode");
40282        for (CodeableConcept e : element.getValueCode()) 
40283          composeCodeableConcept(null, e);
40284        closeArray();
40285      };
40286  }
40287
40288  protected void composeDeviceDefinition(String name, DeviceDefinition element) throws IOException {
40289    if (element != null) {
40290      prop("resourceType", name);
40291      composeDeviceDefinitionInner(element);
40292    }
40293  }
40294
40295  protected void composeDeviceDefinitionInner(DeviceDefinition element) throws IOException {
40296      composeDomainResourceElements(element);
40297      if (element.hasIdentifier()) {
40298        openArray("identifier");
40299        for (Identifier e : element.getIdentifier()) 
40300          composeIdentifier(null, e);
40301        closeArray();
40302      };
40303      if (element.hasUdiDeviceIdentifier()) {
40304        openArray("udiDeviceIdentifier");
40305        for (DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent e : element.getUdiDeviceIdentifier()) 
40306          composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(null, e);
40307        closeArray();
40308      };
40309      if (element.hasManufacturer()) {
40310        composeType("manufacturer", element.getManufacturer());
40311      }
40312      if (element.hasDeviceName()) {
40313        openArray("deviceName");
40314        for (DeviceDefinition.DeviceDefinitionDeviceNameComponent e : element.getDeviceName()) 
40315          composeDeviceDefinitionDeviceDefinitionDeviceNameComponent(null, e);
40316        closeArray();
40317      };
40318      if (element.hasModelNumberElement()) {
40319        composeStringCore("modelNumber", element.getModelNumberElement(), false);
40320        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
40321      }
40322      if (element.hasType()) {
40323        composeCodeableConcept("type", element.getType());
40324      }
40325      if (element.hasSpecialization()) {
40326        openArray("specialization");
40327        for (DeviceDefinition.DeviceDefinitionSpecializationComponent e : element.getSpecialization()) 
40328          composeDeviceDefinitionDeviceDefinitionSpecializationComponent(null, e);
40329        closeArray();
40330      };
40331      if (element.hasVersion()) {
40332        openArray("version");
40333        for (StringType e : element.getVersion()) 
40334          composeStringCore(null, e, true);
40335        closeArray();
40336        if (anyHasExtras(element.getVersion())) {
40337          openArray("_version");
40338          for (StringType e : element.getVersion()) 
40339            composeStringExtras(null, e, true);
40340        closeArray();
40341        }
40342      };
40343      if (element.hasSafety()) {
40344        openArray("safety");
40345        for (CodeableConcept e : element.getSafety()) 
40346          composeCodeableConcept(null, e);
40347        closeArray();
40348      };
40349      if (element.hasShelfLifeStorage()) {
40350        openArray("shelfLifeStorage");
40351        for (ProductShelfLife e : element.getShelfLifeStorage()) 
40352          composeProductShelfLife(null, e);
40353        closeArray();
40354      };
40355      if (element.hasPhysicalCharacteristics()) {
40356        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
40357      }
40358      if (element.hasLanguageCode()) {
40359        openArray("languageCode");
40360        for (CodeableConcept e : element.getLanguageCode()) 
40361          composeCodeableConcept(null, e);
40362        closeArray();
40363      };
40364      if (element.hasCapability()) {
40365        openArray("capability");
40366        for (DeviceDefinition.DeviceDefinitionCapabilityComponent e : element.getCapability()) 
40367          composeDeviceDefinitionDeviceDefinitionCapabilityComponent(null, e);
40368        closeArray();
40369      };
40370      if (element.hasProperty()) {
40371        openArray("property");
40372        for (DeviceDefinition.DeviceDefinitionPropertyComponent e : element.getProperty()) 
40373          composeDeviceDefinitionDeviceDefinitionPropertyComponent(null, e);
40374        closeArray();
40375      };
40376      if (element.hasOwner()) {
40377        composeReference("owner", element.getOwner());
40378      }
40379      if (element.hasContact()) {
40380        openArray("contact");
40381        for (ContactPoint e : element.getContact()) 
40382          composeContactPoint(null, e);
40383        closeArray();
40384      };
40385      if (element.hasUrlElement()) {
40386        composeUriCore("url", element.getUrlElement(), false);
40387        composeUriExtras("url", element.getUrlElement(), false);
40388      }
40389      if (element.hasOnlineInformationElement()) {
40390        composeUriCore("onlineInformation", element.getOnlineInformationElement(), false);
40391        composeUriExtras("onlineInformation", element.getOnlineInformationElement(), false);
40392      }
40393      if (element.hasNote()) {
40394        openArray("note");
40395        for (Annotation e : element.getNote()) 
40396          composeAnnotation(null, e);
40397        closeArray();
40398      };
40399      if (element.hasQuantity()) {
40400        composeQuantity("quantity", element.getQuantity());
40401      }
40402      if (element.hasParentDevice()) {
40403        composeReference("parentDevice", element.getParentDevice());
40404      }
40405      if (element.hasMaterial()) {
40406        openArray("material");
40407        for (DeviceDefinition.DeviceDefinitionMaterialComponent e : element.getMaterial()) 
40408          composeDeviceDefinitionDeviceDefinitionMaterialComponent(null, e);
40409        closeArray();
40410      };
40411  }
40412
40413  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(String name, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
40414    if (element != null) {
40415      open(name);
40416      composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentInner(element);
40417      close();
40418    }
40419  }
40420
40421  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentInner(DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
40422      composeBackbone(element);
40423      if (element.hasDeviceIdentifierElement()) {
40424        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
40425        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
40426      }
40427      if (element.hasIssuerElement()) {
40428        composeUriCore("issuer", element.getIssuerElement(), false);
40429        composeUriExtras("issuer", element.getIssuerElement(), false);
40430      }
40431      if (element.hasJurisdictionElement()) {
40432        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
40433        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
40434      }
40435  }
40436
40437  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponent(String name, DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
40438    if (element != null) {
40439      open(name);
40440      composeDeviceDefinitionDeviceDefinitionDeviceNameComponentInner(element);
40441      close();
40442    }
40443  }
40444
40445  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponentInner(DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
40446      composeBackbone(element);
40447      if (element.hasNameElement()) {
40448        composeStringCore("name", element.getNameElement(), false);
40449        composeStringExtras("name", element.getNameElement(), false);
40450      }
40451      if (element.hasTypeElement()) {
40452        composeEnumerationCore("type", element.getTypeElement(), new DeviceDefinition.DeviceNameTypeEnumFactory(), false);
40453        composeEnumerationExtras("type", element.getTypeElement(), new DeviceDefinition.DeviceNameTypeEnumFactory(), false);
40454      }
40455  }
40456
40457  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponent(String name, DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
40458    if (element != null) {
40459      open(name);
40460      composeDeviceDefinitionDeviceDefinitionSpecializationComponentInner(element);
40461      close();
40462    }
40463  }
40464
40465  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponentInner(DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
40466      composeBackbone(element);
40467      if (element.hasSystemTypeElement()) {
40468        composeStringCore("systemType", element.getSystemTypeElement(), false);
40469        composeStringExtras("systemType", element.getSystemTypeElement(), false);
40470      }
40471      if (element.hasVersionElement()) {
40472        composeStringCore("version", element.getVersionElement(), false);
40473        composeStringExtras("version", element.getVersionElement(), false);
40474      }
40475  }
40476
40477  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponent(String name, DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
40478    if (element != null) {
40479      open(name);
40480      composeDeviceDefinitionDeviceDefinitionCapabilityComponentInner(element);
40481      close();
40482    }
40483  }
40484
40485  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponentInner(DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
40486      composeBackbone(element);
40487      if (element.hasType()) {
40488        composeCodeableConcept("type", element.getType());
40489      }
40490      if (element.hasDescription()) {
40491        openArray("description");
40492        for (CodeableConcept e : element.getDescription()) 
40493          composeCodeableConcept(null, e);
40494        closeArray();
40495      };
40496  }
40497
40498  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponent(String name, DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
40499    if (element != null) {
40500      open(name);
40501      composeDeviceDefinitionDeviceDefinitionPropertyComponentInner(element);
40502      close();
40503    }
40504  }
40505
40506  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponentInner(DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
40507      composeBackbone(element);
40508      if (element.hasType()) {
40509        composeCodeableConcept("type", element.getType());
40510      }
40511      if (element.hasValueQuantity()) {
40512        openArray("valueQuantity");
40513        for (Quantity e : element.getValueQuantity()) 
40514          composeQuantity(null, e);
40515        closeArray();
40516      };
40517      if (element.hasValueCode()) {
40518        openArray("valueCode");
40519        for (CodeableConcept e : element.getValueCode()) 
40520          composeCodeableConcept(null, e);
40521        closeArray();
40522      };
40523  }
40524
40525  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponent(String name, DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
40526    if (element != null) {
40527      open(name);
40528      composeDeviceDefinitionDeviceDefinitionMaterialComponentInner(element);
40529      close();
40530    }
40531  }
40532
40533  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponentInner(DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
40534      composeBackbone(element);
40535      if (element.hasSubstance()) {
40536        composeCodeableConcept("substance", element.getSubstance());
40537      }
40538      if (element.hasAlternateElement()) {
40539        composeBooleanCore("alternate", element.getAlternateElement(), false);
40540        composeBooleanExtras("alternate", element.getAlternateElement(), false);
40541      }
40542      if (element.hasAllergenicIndicatorElement()) {
40543        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
40544        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
40545      }
40546  }
40547
40548  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
40549    if (element != null) {
40550      prop("resourceType", name);
40551      composeDeviceMetricInner(element);
40552    }
40553  }
40554
40555  protected void composeDeviceMetricInner(DeviceMetric element) throws IOException {
40556      composeDomainResourceElements(element);
40557      if (element.hasIdentifier()) {
40558        openArray("identifier");
40559        for (Identifier e : element.getIdentifier()) 
40560          composeIdentifier(null, e);
40561        closeArray();
40562      };
40563      if (element.hasType()) {
40564        composeCodeableConcept("type", element.getType());
40565      }
40566      if (element.hasUnit()) {
40567        composeCodeableConcept("unit", element.getUnit());
40568      }
40569      if (element.hasSource()) {
40570        composeReference("source", element.getSource());
40571      }
40572      if (element.hasParent()) {
40573        composeReference("parent", element.getParent());
40574      }
40575      if (element.hasOperationalStatusElement()) {
40576        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
40577        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
40578      }
40579      if (element.hasColorElement()) {
40580        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
40581        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
40582      }
40583      if (element.hasCategoryElement()) {
40584        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
40585        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
40586        }
40587      if (element.hasMeasurementPeriod()) {
40588        composeTiming("measurementPeriod", element.getMeasurementPeriod());
40589      }
40590      if (element.hasCalibration()) {
40591        openArray("calibration");
40592        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
40593          composeDeviceMetricDeviceMetricCalibrationComponent(null, e);
40594        closeArray();
40595      };
40596  }
40597
40598  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
40599    if (element != null) {
40600      open(name);
40601      composeDeviceMetricDeviceMetricCalibrationComponentInner(element);
40602      close();
40603    }
40604  }
40605
40606  protected void composeDeviceMetricDeviceMetricCalibrationComponentInner(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
40607      composeBackbone(element);
40608      if (element.hasTypeElement()) {
40609        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
40610        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
40611      }
40612      if (element.hasStateElement()) {
40613        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
40614        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
40615      }
40616      if (element.hasTimeElement()) {
40617        composeInstantCore("time", element.getTimeElement(), false);
40618        composeInstantExtras("time", element.getTimeElement(), false);
40619      }
40620  }
40621
40622  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
40623    if (element != null) {
40624      prop("resourceType", name);
40625      composeDeviceRequestInner(element);
40626    }
40627  }
40628
40629  protected void composeDeviceRequestInner(DeviceRequest element) throws IOException {
40630      composeDomainResourceElements(element);
40631      if (element.hasIdentifier()) {
40632        openArray("identifier");
40633        for (Identifier e : element.getIdentifier()) 
40634          composeIdentifier(null, e);
40635        closeArray();
40636      };
40637      if (element.hasInstantiatesCanonical()) {
40638        openArray("instantiatesCanonical");
40639        for (CanonicalType e : element.getInstantiatesCanonical()) 
40640          composeCanonicalCore(null, e, true);
40641        closeArray();
40642        if (anyHasExtras(element.getInstantiatesCanonical())) {
40643          openArray("_instantiatesCanonical");
40644          for (CanonicalType e : element.getInstantiatesCanonical()) 
40645            composeCanonicalExtras(null, e, true);
40646        closeArray();
40647      }
40648      };
40649      if (element.hasInstantiatesUri()) {
40650        openArray("instantiatesUri");
40651        for (UriType e : element.getInstantiatesUri()) 
40652          composeUriCore(null, e, true);
40653        closeArray();
40654        if (anyHasExtras(element.getInstantiatesUri())) {
40655          openArray("_instantiatesUri");
40656          for (UriType e : element.getInstantiatesUri()) 
40657            composeUriExtras(null, e, true);
40658        closeArray();
40659      }
40660      };
40661      if (element.hasBasedOn()) {
40662        openArray("basedOn");
40663        for (Reference e : element.getBasedOn()) 
40664          composeReference(null, e);
40665        closeArray();
40666      };
40667      if (element.hasPriorRequest()) {
40668        openArray("priorRequest");
40669        for (Reference e : element.getPriorRequest()) 
40670          composeReference(null, e);
40671        closeArray();
40672      };
40673      if (element.hasGroupIdentifier()) {
40674        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
40675  }
40676      if (element.hasStatusElement()) {
40677        composeEnumerationCore("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
40678        composeEnumerationExtras("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
40679      }
40680      if (element.hasIntentElement()) {
40681        composeEnumerationCore("intent", element.getIntentElement(), new DeviceRequest.RequestIntentEnumFactory(), false);
40682        composeEnumerationExtras("intent", element.getIntentElement(), new DeviceRequest.RequestIntentEnumFactory(), false);
40683      }
40684      if (element.hasPriorityElement()) {
40685        composeEnumerationCore("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
40686        composeEnumerationExtras("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
40687  }
40688      if (element.hasCode()) {
40689        composeType("code", element.getCode());
40690    }
40691      if (element.hasParameter()) {
40692        openArray("parameter");
40693        for (DeviceRequest.DeviceRequestParameterComponent e : element.getParameter()) 
40694          composeDeviceRequestDeviceRequestParameterComponent(null, e);
40695        closeArray();
40696      };
40697      if (element.hasSubject()) {
40698        composeReference("subject", element.getSubject());
40699      }
40700      if (element.hasEncounter()) {
40701        composeReference("encounter", element.getEncounter());
40702      }
40703      if (element.hasOccurrence()) {
40704        composeType("occurrence", element.getOccurrence());
40705      }
40706      if (element.hasAuthoredOnElement()) {
40707        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
40708        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
40709      }
40710      if (element.hasRequester()) {
40711        composeReference("requester", element.getRequester());
40712      }
40713      if (element.hasPerformerType()) {
40714        composeCodeableConcept("performerType", element.getPerformerType());
40715      }
40716      if (element.hasPerformer()) {
40717        composeReference("performer", element.getPerformer());
40718      }
40719      if (element.hasReasonCode()) {
40720        openArray("reasonCode");
40721        for (CodeableConcept e : element.getReasonCode()) 
40722          composeCodeableConcept(null, e);
40723        closeArray();
40724      };
40725      if (element.hasReasonReference()) {
40726        openArray("reasonReference");
40727        for (Reference e : element.getReasonReference()) 
40728          composeReference(null, e);
40729        closeArray();
40730      };
40731      if (element.hasInsurance()) {
40732        openArray("insurance");
40733        for (Reference e : element.getInsurance()) 
40734          composeReference(null, e);
40735        closeArray();
40736      };
40737      if (element.hasSupportingInfo()) {
40738        openArray("supportingInfo");
40739        for (Reference e : element.getSupportingInfo()) 
40740          composeReference(null, e);
40741        closeArray();
40742      };
40743      if (element.hasNote()) {
40744        openArray("note");
40745        for (Annotation e : element.getNote()) 
40746          composeAnnotation(null, e);
40747        closeArray();
40748      };
40749      if (element.hasRelevantHistory()) {
40750        openArray("relevantHistory");
40751        for (Reference e : element.getRelevantHistory()) 
40752          composeReference(null, e);
40753        closeArray();
40754      };
40755  }
40756
40757  protected void composeDeviceRequestDeviceRequestParameterComponent(String name, DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
40758    if (element != null) {
40759      open(name);
40760      composeDeviceRequestDeviceRequestParameterComponentInner(element);
40761      close();
40762    }
40763  }
40764
40765  protected void composeDeviceRequestDeviceRequestParameterComponentInner(DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
40766      composeBackbone(element);
40767      if (element.hasCode()) {
40768        composeCodeableConcept("code", element.getCode());
40769      }
40770      if (element.hasValue()) {
40771        composeType("value", element.getValue());
40772      }
40773  }
40774
40775  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
40776    if (element != null) {
40777      prop("resourceType", name);
40778      composeDeviceUseStatementInner(element);
40779    }
40780  }
40781
40782  protected void composeDeviceUseStatementInner(DeviceUseStatement element) throws IOException {
40783      composeDomainResourceElements(element);
40784      if (element.hasIdentifier()) {
40785        openArray("identifier");
40786        for (Identifier e : element.getIdentifier()) 
40787          composeIdentifier(null, e);
40788        closeArray();
40789      };
40790      if (element.hasBasedOn()) {
40791        openArray("basedOn");
40792        for (Reference e : element.getBasedOn()) 
40793          composeReference(null, e);
40794        closeArray();
40795      };
40796      if (element.hasStatusElement()) {
40797        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
40798        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
40799      }
40800      if (element.hasSubject()) {
40801        composeReference("subject", element.getSubject());
40802      }
40803      if (element.hasDerivedFrom()) {
40804        openArray("derivedFrom");
40805        for (Reference e : element.getDerivedFrom()) 
40806          composeReference(null, e);
40807        closeArray();
40808      };
40809      if (element.hasTiming()) {
40810        composeType("timing", element.getTiming());
40811      }
40812      if (element.hasRecordedOnElement()) {
40813        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
40814        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
40815      }
40816      if (element.hasSource()) {
40817        composeReference("source", element.getSource());
40818      }
40819      if (element.hasDevice()) {
40820        composeReference("device", element.getDevice());
40821      }
40822      if (element.hasReasonCode()) {
40823        openArray("reasonCode");
40824        for (CodeableConcept e : element.getReasonCode()) 
40825          composeCodeableConcept(null, e);
40826        closeArray();
40827      };
40828      if (element.hasReasonReference()) {
40829        openArray("reasonReference");
40830        for (Reference e : element.getReasonReference()) 
40831          composeReference(null, e);
40832        closeArray();
40833      };
40834      if (element.hasBodySite()) {
40835        composeCodeableConcept("bodySite", element.getBodySite());
40836      }
40837      if (element.hasNote()) {
40838        openArray("note");
40839        for (Annotation e : element.getNote()) 
40840          composeAnnotation(null, e);
40841        closeArray();
40842      };
40843  }
40844
40845  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
40846    if (element != null) {
40847      prop("resourceType", name);
40848      composeDiagnosticReportInner(element);
40849    }
40850  }
40851
40852  protected void composeDiagnosticReportInner(DiagnosticReport element) throws IOException {
40853      composeDomainResourceElements(element);
40854      if (element.hasIdentifier()) {
40855        openArray("identifier");
40856        for (Identifier e : element.getIdentifier()) 
40857          composeIdentifier(null, e);
40858        closeArray();
40859      };
40860      if (element.hasBasedOn()) {
40861        openArray("basedOn");
40862        for (Reference e : element.getBasedOn()) 
40863          composeReference(null, e);
40864        closeArray();
40865      };
40866      if (element.hasStatusElement()) {
40867        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
40868        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
40869      }
40870      if (element.hasCategory()) {
40871        openArray("category");
40872        for (CodeableConcept e : element.getCategory()) 
40873          composeCodeableConcept(null, e);
40874        closeArray();
40875      };
40876      if (element.hasCode()) {
40877        composeCodeableConcept("code", element.getCode());
40878      }
40879      if (element.hasSubject()) {
40880        composeReference("subject", element.getSubject());
40881      }
40882      if (element.hasEncounter()) {
40883        composeReference("encounter", element.getEncounter());
40884      }
40885      if (element.hasEffective()) {
40886        composeType("effective", element.getEffective());
40887      }
40888      if (element.hasIssuedElement()) {
40889        composeInstantCore("issued", element.getIssuedElement(), false);
40890        composeInstantExtras("issued", element.getIssuedElement(), false);
40891      }
40892      if (element.hasPerformer()) {
40893        openArray("performer");
40894        for (Reference e : element.getPerformer()) 
40895          composeReference(null, e);
40896        closeArray();
40897      };
40898      if (element.hasResultsInterpreter()) {
40899        openArray("resultsInterpreter");
40900        for (Reference e : element.getResultsInterpreter()) 
40901          composeReference(null, e);
40902        closeArray();
40903      };
40904      if (element.hasSpecimen()) {
40905        openArray("specimen");
40906        for (Reference e : element.getSpecimen()) 
40907          composeReference(null, e);
40908        closeArray();
40909      };
40910      if (element.hasResult()) {
40911        openArray("result");
40912        for (Reference e : element.getResult()) 
40913          composeReference(null, e);
40914        closeArray();
40915      };
40916      if (element.hasImagingStudy()) {
40917        openArray("imagingStudy");
40918        for (Reference e : element.getImagingStudy()) 
40919          composeReference(null, e);
40920        closeArray();
40921      };
40922      if (element.hasMedia()) {
40923        openArray("media");
40924        for (DiagnosticReport.DiagnosticReportMediaComponent e : element.getMedia()) 
40925          composeDiagnosticReportDiagnosticReportMediaComponent(null, e);
40926        closeArray();
40927      };
40928      if (element.hasConclusionElement()) {
40929        composeStringCore("conclusion", element.getConclusionElement(), false);
40930        composeStringExtras("conclusion", element.getConclusionElement(), false);
40931      }
40932      if (element.hasConclusionCode()) {
40933        openArray("conclusionCode");
40934        for (CodeableConcept e : element.getConclusionCode()) 
40935          composeCodeableConcept(null, e);
40936        closeArray();
40937      };
40938      if (element.hasPresentedForm()) {
40939        openArray("presentedForm");
40940        for (Attachment e : element.getPresentedForm()) 
40941          composeAttachment(null, e);
40942        closeArray();
40943      };
40944  }
40945
40946  protected void composeDiagnosticReportDiagnosticReportMediaComponent(String name, DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
40947    if (element != null) {
40948      open(name);
40949      composeDiagnosticReportDiagnosticReportMediaComponentInner(element);
40950      close();
40951    }
40952  }
40953
40954  protected void composeDiagnosticReportDiagnosticReportMediaComponentInner(DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
40955      composeBackbone(element);
40956      if (element.hasCommentElement()) {
40957        composeStringCore("comment", element.getCommentElement(), false);
40958        composeStringExtras("comment", element.getCommentElement(), false);
40959      }
40960      if (element.hasLink()) {
40961        composeReference("link", element.getLink());
40962      }
40963  }
40964
40965  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
40966    if (element != null) {
40967      prop("resourceType", name);
40968      composeDocumentManifestInner(element);
40969    }
40970  }
40971
40972  protected void composeDocumentManifestInner(DocumentManifest element) throws IOException {
40973      composeDomainResourceElements(element);
40974      if (element.hasMasterIdentifier()) {
40975        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
40976      }
40977      if (element.hasIdentifier()) {
40978        openArray("identifier");
40979        for (Identifier e : element.getIdentifier()) 
40980          composeIdentifier(null, e);
40981        closeArray();
40982      };
40983      if (element.hasStatusElement()) {
40984        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
40985        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
40986      }
40987      if (element.hasType()) {
40988        composeCodeableConcept("type", element.getType());
40989      }
40990      if (element.hasSubject()) {
40991        composeReference("subject", element.getSubject());
40992      }
40993      if (element.hasCreatedElement()) {
40994        composeDateTimeCore("created", element.getCreatedElement(), false);
40995        composeDateTimeExtras("created", element.getCreatedElement(), false);
40996      }
40997      if (element.hasAuthor()) {
40998        openArray("author");
40999        for (Reference e : element.getAuthor()) 
41000          composeReference(null, e);
41001        closeArray();
41002      };
41003      if (element.hasRecipient()) {
41004        openArray("recipient");
41005        for (Reference e : element.getRecipient()) 
41006          composeReference(null, e);
41007        closeArray();
41008      };
41009      if (element.hasSourceElement()) {
41010        composeUriCore("source", element.getSourceElement(), false);
41011        composeUriExtras("source", element.getSourceElement(), false);
41012      }
41013      if (element.hasDescriptionElement()) {
41014        composeStringCore("description", element.getDescriptionElement(), false);
41015        composeStringExtras("description", element.getDescriptionElement(), false);
41016      }
41017      if (element.hasContent()) {
41018        openArray("content");
41019        for (Reference e : element.getContent()) 
41020          composeReference(null, e);
41021        closeArray();
41022      };
41023      if (element.hasRelated()) {
41024        openArray("related");
41025        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
41026          composeDocumentManifestDocumentManifestRelatedComponent(null, e);
41027        closeArray();
41028      };
41029  }
41030
41031  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
41032    if (element != null) {
41033      open(name);
41034      composeDocumentManifestDocumentManifestRelatedComponentInner(element);
41035      close();
41036    }
41037  }
41038
41039  protected void composeDocumentManifestDocumentManifestRelatedComponentInner(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
41040      composeBackbone(element);
41041      if (element.hasIdentifier()) {
41042        composeIdentifier("identifier", element.getIdentifier());
41043      }
41044      if (element.hasRef()) {
41045        composeReference("ref", element.getRef());
41046      }
41047  }
41048
41049  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
41050    if (element != null) {
41051      prop("resourceType", name);
41052      composeDocumentReferenceInner(element);
41053    }
41054  }
41055
41056  protected void composeDocumentReferenceInner(DocumentReference element) throws IOException {
41057      composeDomainResourceElements(element);
41058      if (element.hasMasterIdentifier()) {
41059        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
41060      }
41061      if (element.hasIdentifier()) {
41062        openArray("identifier");
41063        for (Identifier e : element.getIdentifier()) 
41064          composeIdentifier(null, e);
41065        closeArray();
41066      };
41067      if (element.hasStatusElement()) {
41068        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
41069        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
41070      }
41071      if (element.hasDocStatusElement()) {
41072        composeEnumerationCore("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
41073        composeEnumerationExtras("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
41074      }
41075      if (element.hasType()) {
41076        composeCodeableConcept("type", element.getType());
41077      }
41078      if (element.hasCategory()) {
41079        openArray("category");
41080        for (CodeableConcept e : element.getCategory()) 
41081          composeCodeableConcept(null, e);
41082        closeArray();
41083      };
41084      if (element.hasSubject()) {
41085        composeReference("subject", element.getSubject());
41086      }
41087      if (element.hasDateElement()) {
41088        composeInstantCore("date", element.getDateElement(), false);
41089        composeInstantExtras("date", element.getDateElement(), false);
41090      }
41091      if (element.hasAuthor()) {
41092        openArray("author");
41093        for (Reference e : element.getAuthor()) 
41094          composeReference(null, e);
41095        closeArray();
41096      };
41097      if (element.hasAuthenticator()) {
41098        composeReference("authenticator", element.getAuthenticator());
41099      }
41100      if (element.hasCustodian()) {
41101        composeReference("custodian", element.getCustodian());
41102      }
41103      if (element.hasRelatesTo()) {
41104        openArray("relatesTo");
41105        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
41106          composeDocumentReferenceDocumentReferenceRelatesToComponent(null, e);
41107        closeArray();
41108      };
41109      if (element.hasDescriptionElement()) {
41110        composeStringCore("description", element.getDescriptionElement(), false);
41111        composeStringExtras("description", element.getDescriptionElement(), false);
41112      }
41113      if (element.hasSecurityLabel()) {
41114        openArray("securityLabel");
41115        for (CodeableConcept e : element.getSecurityLabel()) 
41116          composeCodeableConcept(null, e);
41117        closeArray();
41118      };
41119      if (element.hasContent()) {
41120        openArray("content");
41121        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
41122          composeDocumentReferenceDocumentReferenceContentComponent(null, e);
41123        closeArray();
41124      };
41125      if (element.hasContext()) {
41126        composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
41127      }
41128  }
41129
41130  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
41131    if (element != null) {
41132      open(name);
41133      composeDocumentReferenceDocumentReferenceRelatesToComponentInner(element);
41134      close();
41135    }
41136  }
41137
41138  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentInner(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
41139      composeBackbone(element);
41140      if (element.hasCodeElement()) {
41141        composeEnumerationCore("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
41142        composeEnumerationExtras("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
41143      }
41144      if (element.hasTarget()) {
41145        composeReference("target", element.getTarget());
41146      }
41147  }
41148
41149  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
41150    if (element != null) {
41151      open(name);
41152      composeDocumentReferenceDocumentReferenceContentComponentInner(element);
41153      close();
41154    }
41155  }
41156
41157  protected void composeDocumentReferenceDocumentReferenceContentComponentInner(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
41158      composeBackbone(element);
41159      if (element.hasAttachment()) {
41160        composeAttachment("attachment", element.getAttachment());
41161      }
41162      if (element.hasFormat()) {
41163        composeCoding("format", element.getFormat());
41164      }
41165  }
41166
41167  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
41168    if (element != null) {
41169      open(name);
41170      composeDocumentReferenceDocumentReferenceContextComponentInner(element);
41171      close();
41172      }
41173      }
41174
41175  protected void composeDocumentReferenceDocumentReferenceContextComponentInner(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
41176      composeBackbone(element);
41177      if (element.hasEncounter()) {
41178        openArray("encounter");
41179        for (Reference e : element.getEncounter()) 
41180          composeReference(null, e);
41181        closeArray();
41182      };
41183      if (element.hasEvent()) {
41184        openArray("event");
41185        for (CodeableConcept e : element.getEvent()) 
41186          composeCodeableConcept(null, e);
41187        closeArray();
41188      };
41189      if (element.hasPeriod()) {
41190        composePeriod("period", element.getPeriod());
41191      }
41192      if (element.hasFacilityType()) {
41193        composeCodeableConcept("facilityType", element.getFacilityType());
41194      }
41195      if (element.hasPracticeSetting()) {
41196        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
41197      }
41198      if (element.hasSourcePatientInfo()) {
41199        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
41200      }
41201      if (element.hasRelated()) {
41202        openArray("related");
41203        for (Reference e : element.getRelated()) 
41204          composeReference(null, e);
41205        closeArray();
41206      };
41207      if (element.hasBasedOn()) {
41208        openArray("basedOn");
41209        for (Reference e : element.getBasedOn()) 
41210          composeReference(null, e);
41211        closeArray();
41212      };
41213  }
41214
41215  protected void composeEncounter(String name, Encounter element) throws IOException {
41216    if (element != null) {
41217      prop("resourceType", name);
41218      composeEncounterInner(element);
41219    }
41220  }
41221
41222  protected void composeEncounterInner(Encounter element) throws IOException {
41223      composeDomainResourceElements(element);
41224      if (element.hasIdentifier()) {
41225        openArray("identifier");
41226        for (Identifier e : element.getIdentifier()) 
41227          composeIdentifier(null, e);
41228        closeArray();
41229      };
41230      if (element.hasStatusElement()) {
41231        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
41232        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
41233      }
41234      if (element.hasStatusHistory()) {
41235        openArray("statusHistory");
41236        for (Encounter.StatusHistoryComponent e : element.getStatusHistory()) 
41237          composeEncounterStatusHistoryComponent(null, e);
41238        closeArray();
41239      };
41240      if (element.hasClass_()) {
41241        composeCoding("class", element.getClass_());
41242      }
41243      if (element.hasClassHistory()) {
41244        openArray("classHistory");
41245        for (Encounter.ClassHistoryComponent e : element.getClassHistory()) 
41246          composeEncounterClassHistoryComponent(null, e);
41247        closeArray();
41248      };
41249      if (element.hasType()) {
41250        openArray("type");
41251        for (CodeableConcept e : element.getType()) 
41252          composeCodeableConcept(null, e);
41253        closeArray();
41254      };
41255      if (element.hasServiceType()) {
41256        composeCodeableConcept("serviceType", element.getServiceType());
41257      }
41258      if (element.hasPriority()) {
41259        composeCodeableConcept("priority", element.getPriority());
41260      }
41261      if (element.hasSubject()) {
41262        composeReference("subject", element.getSubject());
41263      }
41264      if (element.hasSubjectStatus()) {
41265        composeCodeableConcept("subjectStatus", element.getSubjectStatus());
41266      }
41267      if (element.hasEpisodeOfCare()) {
41268        openArray("episodeOfCare");
41269        for (Reference e : element.getEpisodeOfCare()) 
41270          composeReference(null, e);
41271        closeArray();
41272      };
41273      if (element.hasBasedOn()) {
41274        openArray("basedOn");
41275        for (Reference e : element.getBasedOn()) 
41276          composeReference(null, e);
41277        closeArray();
41278      };
41279      if (element.hasParticipant()) {
41280        openArray("participant");
41281        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
41282          composeEncounterEncounterParticipantComponent(null, e);
41283        closeArray();
41284      };
41285      if (element.hasAppointment()) {
41286        openArray("appointment");
41287        for (Reference e : element.getAppointment()) 
41288          composeReference(null, e);
41289        closeArray();
41290      };
41291      if (element.hasPeriod()) {
41292        composePeriod("period", element.getPeriod());
41293      }
41294      if (element.hasLength()) {
41295        composeDuration("length", element.getLength());
41296      }
41297      if (element.hasReasonCode()) {
41298        openArray("reasonCode");
41299        for (CodeableConcept e : element.getReasonCode()) 
41300          composeCodeableConcept(null, e);
41301        closeArray();
41302      };
41303      if (element.hasReasonReference()) {
41304        openArray("reasonReference");
41305        for (Reference e : element.getReasonReference()) 
41306          composeReference(null, e);
41307        closeArray();
41308      };
41309      if (element.hasDiagnosis()) {
41310        openArray("diagnosis");
41311        for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
41312          composeEncounterDiagnosisComponent(null, e);
41313        closeArray();
41314      };
41315      if (element.hasAccount()) {
41316        openArray("account");
41317        for (Reference e : element.getAccount()) 
41318          composeReference(null, e);
41319        closeArray();
41320      };
41321      if (element.hasHospitalization()) {
41322        composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
41323      }
41324      if (element.hasLocation()) {
41325        openArray("location");
41326        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
41327          composeEncounterEncounterLocationComponent(null, e);
41328          closeArray();
41329      };
41330      if (element.hasServiceProvider()) {
41331        composeReference("serviceProvider", element.getServiceProvider());
41332      }
41333      if (element.hasPartOf()) {
41334        composeReference("partOf", element.getPartOf());
41335        }
41336  }
41337
41338  protected void composeEncounterStatusHistoryComponent(String name, Encounter.StatusHistoryComponent element) throws IOException {
41339    if (element != null) {
41340      open(name);
41341      composeEncounterStatusHistoryComponentInner(element);
41342      close();
41343    }
41344  }
41345
41346  protected void composeEncounterStatusHistoryComponentInner(Encounter.StatusHistoryComponent element) throws IOException {
41347      composeBackbone(element);
41348      if (element.hasStatusElement()) {
41349        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
41350        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
41351      }
41352      if (element.hasPeriod()) {
41353        composePeriod("period", element.getPeriod());
41354      }
41355  }
41356
41357  protected void composeEncounterClassHistoryComponent(String name, Encounter.ClassHistoryComponent element) throws IOException {
41358    if (element != null) {
41359      open(name);
41360      composeEncounterClassHistoryComponentInner(element);
41361      close();
41362    }
41363  }
41364
41365  protected void composeEncounterClassHistoryComponentInner(Encounter.ClassHistoryComponent element) throws IOException {
41366      composeBackbone(element);
41367      if (element.hasClass_()) {
41368        composeCoding("class", element.getClass_());
41369      }
41370      if (element.hasPeriod()) {
41371        composePeriod("period", element.getPeriod());
41372      }
41373  }
41374
41375  protected void composeEncounterEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
41376    if (element != null) {
41377      open(name);
41378      composeEncounterEncounterParticipantComponentInner(element);
41379      close();
41380    }
41381  }
41382
41383  protected void composeEncounterEncounterParticipantComponentInner(Encounter.EncounterParticipantComponent element) throws IOException {
41384      composeBackbone(element);
41385      if (element.hasType()) {
41386        openArray("type");
41387        for (CodeableConcept e : element.getType()) 
41388          composeCodeableConcept(null, e);
41389        closeArray();
41390      };
41391      if (element.hasPeriod()) {
41392        composePeriod("period", element.getPeriod());
41393      }
41394      if (element.hasIndividual()) {
41395        composeReference("individual", element.getIndividual());
41396      }
41397  }
41398
41399  protected void composeEncounterDiagnosisComponent(String name, Encounter.DiagnosisComponent element) throws IOException {
41400    if (element != null) {
41401      open(name);
41402      composeEncounterDiagnosisComponentInner(element);
41403      close();
41404    }
41405  }
41406
41407  protected void composeEncounterDiagnosisComponentInner(Encounter.DiagnosisComponent element) throws IOException {
41408      composeBackbone(element);
41409      if (element.hasCondition()) {
41410        composeReference("condition", element.getCondition());
41411      }
41412      if (element.hasUse()) {
41413        composeCodeableConcept("use", element.getUse());
41414      }
41415      if (element.hasRankElement()) {
41416        composePositiveIntCore("rank", element.getRankElement(), false);
41417        composePositiveIntExtras("rank", element.getRankElement(), false);
41418      }
41419  }
41420
41421  protected void composeEncounterEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
41422    if (element != null) {
41423      open(name);
41424      composeEncounterEncounterHospitalizationComponentInner(element);
41425      close();
41426    }
41427  }
41428
41429  protected void composeEncounterEncounterHospitalizationComponentInner(Encounter.EncounterHospitalizationComponent element) throws IOException {
41430      composeBackbone(element);
41431      if (element.hasPreAdmissionIdentifier()) {
41432        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
41433      }
41434      if (element.hasOrigin()) {
41435        composeReference("origin", element.getOrigin());
41436      }
41437      if (element.hasAdmitSource()) {
41438        composeCodeableConcept("admitSource", element.getAdmitSource());
41439      }
41440      if (element.hasReAdmission()) {
41441        composeCodeableConcept("reAdmission", element.getReAdmission());
41442      }
41443      if (element.hasDietPreference()) {
41444        openArray("dietPreference");
41445        for (CodeableConcept e : element.getDietPreference()) 
41446          composeCodeableConcept(null, e);
41447        closeArray();
41448      };
41449      if (element.hasSpecialCourtesy()) {
41450        openArray("specialCourtesy");
41451        for (CodeableConcept e : element.getSpecialCourtesy()) 
41452          composeCodeableConcept(null, e);
41453        closeArray();
41454      };
41455      if (element.hasSpecialArrangement()) {
41456        openArray("specialArrangement");
41457        for (CodeableConcept e : element.getSpecialArrangement()) 
41458          composeCodeableConcept(null, e);
41459        closeArray();
41460      };
41461      if (element.hasDestination()) {
41462        composeReference("destination", element.getDestination());
41463      }
41464      if (element.hasDischargeDisposition()) {
41465        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
41466      }
41467  }
41468
41469  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
41470    if (element != null) {
41471      open(name);
41472      composeEncounterEncounterLocationComponentInner(element);
41473      close();
41474    }
41475  }
41476
41477  protected void composeEncounterEncounterLocationComponentInner(Encounter.EncounterLocationComponent element) throws IOException {
41478      composeBackbone(element);
41479      if (element.hasLocation()) {
41480        composeReference("location", element.getLocation());
41481      }
41482      if (element.hasStatusElement()) {
41483        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
41484        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
41485      }
41486      if (element.hasPhysicalType()) {
41487        composeCodeableConcept("physicalType", element.getPhysicalType());
41488      }
41489      if (element.hasPeriod()) {
41490        composePeriod("period", element.getPeriod());
41491      }
41492  }
41493
41494  protected void composeEndpoint(String name, Endpoint element) throws IOException {
41495    if (element != null) {
41496      prop("resourceType", name);
41497      composeEndpointInner(element);
41498    }
41499  }
41500
41501  protected void composeEndpointInner(Endpoint element) throws IOException {
41502      composeDomainResourceElements(element);
41503      if (element.hasIdentifier()) {
41504        openArray("identifier");
41505        for (Identifier e : element.getIdentifier()) 
41506          composeIdentifier(null, e);
41507        closeArray();
41508      };
41509      if (element.hasStatusElement()) {
41510        composeEnumerationCore("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
41511        composeEnumerationExtras("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
41512      }
41513      if (element.hasConnectionType()) {
41514        composeCoding("connectionType", element.getConnectionType());
41515      }
41516      if (element.hasNameElement()) {
41517        composeStringCore("name", element.getNameElement(), false);
41518        composeStringExtras("name", element.getNameElement(), false);
41519      }
41520      if (element.hasManagingOrganization()) {
41521        composeReference("managingOrganization", element.getManagingOrganization());
41522      }
41523      if (element.hasContact()) {
41524        openArray("contact");
41525        for (ContactPoint e : element.getContact()) 
41526          composeContactPoint(null, e);
41527        closeArray();
41528      };
41529      if (element.hasPeriod()) {
41530        composePeriod("period", element.getPeriod());
41531      }
41532      if (element.hasPayloadType()) {
41533        openArray("payloadType");
41534        for (CodeableConcept e : element.getPayloadType()) 
41535          composeCodeableConcept(null, e);
41536        closeArray();
41537      };
41538      if (element.hasPayloadMimeType()) {
41539        openArray("payloadMimeType");
41540        for (CodeType e : element.getPayloadMimeType()) 
41541          composeCodeCore(null, e, true);
41542        closeArray();
41543        if (anyHasExtras(element.getPayloadMimeType())) {
41544          openArray("_payloadMimeType");
41545          for (CodeType e : element.getPayloadMimeType()) 
41546            composeCodeExtras(null, e, true);
41547          closeArray();
41548    }
41549      };
41550      if (element.hasAddressElement()) {
41551        composeUrlCore("address", element.getAddressElement(), false);
41552        composeUrlExtras("address", element.getAddressElement(), false);
41553  }
41554      if (element.hasHeader()) {
41555        openArray("header");
41556        for (StringType e : element.getHeader()) 
41557          composeStringCore(null, e, true);
41558        closeArray();
41559        if (anyHasExtras(element.getHeader())) {
41560          openArray("_header");
41561          for (StringType e : element.getHeader()) 
41562            composeStringExtras(null, e, true);
41563          closeArray();
41564      }
41565      };
41566  }
41567
41568  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
41569    if (element != null) {
41570      prop("resourceType", name);
41571      composeEnrollmentRequestInner(element);
41572    }
41573  }
41574
41575  protected void composeEnrollmentRequestInner(EnrollmentRequest element) throws IOException {
41576      composeDomainResourceElements(element);
41577      if (element.hasIdentifier()) {
41578        openArray("identifier");
41579        for (Identifier e : element.getIdentifier()) 
41580          composeIdentifier(null, e);
41581        closeArray();
41582      };
41583      if (element.hasStatusElement()) {
41584        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
41585        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
41586      }
41587      if (element.hasCreatedElement()) {
41588        composeDateTimeCore("created", element.getCreatedElement(), false);
41589        composeDateTimeExtras("created", element.getCreatedElement(), false);
41590      }
41591      if (element.hasInsurer()) {
41592        composeReference("insurer", element.getInsurer());
41593      }
41594      if (element.hasProvider()) {
41595        composeReference("provider", element.getProvider());
41596      }
41597      if (element.hasCandidate()) {
41598        composeReference("candidate", element.getCandidate());
41599      }
41600      if (element.hasCoverage()) {
41601        composeReference("coverage", element.getCoverage());
41602      }
41603      }
41604
41605  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
41606    if (element != null) {
41607      prop("resourceType", name);
41608      composeEnrollmentResponseInner(element);
41609      }
41610      }
41611
41612  protected void composeEnrollmentResponseInner(EnrollmentResponse element) throws IOException {
41613      composeDomainResourceElements(element);
41614      if (element.hasIdentifier()) {
41615        openArray("identifier");
41616        for (Identifier e : element.getIdentifier()) 
41617          composeIdentifier(null, e);
41618        closeArray();
41619      };
41620      if (element.hasStatusElement()) {
41621        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
41622        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
41623      }
41624      if (element.hasRequest()) {
41625        composeReference("request", element.getRequest());
41626      }
41627      if (element.hasOutcomeElement()) {
41628        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
41629        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
41630      }
41631      if (element.hasDispositionElement()) {
41632        composeStringCore("disposition", element.getDispositionElement(), false);
41633        composeStringExtras("disposition", element.getDispositionElement(), false);
41634      }
41635      if (element.hasCreatedElement()) {
41636        composeDateTimeCore("created", element.getCreatedElement(), false);
41637        composeDateTimeExtras("created", element.getCreatedElement(), false);
41638      }
41639      if (element.hasOrganization()) {
41640        composeReference("organization", element.getOrganization());
41641      }
41642      if (element.hasRequestProvider()) {
41643        composeReference("requestProvider", element.getRequestProvider());
41644      }
41645      }
41646
41647  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
41648    if (element != null) {
41649      prop("resourceType", name);
41650      composeEpisodeOfCareInner(element);
41651      }
41652        }
41653
41654  protected void composeEpisodeOfCareInner(EpisodeOfCare element) throws IOException {
41655      composeDomainResourceElements(element);
41656      if (element.hasIdentifier()) {
41657        openArray("identifier");
41658        for (Identifier e : element.getIdentifier()) 
41659          composeIdentifier(null, e);
41660        closeArray();
41661      };
41662      if (element.hasStatusElement()) {
41663        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
41664        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
41665      }
41666      if (element.hasStatusHistory()) {
41667        openArray("statusHistory");
41668        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
41669          composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(null, e);
41670        closeArray();
41671      };
41672      if (element.hasType()) {
41673        openArray("type");
41674        for (CodeableConcept e : element.getType()) 
41675          composeCodeableConcept(null, e);
41676        closeArray();
41677      };
41678      if (element.hasDiagnosis()) {
41679        openArray("diagnosis");
41680        for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis()) 
41681          composeEpisodeOfCareDiagnosisComponent(null, e);
41682        closeArray();
41683      };
41684      if (element.hasPatient()) {
41685        composeReference("patient", element.getPatient());
41686      }
41687      if (element.hasManagingOrganization()) {
41688        composeReference("managingOrganization", element.getManagingOrganization());
41689      }
41690      if (element.hasPeriod()) {
41691        composePeriod("period", element.getPeriod());
41692      }
41693      if (element.hasReferralRequest()) {
41694        openArray("referralRequest");
41695        for (Reference e : element.getReferralRequest()) 
41696          composeReference(null, e);
41697        closeArray();
41698      };
41699      if (element.hasCareManager()) {
41700        composeReference("careManager", element.getCareManager());
41701      }
41702      if (element.hasTeam()) {
41703        openArray("team");
41704        for (Reference e : element.getTeam()) 
41705          composeReference(null, e);
41706        closeArray();
41707      };
41708      if (element.hasAccount()) {
41709        openArray("account");
41710        for (Reference e : element.getAccount()) 
41711          composeReference(null, e);
41712        closeArray();
41713      };
41714  }
41715
41716  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
41717    if (element != null) {
41718      open(name);
41719      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(element);
41720      close();
41721    }
41722  }
41723
41724  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
41725      composeBackbone(element);
41726      if (element.hasStatusElement()) {
41727        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
41728        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
41729      }
41730      if (element.hasPeriod()) {
41731        composePeriod("period", element.getPeriod());
41732      }
41733  }
41734
41735  protected void composeEpisodeOfCareDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element) throws IOException {
41736    if (element != null) {
41737      open(name);
41738      composeEpisodeOfCareDiagnosisComponentInner(element);
41739      close();
41740    }
41741  }
41742
41743  protected void composeEpisodeOfCareDiagnosisComponentInner(EpisodeOfCare.DiagnosisComponent element) throws IOException {
41744      composeBackbone(element);
41745      if (element.hasCondition()) {
41746        composeReference("condition", element.getCondition());
41747      }
41748      if (element.hasRole()) {
41749        composeCodeableConcept("role", element.getRole());
41750      }
41751      if (element.hasRankElement()) {
41752        composePositiveIntCore("rank", element.getRankElement(), false);
41753        composePositiveIntExtras("rank", element.getRankElement(), false);
41754      }
41755  }
41756
41757  protected void composeEventDefinition(String name, EventDefinition element) throws IOException {
41758    if (element != null) {
41759      prop("resourceType", name);
41760      composeEventDefinitionInner(element);
41761    }
41762  }
41763
41764  protected void composeEventDefinitionInner(EventDefinition element) throws IOException {
41765      composeDomainResourceElements(element);
41766      if (element.hasUrlElement()) {
41767        composeUriCore("url", element.getUrlElement(), false);
41768        composeUriExtras("url", element.getUrlElement(), false);
41769      }
41770      if (element.hasIdentifier()) {
41771        openArray("identifier");
41772        for (Identifier e : element.getIdentifier()) 
41773          composeIdentifier(null, e);
41774        closeArray();
41775      };
41776      if (element.hasVersionElement()) {
41777        composeStringCore("version", element.getVersionElement(), false);
41778        composeStringExtras("version", element.getVersionElement(), false);
41779      }
41780      if (element.hasNameElement()) {
41781        composeStringCore("name", element.getNameElement(), false);
41782        composeStringExtras("name", element.getNameElement(), false);
41783      }
41784      if (element.hasTitleElement()) {
41785        composeStringCore("title", element.getTitleElement(), false);
41786        composeStringExtras("title", element.getTitleElement(), false);
41787      }
41788      if (element.hasSubtitleElement()) {
41789        composeStringCore("subtitle", element.getSubtitleElement(), false);
41790        composeStringExtras("subtitle", element.getSubtitleElement(), false);
41791  }
41792      if (element.hasStatusElement()) {
41793        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41794        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41795    }
41796      if (element.hasExperimentalElement()) {
41797        composeBooleanCore("experimental", element.getExperimentalElement(), false);
41798        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
41799  }
41800      if (element.hasSubject()) {
41801        composeType("subject", element.getSubject());
41802      }
41803      if (element.hasDateElement()) {
41804        composeDateTimeCore("date", element.getDateElement(), false);
41805        composeDateTimeExtras("date", element.getDateElement(), false);
41806      }
41807      if (element.hasPublisherElement()) {
41808        composeStringCore("publisher", element.getPublisherElement(), false);
41809        composeStringExtras("publisher", element.getPublisherElement(), false);
41810      }
41811      if (element.hasContact()) {
41812        openArray("contact");
41813        for (ContactDetail e : element.getContact()) 
41814          composeContactDetail(null, e);
41815        closeArray();
41816      };
41817      if (element.hasDescriptionElement()) {
41818        composeMarkdownCore("description", element.getDescriptionElement(), false);
41819        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41820  }
41821      if (element.hasUseContext()) {
41822        openArray("useContext");
41823        for (UsageContext e : element.getUseContext()) 
41824          composeUsageContext(null, e);
41825        closeArray();
41826      };
41827      if (element.hasJurisdiction()) {
41828        openArray("jurisdiction");
41829        for (CodeableConcept e : element.getJurisdiction()) 
41830          composeCodeableConcept(null, e);
41831          closeArray();
41832      };
41833      if (element.hasPurposeElement()) {
41834        composeMarkdownCore("purpose", element.getPurposeElement(), false);
41835        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
41836  }
41837      if (element.hasUsageElement()) {
41838        composeStringCore("usage", element.getUsageElement(), false);
41839        composeStringExtras("usage", element.getUsageElement(), false);
41840    }
41841      if (element.hasCopyrightElement()) {
41842        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
41843        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
41844  }
41845      if (element.hasApprovalDateElement()) {
41846        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
41847        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
41848      }
41849      if (element.hasLastReviewDateElement()) {
41850        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
41851        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
41852    }
41853      if (element.hasEffectivePeriod()) {
41854        composePeriod("effectivePeriod", element.getEffectivePeriod());
41855  }
41856      if (element.hasTopic()) {
41857        openArray("topic");
41858        for (CodeableConcept e : element.getTopic()) 
41859          composeCodeableConcept(null, e);
41860        closeArray();
41861      };
41862      if (element.hasAuthor()) {
41863        openArray("author");
41864        for (ContactDetail e : element.getAuthor()) 
41865          composeContactDetail(null, e);
41866          closeArray();
41867      };
41868      if (element.hasEditor()) {
41869        openArray("editor");
41870        for (ContactDetail e : element.getEditor()) 
41871          composeContactDetail(null, e);
41872        closeArray();
41873      };
41874      if (element.hasReviewer()) {
41875        openArray("reviewer");
41876        for (ContactDetail e : element.getReviewer()) 
41877          composeContactDetail(null, e);
41878          closeArray();
41879      };
41880      if (element.hasEndorser()) {
41881        openArray("endorser");
41882        for (ContactDetail e : element.getEndorser()) 
41883          composeContactDetail(null, e);
41884        closeArray();
41885      };
41886      if (element.hasRelatedArtifact()) {
41887        openArray("relatedArtifact");
41888        for (RelatedArtifact e : element.getRelatedArtifact()) 
41889          composeRelatedArtifact(null, e);
41890          closeArray();
41891      };
41892      if (element.hasTrigger()) {
41893        openArray("trigger");
41894        for (TriggerDefinition e : element.getTrigger()) 
41895          composeTriggerDefinition(null, e);
41896          closeArray();
41897      };
41898        }
41899
41900  protected void composeEvidence(String name, Evidence element) throws IOException {
41901    if (element != null) {
41902      prop("resourceType", name);
41903      composeEvidenceInner(element);
41904      }
41905      }
41906
41907  protected void composeEvidenceInner(Evidence element) throws IOException {
41908      composeDomainResourceElements(element);
41909      if (element.hasUrlElement()) {
41910        composeUriCore("url", element.getUrlElement(), false);
41911        composeUriExtras("url", element.getUrlElement(), false);
41912      }
41913      if (element.hasIdentifier()) {
41914        openArray("identifier");
41915        for (Identifier e : element.getIdentifier()) 
41916          composeIdentifier(null, e);
41917        closeArray();
41918      };
41919      if (element.hasVersionElement()) {
41920        composeStringCore("version", element.getVersionElement(), false);
41921        composeStringExtras("version", element.getVersionElement(), false);
41922      }
41923      if (element.hasTitleElement()) {
41924        composeStringCore("title", element.getTitleElement(), false);
41925        composeStringExtras("title", element.getTitleElement(), false);
41926      }
41927      if (element.hasStatusElement()) {
41928        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41929        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41930      }
41931      if (element.hasUseContext()) {
41932        openArray("useContext");
41933        for (UsageContext e : element.getUseContext()) 
41934          composeUsageContext(null, e);
41935        closeArray();
41936      };
41937      if (element.hasDateElement()) {
41938        composeDateTimeCore("date", element.getDateElement(), false);
41939        composeDateTimeExtras("date", element.getDateElement(), false);
41940      }
41941      if (element.hasApprovalDateElement()) {
41942        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
41943        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
41944      }
41945      if (element.hasLastReviewDateElement()) {
41946        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
41947        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
41948      }
41949      if (element.hasContributor()) {
41950        openArray("contributor");
41951        for (Contributor e : element.getContributor()) 
41952          composeContributor(null, e);
41953        closeArray();
41954      };
41955      if (element.hasRelatedArtifact()) {
41956        openArray("relatedArtifact");
41957        for (RelatedArtifact e : element.getRelatedArtifact()) 
41958          composeRelatedArtifact(null, e);
41959        closeArray();
41960      };
41961      if (element.hasDescriptionElement()) {
41962        composeMarkdownCore("description", element.getDescriptionElement(), false);
41963        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41964      }
41965      if (element.hasAssertionElement()) {
41966        composeMarkdownCore("assertion", element.getAssertionElement(), false);
41967        composeMarkdownExtras("assertion", element.getAssertionElement(), false);
41968      }
41969      if (element.hasNote()) {
41970        openArray("note");
41971        for (Annotation e : element.getNote()) 
41972          composeAnnotation(null, e);
41973        closeArray();
41974      };
41975      if (element.hasReferentGroup()) {
41976        composeEvidenceEvidenceReferentGroupComponent("referentGroup", element.getReferentGroup());
41977      }
41978      if (element.hasVariableDefinition()) {
41979        openArray("variableDefinition");
41980        for (Evidence.EvidenceVariableDefinitionComponent e : element.getVariableDefinition()) 
41981          composeEvidenceEvidenceVariableDefinitionComponent(null, e);
41982        closeArray();
41983      };
41984      if (element.hasSynthesisType()) {
41985        composeCodeableConcept("synthesisType", element.getSynthesisType());
41986      }
41987      if (element.hasStudyType()) {
41988        composeCodeableConcept("studyType", element.getStudyType());
41989      }
41990      if (element.hasStatistic()) {
41991        openArray("statistic");
41992        for (Statistic e : element.getStatistic()) 
41993          composeStatistic(null, e);
41994          closeArray();
41995      };
41996      if (element.hasDistribution()) {
41997        openArray("distribution");
41998        for (OrderedDistribution e : element.getDistribution()) 
41999          composeOrderedDistribution(null, e);
42000        closeArray();
42001      };
42002      if (element.hasCertainty()) {
42003        openArray("certainty");
42004        for (Evidence.EvidenceCertaintyComponent e : element.getCertainty()) 
42005          composeEvidenceEvidenceCertaintyComponent(null, e);
42006        closeArray();
42007      };
42008  }
42009
42010  protected void composeEvidenceEvidenceReferentGroupComponent(String name, Evidence.EvidenceReferentGroupComponent element) throws IOException {
42011    if (element != null) {
42012      open(name);
42013      composeEvidenceEvidenceReferentGroupComponentInner(element);
42014      close();
42015    }
42016  }
42017
42018  protected void composeEvidenceEvidenceReferentGroupComponentInner(Evidence.EvidenceReferentGroupComponent element) throws IOException {
42019      composeBackbone(element);
42020      if (element.hasDescriptionElement()) {
42021        composeMarkdownCore("description", element.getDescriptionElement(), false);
42022        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42023      }
42024      if (element.hasNote()) {
42025        openArray("note");
42026        for (Annotation e : element.getNote()) 
42027          composeAnnotation(null, e);
42028        closeArray();
42029      };
42030      if (element.hasEvidenceSource()) {
42031        composeReference("evidenceSource", element.getEvidenceSource());
42032      }
42033      if (element.hasIntendedGroup()) {
42034        composeReference("intendedGroup", element.getIntendedGroup());
42035      }
42036      if (element.hasDirectnessMatch()) {
42037        composeCodeableConcept("directnessMatch", element.getDirectnessMatch());
42038      }
42039  }
42040
42041  protected void composeEvidenceEvidenceVariableDefinitionComponent(String name, Evidence.EvidenceVariableDefinitionComponent element) throws IOException {
42042    if (element != null) {
42043      open(name);
42044      composeEvidenceEvidenceVariableDefinitionComponentInner(element);
42045      close();
42046    }
42047  }
42048
42049  protected void composeEvidenceEvidenceVariableDefinitionComponentInner(Evidence.EvidenceVariableDefinitionComponent element) throws IOException {
42050      composeBackbone(element);
42051      if (element.hasDescriptionElement()) {
42052        composeMarkdownCore("description", element.getDescriptionElement(), false);
42053        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42054      }
42055      if (element.hasNote()) {
42056        openArray("note");
42057        for (Annotation e : element.getNote()) 
42058          composeAnnotation(null, e);
42059        closeArray();
42060      };
42061      if (element.hasVariableRole()) {
42062        composeCodeableConcept("variableRole", element.getVariableRole());
42063      }
42064      if (element.hasActualDefinition()) {
42065        composeReference("actualDefinition", element.getActualDefinition());
42066      }
42067      if (element.hasIntendedDefinition()) {
42068        composeReference("intendedDefinition", element.getIntendedDefinition());
42069      }
42070      if (element.hasDirectnessMatch()) {
42071        composeCodeableConcept("directnessMatch", element.getDirectnessMatch());
42072      }
42073      }
42074
42075  protected void composeEvidenceEvidenceCertaintyComponent(String name, Evidence.EvidenceCertaintyComponent element) throws IOException {
42076    if (element != null) {
42077      open(name);
42078      composeEvidenceEvidenceCertaintyComponentInner(element);
42079      close();
42080      }
42081      }
42082
42083  protected void composeEvidenceEvidenceCertaintyComponentInner(Evidence.EvidenceCertaintyComponent element) throws IOException {
42084      composeBackbone(element);
42085      if (element.hasDescriptionElement()) {
42086        composeStringCore("description", element.getDescriptionElement(), false);
42087        composeStringExtras("description", element.getDescriptionElement(), false);
42088      }
42089      if (element.hasNote()) {
42090        composeAnnotation("note", element.getNote());
42091        }
42092      if (element.hasRating()) {
42093        openArray("rating");
42094        for (CodeableConcept e : element.getRating()) 
42095          composeCodeableConcept(null, e);
42096        closeArray();
42097      };
42098      if (element.hasCertaintySubcomponent()) {
42099        openArray("certaintySubcomponent");
42100        for (Evidence.EvidenceCertaintyCertaintySubcomponentComponent e : element.getCertaintySubcomponent()) 
42101          composeEvidenceEvidenceCertaintyCertaintySubcomponentComponent(null, e);
42102        closeArray();
42103      };
42104  }
42105
42106  protected void composeEvidenceEvidenceCertaintyCertaintySubcomponentComponent(String name, Evidence.EvidenceCertaintyCertaintySubcomponentComponent element) throws IOException {
42107    if (element != null) {
42108      open(name);
42109      composeEvidenceEvidenceCertaintyCertaintySubcomponentComponentInner(element);
42110      close();
42111    }
42112  }
42113
42114  protected void composeEvidenceEvidenceCertaintyCertaintySubcomponentComponentInner(Evidence.EvidenceCertaintyCertaintySubcomponentComponent element) throws IOException {
42115      composeBackbone(element);
42116      if (element.hasDescriptionElement()) {
42117        composeStringCore("description", element.getDescriptionElement(), false);
42118        composeStringExtras("description", element.getDescriptionElement(), false);
42119      }
42120      if (element.hasNote()) {
42121        composeAnnotation("note", element.getNote());
42122      }
42123      if (element.hasType()) {
42124        openArray("type");
42125        for (CodeableConcept e : element.getType()) 
42126          composeCodeableConcept(null, e);
42127        closeArray();
42128      };
42129      if (element.hasRating()) {
42130        openArray("rating");
42131        for (CodeableConcept e : element.getRating()) 
42132          composeCodeableConcept(null, e);
42133        closeArray();
42134      };
42135      }
42136
42137  protected void composeEvidenceVariable(String name, EvidenceVariable element) throws IOException {
42138    if (element != null) {
42139      prop("resourceType", name);
42140      composeEvidenceVariableInner(element);
42141      }
42142      }
42143
42144  protected void composeEvidenceVariableInner(EvidenceVariable element) throws IOException {
42145      composeDomainResourceElements(element);
42146      if (element.hasUrlElement()) {
42147        composeUriCore("url", element.getUrlElement(), false);
42148        composeUriExtras("url", element.getUrlElement(), false);
42149      }
42150      if (element.hasIdentifier()) {
42151        openArray("identifier");
42152        for (Identifier e : element.getIdentifier()) 
42153          composeIdentifier(null, e);
42154        closeArray();
42155      };
42156      if (element.hasVersionElement()) {
42157        composeStringCore("version", element.getVersionElement(), false);
42158        composeStringExtras("version", element.getVersionElement(), false);
42159      }
42160      if (element.hasNameElement()) {
42161        composeStringCore("name", element.getNameElement(), false);
42162        composeStringExtras("name", element.getNameElement(), false);
42163      }
42164      if (element.hasTitleElement()) {
42165        composeStringCore("title", element.getTitleElement(), false);
42166        composeStringExtras("title", element.getTitleElement(), false);
42167      }
42168      if (element.hasShortTitleElement()) {
42169        composeStringCore("shortTitle", element.getShortTitleElement(), false);
42170        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
42171        }
42172      if (element.hasSubtitleElement()) {
42173        composeStringCore("subtitle", element.getSubtitleElement(), false);
42174        composeStringExtras("subtitle", element.getSubtitleElement(), false);
42175  }
42176      if (element.hasStatusElement()) {
42177        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42178        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42179    }
42180      if (element.hasDateElement()) {
42181        composeDateTimeCore("date", element.getDateElement(), false);
42182        composeDateTimeExtras("date", element.getDateElement(), false);
42183  }
42184      if (element.hasPublisherElement()) {
42185        composeStringCore("publisher", element.getPublisherElement(), false);
42186        composeStringExtras("publisher", element.getPublisherElement(), false);
42187        }
42188      if (element.hasContact()) {
42189        openArray("contact");
42190        for (ContactDetail e : element.getContact()) 
42191          composeContactDetail(null, e);
42192          closeArray();
42193      };
42194      if (element.hasDescriptionElement()) {
42195        composeMarkdownCore("description", element.getDescriptionElement(), false);
42196        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42197        }
42198      if (element.hasNote()) {
42199        openArray("note");
42200        for (Annotation e : element.getNote()) 
42201          composeAnnotation(null, e);
42202        closeArray();
42203      };
42204      if (element.hasUseContext()) {
42205        openArray("useContext");
42206        for (UsageContext e : element.getUseContext()) 
42207          composeUsageContext(null, e);
42208        closeArray();
42209      };
42210      if (element.hasJurisdiction()) {
42211        openArray("jurisdiction");
42212        for (CodeableConcept e : element.getJurisdiction()) 
42213          composeCodeableConcept(null, e);
42214        closeArray();
42215      };
42216      if (element.hasCopyrightElement()) {
42217        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
42218        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
42219      }
42220      if (element.hasApprovalDateElement()) {
42221        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
42222        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
42223      }
42224      if (element.hasLastReviewDateElement()) {
42225        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
42226        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
42227      }
42228      if (element.hasEffectivePeriod()) {
42229        composePeriod("effectivePeriod", element.getEffectivePeriod());
42230      }
42231      if (element.hasTopic()) {
42232        openArray("topic");
42233        for (CodeableConcept e : element.getTopic()) 
42234          composeCodeableConcept(null, e);
42235        closeArray();
42236      };
42237      if (element.hasAuthor()) {
42238        openArray("author");
42239        for (ContactDetail e : element.getAuthor()) 
42240          composeContactDetail(null, e);
42241        closeArray();
42242      };
42243      if (element.hasEditor()) {
42244        openArray("editor");
42245        for (ContactDetail e : element.getEditor()) 
42246          composeContactDetail(null, e);
42247        closeArray();
42248      };
42249      if (element.hasReviewer()) {
42250        openArray("reviewer");
42251        for (ContactDetail e : element.getReviewer()) 
42252          composeContactDetail(null, e);
42253        closeArray();
42254      };
42255      if (element.hasEndorser()) {
42256        openArray("endorser");
42257        for (ContactDetail e : element.getEndorser()) 
42258          composeContactDetail(null, e);
42259          closeArray();
42260      };
42261      if (element.hasRelatedArtifact()) {
42262        openArray("relatedArtifact");
42263        for (RelatedArtifact e : element.getRelatedArtifact()) 
42264          composeRelatedArtifact(null, e);
42265        closeArray();
42266      };
42267      if (element.hasTypeElement()) {
42268        composeEnumerationCore("type", element.getTypeElement(), new EvidenceVariable.EvidenceVariableTypeEnumFactory(), false);
42269        composeEnumerationExtras("type", element.getTypeElement(), new EvidenceVariable.EvidenceVariableTypeEnumFactory(), false);
42270      }
42271      if (element.hasActualElement()) {
42272        composeBooleanCore("actual", element.getActualElement(), false);
42273        composeBooleanExtras("actual", element.getActualElement(), false);
42274      }
42275      if (element.hasCharacteristic()) {
42276        openArray("characteristic");
42277        for (EvidenceVariable.EvidenceVariableCharacteristicComponent e : element.getCharacteristic()) 
42278          composeEvidenceVariableEvidenceVariableCharacteristicComponent(null, e);
42279        closeArray();
42280      };
42281  }
42282
42283  protected void composeEvidenceVariableEvidenceVariableCharacteristicComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
42284    if (element != null) {
42285      open(name);
42286      composeEvidenceVariableEvidenceVariableCharacteristicComponentInner(element);
42287      close();
42288    }
42289  }
42290
42291  protected void composeEvidenceVariableEvidenceVariableCharacteristicComponentInner(EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
42292      composeBackbone(element);
42293      if (element.hasDescriptionElement()) {
42294        composeStringCore("description", element.getDescriptionElement(), false);
42295        composeStringExtras("description", element.getDescriptionElement(), false);
42296      }
42297      if (element.hasDefinition()) {
42298        composeType("definition", element.getDefinition());
42299      }
42300      if (element.hasMethod()) {
42301        composeCodeableConcept("method", element.getMethod());
42302      }
42303      if (element.hasDevice()) {
42304        composeReference("device", element.getDevice());
42305      }
42306      if (element.hasBooleanSet()) {
42307        openArray("booleanSet");
42308        for (StringType e : element.getBooleanSet()) 
42309          composeStringCore(null, e, true);
42310        closeArray();
42311        if (anyHasExtras(element.getBooleanSet())) {
42312          openArray("_booleanSet");
42313          for (StringType e : element.getBooleanSet()) 
42314            composeStringExtras(null, e, true);
42315          closeArray();
42316        }
42317      };
42318      if (element.hasExcludeElement()) {
42319        composeBooleanCore("exclude", element.getExcludeElement(), false);
42320        composeBooleanExtras("exclude", element.getExcludeElement(), false);
42321      }
42322      if (element.hasParticipantEffective()) {
42323        composeType("participantEffective", element.getParticipantEffective());
42324      }
42325      if (element.hasTimeFromStart()) {
42326        composeDuration("timeFromStart", element.getTimeFromStart());
42327      }
42328      if (element.hasGroupMeasureElement()) {
42329        composeEnumerationCore("groupMeasure", element.getGroupMeasureElement(), new EvidenceVariable.GroupMeasureEnumFactory(), false);
42330        composeEnumerationExtras("groupMeasure", element.getGroupMeasureElement(), new EvidenceVariable.GroupMeasureEnumFactory(), false);
42331      }
42332  }
42333
42334  protected void composeExampleScenario(String name, ExampleScenario element) throws IOException {
42335    if (element != null) {
42336      prop("resourceType", name);
42337      composeExampleScenarioInner(element);
42338    }
42339  }
42340
42341  protected void composeExampleScenarioInner(ExampleScenario element) throws IOException {
42342      composeDomainResourceElements(element);
42343      if (element.hasUrlElement()) {
42344        composeUriCore("url", element.getUrlElement(), false);
42345        composeUriExtras("url", element.getUrlElement(), false);
42346      }
42347      if (element.hasIdentifier()) {
42348        openArray("identifier");
42349        for (Identifier e : element.getIdentifier()) 
42350          composeIdentifier(null, e);
42351        closeArray();
42352      };
42353      if (element.hasVersionElement()) {
42354        composeStringCore("version", element.getVersionElement(), false);
42355        composeStringExtras("version", element.getVersionElement(), false);
42356      }
42357      if (element.hasNameElement()) {
42358        composeStringCore("name", element.getNameElement(), false);
42359        composeStringExtras("name", element.getNameElement(), false);
42360      }
42361      if (element.hasStatusElement()) {
42362        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42363        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42364      }
42365      if (element.hasExperimentalElement()) {
42366        composeBooleanCore("experimental", element.getExperimentalElement(), false);
42367        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
42368      }
42369      if (element.hasDateElement()) {
42370        composeDateTimeCore("date", element.getDateElement(), false);
42371        composeDateTimeExtras("date", element.getDateElement(), false);
42372      }
42373      if (element.hasPublisherElement()) {
42374        composeStringCore("publisher", element.getPublisherElement(), false);
42375        composeStringExtras("publisher", element.getPublisherElement(), false);
42376      }
42377      if (element.hasContact()) {
42378        openArray("contact");
42379        for (ContactDetail e : element.getContact()) 
42380          composeContactDetail(null, e);
42381        closeArray();
42382      };
42383      if (element.hasUseContext()) {
42384        openArray("useContext");
42385        for (UsageContext e : element.getUseContext()) 
42386          composeUsageContext(null, e);
42387        closeArray();
42388      };
42389      if (element.hasJurisdiction()) {
42390        openArray("jurisdiction");
42391        for (CodeableConcept e : element.getJurisdiction()) 
42392          composeCodeableConcept(null, e);
42393          closeArray();
42394      };
42395      if (element.hasCopyrightElement()) {
42396        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
42397        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
42398      }
42399      if (element.hasPurposeElement()) {
42400        composeMarkdownCore("purpose", element.getPurposeElement(), false);
42401        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
42402        }
42403      if (element.hasActor()) {
42404        openArray("actor");
42405        for (ExampleScenario.ExampleScenarioActorComponent e : element.getActor()) 
42406          composeExampleScenarioExampleScenarioActorComponent(null, e);
42407        closeArray();
42408      };
42409      if (element.hasInstance()) {
42410        openArray("instance");
42411        for (ExampleScenario.ExampleScenarioInstanceComponent e : element.getInstance()) 
42412          composeExampleScenarioExampleScenarioInstanceComponent(null, e);
42413        closeArray();
42414      };
42415      if (element.hasProcess()) {
42416        openArray("process");
42417        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
42418          composeExampleScenarioExampleScenarioProcessComponent(null, e);
42419        closeArray();
42420      };
42421      if (element.hasWorkflow()) {
42422        openArray("workflow");
42423        for (CanonicalType e : element.getWorkflow()) 
42424          composeCanonicalCore(null, e, true);
42425        closeArray();
42426        if (anyHasExtras(element.getWorkflow())) {
42427          openArray("_workflow");
42428          for (CanonicalType e : element.getWorkflow()) 
42429            composeCanonicalExtras(null, e, true);
42430        closeArray();
42431        }
42432      };
42433  }
42434
42435  protected void composeExampleScenarioExampleScenarioActorComponent(String name, ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
42436    if (element != null) {
42437      open(name);
42438      composeExampleScenarioExampleScenarioActorComponentInner(element);
42439      close();
42440    }
42441  }
42442
42443  protected void composeExampleScenarioExampleScenarioActorComponentInner(ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
42444      composeBackbone(element);
42445      if (element.hasActorIdElement()) {
42446        composeStringCore("actorId", element.getActorIdElement(), false);
42447        composeStringExtras("actorId", element.getActorIdElement(), false);
42448      }
42449      if (element.hasTypeElement()) {
42450        composeEnumerationCore("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
42451        composeEnumerationExtras("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
42452      }
42453      if (element.hasNameElement()) {
42454        composeStringCore("name", element.getNameElement(), false);
42455        composeStringExtras("name", element.getNameElement(), false);
42456      }
42457      if (element.hasDescriptionElement()) {
42458        composeMarkdownCore("description", element.getDescriptionElement(), false);
42459        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42460      }
42461  }
42462
42463  protected void composeExampleScenarioExampleScenarioInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
42464    if (element != null) {
42465      open(name);
42466      composeExampleScenarioExampleScenarioInstanceComponentInner(element);
42467      close();
42468    }
42469  }
42470
42471  protected void composeExampleScenarioExampleScenarioInstanceComponentInner(ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
42472      composeBackbone(element);
42473      if (element.hasResourceIdElement()) {
42474        composeStringCore("resourceId", element.getResourceIdElement(), false);
42475        composeStringExtras("resourceId", element.getResourceIdElement(), false);
42476      }
42477      if (element.hasResourceTypeElement()) {
42478        composeEnumerationCore("resourceType", element.getResourceTypeElement(), new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
42479        composeEnumerationExtras("resourceType", element.getResourceTypeElement(), new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
42480      }
42481      if (element.hasNameElement()) {
42482        composeStringCore("name", element.getNameElement(), false);
42483        composeStringExtras("name", element.getNameElement(), false);
42484      }
42485      if (element.hasDescriptionElement()) {
42486        composeMarkdownCore("description", element.getDescriptionElement(), false);
42487        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42488      }
42489      if (element.hasVersion()) {
42490        openArray("version");
42491        for (ExampleScenario.ExampleScenarioInstanceVersionComponent e : element.getVersion()) 
42492          composeExampleScenarioExampleScenarioInstanceVersionComponent(null, e);
42493        closeArray();
42494      };
42495      if (element.hasContainedInstance()) {
42496        openArray("containedInstance");
42497        for (ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent e : element.getContainedInstance()) 
42498          composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(null, e);
42499        closeArray();
42500      };
42501  }
42502
42503  protected void composeExampleScenarioExampleScenarioInstanceVersionComponent(String name, ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
42504    if (element != null) {
42505      open(name);
42506      composeExampleScenarioExampleScenarioInstanceVersionComponentInner(element);
42507      close();
42508    }
42509  }
42510
42511  protected void composeExampleScenarioExampleScenarioInstanceVersionComponentInner(ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
42512      composeBackbone(element);
42513      if (element.hasVersionIdElement()) {
42514        composeStringCore("versionId", element.getVersionIdElement(), false);
42515        composeStringExtras("versionId", element.getVersionIdElement(), false);
42516      }
42517      if (element.hasDescriptionElement()) {
42518        composeMarkdownCore("description", element.getDescriptionElement(), false);
42519        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42520      }
42521  }
42522
42523  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
42524    if (element != null) {
42525      open(name);
42526      composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(element);
42527      close();
42528    }
42529  }
42530
42531  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
42532      composeBackbone(element);
42533      if (element.hasResourceIdElement()) {
42534        composeStringCore("resourceId", element.getResourceIdElement(), false);
42535        composeStringExtras("resourceId", element.getResourceIdElement(), false);
42536      }
42537      if (element.hasVersionIdElement()) {
42538        composeStringCore("versionId", element.getVersionIdElement(), false);
42539        composeStringExtras("versionId", element.getVersionIdElement(), false);
42540      }
42541  }
42542
42543  protected void composeExampleScenarioExampleScenarioProcessComponent(String name, ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
42544    if (element != null) {
42545      open(name);
42546      composeExampleScenarioExampleScenarioProcessComponentInner(element);
42547      close();
42548    }
42549  }
42550
42551  protected void composeExampleScenarioExampleScenarioProcessComponentInner(ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
42552      composeBackbone(element);
42553      if (element.hasTitleElement()) {
42554        composeStringCore("title", element.getTitleElement(), false);
42555        composeStringExtras("title", element.getTitleElement(), false);
42556      }
42557      if (element.hasDescriptionElement()) {
42558        composeMarkdownCore("description", element.getDescriptionElement(), false);
42559        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42560      }
42561      if (element.hasPreConditionsElement()) {
42562        composeMarkdownCore("preConditions", element.getPreConditionsElement(), false);
42563        composeMarkdownExtras("preConditions", element.getPreConditionsElement(), false);
42564      }
42565      if (element.hasPostConditionsElement()) {
42566        composeMarkdownCore("postConditions", element.getPostConditionsElement(), false);
42567        composeMarkdownExtras("postConditions", element.getPostConditionsElement(), false);
42568      }
42569      if (element.hasStep()) {
42570        openArray("step");
42571        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
42572          composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
42573        closeArray();
42574      };
42575  }
42576
42577  protected void composeExampleScenarioExampleScenarioProcessStepComponent(String name, ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
42578    if (element != null) {
42579      open(name);
42580      composeExampleScenarioExampleScenarioProcessStepComponentInner(element);
42581      close();
42582    }
42583  }
42584
42585  protected void composeExampleScenarioExampleScenarioProcessStepComponentInner(ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
42586      composeBackbone(element);
42587      if (element.hasProcess()) {
42588        openArray("process");
42589        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
42590          composeExampleScenarioExampleScenarioProcessComponent(null, e);
42591        closeArray();
42592      };
42593      if (element.hasPauseElement()) {
42594        composeBooleanCore("pause", element.getPauseElement(), false);
42595        composeBooleanExtras("pause", element.getPauseElement(), false);
42596      }
42597      if (element.hasOperation()) {
42598        composeExampleScenarioExampleScenarioProcessStepOperationComponent("operation", element.getOperation());
42599      }
42600      if (element.hasAlternative()) {
42601        openArray("alternative");
42602        for (ExampleScenario.ExampleScenarioProcessStepAlternativeComponent e : element.getAlternative()) 
42603          composeExampleScenarioExampleScenarioProcessStepAlternativeComponent(null, e);
42604          closeArray();
42605      };
42606        }
42607
42608  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponent(String name, ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
42609    if (element != null) {
42610      open(name);
42611      composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(element);
42612      close();
42613      }
42614      }
42615
42616  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
42617      composeBackbone(element);
42618      if (element.hasNumberElement()) {
42619        composeStringCore("number", element.getNumberElement(), false);
42620        composeStringExtras("number", element.getNumberElement(), false);
42621      }
42622      if (element.hasTypeElement()) {
42623        composeStringCore("type", element.getTypeElement(), false);
42624        composeStringExtras("type", element.getTypeElement(), false);
42625      }
42626      if (element.hasNameElement()) {
42627        composeStringCore("name", element.getNameElement(), false);
42628        composeStringExtras("name", element.getNameElement(), false);
42629      }
42630      if (element.hasInitiatorElement()) {
42631        composeStringCore("initiator", element.getInitiatorElement(), false);
42632        composeStringExtras("initiator", element.getInitiatorElement(), false);
42633      }
42634      if (element.hasReceiverElement()) {
42635        composeStringCore("receiver", element.getReceiverElement(), false);
42636        composeStringExtras("receiver", element.getReceiverElement(), false);
42637      }
42638      if (element.hasDescriptionElement()) {
42639        composeMarkdownCore("description", element.getDescriptionElement(), false);
42640        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42641      }
42642      if (element.hasInitiatorActiveElement()) {
42643        composeBooleanCore("initiatorActive", element.getInitiatorActiveElement(), false);
42644        composeBooleanExtras("initiatorActive", element.getInitiatorActiveElement(), false);
42645      }
42646      if (element.hasReceiverActiveElement()) {
42647        composeBooleanCore("receiverActive", element.getReceiverActiveElement(), false);
42648        composeBooleanExtras("receiverActive", element.getReceiverActiveElement(), false);
42649      }
42650      if (element.hasRequest()) {
42651        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("request", element.getRequest());
42652      }
42653      if (element.hasResponse()) {
42654        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("response", element.getResponse());
42655      }
42656  }
42657
42658  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponent(String name, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
42659    if (element != null) {
42660      open(name);
42661      composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(element);
42662      close();
42663    }
42664  }
42665
42666  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
42667      composeBackbone(element);
42668      if (element.hasTitleElement()) {
42669        composeStringCore("title", element.getTitleElement(), false);
42670        composeStringExtras("title", element.getTitleElement(), false);
42671      }
42672      if (element.hasDescriptionElement()) {
42673        composeMarkdownCore("description", element.getDescriptionElement(), false);
42674        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42675      }
42676      if (element.hasStep()) {
42677        openArray("step");
42678        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
42679          composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
42680        closeArray();
42681      };
42682  }
42683
42684  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
42685    if (element != null) {
42686      prop("resourceType", name);
42687      composeExplanationOfBenefitInner(element);
42688    }
42689  }
42690
42691  protected void composeExplanationOfBenefitInner(ExplanationOfBenefit element) throws IOException {
42692      composeDomainResourceElements(element);
42693      if (element.hasIdentifier()) {
42694        openArray("identifier");
42695        for (Identifier e : element.getIdentifier()) 
42696          composeIdentifier(null, e);
42697        closeArray();
42698      };
42699      if (element.hasStatusElement()) {
42700        composeEnumerationCore("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
42701        composeEnumerationExtras("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
42702      }
42703      if (element.hasType()) {
42704        composeCodeableConcept("type", element.getType());
42705      }
42706      if (element.hasSubType()) {
42707        composeCodeableConcept("subType", element.getSubType());
42708      }
42709      if (element.hasUseElement()) {
42710        composeEnumerationCore("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
42711        composeEnumerationExtras("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
42712      }
42713      if (element.hasPatient()) {
42714        composeReference("patient", element.getPatient());
42715      }
42716      if (element.hasBillablePeriod()) {
42717        composePeriod("billablePeriod", element.getBillablePeriod());
42718      }
42719      if (element.hasCreatedElement()) {
42720        composeDateTimeCore("created", element.getCreatedElement(), false);
42721        composeDateTimeExtras("created", element.getCreatedElement(), false);
42722      }
42723      if (element.hasEnterer()) {
42724        composeReference("enterer", element.getEnterer());
42725      }
42726      if (element.hasInsurer()) {
42727        composeReference("insurer", element.getInsurer());
42728      }
42729      if (element.hasProvider()) {
42730        composeReference("provider", element.getProvider());
42731      }
42732      if (element.hasPriority()) {
42733        composeCodeableConcept("priority", element.getPriority());
42734  }
42735      if (element.hasFundsReserveRequested()) {
42736        composeCodeableConcept("fundsReserveRequested", element.getFundsReserveRequested());
42737    }
42738      if (element.hasFundsReserve()) {
42739        composeCodeableConcept("fundsReserve", element.getFundsReserve());
42740  }
42741      if (element.hasRelated()) {
42742        openArray("related");
42743        for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated()) 
42744          composeExplanationOfBenefitRelatedClaimComponent(null, e);
42745        closeArray();
42746      };
42747      if (element.hasPrescription()) {
42748        composeReference("prescription", element.getPrescription());
42749      }
42750      if (element.hasOriginalPrescription()) {
42751        composeReference("originalPrescription", element.getOriginalPrescription());
42752      }
42753      if (element.hasPayee()) {
42754        composeExplanationOfBenefitPayeeComponent("payee", element.getPayee());
42755      }
42756      if (element.hasReferral()) {
42757        composeReference("referral", element.getReferral());
42758      }
42759      if (element.hasFacility()) {
42760        composeReference("facility", element.getFacility());
42761      }
42762      if (element.hasClaim()) {
42763        composeReference("claim", element.getClaim());
42764      }
42765      if (element.hasClaimResponse()) {
42766        composeReference("claimResponse", element.getClaimResponse());
42767      }
42768      if (element.hasOutcomeElement()) {
42769        composeEnumerationCore("outcome", element.getOutcomeElement(), new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
42770        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
42771      }
42772      if (element.hasDispositionElement()) {
42773        composeStringCore("disposition", element.getDispositionElement(), false);
42774        composeStringExtras("disposition", element.getDispositionElement(), false);
42775      }
42776      if (element.hasPreAuthRef()) {
42777        openArray("preAuthRef");
42778        for (StringType e : element.getPreAuthRef()) 
42779          composeStringCore(null, e, true);
42780        closeArray();
42781        if (anyHasExtras(element.getPreAuthRef())) {
42782          openArray("_preAuthRef");
42783          for (StringType e : element.getPreAuthRef()) 
42784            composeStringExtras(null, e, true);
42785          closeArray();
42786      }
42787      };
42788      if (element.hasPreAuthRefPeriod()) {
42789        openArray("preAuthRefPeriod");
42790        for (Period e : element.getPreAuthRefPeriod()) 
42791          composePeriod(null, e);
42792        closeArray();
42793      };
42794      if (element.hasCareTeam()) {
42795        openArray("careTeam");
42796        for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam()) 
42797          composeExplanationOfBenefitCareTeamComponent(null, e);
42798        closeArray();
42799      };
42800      if (element.hasSupportingInfo()) {
42801        openArray("supportingInfo");
42802        for (ExplanationOfBenefit.SupportingInformationComponent e : element.getSupportingInfo()) 
42803          composeExplanationOfBenefitSupportingInformationComponent(null, e);
42804        closeArray();
42805      };
42806      if (element.hasDiagnosis()) {
42807        openArray("diagnosis");
42808        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
42809          composeExplanationOfBenefitDiagnosisComponent(null, e);
42810        closeArray();
42811      };
42812      if (element.hasProcedure()) {
42813        openArray("procedure");
42814        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
42815          composeExplanationOfBenefitProcedureComponent(null, e);
42816        closeArray();
42817      };
42818      if (element.hasPrecedenceElement()) {
42819        composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
42820        composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
42821      }
42822      if (element.hasInsurance()) {
42823        openArray("insurance");
42824        for (ExplanationOfBenefit.InsuranceComponent e : element.getInsurance()) 
42825          composeExplanationOfBenefitInsuranceComponent(null, e);
42826        closeArray();
42827      };
42828      if (element.hasAccident()) {
42829        composeExplanationOfBenefitAccidentComponent("accident", element.getAccident());
42830      }
42831      if (element.hasItem()) {
42832        openArray("item");
42833        for (ExplanationOfBenefit.ItemComponent e : element.getItem()) 
42834          composeExplanationOfBenefitItemComponent(null, e);
42835        closeArray();
42836      };
42837      if (element.hasAddItem()) {
42838        openArray("addItem");
42839        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
42840          composeExplanationOfBenefitAddedItemComponent(null, e);
42841        closeArray();
42842      };
42843      if (element.hasAdjudication()) {
42844        openArray("adjudication");
42845        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
42846          composeExplanationOfBenefitAdjudicationComponent(null, e);
42847        closeArray();
42848      };
42849      if (element.hasTotal()) {
42850        openArray("total");
42851        for (ExplanationOfBenefit.TotalComponent e : element.getTotal()) 
42852          composeExplanationOfBenefitTotalComponent(null, e);
42853        closeArray();
42854      };
42855      if (element.hasPayment()) {
42856        composeExplanationOfBenefitPaymentComponent("payment", element.getPayment());
42857      }
42858      if (element.hasFormCode()) {
42859        composeCodeableConcept("formCode", element.getFormCode());
42860      }
42861      if (element.hasForm()) {
42862        composeAttachment("form", element.getForm());
42863      }
42864      if (element.hasProcessNote()) {
42865        openArray("processNote");
42866        for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote()) 
42867          composeExplanationOfBenefitNoteComponent(null, e);
42868        closeArray();
42869      };
42870      if (element.hasBenefitPeriod()) {
42871        composePeriod("benefitPeriod", element.getBenefitPeriod());
42872      }
42873      if (element.hasBenefitBalance()) {
42874        openArray("benefitBalance");
42875        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
42876          composeExplanationOfBenefitBenefitBalanceComponent(null, e);
42877        closeArray();
42878      };
42879  }
42880
42881  protected void composeExplanationOfBenefitRelatedClaimComponent(String name, ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
42882    if (element != null) {
42883      open(name);
42884      composeExplanationOfBenefitRelatedClaimComponentInner(element);
42885      close();
42886    }
42887  }
42888
42889  protected void composeExplanationOfBenefitRelatedClaimComponentInner(ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
42890      composeBackbone(element);
42891      if (element.hasClaim()) {
42892        composeReference("claim", element.getClaim());
42893      }
42894      if (element.hasRelationship()) {
42895        composeCodeableConcept("relationship", element.getRelationship());
42896      }
42897      if (element.hasReference()) {
42898        composeIdentifier("reference", element.getReference());
42899      }
42900  }
42901
42902  protected void composeExplanationOfBenefitPayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
42903    if (element != null) {
42904      open(name);
42905      composeExplanationOfBenefitPayeeComponentInner(element);
42906      close();
42907    }
42908  }
42909
42910  protected void composeExplanationOfBenefitPayeeComponentInner(ExplanationOfBenefit.PayeeComponent element) throws IOException {
42911      composeBackbone(element);
42912      if (element.hasType()) {
42913        composeCodeableConcept("type", element.getType());
42914      }
42915      if (element.hasParty()) {
42916        composeReference("party", element.getParty());
42917      }
42918  }
42919
42920  protected void composeExplanationOfBenefitCareTeamComponent(String name, ExplanationOfBenefit.CareTeamComponent element) throws IOException {
42921    if (element != null) {
42922      open(name);
42923      composeExplanationOfBenefitCareTeamComponentInner(element);
42924      close();
42925    }
42926  }
42927
42928  protected void composeExplanationOfBenefitCareTeamComponentInner(ExplanationOfBenefit.CareTeamComponent element) throws IOException {
42929      composeBackbone(element);
42930      if (element.hasSequenceElement()) {
42931        composePositiveIntCore("sequence", element.getSequenceElement(), false);
42932        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
42933      }
42934      if (element.hasProvider()) {
42935        composeReference("provider", element.getProvider());
42936      }
42937      if (element.hasResponsibleElement()) {
42938        composeBooleanCore("responsible", element.getResponsibleElement(), false);
42939        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
42940      }
42941      if (element.hasRole()) {
42942        composeCodeableConcept("role", element.getRole());
42943      }
42944      if (element.hasQualification()) {
42945        composeCodeableConcept("qualification", element.getQualification());
42946      }
42947  }
42948
42949  protected void composeExplanationOfBenefitSupportingInformationComponent(String name, ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
42950    if (element != null) {
42951      open(name);
42952      composeExplanationOfBenefitSupportingInformationComponentInner(element);
42953      close();
42954    }
42955  }
42956
42957  protected void composeExplanationOfBenefitSupportingInformationComponentInner(ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
42958      composeBackbone(element);
42959      if (element.hasSequenceElement()) {
42960        composePositiveIntCore("sequence", element.getSequenceElement(), false);
42961        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
42962      }
42963      if (element.hasCategory()) {
42964        composeCodeableConcept("category", element.getCategory());
42965      }
42966      if (element.hasCode()) {
42967        composeCodeableConcept("code", element.getCode());
42968      }
42969      if (element.hasTiming()) {
42970        composeType("timing", element.getTiming());
42971      }
42972      if (element.hasValue()) {
42973        composeType("value", element.getValue());
42974      }
42975      if (element.hasReason()) {
42976        composeCoding("reason", element.getReason());
42977      }
42978      }
42979
42980  protected void composeExplanationOfBenefitDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
42981    if (element != null) {
42982      open(name);
42983      composeExplanationOfBenefitDiagnosisComponentInner(element);
42984      close();
42985      }
42986      }
42987
42988  protected void composeExplanationOfBenefitDiagnosisComponentInner(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
42989      composeBackbone(element);
42990      if (element.hasSequenceElement()) {
42991        composePositiveIntCore("sequence", element.getSequenceElement(), false);
42992        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
42993      }
42994      if (element.hasDiagnosis()) {
42995        composeType("diagnosis", element.getDiagnosis());
42996      }
42997      if (element.hasType()) {
42998        openArray("type");
42999        for (CodeableConcept e : element.getType()) 
43000          composeCodeableConcept(null, e);
43001        closeArray();
43002      };
43003      if (element.hasOnAdmission()) {
43004        composeCodeableConcept("onAdmission", element.getOnAdmission());
43005      }
43006      if (element.hasPackageCode()) {
43007        composeCodeableConcept("packageCode", element.getPackageCode());
43008      }
43009  }
43010
43011  protected void composeExplanationOfBenefitProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
43012    if (element != null) {
43013      open(name);
43014      composeExplanationOfBenefitProcedureComponentInner(element);
43015      close();
43016    }
43017  }
43018
43019  protected void composeExplanationOfBenefitProcedureComponentInner(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
43020      composeBackbone(element);
43021      if (element.hasSequenceElement()) {
43022        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43023        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43024      }
43025      if (element.hasType()) {
43026        openArray("type");
43027        for (CodeableConcept e : element.getType()) 
43028          composeCodeableConcept(null, e);
43029        closeArray();
43030      };
43031      if (element.hasDateElement()) {
43032        composeDateTimeCore("date", element.getDateElement(), false);
43033        composeDateTimeExtras("date", element.getDateElement(), false);
43034      }
43035      if (element.hasProcedure()) {
43036        composeType("procedure", element.getProcedure());
43037      }
43038      if (element.hasUdi()) {
43039        openArray("udi");
43040        for (Reference e : element.getUdi()) 
43041          composeReference(null, e);
43042        closeArray();
43043      };
43044  }
43045
43046  protected void composeExplanationOfBenefitInsuranceComponent(String name, ExplanationOfBenefit.InsuranceComponent element) throws IOException {
43047    if (element != null) {
43048      open(name);
43049      composeExplanationOfBenefitInsuranceComponentInner(element);
43050      close();
43051    }
43052  }
43053
43054  protected void composeExplanationOfBenefitInsuranceComponentInner(ExplanationOfBenefit.InsuranceComponent element) throws IOException {
43055      composeBackbone(element);
43056      if (element.hasFocalElement()) {
43057        composeBooleanCore("focal", element.getFocalElement(), false);
43058        composeBooleanExtras("focal", element.getFocalElement(), false);
43059      }
43060      if (element.hasCoverage()) {
43061        composeReference("coverage", element.getCoverage());
43062      }
43063      if (element.hasPreAuthRef()) {
43064        openArray("preAuthRef");
43065        for (StringType e : element.getPreAuthRef()) 
43066          composeStringCore(null, e, true);
43067        closeArray();
43068        if (anyHasExtras(element.getPreAuthRef())) {
43069          openArray("_preAuthRef");
43070          for (StringType e : element.getPreAuthRef()) 
43071            composeStringExtras(null, e, true);
43072        closeArray();
43073        }
43074      };
43075  }
43076
43077  protected void composeExplanationOfBenefitAccidentComponent(String name, ExplanationOfBenefit.AccidentComponent element) throws IOException {
43078    if (element != null) {
43079      open(name);
43080      composeExplanationOfBenefitAccidentComponentInner(element);
43081      close();
43082    }
43083  }
43084
43085  protected void composeExplanationOfBenefitAccidentComponentInner(ExplanationOfBenefit.AccidentComponent element) throws IOException {
43086      composeBackbone(element);
43087      if (element.hasDateElement()) {
43088        composeDateCore("date", element.getDateElement(), false);
43089        composeDateExtras("date", element.getDateElement(), false);
43090      }
43091      if (element.hasType()) {
43092        composeCodeableConcept("type", element.getType());
43093      }
43094      if (element.hasLocation()) {
43095        composeType("location", element.getLocation());
43096      }
43097  }
43098
43099  protected void composeExplanationOfBenefitItemComponent(String name, ExplanationOfBenefit.ItemComponent element) throws IOException {
43100    if (element != null) {
43101      open(name);
43102      composeExplanationOfBenefitItemComponentInner(element);
43103      close();
43104    }
43105  }
43106
43107  protected void composeExplanationOfBenefitItemComponentInner(ExplanationOfBenefit.ItemComponent element) throws IOException {
43108      composeBackbone(element);
43109      if (element.hasSequenceElement()) {
43110        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43111        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43112      }
43113      if (element.hasCareTeamSequence()) {
43114        openArray("careTeamSequence");
43115        for (PositiveIntType e : element.getCareTeamSequence()) 
43116          composePositiveIntCore(null, e, true);
43117        closeArray();
43118        if (anyHasExtras(element.getCareTeamSequence())) {
43119          openArray("_careTeamSequence");
43120          for (PositiveIntType e : element.getCareTeamSequence()) 
43121            composePositiveIntExtras(null, e, true);
43122          closeArray();
43123      }
43124      };
43125      if (element.hasDiagnosisSequence()) {
43126        openArray("diagnosisSequence");
43127        for (PositiveIntType e : element.getDiagnosisSequence()) 
43128          composePositiveIntCore(null, e, true);
43129        closeArray();
43130        if (anyHasExtras(element.getDiagnosisSequence())) {
43131          openArray("_diagnosisSequence");
43132          for (PositiveIntType e : element.getDiagnosisSequence()) 
43133            composePositiveIntExtras(null, e, true);
43134          closeArray();
43135      }
43136      };
43137      if (element.hasProcedureSequence()) {
43138        openArray("procedureSequence");
43139        for (PositiveIntType e : element.getProcedureSequence()) 
43140          composePositiveIntCore(null, e, true);
43141        closeArray();
43142        if (anyHasExtras(element.getProcedureSequence())) {
43143          openArray("_procedureSequence");
43144          for (PositiveIntType e : element.getProcedureSequence()) 
43145            composePositiveIntExtras(null, e, true);
43146          closeArray();
43147      }
43148      };
43149      if (element.hasInformationSequence()) {
43150        openArray("informationSequence");
43151        for (PositiveIntType e : element.getInformationSequence()) 
43152          composePositiveIntCore(null, e, true);
43153        closeArray();
43154        if (anyHasExtras(element.getInformationSequence())) {
43155          openArray("_informationSequence");
43156          for (PositiveIntType e : element.getInformationSequence()) 
43157            composePositiveIntExtras(null, e, true);
43158          closeArray();
43159      }
43160      };
43161      if (element.hasRevenue()) {
43162        composeCodeableConcept("revenue", element.getRevenue());
43163  }
43164      if (element.hasCategory()) {
43165        composeCodeableConcept("category", element.getCategory());
43166    }
43167      if (element.hasProductOrService()) {
43168        composeCodeableConcept("productOrService", element.getProductOrService());
43169  }
43170      if (element.hasModifier()) {
43171        openArray("modifier");
43172        for (CodeableConcept e : element.getModifier()) 
43173          composeCodeableConcept(null, e);
43174        closeArray();
43175      };
43176      if (element.hasProgramCode()) {
43177        openArray("programCode");
43178        for (CodeableConcept e : element.getProgramCode()) 
43179          composeCodeableConcept(null, e);
43180        closeArray();
43181      };
43182      if (element.hasServiced()) {
43183        composeType("serviced", element.getServiced());
43184      }
43185      if (element.hasLocation()) {
43186        composeType("location", element.getLocation());
43187      }
43188      if (element.hasQuantity()) {
43189        composeQuantity("quantity", element.getQuantity());
43190      }
43191      if (element.hasUnitPrice()) {
43192        composeMoney("unitPrice", element.getUnitPrice());
43193      }
43194      if (element.hasFactorElement()) {
43195        composeDecimalCore("factor", element.getFactorElement(), false);
43196        composeDecimalExtras("factor", element.getFactorElement(), false);
43197      }
43198      if (element.hasNet()) {
43199        composeMoney("net", element.getNet());
43200      }
43201      if (element.hasUdi()) {
43202        openArray("udi");
43203        for (Reference e : element.getUdi()) 
43204          composeReference(null, e);
43205        closeArray();
43206      };
43207      if (element.hasBodySite()) {
43208        composeCodeableConcept("bodySite", element.getBodySite());
43209      }
43210      if (element.hasSubSite()) {
43211        openArray("subSite");
43212        for (CodeableConcept e : element.getSubSite()) 
43213          composeCodeableConcept(null, e);
43214        closeArray();
43215      };
43216      if (element.hasEncounter()) {
43217        openArray("encounter");
43218        for (Reference e : element.getEncounter()) 
43219          composeReference(null, e);
43220        closeArray();
43221      };
43222      if (element.hasNoteNumber()) {
43223        openArray("noteNumber");
43224        for (PositiveIntType e : element.getNoteNumber()) 
43225          composePositiveIntCore(null, e, true);
43226        closeArray();
43227        if (anyHasExtras(element.getNoteNumber())) {
43228          openArray("_noteNumber");
43229          for (PositiveIntType e : element.getNoteNumber()) 
43230            composePositiveIntExtras(null, e, true);
43231          closeArray();
43232      }
43233      };
43234      if (element.hasAdjudication()) {
43235        openArray("adjudication");
43236        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
43237          composeExplanationOfBenefitAdjudicationComponent(null, e);
43238        closeArray();
43239      };
43240      if (element.hasDetail()) {
43241        openArray("detail");
43242        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
43243          composeExplanationOfBenefitDetailComponent(null, e);
43244        closeArray();
43245      };
43246  }
43247
43248  protected void composeExplanationOfBenefitAdjudicationComponent(String name, ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
43249    if (element != null) {
43250      open(name);
43251      composeExplanationOfBenefitAdjudicationComponentInner(element);
43252      close();
43253    }
43254  }
43255
43256  protected void composeExplanationOfBenefitAdjudicationComponentInner(ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
43257      composeBackbone(element);
43258      if (element.hasCategory()) {
43259        composeCodeableConcept("category", element.getCategory());
43260      }
43261      if (element.hasReason()) {
43262        composeCodeableConcept("reason", element.getReason());
43263      }
43264      if (element.hasAmount()) {
43265        composeMoney("amount", element.getAmount());
43266      }
43267      if (element.hasValueElement()) {
43268        composeDecimalCore("value", element.getValueElement(), false);
43269        composeDecimalExtras("value", element.getValueElement(), false);
43270      }
43271  }
43272
43273  protected void composeExplanationOfBenefitDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
43274    if (element != null) {
43275      open(name);
43276      composeExplanationOfBenefitDetailComponentInner(element);
43277      close();
43278    }
43279  }
43280
43281  protected void composeExplanationOfBenefitDetailComponentInner(ExplanationOfBenefit.DetailComponent element) throws IOException {
43282      composeBackbone(element);
43283      if (element.hasSequenceElement()) {
43284        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43285        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43286      }
43287      if (element.hasRevenue()) {
43288        composeCodeableConcept("revenue", element.getRevenue());
43289      }
43290      if (element.hasCategory()) {
43291        composeCodeableConcept("category", element.getCategory());
43292      }
43293      if (element.hasProductOrService()) {
43294        composeCodeableConcept("productOrService", element.getProductOrService());
43295  }
43296      if (element.hasModifier()) {
43297        openArray("modifier");
43298        for (CodeableConcept e : element.getModifier()) 
43299          composeCodeableConcept(null, e);
43300        closeArray();
43301      };
43302      if (element.hasProgramCode()) {
43303        openArray("programCode");
43304        for (CodeableConcept e : element.getProgramCode()) 
43305          composeCodeableConcept(null, e);
43306        closeArray();
43307      };
43308      if (element.hasQuantity()) {
43309        composeQuantity("quantity", element.getQuantity());
43310      }
43311      if (element.hasUnitPrice()) {
43312        composeMoney("unitPrice", element.getUnitPrice());
43313      }
43314      if (element.hasFactorElement()) {
43315        composeDecimalCore("factor", element.getFactorElement(), false);
43316        composeDecimalExtras("factor", element.getFactorElement(), false);
43317      }
43318      if (element.hasNet()) {
43319        composeMoney("net", element.getNet());
43320      }
43321      if (element.hasUdi()) {
43322        openArray("udi");
43323        for (Reference e : element.getUdi()) 
43324          composeReference(null, e);
43325        closeArray();
43326      };
43327      if (element.hasNoteNumber()) {
43328        openArray("noteNumber");
43329        for (PositiveIntType e : element.getNoteNumber()) 
43330          composePositiveIntCore(null, e, true);
43331        closeArray();
43332        if (anyHasExtras(element.getNoteNumber())) {
43333          openArray("_noteNumber");
43334          for (PositiveIntType e : element.getNoteNumber()) 
43335            composePositiveIntExtras(null, e, true);
43336        closeArray();
43337        }
43338      };
43339      if (element.hasAdjudication()) {
43340        openArray("adjudication");
43341        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
43342          composeExplanationOfBenefitAdjudicationComponent(null, e);
43343        closeArray();
43344      };
43345      if (element.hasSubDetail()) {
43346        openArray("subDetail");
43347        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
43348          composeExplanationOfBenefitSubDetailComponent(null, e);
43349        closeArray();
43350      };
43351  }
43352
43353  protected void composeExplanationOfBenefitSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
43354    if (element != null) {
43355      open(name);
43356      composeExplanationOfBenefitSubDetailComponentInner(element);
43357      close();
43358    }
43359  }
43360
43361  protected void composeExplanationOfBenefitSubDetailComponentInner(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
43362      composeBackbone(element);
43363      if (element.hasSequenceElement()) {
43364        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43365        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43366      }
43367      if (element.hasRevenue()) {
43368        composeCodeableConcept("revenue", element.getRevenue());
43369      }
43370      if (element.hasCategory()) {
43371        composeCodeableConcept("category", element.getCategory());
43372      }
43373      if (element.hasProductOrService()) {
43374        composeCodeableConcept("productOrService", element.getProductOrService());
43375      }
43376      if (element.hasModifier()) {
43377        openArray("modifier");
43378        for (CodeableConcept e : element.getModifier()) 
43379          composeCodeableConcept(null, e);
43380        closeArray();
43381      };
43382      if (element.hasProgramCode()) {
43383        openArray("programCode");
43384        for (CodeableConcept e : element.getProgramCode()) 
43385          composeCodeableConcept(null, e);
43386        closeArray();
43387      };
43388      if (element.hasQuantity()) {
43389        composeQuantity("quantity", element.getQuantity());
43390      }
43391      if (element.hasUnitPrice()) {
43392        composeMoney("unitPrice", element.getUnitPrice());
43393      }
43394      if (element.hasFactorElement()) {
43395        composeDecimalCore("factor", element.getFactorElement(), false);
43396        composeDecimalExtras("factor", element.getFactorElement(), false);
43397      }
43398      if (element.hasNet()) {
43399        composeMoney("net", element.getNet());
43400      }
43401      if (element.hasUdi()) {
43402        openArray("udi");
43403        for (Reference e : element.getUdi()) 
43404          composeReference(null, e);
43405        closeArray();
43406      };
43407      if (element.hasNoteNumber()) {
43408        openArray("noteNumber");
43409        for (PositiveIntType e : element.getNoteNumber()) 
43410          composePositiveIntCore(null, e, true);
43411        closeArray();
43412        if (anyHasExtras(element.getNoteNumber())) {
43413          openArray("_noteNumber");
43414          for (PositiveIntType e : element.getNoteNumber()) 
43415            composePositiveIntExtras(null, e, true);
43416        closeArray();
43417        }
43418      };
43419      if (element.hasAdjudication()) {
43420        openArray("adjudication");
43421        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
43422          composeExplanationOfBenefitAdjudicationComponent(null, e);
43423        closeArray();
43424      };
43425      }
43426
43427  protected void composeExplanationOfBenefitAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
43428    if (element != null) {
43429      open(name);
43430      composeExplanationOfBenefitAddedItemComponentInner(element);
43431      close();
43432    }
43433  }
43434
43435  protected void composeExplanationOfBenefitAddedItemComponentInner(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
43436      composeBackbone(element);
43437      if (element.hasItemSequence()) {
43438        openArray("itemSequence");
43439        for (PositiveIntType e : element.getItemSequence()) 
43440          composePositiveIntCore(null, e, true);
43441        closeArray();
43442        if (anyHasExtras(element.getItemSequence())) {
43443          openArray("_itemSequence");
43444          for (PositiveIntType e : element.getItemSequence()) 
43445            composePositiveIntExtras(null, e, true);
43446          closeArray();
43447      }
43448      };
43449      if (element.hasDetailSequence()) {
43450        openArray("detailSequence");
43451        for (PositiveIntType e : element.getDetailSequence()) 
43452          composePositiveIntCore(null, e, true);
43453        closeArray();
43454        if (anyHasExtras(element.getDetailSequence())) {
43455          openArray("_detailSequence");
43456          for (PositiveIntType e : element.getDetailSequence()) 
43457            composePositiveIntExtras(null, e, true);
43458          closeArray();
43459      }
43460      };
43461      if (element.hasSubDetailSequence()) {
43462        openArray("subDetailSequence");
43463        for (PositiveIntType e : element.getSubDetailSequence()) 
43464          composePositiveIntCore(null, e, true);
43465        closeArray();
43466        if (anyHasExtras(element.getSubDetailSequence())) {
43467          openArray("_subDetailSequence");
43468          for (PositiveIntType e : element.getSubDetailSequence()) 
43469            composePositiveIntExtras(null, e, true);
43470          closeArray();
43471      }
43472      };
43473      if (element.hasProvider()) {
43474        openArray("provider");
43475        for (Reference e : element.getProvider()) 
43476          composeReference(null, e);
43477        closeArray();
43478      };
43479      if (element.hasProductOrService()) {
43480        composeCodeableConcept("productOrService", element.getProductOrService());
43481      }
43482      if (element.hasModifier()) {
43483        openArray("modifier");
43484        for (CodeableConcept e : element.getModifier()) 
43485          composeCodeableConcept(null, e);
43486        closeArray();
43487      };
43488      if (element.hasProgramCode()) {
43489        openArray("programCode");
43490        for (CodeableConcept e : element.getProgramCode()) 
43491          composeCodeableConcept(null, e);
43492        closeArray();
43493      };
43494      if (element.hasServiced()) {
43495        composeType("serviced", element.getServiced());
43496      }
43497      if (element.hasLocation()) {
43498        composeType("location", element.getLocation());
43499      }
43500      if (element.hasQuantity()) {
43501        composeQuantity("quantity", element.getQuantity());
43502      }
43503      if (element.hasUnitPrice()) {
43504        composeMoney("unitPrice", element.getUnitPrice());
43505      }
43506      if (element.hasFactorElement()) {
43507        composeDecimalCore("factor", element.getFactorElement(), false);
43508        composeDecimalExtras("factor", element.getFactorElement(), false);
43509      }
43510      if (element.hasNet()) {
43511        composeMoney("net", element.getNet());
43512      }
43513      if (element.hasBodySite()) {
43514        composeCodeableConcept("bodySite", element.getBodySite());
43515      }
43516      if (element.hasSubSite()) {
43517        openArray("subSite");
43518        for (CodeableConcept e : element.getSubSite()) 
43519          composeCodeableConcept(null, e);
43520        closeArray();
43521      };
43522      if (element.hasNoteNumber()) {
43523        openArray("noteNumber");
43524        for (PositiveIntType e : element.getNoteNumber()) 
43525          composePositiveIntCore(null, e, true);
43526        closeArray();
43527        if (anyHasExtras(element.getNoteNumber())) {
43528          openArray("_noteNumber");
43529          for (PositiveIntType e : element.getNoteNumber()) 
43530            composePositiveIntExtras(null, e, true);
43531        closeArray();
43532      }
43533      };
43534      if (element.hasAdjudication()) {
43535        openArray("adjudication");
43536        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
43537          composeExplanationOfBenefitAdjudicationComponent(null, e);
43538        closeArray();
43539      };
43540      if (element.hasDetail()) {
43541        openArray("detail");
43542        for (ExplanationOfBenefit.AddedItemDetailComponent e : element.getDetail()) 
43543          composeExplanationOfBenefitAddedItemDetailComponent(null, e);
43544        closeArray();
43545      };
43546  }
43547
43548  protected void composeExplanationOfBenefitAddedItemDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
43549    if (element != null) {
43550      open(name);
43551      composeExplanationOfBenefitAddedItemDetailComponentInner(element);
43552      close();
43553    }
43554  }
43555
43556  protected void composeExplanationOfBenefitAddedItemDetailComponentInner(ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
43557      composeBackbone(element);
43558      if (element.hasProductOrService()) {
43559        composeCodeableConcept("productOrService", element.getProductOrService());
43560      }
43561      if (element.hasModifier()) {
43562        openArray("modifier");
43563        for (CodeableConcept e : element.getModifier()) 
43564          composeCodeableConcept(null, e);
43565        closeArray();
43566      };
43567      if (element.hasQuantity()) {
43568        composeQuantity("quantity", element.getQuantity());
43569      }
43570      if (element.hasUnitPrice()) {
43571        composeMoney("unitPrice", element.getUnitPrice());
43572      }
43573      if (element.hasFactorElement()) {
43574        composeDecimalCore("factor", element.getFactorElement(), false);
43575        composeDecimalExtras("factor", element.getFactorElement(), false);
43576      }
43577      if (element.hasNet()) {
43578        composeMoney("net", element.getNet());
43579      }
43580      if (element.hasNoteNumber()) {
43581        openArray("noteNumber");
43582        for (PositiveIntType e : element.getNoteNumber()) 
43583          composePositiveIntCore(null, e, true);
43584        closeArray();
43585        if (anyHasExtras(element.getNoteNumber())) {
43586          openArray("_noteNumber");
43587          for (PositiveIntType e : element.getNoteNumber()) 
43588            composePositiveIntExtras(null, e, true);
43589          closeArray();
43590      }
43591      };
43592      if (element.hasAdjudication()) {
43593        openArray("adjudication");
43594        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
43595          composeExplanationOfBenefitAdjudicationComponent(null, e);
43596        closeArray();
43597      };
43598      if (element.hasSubDetail()) {
43599        openArray("subDetail");
43600        for (ExplanationOfBenefit.AddedItemDetailSubDetailComponent e : element.getSubDetail()) 
43601          composeExplanationOfBenefitAddedItemDetailSubDetailComponent(null, e);
43602        closeArray();
43603      };
43604  }
43605
43606  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
43607    if (element != null) {
43608      open(name);
43609      composeExplanationOfBenefitAddedItemDetailSubDetailComponentInner(element);
43610      close();
43611    }
43612  }
43613
43614  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponentInner(ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
43615      composeBackbone(element);
43616      if (element.hasProductOrService()) {
43617        composeCodeableConcept("productOrService", element.getProductOrService());
43618      }
43619      if (element.hasModifier()) {
43620        openArray("modifier");
43621        for (CodeableConcept e : element.getModifier()) 
43622          composeCodeableConcept(null, e);
43623          closeArray();
43624      };
43625      if (element.hasQuantity()) {
43626        composeQuantity("quantity", element.getQuantity());
43627      }
43628      if (element.hasUnitPrice()) {
43629        composeMoney("unitPrice", element.getUnitPrice());
43630        }
43631      if (element.hasFactorElement()) {
43632        composeDecimalCore("factor", element.getFactorElement(), false);
43633        composeDecimalExtras("factor", element.getFactorElement(), false);
43634      }
43635      if (element.hasNet()) {
43636        composeMoney("net", element.getNet());
43637      }
43638      if (element.hasNoteNumber()) {
43639        openArray("noteNumber");
43640        for (PositiveIntType e : element.getNoteNumber()) 
43641          composePositiveIntCore(null, e, true);
43642        closeArray();
43643        if (anyHasExtras(element.getNoteNumber())) {
43644          openArray("_noteNumber");
43645          for (PositiveIntType e : element.getNoteNumber()) 
43646            composePositiveIntExtras(null, e, true);
43647          closeArray();
43648      }
43649      };
43650      if (element.hasAdjudication()) {
43651        openArray("adjudication");
43652        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
43653          composeExplanationOfBenefitAdjudicationComponent(null, e);
43654        closeArray();
43655      };
43656  }
43657
43658  protected void composeExplanationOfBenefitTotalComponent(String name, ExplanationOfBenefit.TotalComponent element) throws IOException {
43659    if (element != null) {
43660      open(name);
43661      composeExplanationOfBenefitTotalComponentInner(element);
43662      close();
43663    }
43664  }
43665
43666  protected void composeExplanationOfBenefitTotalComponentInner(ExplanationOfBenefit.TotalComponent element) throws IOException {
43667      composeBackbone(element);
43668      if (element.hasCategory()) {
43669        composeCodeableConcept("category", element.getCategory());
43670      }
43671      if (element.hasAmount()) {
43672        composeMoney("amount", element.getAmount());
43673      }
43674  }
43675
43676  protected void composeExplanationOfBenefitPaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element) throws IOException {
43677    if (element != null) {
43678      open(name);
43679      composeExplanationOfBenefitPaymentComponentInner(element);
43680      close();
43681    }
43682  }
43683
43684  protected void composeExplanationOfBenefitPaymentComponentInner(ExplanationOfBenefit.PaymentComponent element) throws IOException {
43685      composeBackbone(element);
43686      if (element.hasType()) {
43687        composeCodeableConcept("type", element.getType());
43688      }
43689      if (element.hasAdjustment()) {
43690        composeMoney("adjustment", element.getAdjustment());
43691      }
43692      if (element.hasAdjustmentReason()) {
43693        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
43694      }
43695      if (element.hasDateElement()) {
43696        composeDateCore("date", element.getDateElement(), false);
43697        composeDateExtras("date", element.getDateElement(), false);
43698      }
43699      if (element.hasAmount()) {
43700        composeMoney("amount", element.getAmount());
43701      }
43702      if (element.hasIdentifier()) {
43703        composeIdentifier("identifier", element.getIdentifier());
43704      }
43705      }
43706
43707  protected void composeExplanationOfBenefitNoteComponent(String name, ExplanationOfBenefit.NoteComponent element) throws IOException {
43708    if (element != null) {
43709      open(name);
43710      composeExplanationOfBenefitNoteComponentInner(element);
43711      close();
43712      }
43713      }
43714
43715  protected void composeExplanationOfBenefitNoteComponentInner(ExplanationOfBenefit.NoteComponent element) throws IOException {
43716      composeBackbone(element);
43717      if (element.hasNumberElement()) {
43718        composePositiveIntCore("number", element.getNumberElement(), false);
43719        composePositiveIntExtras("number", element.getNumberElement(), false);
43720      }
43721      if (element.hasTypeElement()) {
43722        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
43723        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
43724      }
43725      if (element.hasTextElement()) {
43726        composeStringCore("text", element.getTextElement(), false);
43727        composeStringExtras("text", element.getTextElement(), false);
43728      }
43729      if (element.hasLanguage()) {
43730        composeCodeableConcept("language", element.getLanguage());
43731      }
43732  }
43733
43734  protected void composeExplanationOfBenefitBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
43735    if (element != null) {
43736      open(name);
43737      composeExplanationOfBenefitBenefitBalanceComponentInner(element);
43738      close();
43739    }
43740  }
43741
43742  protected void composeExplanationOfBenefitBenefitBalanceComponentInner(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
43743      composeBackbone(element);
43744      if (element.hasCategory()) {
43745        composeCodeableConcept("category", element.getCategory());
43746      }
43747      if (element.hasExcludedElement()) {
43748        composeBooleanCore("excluded", element.getExcludedElement(), false);
43749        composeBooleanExtras("excluded", element.getExcludedElement(), false);
43750      }
43751      if (element.hasNameElement()) {
43752        composeStringCore("name", element.getNameElement(), false);
43753        composeStringExtras("name", element.getNameElement(), false);
43754      }
43755      if (element.hasDescriptionElement()) {
43756        composeStringCore("description", element.getDescriptionElement(), false);
43757        composeStringExtras("description", element.getDescriptionElement(), false);
43758      }
43759      if (element.hasNetwork()) {
43760        composeCodeableConcept("network", element.getNetwork());
43761      }
43762      if (element.hasUnit()) {
43763        composeCodeableConcept("unit", element.getUnit());
43764      }
43765      if (element.hasTerm()) {
43766        composeCodeableConcept("term", element.getTerm());
43767      }
43768      if (element.hasFinancial()) {
43769        openArray("financial");
43770        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
43771          composeExplanationOfBenefitBenefitComponent(null, e);
43772        closeArray();
43773      };
43774  }
43775
43776  protected void composeExplanationOfBenefitBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
43777    if (element != null) {
43778      open(name);
43779      composeExplanationOfBenefitBenefitComponentInner(element);
43780      close();
43781    }
43782  }
43783
43784  protected void composeExplanationOfBenefitBenefitComponentInner(ExplanationOfBenefit.BenefitComponent element) throws IOException {
43785      composeBackbone(element);
43786      if (element.hasType()) {
43787        composeCodeableConcept("type", element.getType());
43788      }
43789      if (element.hasAllowed()) {
43790        composeType("allowed", element.getAllowed());
43791      }
43792      if (element.hasUsed()) {
43793        composeType("used", element.getUsed());
43794    }
43795  }
43796
43797  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
43798    if (element != null) {
43799      prop("resourceType", name);
43800      composeFamilyMemberHistoryInner(element);
43801    }
43802  }
43803
43804  protected void composeFamilyMemberHistoryInner(FamilyMemberHistory element) throws IOException {
43805      composeDomainResourceElements(element);
43806      if (element.hasIdentifier()) {
43807        openArray("identifier");
43808        for (Identifier e : element.getIdentifier()) 
43809          composeIdentifier(null, e);
43810        closeArray();
43811      };
43812      if (element.hasInstantiatesCanonical()) {
43813        openArray("instantiatesCanonical");
43814        for (CanonicalType e : element.getInstantiatesCanonical()) 
43815          composeCanonicalCore(null, e, true);
43816        closeArray();
43817        if (anyHasExtras(element.getInstantiatesCanonical())) {
43818          openArray("_instantiatesCanonical");
43819          for (CanonicalType e : element.getInstantiatesCanonical()) 
43820            composeCanonicalExtras(null, e, true);
43821          closeArray();
43822        }
43823      };
43824      if (element.hasInstantiatesUri()) {
43825        openArray("instantiatesUri");
43826        for (UriType e : element.getInstantiatesUri()) 
43827          composeUriCore(null, e, true);
43828        closeArray();
43829        if (anyHasExtras(element.getInstantiatesUri())) {
43830          openArray("_instantiatesUri");
43831          for (UriType e : element.getInstantiatesUri()) 
43832            composeUriExtras(null, e, true);
43833          closeArray();
43834        }
43835      };
43836      if (element.hasStatusElement()) {
43837        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
43838        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
43839      }
43840      if (element.hasDataAbsentReason()) {
43841        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
43842      }
43843      if (element.hasPatient()) {
43844        composeReference("patient", element.getPatient());
43845      }
43846      if (element.hasDateElement()) {
43847        composeDateTimeCore("date", element.getDateElement(), false);
43848        composeDateTimeExtras("date", element.getDateElement(), false);
43849      }
43850      if (element.hasNameElement()) {
43851        composeStringCore("name", element.getNameElement(), false);
43852        composeStringExtras("name", element.getNameElement(), false);
43853      }
43854      if (element.hasRelationship()) {
43855        composeCodeableConcept("relationship", element.getRelationship());
43856      }
43857      if (element.hasSex()) {
43858        composeCodeableConcept("sex", element.getSex());
43859      }
43860      if (element.hasBorn()) {
43861        composeType("born", element.getBorn());
43862      }
43863      if (element.hasAge()) {
43864        composeType("age", element.getAge());
43865      }
43866      if (element.hasEstimatedAgeElement()) {
43867        composeBooleanCore("estimatedAge", element.getEstimatedAgeElement(), false);
43868        composeBooleanExtras("estimatedAge", element.getEstimatedAgeElement(), false);
43869      }
43870      if (element.hasDeceased()) {
43871        composeType("deceased", element.getDeceased());
43872      }
43873      if (element.hasReasonCode()) {
43874        openArray("reasonCode");
43875        for (CodeableConcept e : element.getReasonCode()) 
43876          composeCodeableConcept(null, e);
43877        closeArray();
43878      };
43879      if (element.hasReasonReference()) {
43880        openArray("reasonReference");
43881        for (Reference e : element.getReasonReference()) 
43882          composeReference(null, e);
43883        closeArray();
43884      };
43885      if (element.hasNote()) {
43886        openArray("note");
43887        for (Annotation e : element.getNote()) 
43888          composeAnnotation(null, e);
43889        closeArray();
43890      };
43891      if (element.hasCondition()) {
43892        openArray("condition");
43893        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
43894          composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(null, e);
43895        closeArray();
43896      };
43897      if (element.hasProcedure()) {
43898        openArray("procedure");
43899        for (FamilyMemberHistory.FamilyMemberHistoryProcedureComponent e : element.getProcedure()) 
43900          composeFamilyMemberHistoryFamilyMemberHistoryProcedureComponent(null, e);
43901        closeArray();
43902      };
43903  }
43904
43905  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
43906    if (element != null) {
43907      open(name);
43908      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(element);
43909      close();
43910    }
43911  }
43912
43913  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
43914      composeBackbone(element);
43915      if (element.hasCode()) {
43916        composeCodeableConcept("code", element.getCode());
43917      }
43918      if (element.hasOutcome()) {
43919        composeCodeableConcept("outcome", element.getOutcome());
43920      }
43921      if (element.hasContributedToDeathElement()) {
43922        composeBooleanCore("contributedToDeath", element.getContributedToDeathElement(), false);
43923        composeBooleanExtras("contributedToDeath", element.getContributedToDeathElement(), false);
43924  }
43925      if (element.hasOnset()) {
43926        composeType("onset", element.getOnset());
43927      }
43928      if (element.hasNote()) {
43929        openArray("note");
43930        for (Annotation e : element.getNote()) 
43931          composeAnnotation(null, e);
43932        closeArray();
43933      };
43934  }
43935
43936  protected void composeFamilyMemberHistoryFamilyMemberHistoryProcedureComponent(String name, FamilyMemberHistory.FamilyMemberHistoryProcedureComponent element) throws IOException {
43937    if (element != null) {
43938      open(name);
43939      composeFamilyMemberHistoryFamilyMemberHistoryProcedureComponentInner(element);
43940      close();
43941    }
43942  }
43943
43944  protected void composeFamilyMemberHistoryFamilyMemberHistoryProcedureComponentInner(FamilyMemberHistory.FamilyMemberHistoryProcedureComponent element) throws IOException {
43945      composeBackbone(element);
43946      if (element.hasCode()) {
43947        composeCodeableConcept("code", element.getCode());
43948      }
43949      if (element.hasOutcome()) {
43950        composeCodeableConcept("outcome", element.getOutcome());
43951      }
43952      if (element.hasContributedToDeathElement()) {
43953        composeBooleanCore("contributedToDeath", element.getContributedToDeathElement(), false);
43954        composeBooleanExtras("contributedToDeath", element.getContributedToDeathElement(), false);
43955      }
43956      if (element.hasPerformed()) {
43957        composeType("performed", element.getPerformed());
43958  }
43959      if (element.hasNote()) {
43960        openArray("note");
43961        for (Annotation e : element.getNote()) 
43962          composeAnnotation(null, e);
43963        closeArray();
43964      };
43965  }
43966
43967  protected void composeFlag(String name, Flag element) throws IOException {
43968    if (element != null) {
43969      prop("resourceType", name);
43970      composeFlagInner(element);
43971    }
43972  }
43973
43974  protected void composeFlagInner(Flag element) throws IOException {
43975      composeDomainResourceElements(element);
43976      if (element.hasIdentifier()) {
43977        openArray("identifier");
43978        for (Identifier e : element.getIdentifier()) 
43979          composeIdentifier(null, e);
43980        closeArray();
43981      };
43982      if (element.hasStatusElement()) {
43983        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
43984        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
43985      }
43986      if (element.hasCategory()) {
43987        openArray("category");
43988        for (CodeableConcept e : element.getCategory()) 
43989          composeCodeableConcept(null, e);
43990        closeArray();
43991      };
43992      if (element.hasCode()) {
43993        composeCodeableConcept("code", element.getCode());
43994      }
43995      if (element.hasSubject()) {
43996        composeReference("subject", element.getSubject());
43997      }
43998      if (element.hasPeriod()) {
43999        composePeriod("period", element.getPeriod());
44000      }
44001      if (element.hasEncounter()) {
44002        composeReference("encounter", element.getEncounter());
44003      }
44004      if (element.hasAuthor()) {
44005        composeReference("author", element.getAuthor());
44006      }
44007  }
44008
44009  protected void composeGoal(String name, Goal element) throws IOException {
44010    if (element != null) {
44011      prop("resourceType", name);
44012      composeGoalInner(element);
44013    }
44014  }
44015
44016  protected void composeGoalInner(Goal element) throws IOException {
44017      composeDomainResourceElements(element);
44018      if (element.hasIdentifier()) {
44019        openArray("identifier");
44020        for (Identifier e : element.getIdentifier()) 
44021          composeIdentifier(null, e);
44022        closeArray();
44023      };
44024      if (element.hasLifecycleStatusElement()) {
44025        composeEnumerationCore("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
44026        composeEnumerationExtras("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
44027      }
44028      if (element.hasAchievementStatus()) {
44029        composeCodeableConcept("achievementStatus", element.getAchievementStatus());
44030      }
44031      if (element.hasCategory()) {
44032        openArray("category");
44033        for (CodeableConcept e : element.getCategory()) 
44034          composeCodeableConcept(null, e);
44035        closeArray();
44036      };
44037      if (element.hasContinuousElement()) {
44038        composeBooleanCore("continuous", element.getContinuousElement(), false);
44039        composeBooleanExtras("continuous", element.getContinuousElement(), false);
44040      }
44041      if (element.hasPriority()) {
44042        composeCodeableConcept("priority", element.getPriority());
44043  }
44044      if (element.hasDescription()) {
44045        composeCodeableConcept("description", element.getDescription());
44046      }
44047      if (element.hasSubject()) {
44048        composeReference("subject", element.getSubject());
44049    }
44050      if (element.hasStart()) {
44051        composeType("start", element.getStart());
44052  }
44053      if (element.hasTarget()) {
44054        openArray("target");
44055        for (Goal.GoalTargetComponent e : element.getTarget()) 
44056          composeGoalGoalTargetComponent(null, e);
44057        closeArray();
44058      };
44059      if (element.hasStatusDateElement()) {
44060        composeDateCore("statusDate", element.getStatusDateElement(), false);
44061        composeDateExtras("statusDate", element.getStatusDateElement(), false);
44062      }
44063      if (element.hasStatusReasonElement()) {
44064        composeStringCore("statusReason", element.getStatusReasonElement(), false);
44065        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
44066      }
44067      if (element.hasExpressedBy()) {
44068        composeReference("expressedBy", element.getExpressedBy());
44069      }
44070      if (element.hasAddresses()) {
44071        openArray("addresses");
44072        for (Reference e : element.getAddresses()) 
44073          composeReference(null, e);
44074        closeArray();
44075      };
44076      if (element.hasNote()) {
44077        openArray("note");
44078        for (Annotation e : element.getNote()) 
44079          composeAnnotation(null, e);
44080        closeArray();
44081      };
44082      if (element.hasOutcomeCode()) {
44083        openArray("outcomeCode");
44084        for (CodeableConcept e : element.getOutcomeCode()) 
44085          composeCodeableConcept(null, e);
44086        closeArray();
44087      };
44088      if (element.hasOutcomeReference()) {
44089        openArray("outcomeReference");
44090        for (Reference e : element.getOutcomeReference()) 
44091          composeReference(null, e);
44092        closeArray();
44093      };
44094  }
44095
44096  protected void composeGoalGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
44097    if (element != null) {
44098      open(name);
44099      composeGoalGoalTargetComponentInner(element);
44100      close();
44101    }
44102  }
44103
44104  protected void composeGoalGoalTargetComponentInner(Goal.GoalTargetComponent element) throws IOException {
44105      composeBackbone(element);
44106      if (element.hasMeasure()) {
44107        composeCodeableConcept("measure", element.getMeasure());
44108      }
44109      if (element.hasDetail()) {
44110        composeType("detail", element.getDetail());
44111      }
44112      if (element.hasDue()) {
44113        composeType("due", element.getDue());
44114      }
44115  }
44116
44117  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
44118    if (element != null) {
44119      prop("resourceType", name);
44120      composeGraphDefinitionInner(element);
44121    }
44122  }
44123
44124  protected void composeGraphDefinitionInner(GraphDefinition element) throws IOException {
44125      composeDomainResourceElements(element);
44126      if (element.hasUrlElement()) {
44127        composeUriCore("url", element.getUrlElement(), false);
44128        composeUriExtras("url", element.getUrlElement(), false);
44129      }
44130      if (element.hasVersionElement()) {
44131        composeStringCore("version", element.getVersionElement(), false);
44132        composeStringExtras("version", element.getVersionElement(), false);
44133      }
44134      if (element.hasNameElement()) {
44135        composeStringCore("name", element.getNameElement(), false);
44136        composeStringExtras("name", element.getNameElement(), false);
44137      }
44138      if (element.hasStatusElement()) {
44139        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44140        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44141      }
44142      if (element.hasExperimentalElement()) {
44143        composeBooleanCore("experimental", element.getExperimentalElement(), false);
44144        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
44145      }
44146      if (element.hasDateElement()) {
44147        composeDateTimeCore("date", element.getDateElement(), false);
44148        composeDateTimeExtras("date", element.getDateElement(), false);
44149      }
44150      if (element.hasPublisherElement()) {
44151        composeStringCore("publisher", element.getPublisherElement(), false);
44152        composeStringExtras("publisher", element.getPublisherElement(), false);
44153      }
44154      if (element.hasContact()) {
44155        openArray("contact");
44156        for (ContactDetail e : element.getContact()) 
44157          composeContactDetail(null, e);
44158        closeArray();
44159      };
44160      if (element.hasDescriptionElement()) {
44161        composeMarkdownCore("description", element.getDescriptionElement(), false);
44162        composeMarkdownExtras("description", element.getDescriptionElement(), false);
44163      }
44164      if (element.hasUseContext()) {
44165        openArray("useContext");
44166        for (UsageContext e : element.getUseContext()) 
44167          composeUsageContext(null, e);
44168        closeArray();
44169      };
44170      if (element.hasJurisdiction()) {
44171        openArray("jurisdiction");
44172        for (CodeableConcept e : element.getJurisdiction()) 
44173          composeCodeableConcept(null, e);
44174        closeArray();
44175      };
44176      if (element.hasPurposeElement()) {
44177        composeMarkdownCore("purpose", element.getPurposeElement(), false);
44178        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
44179      }
44180      if (element.hasStartElement()) {
44181        composeCodeCore("start", element.getStartElement(), false);
44182        composeCodeExtras("start", element.getStartElement(), false);
44183      }
44184      if (element.hasProfileElement()) {
44185        composeCanonicalCore("profile", element.getProfileElement(), false);
44186        composeCanonicalExtras("profile", element.getProfileElement(), false);
44187      }
44188      if (element.hasLink()) {
44189        openArray("link");
44190        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
44191          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
44192        closeArray();
44193      };
44194  }
44195
44196  protected void composeGraphDefinitionGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
44197    if (element != null) {
44198      open(name);
44199      composeGraphDefinitionGraphDefinitionLinkComponentInner(element);
44200      close();
44201    }
44202  }
44203
44204  protected void composeGraphDefinitionGraphDefinitionLinkComponentInner(GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
44205      composeBackbone(element);
44206      if (element.hasPathElement()) {
44207        composeStringCore("path", element.getPathElement(), false);
44208        composeStringExtras("path", element.getPathElement(), false);
44209      }
44210      if (element.hasSliceNameElement()) {
44211        composeStringCore("sliceName", element.getSliceNameElement(), false);
44212        composeStringExtras("sliceName", element.getSliceNameElement(), false);
44213      }
44214      if (element.hasMinElement()) {
44215        composeIntegerCore("min", element.getMinElement(), false);
44216        composeIntegerExtras("min", element.getMinElement(), false);
44217      }
44218      if (element.hasMaxElement()) {
44219        composeStringCore("max", element.getMaxElement(), false);
44220        composeStringExtras("max", element.getMaxElement(), false);
44221  }
44222      if (element.hasDescriptionElement()) {
44223        composeStringCore("description", element.getDescriptionElement(), false);
44224        composeStringExtras("description", element.getDescriptionElement(), false);
44225    }
44226      if (element.hasTarget()) {
44227        openArray("target");
44228        for (GraphDefinition.GraphDefinitionLinkTargetComponent e : element.getTarget()) 
44229          composeGraphDefinitionGraphDefinitionLinkTargetComponent(null, e);
44230        closeArray();
44231      };
44232  }
44233
44234  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponent(String name, GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
44235    if (element != null) {
44236      open(name);
44237      composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(element);
44238      close();
44239    }
44240  }
44241
44242  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
44243      composeBackbone(element);
44244      if (element.hasTypeElement()) {
44245        composeCodeCore("type", element.getTypeElement(), false);
44246        composeCodeExtras("type", element.getTypeElement(), false);
44247      }
44248      if (element.hasParamsElement()) {
44249        composeStringCore("params", element.getParamsElement(), false);
44250        composeStringExtras("params", element.getParamsElement(), false);
44251      }
44252      if (element.hasProfileElement()) {
44253        composeCanonicalCore("profile", element.getProfileElement(), false);
44254        composeCanonicalExtras("profile", element.getProfileElement(), false);
44255      }
44256      if (element.hasCompartment()) {
44257        openArray("compartment");
44258        for (GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent e : element.getCompartment()) 
44259          composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(null, e);
44260        closeArray();
44261      };
44262      if (element.hasLink()) {
44263        openArray("link");
44264        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
44265          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
44266        closeArray();
44267      };
44268  }
44269
44270  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
44271    if (element != null) {
44272      open(name);
44273      composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(element);
44274      close();
44275    }
44276  }
44277
44278  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
44279      composeBackbone(element);
44280      if (element.hasUseElement()) {
44281        composeEnumerationCore("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
44282        composeEnumerationExtras("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
44283      }
44284      if (element.hasCodeElement()) {
44285        composeEnumerationCore("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
44286        composeEnumerationExtras("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
44287      }
44288      if (element.hasRuleElement()) {
44289        composeEnumerationCore("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
44290        composeEnumerationExtras("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
44291      }
44292      if (element.hasExpressionElement()) {
44293        composeStringCore("expression", element.getExpressionElement(), false);
44294        composeStringExtras("expression", element.getExpressionElement(), false);
44295      }
44296      if (element.hasDescriptionElement()) {
44297        composeStringCore("description", element.getDescriptionElement(), false);
44298        composeStringExtras("description", element.getDescriptionElement(), false);
44299      }
44300  }
44301
44302  protected void composeGroup(String name, Group element) throws IOException {
44303    if (element != null) {
44304      prop("resourceType", name);
44305      composeGroupInner(element);
44306    }
44307  }
44308
44309  protected void composeGroupInner(Group element) throws IOException {
44310      composeDomainResourceElements(element);
44311      if (element.hasIdentifier()) {
44312        openArray("identifier");
44313        for (Identifier e : element.getIdentifier()) 
44314          composeIdentifier(null, e);
44315        closeArray();
44316      };
44317      if (element.hasActiveElement()) {
44318        composeBooleanCore("active", element.getActiveElement(), false);
44319        composeBooleanExtras("active", element.getActiveElement(), false);
44320      }
44321      if (element.hasTypeElement()) {
44322        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
44323        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
44324      }
44325      if (element.hasActualElement()) {
44326        composeBooleanCore("actual", element.getActualElement(), false);
44327        composeBooleanExtras("actual", element.getActualElement(), false);
44328      }
44329      if (element.hasCode()) {
44330        composeCodeableConcept("code", element.getCode());
44331        }
44332      if (element.hasNameElement()) {
44333        composeStringCore("name", element.getNameElement(), false);
44334        composeStringExtras("name", element.getNameElement(), false);
44335      }
44336      if (element.hasQuantityElement()) {
44337        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
44338        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
44339      }
44340      if (element.hasManagingEntity()) {
44341        composeReference("managingEntity", element.getManagingEntity());
44342      }
44343      if (element.hasCharacteristic()) {
44344        openArray("characteristic");
44345        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
44346          composeGroupGroupCharacteristicComponent(null, e);
44347        closeArray();
44348      };
44349      if (element.hasMember()) {
44350        openArray("member");
44351        for (Group.GroupMemberComponent e : element.getMember()) 
44352          composeGroupGroupMemberComponent(null, e);
44353        closeArray();
44354      };
44355  }
44356
44357  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
44358    if (element != null) {
44359      open(name);
44360      composeGroupGroupCharacteristicComponentInner(element);
44361      close();
44362    }
44363  }
44364
44365  protected void composeGroupGroupCharacteristicComponentInner(Group.GroupCharacteristicComponent element) throws IOException {
44366      composeBackbone(element);
44367      if (element.hasCode()) {
44368        composeCodeableConcept("code", element.getCode());
44369      }
44370      if (element.hasValue()) {
44371        composeType("value", element.getValue());
44372      }
44373      if (element.hasExcludeElement()) {
44374        composeBooleanCore("exclude", element.getExcludeElement(), false);
44375        composeBooleanExtras("exclude", element.getExcludeElement(), false);
44376      }
44377      if (element.hasPeriod()) {
44378        composePeriod("period", element.getPeriod());
44379      }
44380  }
44381
44382  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
44383    if (element != null) {
44384      open(name);
44385      composeGroupGroupMemberComponentInner(element);
44386      close();
44387    }
44388  }
44389
44390  protected void composeGroupGroupMemberComponentInner(Group.GroupMemberComponent element) throws IOException {
44391      composeBackbone(element);
44392      if (element.hasEntity()) {
44393        composeReference("entity", element.getEntity());
44394      }
44395      if (element.hasPeriod()) {
44396        composePeriod("period", element.getPeriod());
44397      }
44398      if (element.hasInactiveElement()) {
44399        composeBooleanCore("inactive", element.getInactiveElement(), false);
44400        composeBooleanExtras("inactive", element.getInactiveElement(), false);
44401      }
44402  }
44403
44404  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
44405    if (element != null) {
44406      prop("resourceType", name);
44407      composeGuidanceResponseInner(element);
44408    }
44409  }
44410
44411  protected void composeGuidanceResponseInner(GuidanceResponse element) throws IOException {
44412      composeDomainResourceElements(element);
44413      if (element.hasRequestIdentifier()) {
44414        composeIdentifier("requestIdentifier", element.getRequestIdentifier());
44415      }
44416      if (element.hasIdentifier()) {
44417        openArray("identifier");
44418        for (Identifier e : element.getIdentifier()) 
44419          composeIdentifier(null, e);
44420        closeArray();
44421      };
44422      if (element.hasModule()) {
44423        composeType("module", element.getModule());
44424      }
44425      if (element.hasStatusElement()) {
44426        composeEnumerationCore("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
44427        composeEnumerationExtras("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
44428      }
44429      if (element.hasSubject()) {
44430        composeReference("subject", element.getSubject());
44431      }
44432      if (element.hasEncounter()) {
44433        composeReference("encounter", element.getEncounter());
44434      }
44435      if (element.hasOccurrenceDateTimeElement()) {
44436        composeDateTimeCore("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
44437        composeDateTimeExtras("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
44438      }
44439      if (element.hasPerformer()) {
44440        composeReference("performer", element.getPerformer());
44441      }
44442      if (element.hasReasonCode()) {
44443        openArray("reasonCode");
44444        for (CodeableConcept e : element.getReasonCode()) 
44445          composeCodeableConcept(null, e);
44446        closeArray();
44447      };
44448      if (element.hasReasonReference()) {
44449        openArray("reasonReference");
44450        for (Reference e : element.getReasonReference()) 
44451          composeReference(null, e);
44452        closeArray();
44453      };
44454      if (element.hasNote()) {
44455        openArray("note");
44456        for (Annotation e : element.getNote()) 
44457          composeAnnotation(null, e);
44458        closeArray();
44459      };
44460      if (element.hasEvaluationMessage()) {
44461        openArray("evaluationMessage");
44462        for (Reference e : element.getEvaluationMessage()) 
44463          composeReference(null, e);
44464        closeArray();
44465      };
44466      if (element.hasOutputParameters()) {
44467        composeReference("outputParameters", element.getOutputParameters());
44468      }
44469      if (element.hasResult()) {
44470        composeReference("result", element.getResult());
44471      }
44472      if (element.hasDataRequirement()) {
44473        openArray("dataRequirement");
44474        for (DataRequirement e : element.getDataRequirement()) 
44475          composeDataRequirement(null, e);
44476        closeArray();
44477      };
44478  }
44479
44480  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
44481    if (element != null) {
44482      prop("resourceType", name);
44483      composeHealthcareServiceInner(element);
44484    }
44485  }
44486
44487  protected void composeHealthcareServiceInner(HealthcareService element) throws IOException {
44488      composeDomainResourceElements(element);
44489      if (element.hasIdentifier()) {
44490        openArray("identifier");
44491        for (Identifier e : element.getIdentifier()) 
44492          composeIdentifier(null, e);
44493        closeArray();
44494      };
44495      if (element.hasActiveElement()) {
44496        composeBooleanCore("active", element.getActiveElement(), false);
44497        composeBooleanExtras("active", element.getActiveElement(), false);
44498      }
44499      if (element.hasProvidedBy()) {
44500        composeReference("providedBy", element.getProvidedBy());
44501      }
44502      if (element.hasCategory()) {
44503        openArray("category");
44504        for (CodeableConcept e : element.getCategory()) 
44505          composeCodeableConcept(null, e);
44506        closeArray();
44507      };
44508      if (element.hasType()) {
44509        openArray("type");
44510        for (CodeableConcept e : element.getType()) 
44511          composeCodeableConcept(null, e);
44512        closeArray();
44513      };
44514      if (element.hasSpecialty()) {
44515        openArray("specialty");
44516        for (CodeableConcept e : element.getSpecialty()) 
44517          composeCodeableConcept(null, e);
44518        closeArray();
44519      };
44520      if (element.hasLocation()) {
44521        openArray("location");
44522        for (Reference e : element.getLocation()) 
44523          composeReference(null, e);
44524          closeArray();
44525      };
44526      if (element.hasNameElement()) {
44527        composeStringCore("name", element.getNameElement(), false);
44528        composeStringExtras("name", element.getNameElement(), false);
44529      }
44530      if (element.hasCommentElement()) {
44531        composeStringCore("comment", element.getCommentElement(), false);
44532        composeStringExtras("comment", element.getCommentElement(), false);
44533      }
44534      if (element.hasExtraDetailsElement()) {
44535        composeMarkdownCore("extraDetails", element.getExtraDetailsElement(), false);
44536        composeMarkdownExtras("extraDetails", element.getExtraDetailsElement(), false);
44537      }
44538      if (element.hasPhoto()) {
44539        composeAttachment("photo", element.getPhoto());
44540        }
44541      if (element.hasTelecom()) {
44542        openArray("telecom");
44543        for (ContactPoint e : element.getTelecom()) 
44544          composeContactPoint(null, e);
44545        closeArray();
44546      };
44547      if (element.hasCoverageArea()) {
44548        openArray("coverageArea");
44549        for (Reference e : element.getCoverageArea()) 
44550          composeReference(null, e);
44551        closeArray();
44552      };
44553      if (element.hasServiceProvisionCode()) {
44554        openArray("serviceProvisionCode");
44555        for (CodeableConcept e : element.getServiceProvisionCode()) 
44556          composeCodeableConcept(null, e);
44557        closeArray();
44558      };
44559      if (element.hasEligibility()) {
44560        openArray("eligibility");
44561        for (HealthcareService.HealthcareServiceEligibilityComponent e : element.getEligibility()) 
44562          composeHealthcareServiceHealthcareServiceEligibilityComponent(null, e);
44563        closeArray();
44564      };
44565      if (element.hasProgram()) {
44566        openArray("program");
44567        for (CodeableConcept e : element.getProgram()) 
44568          composeCodeableConcept(null, e);
44569        closeArray();
44570      };
44571      if (element.hasCharacteristic()) {
44572        openArray("characteristic");
44573        for (CodeableConcept e : element.getCharacteristic()) 
44574          composeCodeableConcept(null, e);
44575        closeArray();
44576      };
44577      if (element.hasCommunication()) {
44578        openArray("communication");
44579        for (CodeableConcept e : element.getCommunication()) 
44580          composeCodeableConcept(null, e);
44581        closeArray();
44582      };
44583      if (element.hasReferralMethod()) {
44584        openArray("referralMethod");
44585        for (CodeableConcept e : element.getReferralMethod()) 
44586          composeCodeableConcept(null, e);
44587        closeArray();
44588      };
44589      if (element.hasAppointmentRequiredElement()) {
44590        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
44591        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
44592      }
44593      if (element.hasAvailableTime()) {
44594        openArray("availableTime");
44595        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
44596          composeHealthcareServiceHealthcareServiceAvailableTimeComponent(null, e);
44597        closeArray();
44598      };
44599      if (element.hasNotAvailable()) {
44600        openArray("notAvailable");
44601        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
44602          composeHealthcareServiceHealthcareServiceNotAvailableComponent(null, e);
44603          closeArray();
44604      };
44605      if (element.hasAvailabilityExceptionsElement()) {
44606        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
44607        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
44608        }
44609      if (element.hasEndpoint()) {
44610        openArray("endpoint");
44611        for (Reference e : element.getEndpoint()) 
44612          composeReference(null, e);
44613        closeArray();
44614      };
44615  }
44616
44617  protected void composeHealthcareServiceHealthcareServiceEligibilityComponent(String name, HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
44618    if (element != null) {
44619      open(name);
44620      composeHealthcareServiceHealthcareServiceEligibilityComponentInner(element);
44621      close();
44622    }
44623  }
44624
44625  protected void composeHealthcareServiceHealthcareServiceEligibilityComponentInner(HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
44626      composeBackbone(element);
44627      if (element.hasCode()) {
44628        composeCodeableConcept("code", element.getCode());
44629      }
44630      if (element.hasCommentElement()) {
44631        composeMarkdownCore("comment", element.getCommentElement(), false);
44632        composeMarkdownExtras("comment", element.getCommentElement(), false);
44633      }
44634  }
44635
44636  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
44637    if (element != null) {
44638      open(name);
44639      composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(element);
44640      close();
44641    }
44642  }
44643
44644  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
44645      composeBackbone(element);
44646      if (element.hasDaysOfWeek()) {
44647        openArray("daysOfWeek");
44648        for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
44649          composeEnumerationCore(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
44650        closeArray();
44651        if (anyHasExtras(element.getDaysOfWeek())) {
44652          openArray("_daysOfWeek");
44653          for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
44654            composeEnumerationExtras(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
44655          closeArray();
44656        }
44657      };
44658      if (element.hasAllDayElement()) {
44659        composeBooleanCore("allDay", element.getAllDayElement(), false);
44660        composeBooleanExtras("allDay", element.getAllDayElement(), false);
44661      }
44662      if (element.hasAvailableStartTimeElement()) {
44663        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
44664        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
44665      }
44666      if (element.hasAvailableEndTimeElement()) {
44667        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
44668        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
44669      }
44670  }
44671
44672  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
44673    if (element != null) {
44674      open(name);
44675      composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(element);
44676      close();
44677    }
44678  }
44679
44680  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
44681      composeBackbone(element);
44682      if (element.hasDescriptionElement()) {
44683        composeStringCore("description", element.getDescriptionElement(), false);
44684        composeStringExtras("description", element.getDescriptionElement(), false);
44685      }
44686      if (element.hasDuring()) {
44687        composePeriod("during", element.getDuring());
44688      }
44689  }
44690
44691  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
44692    if (element != null) {
44693      prop("resourceType", name);
44694      composeImagingStudyInner(element);
44695    }
44696  }
44697
44698  protected void composeImagingStudyInner(ImagingStudy element) throws IOException {
44699      composeDomainResourceElements(element);
44700      if (element.hasIdentifier()) {
44701        openArray("identifier");
44702        for (Identifier e : element.getIdentifier()) 
44703          composeIdentifier(null, e);
44704        closeArray();
44705      };
44706      if (element.hasStatusElement()) {
44707        composeEnumerationCore("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
44708        composeEnumerationExtras("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
44709      }
44710      if (element.hasModality()) {
44711        openArray("modality");
44712        for (Coding e : element.getModality()) 
44713          composeCoding(null, e);
44714        closeArray();
44715      };
44716      if (element.hasSubject()) {
44717        composeReference("subject", element.getSubject());
44718      }
44719      if (element.hasEncounter()) {
44720        composeReference("encounter", element.getEncounter());
44721      }
44722      if (element.hasStartedElement()) {
44723        composeDateTimeCore("started", element.getStartedElement(), false);
44724        composeDateTimeExtras("started", element.getStartedElement(), false);
44725      }
44726      if (element.hasBasedOn()) {
44727        openArray("basedOn");
44728        for (Reference e : element.getBasedOn()) 
44729          composeReference(null, e);
44730        closeArray();
44731      };
44732      if (element.hasReferrer()) {
44733        composeReference("referrer", element.getReferrer());
44734      }
44735      if (element.hasInterpreter()) {
44736        openArray("interpreter");
44737        for (Reference e : element.getInterpreter()) 
44738          composeReference(null, e);
44739        closeArray();
44740      };
44741      if (element.hasEndpoint()) {
44742        openArray("endpoint");
44743        for (Reference e : element.getEndpoint()) 
44744          composeReference(null, e);
44745        closeArray();
44746      };
44747      if (element.hasNumberOfSeriesElement()) {
44748        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
44749        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
44750      }
44751      if (element.hasNumberOfInstancesElement()) {
44752        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
44753        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
44754      }
44755      if (element.hasProcedureReference()) {
44756        composeReference("procedureReference", element.getProcedureReference());
44757      }
44758      if (element.hasProcedureCode()) {
44759        openArray("procedureCode");
44760        for (CodeableConcept e : element.getProcedureCode()) 
44761          composeCodeableConcept(null, e);
44762        closeArray();
44763      };
44764      if (element.hasLocation()) {
44765        composeReference("location", element.getLocation());
44766      }
44767      if (element.hasReasonCode()) {
44768        openArray("reasonCode");
44769        for (CodeableConcept e : element.getReasonCode()) 
44770          composeCodeableConcept(null, e);
44771        closeArray();
44772      };
44773      if (element.hasReasonReference()) {
44774        openArray("reasonReference");
44775        for (Reference e : element.getReasonReference()) 
44776          composeReference(null, e);
44777        closeArray();
44778      };
44779      if (element.hasNote()) {
44780        openArray("note");
44781        for (Annotation e : element.getNote()) 
44782          composeAnnotation(null, e);
44783        closeArray();
44784      };
44785      if (element.hasDescriptionElement()) {
44786        composeStringCore("description", element.getDescriptionElement(), false);
44787        composeStringExtras("description", element.getDescriptionElement(), false);
44788      }
44789      if (element.hasSeries()) {
44790        openArray("series");
44791        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
44792          composeImagingStudyImagingStudySeriesComponent(null, e);
44793        closeArray();
44794      };
44795  }
44796
44797  protected void composeImagingStudyImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
44798    if (element != null) {
44799      open(name);
44800      composeImagingStudyImagingStudySeriesComponentInner(element);
44801      close();
44802    }
44803  }
44804
44805  protected void composeImagingStudyImagingStudySeriesComponentInner(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
44806      composeBackbone(element);
44807      if (element.hasUidElement()) {
44808        composeIdCore("uid", element.getUidElement(), false);
44809        composeIdExtras("uid", element.getUidElement(), false);
44810      }
44811      if (element.hasNumberElement()) {
44812        composeUnsignedIntCore("number", element.getNumberElement(), false);
44813        composeUnsignedIntExtras("number", element.getNumberElement(), false);
44814      }
44815      if (element.hasModality()) {
44816        composeCoding("modality", element.getModality());
44817      }
44818      if (element.hasDescriptionElement()) {
44819        composeStringCore("description", element.getDescriptionElement(), false);
44820        composeStringExtras("description", element.getDescriptionElement(), false);
44821  }
44822      if (element.hasNumberOfInstancesElement()) {
44823        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
44824        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
44825    }
44826      if (element.hasEndpoint()) {
44827        openArray("endpoint");
44828        for (Reference e : element.getEndpoint()) 
44829          composeReference(null, e);
44830        closeArray();
44831      };
44832      if (element.hasBodySite()) {
44833        composeCoding("bodySite", element.getBodySite());
44834  }
44835      if (element.hasLaterality()) {
44836        composeCoding("laterality", element.getLaterality());
44837      }
44838      if (element.hasSpecimen()) {
44839        openArray("specimen");
44840        for (Reference e : element.getSpecimen()) 
44841          composeReference(null, e);
44842        closeArray();
44843      };
44844      if (element.hasStartedElement()) {
44845        composeDateTimeCore("started", element.getStartedElement(), false);
44846        composeDateTimeExtras("started", element.getStartedElement(), false);
44847      }
44848      if (element.hasPerformer()) {
44849        openArray("performer");
44850        for (ImagingStudy.ImagingStudySeriesPerformerComponent e : element.getPerformer()) 
44851          composeImagingStudyImagingStudySeriesPerformerComponent(null, e);
44852        closeArray();
44853      };
44854      if (element.hasInstance()) {
44855        openArray("instance");
44856        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
44857          composeImagingStudyImagingStudySeriesInstanceComponent(null, e);
44858        closeArray();
44859      };
44860  }
44861
44862  protected void composeImagingStudyImagingStudySeriesPerformerComponent(String name, ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
44863    if (element != null) {
44864      open(name);
44865      composeImagingStudyImagingStudySeriesPerformerComponentInner(element);
44866      close();
44867    }
44868  }
44869
44870  protected void composeImagingStudyImagingStudySeriesPerformerComponentInner(ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
44871      composeBackbone(element);
44872      if (element.hasFunction()) {
44873        composeCodeableConcept("function", element.getFunction());
44874      }
44875      if (element.hasActor()) {
44876        composeReference("actor", element.getActor());
44877      }
44878  }
44879
44880  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
44881    if (element != null) {
44882      open(name);
44883      composeImagingStudyImagingStudySeriesInstanceComponentInner(element);
44884      close();
44885    }
44886  }
44887
44888  protected void composeImagingStudyImagingStudySeriesInstanceComponentInner(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
44889      composeBackbone(element);
44890      if (element.hasUidElement()) {
44891        composeIdCore("uid", element.getUidElement(), false);
44892        composeIdExtras("uid", element.getUidElement(), false);
44893      }
44894      if (element.hasSopClass()) {
44895        composeCoding("sopClass", element.getSopClass());
44896      }
44897      if (element.hasNumberElement()) {
44898        composeUnsignedIntCore("number", element.getNumberElement(), false);
44899        composeUnsignedIntExtras("number", element.getNumberElement(), false);
44900      }
44901      if (element.hasTitleElement()) {
44902        composeStringCore("title", element.getTitleElement(), false);
44903        composeStringExtras("title", element.getTitleElement(), false);
44904      }
44905  }
44906
44907  protected void composeImmunization(String name, Immunization element) throws IOException {
44908    if (element != null) {
44909      prop("resourceType", name);
44910      composeImmunizationInner(element);
44911    }
44912  }
44913
44914  protected void composeImmunizationInner(Immunization element) throws IOException {
44915      composeDomainResourceElements(element);
44916      if (element.hasIdentifier()) {
44917        openArray("identifier");
44918        for (Identifier e : element.getIdentifier()) 
44919          composeIdentifier(null, e);
44920        closeArray();
44921      };
44922      if (element.hasStatusElement()) {
44923        composeEnumerationCore("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
44924        composeEnumerationExtras("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
44925      }
44926      if (element.hasStatusReason()) {
44927        composeCodeableConcept("statusReason", element.getStatusReason());
44928      }
44929      if (element.hasVaccineCode()) {
44930        composeCodeableConcept("vaccineCode", element.getVaccineCode());
44931      }
44932      if (element.hasPatient()) {
44933        composeReference("patient", element.getPatient());
44934      }
44935      if (element.hasEncounter()) {
44936        composeReference("encounter", element.getEncounter());
44937      }
44938      if (element.hasOccurrence()) {
44939        composeType("occurrence", element.getOccurrence());
44940      }
44941      if (element.hasRecordedElement()) {
44942        composeDateTimeCore("recorded", element.getRecordedElement(), false);
44943        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
44944      }
44945      if (element.hasPrimarySourceElement()) {
44946        composeBooleanCore("primarySource", element.getPrimarySourceElement(), false);
44947        composeBooleanExtras("primarySource", element.getPrimarySourceElement(), false);
44948      }
44949      if (element.hasInformationSource()) {
44950        composeType("informationSource", element.getInformationSource());
44951      }
44952      if (element.hasLocation()) {
44953        composeReference("location", element.getLocation());
44954      }
44955      if (element.hasManufacturer()) {
44956        composeReference("manufacturer", element.getManufacturer());
44957      }
44958      if (element.hasLotNumberElement()) {
44959        composeStringCore("lotNumber", element.getLotNumberElement(), false);
44960        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
44961      }
44962      if (element.hasExpirationDateElement()) {
44963        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
44964        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
44965      }
44966      if (element.hasSite()) {
44967        composeCodeableConcept("site", element.getSite());
44968      }
44969      if (element.hasRoute()) {
44970        composeCodeableConcept("route", element.getRoute());
44971      }
44972      if (element.hasDoseQuantity()) {
44973        composeQuantity("doseQuantity", element.getDoseQuantity());
44974      }
44975      if (element.hasPerformer()) {
44976        openArray("performer");
44977        for (Immunization.ImmunizationPerformerComponent e : element.getPerformer()) 
44978          composeImmunizationImmunizationPerformerComponent(null, e);
44979        closeArray();
44980      };
44981      if (element.hasNote()) {
44982        openArray("note");
44983        for (Annotation e : element.getNote()) 
44984          composeAnnotation(null, e);
44985        closeArray();
44986      };
44987      if (element.hasReasonCode()) {
44988        openArray("reasonCode");
44989        for (CodeableConcept e : element.getReasonCode()) 
44990          composeCodeableConcept(null, e);
44991        closeArray();
44992      };
44993      if (element.hasReasonReference()) {
44994        openArray("reasonReference");
44995        for (Reference e : element.getReasonReference()) 
44996          composeReference(null, e);
44997        closeArray();
44998      };
44999      if (element.hasIsSubpotentElement()) {
45000        composeBooleanCore("isSubpotent", element.getIsSubpotentElement(), false);
45001        composeBooleanExtras("isSubpotent", element.getIsSubpotentElement(), false);
45002      }
45003      if (element.hasSubpotentReason()) {
45004        openArray("subpotentReason");
45005        for (CodeableConcept e : element.getSubpotentReason()) 
45006          composeCodeableConcept(null, e);
45007        closeArray();
45008      };
45009      if (element.hasEducation()) {
45010        openArray("education");
45011        for (Immunization.ImmunizationEducationComponent e : element.getEducation()) 
45012          composeImmunizationImmunizationEducationComponent(null, e);
45013        closeArray();
45014      };
45015      if (element.hasProgramEligibility()) {
45016        openArray("programEligibility");
45017        for (CodeableConcept e : element.getProgramEligibility()) 
45018          composeCodeableConcept(null, e);
45019        closeArray();
45020      };
45021      if (element.hasFundingSource()) {
45022        composeCodeableConcept("fundingSource", element.getFundingSource());
45023      }
45024      if (element.hasReaction()) {
45025        openArray("reaction");
45026        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
45027          composeImmunizationImmunizationReactionComponent(null, e);
45028        closeArray();
45029      };
45030      if (element.hasProtocolApplied()) {
45031        openArray("protocolApplied");
45032        for (Immunization.ImmunizationProtocolAppliedComponent e : element.getProtocolApplied()) 
45033          composeImmunizationImmunizationProtocolAppliedComponent(null, e);
45034        closeArray();
45035      };
45036  }
45037
45038  protected void composeImmunizationImmunizationPerformerComponent(String name, Immunization.ImmunizationPerformerComponent element) throws IOException {
45039    if (element != null) {
45040      open(name);
45041      composeImmunizationImmunizationPerformerComponentInner(element);
45042      close();
45043    }
45044  }
45045
45046  protected void composeImmunizationImmunizationPerformerComponentInner(Immunization.ImmunizationPerformerComponent element) throws IOException {
45047      composeBackbone(element);
45048      if (element.hasFunction()) {
45049        composeCodeableConcept("function", element.getFunction());
45050      }
45051      if (element.hasActor()) {
45052        composeReference("actor", element.getActor());
45053      }
45054  }
45055
45056  protected void composeImmunizationImmunizationEducationComponent(String name, Immunization.ImmunizationEducationComponent element) throws IOException {
45057    if (element != null) {
45058      open(name);
45059      composeImmunizationImmunizationEducationComponentInner(element);
45060      close();
45061    }
45062  }
45063
45064  protected void composeImmunizationImmunizationEducationComponentInner(Immunization.ImmunizationEducationComponent element) throws IOException {
45065      composeBackbone(element);
45066      if (element.hasDocumentTypeElement()) {
45067        composeStringCore("documentType", element.getDocumentTypeElement(), false);
45068        composeStringExtras("documentType", element.getDocumentTypeElement(), false);
45069      }
45070      if (element.hasReferenceElement()) {
45071        composeUriCore("reference", element.getReferenceElement(), false);
45072        composeUriExtras("reference", element.getReferenceElement(), false);
45073      }
45074      if (element.hasPublicationDateElement()) {
45075        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
45076        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
45077      }
45078      if (element.hasPresentationDateElement()) {
45079        composeDateTimeCore("presentationDate", element.getPresentationDateElement(), false);
45080        composeDateTimeExtras("presentationDate", element.getPresentationDateElement(), false);
45081      }
45082  }
45083
45084  protected void composeImmunizationImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
45085    if (element != null) {
45086      open(name);
45087      composeImmunizationImmunizationReactionComponentInner(element);
45088      close();
45089    }
45090  }
45091
45092  protected void composeImmunizationImmunizationReactionComponentInner(Immunization.ImmunizationReactionComponent element) throws IOException {
45093      composeBackbone(element);
45094      if (element.hasDateElement()) {
45095        composeDateTimeCore("date", element.getDateElement(), false);
45096        composeDateTimeExtras("date", element.getDateElement(), false);
45097      }
45098      if (element.hasDetail()) {
45099        composeReference("detail", element.getDetail());
45100      }
45101      if (element.hasReportedElement()) {
45102        composeBooleanCore("reported", element.getReportedElement(), false);
45103        composeBooleanExtras("reported", element.getReportedElement(), false);
45104      }
45105  }
45106
45107  protected void composeImmunizationImmunizationProtocolAppliedComponent(String name, Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
45108    if (element != null) {
45109      open(name);
45110      composeImmunizationImmunizationProtocolAppliedComponentInner(element);
45111      close();
45112    }
45113  }
45114
45115  protected void composeImmunizationImmunizationProtocolAppliedComponentInner(Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
45116      composeBackbone(element);
45117      if (element.hasSeriesElement()) {
45118        composeStringCore("series", element.getSeriesElement(), false);
45119        composeStringExtras("series", element.getSeriesElement(), false);
45120      }
45121      if (element.hasAuthority()) {
45122        composeReference("authority", element.getAuthority());
45123      }
45124      if (element.hasTargetDisease()) {
45125        openArray("targetDisease");
45126        for (CodeableConcept e : element.getTargetDisease()) 
45127          composeCodeableConcept(null, e);
45128        closeArray();
45129      };
45130      if (element.hasDoseNumber()) {
45131        composeType("doseNumber", element.getDoseNumber());
45132      }
45133      if (element.hasSeriesDoses()) {
45134        composeType("seriesDoses", element.getSeriesDoses());
45135      }
45136  }
45137
45138  protected void composeImmunizationEvaluation(String name, ImmunizationEvaluation element) throws IOException {
45139    if (element != null) {
45140      prop("resourceType", name);
45141      composeImmunizationEvaluationInner(element);
45142    }
45143  }
45144
45145  protected void composeImmunizationEvaluationInner(ImmunizationEvaluation element) throws IOException {
45146      composeDomainResourceElements(element);
45147      if (element.hasIdentifier()) {
45148        openArray("identifier");
45149        for (Identifier e : element.getIdentifier()) 
45150          composeIdentifier(null, e);
45151        closeArray();
45152      };
45153      if (element.hasStatusElement()) {
45154        composeEnumerationCore("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
45155        composeEnumerationExtras("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
45156      }
45157      if (element.hasPatient()) {
45158        composeReference("patient", element.getPatient());
45159      }
45160      if (element.hasDateElement()) {
45161        composeDateTimeCore("date", element.getDateElement(), false);
45162        composeDateTimeExtras("date", element.getDateElement(), false);
45163      }
45164      if (element.hasAuthority()) {
45165        composeReference("authority", element.getAuthority());
45166      }
45167      if (element.hasTargetDisease()) {
45168        composeCodeableConcept("targetDisease", element.getTargetDisease());
45169      }
45170      if (element.hasImmunizationEvent()) {
45171        composeReference("immunizationEvent", element.getImmunizationEvent());
45172      }
45173      if (element.hasDoseStatus()) {
45174        composeCodeableConcept("doseStatus", element.getDoseStatus());
45175      }
45176      if (element.hasDoseStatusReason()) {
45177        openArray("doseStatusReason");
45178        for (CodeableConcept e : element.getDoseStatusReason()) 
45179          composeCodeableConcept(null, e);
45180        closeArray();
45181      };
45182      if (element.hasDescriptionElement()) {
45183        composeStringCore("description", element.getDescriptionElement(), false);
45184        composeStringExtras("description", element.getDescriptionElement(), false);
45185      }
45186      if (element.hasSeriesElement()) {
45187        composeStringCore("series", element.getSeriesElement(), false);
45188        composeStringExtras("series", element.getSeriesElement(), false);
45189      }
45190      if (element.hasDoseNumber()) {
45191        composeType("doseNumber", element.getDoseNumber());
45192      }
45193      if (element.hasSeriesDoses()) {
45194        composeType("seriesDoses", element.getSeriesDoses());
45195      }
45196      }
45197
45198  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
45199    if (element != null) {
45200      prop("resourceType", name);
45201      composeImmunizationRecommendationInner(element);
45202      }
45203      }
45204
45205  protected void composeImmunizationRecommendationInner(ImmunizationRecommendation element) throws IOException {
45206      composeDomainResourceElements(element);
45207      if (element.hasIdentifier()) {
45208        openArray("identifier");
45209        for (Identifier e : element.getIdentifier()) 
45210          composeIdentifier(null, e);
45211        closeArray();
45212      };
45213      if (element.hasPatient()) {
45214        composeReference("patient", element.getPatient());
45215      }
45216      if (element.hasDateElement()) {
45217        composeDateTimeCore("date", element.getDateElement(), false);
45218        composeDateTimeExtras("date", element.getDateElement(), false);
45219      }
45220      if (element.hasAuthority()) {
45221        composeReference("authority", element.getAuthority());
45222      }
45223      if (element.hasRecommendation()) {
45224        openArray("recommendation");
45225        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
45226          composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(null, e);
45227        closeArray();
45228      };
45229  }
45230
45231  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
45232    if (element != null) {
45233      open(name);
45234      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(element);
45235      close();
45236    }
45237  }
45238
45239  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
45240      composeBackbone(element);
45241      if (element.hasVaccineCode()) {
45242        openArray("vaccineCode");
45243        for (CodeableConcept e : element.getVaccineCode()) 
45244          composeCodeableConcept(null, e);
45245        closeArray();
45246      };
45247      if (element.hasTargetDisease()) {
45248        openArray("targetDisease");
45249        for (CodeableConcept e : element.getTargetDisease()) 
45250          composeCodeableConcept(null, e);
45251        closeArray();
45252      };
45253      if (element.hasContraindicatedVaccineCode()) {
45254        openArray("contraindicatedVaccineCode");
45255        for (CodeableConcept e : element.getContraindicatedVaccineCode()) 
45256          composeCodeableConcept(null, e);
45257        closeArray();
45258      };
45259      if (element.hasForecastStatus()) {
45260        composeCodeableConcept("forecastStatus", element.getForecastStatus());
45261      }
45262      if (element.hasForecastReason()) {
45263        openArray("forecastReason");
45264        for (CodeableConcept e : element.getForecastReason()) 
45265          composeCodeableConcept(null, e);
45266        closeArray();
45267      };
45268      if (element.hasDateCriterion()) {
45269        openArray("dateCriterion");
45270        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
45271          composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
45272        closeArray();
45273      };
45274      if (element.hasDescriptionElement()) {
45275        composeStringCore("description", element.getDescriptionElement(), false);
45276        composeStringExtras("description", element.getDescriptionElement(), false);
45277      }
45278      if (element.hasSeriesElement()) {
45279        composeStringCore("series", element.getSeriesElement(), false);
45280        composeStringExtras("series", element.getSeriesElement(), false);
45281  }
45282      if (element.hasDoseNumber()) {
45283        composeType("doseNumber", element.getDoseNumber());
45284    }
45285      if (element.hasSeriesDoses()) {
45286        composeType("seriesDoses", element.getSeriesDoses());
45287  }
45288      if (element.hasSupportingImmunization()) {
45289        openArray("supportingImmunization");
45290        for (Reference e : element.getSupportingImmunization()) 
45291          composeReference(null, e);
45292        closeArray();
45293      };
45294      if (element.hasSupportingPatientInformation()) {
45295        openArray("supportingPatientInformation");
45296        for (Reference e : element.getSupportingPatientInformation()) 
45297          composeReference(null, e);
45298        closeArray();
45299      };
45300  }
45301
45302  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
45303    if (element != null) {
45304      open(name);
45305      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(element);
45306      close();
45307    }
45308  }
45309
45310  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
45311      composeBackbone(element);
45312      if (element.hasCode()) {
45313        composeCodeableConcept("code", element.getCode());
45314      }
45315      if (element.hasValueElement()) {
45316        composeDateTimeCore("value", element.getValueElement(), false);
45317        composeDateTimeExtras("value", element.getValueElement(), false);
45318      }
45319  }
45320
45321  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
45322    if (element != null) {
45323      prop("resourceType", name);
45324      composeImplementationGuideInner(element);
45325    }
45326  }
45327
45328  protected void composeImplementationGuideInner(ImplementationGuide element) throws IOException {
45329      composeDomainResourceElements(element);
45330      if (element.hasUrlElement()) {
45331        composeUriCore("url", element.getUrlElement(), false);
45332        composeUriExtras("url", element.getUrlElement(), false);
45333      }
45334      if (element.hasVersionElement()) {
45335        composeStringCore("version", element.getVersionElement(), false);
45336        composeStringExtras("version", element.getVersionElement(), false);
45337      }
45338      if (element.hasNameElement()) {
45339        composeStringCore("name", element.getNameElement(), false);
45340        composeStringExtras("name", element.getNameElement(), false);
45341      }
45342      if (element.hasTitleElement()) {
45343        composeStringCore("title", element.getTitleElement(), false);
45344        composeStringExtras("title", element.getTitleElement(), false);
45345      }
45346      if (element.hasStatusElement()) {
45347        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45348        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45349      }
45350      if (element.hasExperimentalElement()) {
45351        composeBooleanCore("experimental", element.getExperimentalElement(), false);
45352        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
45353      }
45354      if (element.hasDateElement()) {
45355        composeDateTimeCore("date", element.getDateElement(), false);
45356        composeDateTimeExtras("date", element.getDateElement(), false);
45357      }
45358      if (element.hasPublisherElement()) {
45359        composeStringCore("publisher", element.getPublisherElement(), false);
45360        composeStringExtras("publisher", element.getPublisherElement(), false);
45361      }
45362      if (element.hasContact()) {
45363        openArray("contact");
45364        for (ContactDetail e : element.getContact()) 
45365          composeContactDetail(null, e);
45366        closeArray();
45367      };
45368      if (element.hasDescriptionElement()) {
45369        composeMarkdownCore("description", element.getDescriptionElement(), false);
45370        composeMarkdownExtras("description", element.getDescriptionElement(), false);
45371      }
45372      if (element.hasUseContext()) {
45373        openArray("useContext");
45374        for (UsageContext e : element.getUseContext()) 
45375          composeUsageContext(null, e);
45376        closeArray();
45377      };
45378      if (element.hasJurisdiction()) {
45379        openArray("jurisdiction");
45380        for (CodeableConcept e : element.getJurisdiction()) 
45381          composeCodeableConcept(null, e);
45382        closeArray();
45383      };
45384      if (element.hasCopyrightElement()) {
45385        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
45386        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
45387      }
45388      if (element.hasPackageIdElement()) {
45389        composeIdCore("packageId", element.getPackageIdElement(), false);
45390        composeIdExtras("packageId", element.getPackageIdElement(), false);
45391      }
45392      if (element.hasLicenseElement()) {
45393        composeEnumerationCore("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
45394        composeEnumerationExtras("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
45395      }
45396      if (element.hasFhirVersion()) {
45397        openArray("fhirVersion");
45398        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
45399          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
45400        closeArray();
45401        if (anyHasExtras(element.getFhirVersion())) {
45402          openArray("_fhirVersion");
45403          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
45404            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
45405        closeArray();
45406        }
45407      };
45408      if (element.hasDependsOn()) {
45409        openArray("dependsOn");
45410        for (ImplementationGuide.ImplementationGuideDependsOnComponent e : element.getDependsOn()) 
45411          composeImplementationGuideImplementationGuideDependsOnComponent(null, e);
45412        closeArray();
45413      };
45414      if (element.hasGlobal()) {
45415        openArray("global");
45416        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
45417          composeImplementationGuideImplementationGuideGlobalComponent(null, e);
45418        closeArray();
45419      };
45420      if (element.hasDefinition()) {
45421        composeImplementationGuideImplementationGuideDefinitionComponent("definition", element.getDefinition());
45422      }
45423      if (element.hasManifest()) {
45424        composeImplementationGuideImplementationGuideManifestComponent("manifest", element.getManifest());
45425      }
45426  }
45427
45428  protected void composeImplementationGuideImplementationGuideDependsOnComponent(String name, ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
45429    if (element != null) {
45430      open(name);
45431      composeImplementationGuideImplementationGuideDependsOnComponentInner(element);
45432      close();
45433    }
45434  }
45435
45436  protected void composeImplementationGuideImplementationGuideDependsOnComponentInner(ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
45437      composeBackbone(element);
45438      if (element.hasUriElement()) {
45439        composeCanonicalCore("uri", element.getUriElement(), false);
45440        composeCanonicalExtras("uri", element.getUriElement(), false);
45441      }
45442      if (element.hasPackageIdElement()) {
45443        composeIdCore("packageId", element.getPackageIdElement(), false);
45444        composeIdExtras("packageId", element.getPackageIdElement(), false);
45445      }
45446      if (element.hasVersionElement()) {
45447        composeStringCore("version", element.getVersionElement(), false);
45448        composeStringExtras("version", element.getVersionElement(), false);
45449      }
45450  }
45451
45452  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
45453    if (element != null) {
45454      open(name);
45455      composeImplementationGuideImplementationGuideGlobalComponentInner(element);
45456      close();
45457    }
45458  }
45459
45460  protected void composeImplementationGuideImplementationGuideGlobalComponentInner(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
45461      composeBackbone(element);
45462      if (element.hasTypeElement()) {
45463        composeCodeCore("type", element.getTypeElement(), false);
45464        composeCodeExtras("type", element.getTypeElement(), false);
45465      }
45466      if (element.hasProfileElement()) {
45467        composeCanonicalCore("profile", element.getProfileElement(), false);
45468        composeCanonicalExtras("profile", element.getProfileElement(), false);
45469      }
45470  }
45471
45472  protected void composeImplementationGuideImplementationGuideDefinitionComponent(String name, ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
45473    if (element != null) {
45474      open(name);
45475      composeImplementationGuideImplementationGuideDefinitionComponentInner(element);
45476      close();
45477    }
45478  }
45479
45480  protected void composeImplementationGuideImplementationGuideDefinitionComponentInner(ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
45481      composeBackbone(element);
45482      if (element.hasGrouping()) {
45483        openArray("grouping");
45484        for (ImplementationGuide.ImplementationGuideDefinitionGroupingComponent e : element.getGrouping()) 
45485          composeImplementationGuideImplementationGuideDefinitionGroupingComponent(null, e);
45486        closeArray();
45487      };
45488      if (element.hasResource()) {
45489        openArray("resource");
45490        for (ImplementationGuide.ImplementationGuideDefinitionResourceComponent e : element.getResource()) 
45491          composeImplementationGuideImplementationGuideDefinitionResourceComponent(null, e);
45492        closeArray();
45493      };
45494      if (element.hasPage()) {
45495        composeImplementationGuideImplementationGuideDefinitionPageComponent("page", element.getPage());
45496      }
45497      if (element.hasParameter()) {
45498        openArray("parameter");
45499        for (ImplementationGuide.ImplementationGuideDefinitionParameterComponent e : element.getParameter()) 
45500          composeImplementationGuideImplementationGuideDefinitionParameterComponent(null, e);
45501        closeArray();
45502      };
45503      if (element.hasTemplate()) {
45504        openArray("template");
45505        for (ImplementationGuide.ImplementationGuideDefinitionTemplateComponent e : element.getTemplate()) 
45506          composeImplementationGuideImplementationGuideDefinitionTemplateComponent(null, e);
45507        closeArray();
45508      };
45509  }
45510
45511  protected void composeImplementationGuideImplementationGuideDefinitionGroupingComponent(String name, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
45512    if (element != null) {
45513      open(name);
45514      composeImplementationGuideImplementationGuideDefinitionGroupingComponentInner(element);
45515      close();
45516    }
45517  }
45518
45519  protected void composeImplementationGuideImplementationGuideDefinitionGroupingComponentInner(ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
45520      composeBackbone(element);
45521      if (element.hasNameElement()) {
45522        composeStringCore("name", element.getNameElement(), false);
45523        composeStringExtras("name", element.getNameElement(), false);
45524      }
45525      if (element.hasDescriptionElement()) {
45526        composeStringCore("description", element.getDescriptionElement(), false);
45527        composeStringExtras("description", element.getDescriptionElement(), false);
45528      }
45529  }
45530
45531  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponent(String name, ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
45532    if (element != null) {
45533      open(name);
45534      composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(element);
45535      close();
45536    }
45537  }
45538
45539  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
45540      composeBackbone(element);
45541      if (element.hasReference()) {
45542        composeReference("reference", element.getReference());
45543      }
45544      if (element.hasFhirVersion()) {
45545        openArray("fhirVersion");
45546        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
45547          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
45548        closeArray();
45549        if (anyHasExtras(element.getFhirVersion())) {
45550          openArray("_fhirVersion");
45551          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
45552            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
45553        closeArray();
45554        }
45555      };
45556      if (element.hasNameElement()) {
45557        composeStringCore("name", element.getNameElement(), false);
45558        composeStringExtras("name", element.getNameElement(), false);
45559      }
45560      if (element.hasDescriptionElement()) {
45561        composeStringCore("description", element.getDescriptionElement(), false);
45562        composeStringExtras("description", element.getDescriptionElement(), false);
45563      }
45564      if (element.hasExample()) {
45565        composeType("example", element.getExample());
45566      }
45567      if (element.hasGroupingIdElement()) {
45568        composeIdCore("groupingId", element.getGroupingIdElement(), false);
45569        composeIdExtras("groupingId", element.getGroupingIdElement(), false);
45570      }
45571  }
45572
45573  protected void composeImplementationGuideImplementationGuideDefinitionPageComponent(String name, ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
45574    if (element != null) {
45575      open(name);
45576      composeImplementationGuideImplementationGuideDefinitionPageComponentInner(element);
45577      close();
45578    }
45579  }
45580
45581  protected void composeImplementationGuideImplementationGuideDefinitionPageComponentInner(ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
45582      composeBackbone(element);
45583      if (element.hasName()) {
45584        composeType("name", element.getName());
45585      }
45586      if (element.hasTitleElement()) {
45587        composeStringCore("title", element.getTitleElement(), false);
45588        composeStringExtras("title", element.getTitleElement(), false);
45589      }
45590      if (element.hasGenerationElement()) {
45591        composeEnumerationCore("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
45592        composeEnumerationExtras("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
45593      }
45594      if (element.hasPage()) {
45595        openArray("page");
45596        for (ImplementationGuide.ImplementationGuideDefinitionPageComponent e : element.getPage()) 
45597          composeImplementationGuideImplementationGuideDefinitionPageComponent(null, e);
45598        closeArray();
45599      };
45600  }
45601
45602  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponent(String name, ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
45603    if (element != null) {
45604      open(name);
45605      composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(element);
45606      close();
45607    }
45608  }
45609
45610  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
45611      composeBackbone(element);
45612      if (element.hasCodeElement()) {
45613        composeStringCore("code", element.getCodeElement(), false);
45614        composeStringExtras("code", element.getCodeElement(), false);
45615      }
45616      if (element.hasValueElement()) {
45617        composeStringCore("value", element.getValueElement(), false);
45618        composeStringExtras("value", element.getValueElement(), false);
45619      }
45620  }
45621
45622  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponent(String name, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
45623    if (element != null) {
45624      open(name);
45625      composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(element);
45626      close();
45627    }
45628  }
45629
45630  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
45631      composeBackbone(element);
45632      if (element.hasCodeElement()) {
45633        composeCodeCore("code", element.getCodeElement(), false);
45634        composeCodeExtras("code", element.getCodeElement(), false);
45635      }
45636      if (element.hasSourceElement()) {
45637        composeStringCore("source", element.getSourceElement(), false);
45638        composeStringExtras("source", element.getSourceElement(), false);
45639      }
45640      if (element.hasScopeElement()) {
45641        composeStringCore("scope", element.getScopeElement(), false);
45642        composeStringExtras("scope", element.getScopeElement(), false);
45643      }
45644      }
45645
45646  protected void composeImplementationGuideImplementationGuideManifestComponent(String name, ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
45647    if (element != null) {
45648      open(name);
45649      composeImplementationGuideImplementationGuideManifestComponentInner(element);
45650      close();
45651      }
45652      }
45653
45654  protected void composeImplementationGuideImplementationGuideManifestComponentInner(ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
45655      composeBackbone(element);
45656      if (element.hasRenderingElement()) {
45657        composeUrlCore("rendering", element.getRenderingElement(), false);
45658        composeUrlExtras("rendering", element.getRenderingElement(), false);
45659      }
45660      if (element.hasResource()) {
45661        openArray("resource");
45662        for (ImplementationGuide.ManifestResourceComponent e : element.getResource()) 
45663          composeImplementationGuideManifestResourceComponent(null, e);
45664        closeArray();
45665      };
45666      if (element.hasPage()) {
45667        openArray("page");
45668        for (ImplementationGuide.ManifestPageComponent e : element.getPage()) 
45669          composeImplementationGuideManifestPageComponent(null, e);
45670        closeArray();
45671      };
45672      if (element.hasImage()) {
45673        openArray("image");
45674        for (StringType e : element.getImage()) 
45675          composeStringCore(null, e, true);
45676        closeArray();
45677        if (anyHasExtras(element.getImage())) {
45678          openArray("_image");
45679          for (StringType e : element.getImage()) 
45680            composeStringExtras(null, e, true);
45681        closeArray();
45682        }
45683      };
45684      if (element.hasOther()) {
45685        openArray("other");
45686        for (StringType e : element.getOther()) 
45687          composeStringCore(null, e, true);
45688        closeArray();
45689        if (anyHasExtras(element.getOther())) {
45690          openArray("_other");
45691          for (StringType e : element.getOther()) 
45692            composeStringExtras(null, e, true);
45693          closeArray();
45694      }
45695      };
45696  }
45697
45698  protected void composeImplementationGuideManifestResourceComponent(String name, ImplementationGuide.ManifestResourceComponent element) throws IOException {
45699    if (element != null) {
45700      open(name);
45701      composeImplementationGuideManifestResourceComponentInner(element);
45702      close();
45703    }
45704  }
45705
45706  protected void composeImplementationGuideManifestResourceComponentInner(ImplementationGuide.ManifestResourceComponent element) throws IOException {
45707      composeBackbone(element);
45708      if (element.hasReference()) {
45709        composeReference("reference", element.getReference());
45710      }
45711      if (element.hasExample()) {
45712        composeType("example", element.getExample());
45713      }
45714      if (element.hasRelativePathElement()) {
45715        composeUrlCore("relativePath", element.getRelativePathElement(), false);
45716        composeUrlExtras("relativePath", element.getRelativePathElement(), false);
45717      }
45718  }
45719
45720  protected void composeImplementationGuideManifestPageComponent(String name, ImplementationGuide.ManifestPageComponent element) throws IOException {
45721    if (element != null) {
45722      open(name);
45723      composeImplementationGuideManifestPageComponentInner(element);
45724      close();
45725    }
45726  }
45727
45728  protected void composeImplementationGuideManifestPageComponentInner(ImplementationGuide.ManifestPageComponent element) throws IOException {
45729      composeBackbone(element);
45730      if (element.hasNameElement()) {
45731        composeStringCore("name", element.getNameElement(), false);
45732        composeStringExtras("name", element.getNameElement(), false);
45733      }
45734      if (element.hasTitleElement()) {
45735        composeStringCore("title", element.getTitleElement(), false);
45736        composeStringExtras("title", element.getTitleElement(), false);
45737      }
45738      if (element.hasAnchor()) {
45739        openArray("anchor");
45740        for (StringType e : element.getAnchor()) 
45741          composeStringCore(null, e, true);
45742        closeArray();
45743        if (anyHasExtras(element.getAnchor())) {
45744          openArray("_anchor");
45745          for (StringType e : element.getAnchor()) 
45746            composeStringExtras(null, e, true);
45747          closeArray();
45748        }
45749      };
45750      }
45751
45752  protected void composeIngredient(String name, Ingredient element) throws IOException {
45753    if (element != null) {
45754      prop("resourceType", name);
45755      composeIngredientInner(element);
45756    }
45757  }
45758
45759  protected void composeIngredientInner(Ingredient element) throws IOException {
45760      composeDomainResourceElements(element);
45761      if (element.hasIdentifier()) {
45762        composeIdentifier("identifier", element.getIdentifier());
45763      }
45764      if (element.hasRole()) {
45765        composeCodeableConcept("role", element.getRole());
45766      }
45767      if (element.hasAllergenicIndicatorElement()) {
45768        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
45769        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
45770      }
45771      if (element.hasManufacturer()) {
45772        openArray("manufacturer");
45773        for (Reference e : element.getManufacturer()) 
45774          composeReference(null, e);
45775        closeArray();
45776      };
45777      if (element.hasSpecifiedSubstance()) {
45778        openArray("specifiedSubstance");
45779        for (Ingredient.IngredientSpecifiedSubstanceComponent e : element.getSpecifiedSubstance()) 
45780          composeIngredientIngredientSpecifiedSubstanceComponent(null, e);
45781        closeArray();
45782      };
45783      if (element.hasSubstance()) {
45784        composeIngredientIngredientSubstanceComponent("substance", element.getSubstance());
45785      }
45786      }
45787
45788  protected void composeIngredientIngredientSpecifiedSubstanceComponent(String name, Ingredient.IngredientSpecifiedSubstanceComponent element) throws IOException {
45789    if (element != null) {
45790      open(name);
45791      composeIngredientIngredientSpecifiedSubstanceComponentInner(element);
45792      close();
45793      }
45794      }
45795
45796  protected void composeIngredientIngredientSpecifiedSubstanceComponentInner(Ingredient.IngredientSpecifiedSubstanceComponent element) throws IOException {
45797      composeBackbone(element);
45798      if (element.hasCode()) {
45799        composeType("code", element.getCode());
45800      }
45801      if (element.hasGroup()) {
45802        composeCodeableConcept("group", element.getGroup());
45803      }
45804      if (element.hasConfidentiality()) {
45805        composeCodeableConcept("confidentiality", element.getConfidentiality());
45806      }
45807      if (element.hasStrength()) {
45808        openArray("strength");
45809        for (Ingredient.IngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
45810          composeIngredientIngredientSpecifiedSubstanceStrengthComponent(null, e);
45811        closeArray();
45812      };
45813  }
45814
45815  protected void composeIngredientIngredientSpecifiedSubstanceStrengthComponent(String name, Ingredient.IngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
45816    if (element != null) {
45817      open(name);
45818      composeIngredientIngredientSpecifiedSubstanceStrengthComponentInner(element);
45819      close();
45820    }
45821  }
45822
45823  protected void composeIngredientIngredientSpecifiedSubstanceStrengthComponentInner(Ingredient.IngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
45824      composeBackbone(element);
45825      if (element.hasPresentation()) {
45826        composeRatio("presentation", element.getPresentation());
45827      }
45828      if (element.hasPresentationHighLimit()) {
45829        composeRatio("presentationHighLimit", element.getPresentationHighLimit());
45830      }
45831      if (element.hasConcentration()) {
45832        composeRatio("concentration", element.getConcentration());
45833      }
45834      if (element.hasConcentrationHighLimit()) {
45835        composeRatio("concentrationHighLimit", element.getConcentrationHighLimit());
45836      }
45837      if (element.hasMeasurementPointElement()) {
45838        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
45839        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
45840      }
45841      if (element.hasCountry()) {
45842        openArray("country");
45843        for (CodeableConcept e : element.getCountry()) 
45844          composeCodeableConcept(null, e);
45845        closeArray();
45846      };
45847      if (element.hasReferenceStrength()) {
45848        openArray("referenceStrength");
45849        for (Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent e : element.getReferenceStrength()) 
45850          composeIngredientIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(null, e);
45851        closeArray();
45852      };
45853  }
45854
45855  protected void composeIngredientIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(String name, Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
45856    if (element != null) {
45857      open(name);
45858      composeIngredientIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(element);
45859      close();
45860    }
45861  }
45862
45863  protected void composeIngredientIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
45864      composeBackbone(element);
45865      if (element.hasSubstance()) {
45866        composeType("substance", element.getSubstance());
45867      }
45868      if (element.hasStrength()) {
45869        composeRatio("strength", element.getStrength());
45870      }
45871      if (element.hasStrengthHighLimit()) {
45872        composeRatio("strengthHighLimit", element.getStrengthHighLimit());
45873      }
45874      if (element.hasMeasurementPointElement()) {
45875        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
45876        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
45877      }
45878      if (element.hasCountry()) {
45879        openArray("country");
45880        for (CodeableConcept e : element.getCountry()) 
45881          composeCodeableConcept(null, e);
45882          closeArray();
45883      };
45884        }
45885
45886  protected void composeIngredientIngredientSubstanceComponent(String name, Ingredient.IngredientSubstanceComponent element) throws IOException {
45887    if (element != null) {
45888      open(name);
45889      composeIngredientIngredientSubstanceComponentInner(element);
45890      close();
45891      }
45892      }
45893
45894  protected void composeIngredientIngredientSubstanceComponentInner(Ingredient.IngredientSubstanceComponent element) throws IOException {
45895      composeBackbone(element);
45896      if (element.hasCode()) {
45897        composeType("code", element.getCode());
45898      }
45899      if (element.hasStrength()) {
45900        openArray("strength");
45901        for (Ingredient.IngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
45902          composeIngredientIngredientSpecifiedSubstanceStrengthComponent(null, e);
45903        closeArray();
45904      };
45905  }
45906
45907  protected void composeInsurancePlan(String name, InsurancePlan element) throws IOException {
45908    if (element != null) {
45909      prop("resourceType", name);
45910      composeInsurancePlanInner(element);
45911    }
45912  }
45913
45914  protected void composeInsurancePlanInner(InsurancePlan element) throws IOException {
45915      composeDomainResourceElements(element);
45916      if (element.hasIdentifier()) {
45917        openArray("identifier");
45918        for (Identifier e : element.getIdentifier()) 
45919          composeIdentifier(null, e);
45920        closeArray();
45921      };
45922      if (element.hasStatusElement()) {
45923        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45924        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45925      }
45926      if (element.hasType()) {
45927        openArray("type");
45928        for (CodeableConcept e : element.getType()) 
45929          composeCodeableConcept(null, e);
45930        closeArray();
45931      };
45932      if (element.hasNameElement()) {
45933        composeStringCore("name", element.getNameElement(), false);
45934        composeStringExtras("name", element.getNameElement(), false);
45935      }
45936      if (element.hasAlias()) {
45937        openArray("alias");
45938        for (StringType e : element.getAlias()) 
45939          composeStringCore(null, e, true);
45940        closeArray();
45941        if (anyHasExtras(element.getAlias())) {
45942          openArray("_alias");
45943          for (StringType e : element.getAlias()) 
45944            composeStringExtras(null, e, true);
45945        closeArray();
45946        }
45947      };
45948      if (element.hasPeriod()) {
45949        composePeriod("period", element.getPeriod());
45950      }
45951      if (element.hasOwnedBy()) {
45952        composeReference("ownedBy", element.getOwnedBy());
45953      }
45954      if (element.hasAdministeredBy()) {
45955        composeReference("administeredBy", element.getAdministeredBy());
45956      }
45957      if (element.hasCoverageArea()) {
45958        openArray("coverageArea");
45959        for (Reference e : element.getCoverageArea()) 
45960          composeReference(null, e);
45961        closeArray();
45962      };
45963      if (element.hasContact()) {
45964        openArray("contact");
45965        for (InsurancePlan.InsurancePlanContactComponent e : element.getContact()) 
45966          composeInsurancePlanInsurancePlanContactComponent(null, e);
45967        closeArray();
45968      };
45969      if (element.hasEndpoint()) {
45970        openArray("endpoint");
45971        for (Reference e : element.getEndpoint()) 
45972          composeReference(null, e);
45973        closeArray();
45974      };
45975      if (element.hasNetwork()) {
45976        openArray("network");
45977        for (Reference e : element.getNetwork()) 
45978          composeReference(null, e);
45979        closeArray();
45980      };
45981      if (element.hasCoverage()) {
45982        openArray("coverage");
45983        for (InsurancePlan.InsurancePlanCoverageComponent e : element.getCoverage()) 
45984          composeInsurancePlanInsurancePlanCoverageComponent(null, e);
45985        closeArray();
45986      };
45987      if (element.hasPlan()) {
45988        openArray("plan");
45989        for (InsurancePlan.InsurancePlanPlanComponent e : element.getPlan()) 
45990          composeInsurancePlanInsurancePlanPlanComponent(null, e);
45991        closeArray();
45992      };
45993        }
45994
45995  protected void composeInsurancePlanInsurancePlanContactComponent(String name, InsurancePlan.InsurancePlanContactComponent element) throws IOException {
45996    if (element != null) {
45997      open(name);
45998      composeInsurancePlanInsurancePlanContactComponentInner(element);
45999      close();
46000    }
46001      }
46002
46003  protected void composeInsurancePlanInsurancePlanContactComponentInner(InsurancePlan.InsurancePlanContactComponent element) throws IOException {
46004      composeBackbone(element);
46005      if (element.hasPurpose()) {
46006        composeCodeableConcept("purpose", element.getPurpose());
46007      }
46008      if (element.hasName()) {
46009        composeHumanName("name", element.getName());
46010      }
46011      if (element.hasTelecom()) {
46012        openArray("telecom");
46013        for (ContactPoint e : element.getTelecom()) 
46014          composeContactPoint(null, e);
46015        closeArray();
46016      };
46017      if (element.hasAddress()) {
46018        composeAddress("address", element.getAddress());
46019      }
46020      }
46021
46022  protected void composeInsurancePlanInsurancePlanCoverageComponent(String name, InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
46023    if (element != null) {
46024      open(name);
46025      composeInsurancePlanInsurancePlanCoverageComponentInner(element);
46026      close();
46027      }
46028      }
46029
46030  protected void composeInsurancePlanInsurancePlanCoverageComponentInner(InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
46031      composeBackbone(element);
46032      if (element.hasType()) {
46033        composeCodeableConcept("type", element.getType());
46034      }
46035      if (element.hasNetwork()) {
46036        openArray("network");
46037        for (Reference e : element.getNetwork()) 
46038          composeReference(null, e);
46039        closeArray();
46040      };
46041      if (element.hasBenefit()) {
46042        openArray("benefit");
46043        for (InsurancePlan.CoverageBenefitComponent e : element.getBenefit()) 
46044          composeInsurancePlanCoverageBenefitComponent(null, e);
46045          closeArray();
46046      };
46047  }
46048
46049  protected void composeInsurancePlanCoverageBenefitComponent(String name, InsurancePlan.CoverageBenefitComponent element) throws IOException {
46050    if (element != null) {
46051      open(name);
46052      composeInsurancePlanCoverageBenefitComponentInner(element);
46053      close();
46054    }
46055  }
46056
46057  protected void composeInsurancePlanCoverageBenefitComponentInner(InsurancePlan.CoverageBenefitComponent element) throws IOException {
46058      composeBackbone(element);
46059      if (element.hasType()) {
46060        composeCodeableConcept("type", element.getType());
46061        }
46062      if (element.hasRequirementElement()) {
46063        composeStringCore("requirement", element.getRequirementElement(), false);
46064        composeStringExtras("requirement", element.getRequirementElement(), false);
46065      }
46066      if (element.hasLimit()) {
46067        openArray("limit");
46068        for (InsurancePlan.CoverageBenefitLimitComponent e : element.getLimit()) 
46069          composeInsurancePlanCoverageBenefitLimitComponent(null, e);
46070        closeArray();
46071      };
46072  }
46073
46074  protected void composeInsurancePlanCoverageBenefitLimitComponent(String name, InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
46075    if (element != null) {
46076      open(name);
46077      composeInsurancePlanCoverageBenefitLimitComponentInner(element);
46078      close();
46079    }
46080  }
46081
46082  protected void composeInsurancePlanCoverageBenefitLimitComponentInner(InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
46083      composeBackbone(element);
46084      if (element.hasValue()) {
46085        composeQuantity("value", element.getValue());
46086      }
46087      if (element.hasCode()) {
46088        composeCodeableConcept("code", element.getCode());
46089      }
46090      }
46091
46092  protected void composeInsurancePlanInsurancePlanPlanComponent(String name, InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
46093    if (element != null) {
46094      open(name);
46095      composeInsurancePlanInsurancePlanPlanComponentInner(element);
46096      close();
46097    }
46098  }
46099
46100  protected void composeInsurancePlanInsurancePlanPlanComponentInner(InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
46101      composeBackbone(element);
46102      if (element.hasIdentifier()) {
46103        openArray("identifier");
46104        for (Identifier e : element.getIdentifier()) 
46105          composeIdentifier(null, e);
46106        closeArray();
46107      };
46108      if (element.hasType()) {
46109        composeCodeableConcept("type", element.getType());
46110      }
46111      if (element.hasCoverageArea()) {
46112        openArray("coverageArea");
46113        for (Reference e : element.getCoverageArea()) 
46114          composeReference(null, e);
46115        closeArray();
46116      };
46117      if (element.hasNetwork()) {
46118        openArray("network");
46119        for (Reference e : element.getNetwork()) 
46120          composeReference(null, e);
46121        closeArray();
46122      };
46123      if (element.hasGeneralCost()) {
46124        openArray("generalCost");
46125        for (InsurancePlan.InsurancePlanPlanGeneralCostComponent e : element.getGeneralCost()) 
46126          composeInsurancePlanInsurancePlanPlanGeneralCostComponent(null, e);
46127        closeArray();
46128      };
46129      if (element.hasSpecificCost()) {
46130        openArray("specificCost");
46131        for (InsurancePlan.InsurancePlanPlanSpecificCostComponent e : element.getSpecificCost()) 
46132          composeInsurancePlanInsurancePlanPlanSpecificCostComponent(null, e);
46133        closeArray();
46134      };
46135  }
46136
46137  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponent(String name, InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
46138    if (element != null) {
46139      open(name);
46140      composeInsurancePlanInsurancePlanPlanGeneralCostComponentInner(element);
46141      close();
46142    }
46143  }
46144
46145  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponentInner(InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
46146      composeBackbone(element);
46147      if (element.hasType()) {
46148        composeCodeableConcept("type", element.getType());
46149      }
46150      if (element.hasGroupSizeElement()) {
46151        composePositiveIntCore("groupSize", element.getGroupSizeElement(), false);
46152        composePositiveIntExtras("groupSize", element.getGroupSizeElement(), false);
46153      }
46154      if (element.hasCost()) {
46155        composeMoney("cost", element.getCost());
46156      }
46157      if (element.hasCommentElement()) {
46158        composeStringCore("comment", element.getCommentElement(), false);
46159        composeStringExtras("comment", element.getCommentElement(), false);
46160      }
46161  }
46162
46163  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponent(String name, InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
46164    if (element != null) {
46165      open(name);
46166      composeInsurancePlanInsurancePlanPlanSpecificCostComponentInner(element);
46167      close();
46168    }
46169  }
46170
46171  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponentInner(InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
46172      composeBackbone(element);
46173      if (element.hasCategory()) {
46174        composeCodeableConcept("category", element.getCategory());
46175      }
46176      if (element.hasBenefit()) {
46177        openArray("benefit");
46178        for (InsurancePlan.PlanBenefitComponent e : element.getBenefit()) 
46179          composeInsurancePlanPlanBenefitComponent(null, e);
46180        closeArray();
46181      };
46182  }
46183
46184  protected void composeInsurancePlanPlanBenefitComponent(String name, InsurancePlan.PlanBenefitComponent element) throws IOException {
46185    if (element != null) {
46186      open(name);
46187      composeInsurancePlanPlanBenefitComponentInner(element);
46188      close();
46189    }
46190  }
46191
46192  protected void composeInsurancePlanPlanBenefitComponentInner(InsurancePlan.PlanBenefitComponent element) throws IOException {
46193      composeBackbone(element);
46194      if (element.hasType()) {
46195        composeCodeableConcept("type", element.getType());
46196      }
46197      if (element.hasCost()) {
46198        openArray("cost");
46199        for (InsurancePlan.PlanBenefitCostComponent e : element.getCost()) 
46200          composeInsurancePlanPlanBenefitCostComponent(null, e);
46201        closeArray();
46202      };
46203  }
46204
46205  protected void composeInsurancePlanPlanBenefitCostComponent(String name, InsurancePlan.PlanBenefitCostComponent element) throws IOException {
46206    if (element != null) {
46207      open(name);
46208      composeInsurancePlanPlanBenefitCostComponentInner(element);
46209      close();
46210    }
46211  }
46212
46213  protected void composeInsurancePlanPlanBenefitCostComponentInner(InsurancePlan.PlanBenefitCostComponent element) throws IOException {
46214      composeBackbone(element);
46215      if (element.hasType()) {
46216        composeCodeableConcept("type", element.getType());
46217      }
46218      if (element.hasApplicability()) {
46219        composeCodeableConcept("applicability", element.getApplicability());
46220      }
46221      if (element.hasQualifiers()) {
46222        openArray("qualifiers");
46223        for (CodeableConcept e : element.getQualifiers()) 
46224          composeCodeableConcept(null, e);
46225        closeArray();
46226      };
46227      if (element.hasValue()) {
46228        composeQuantity("value", element.getValue());
46229      }
46230  }
46231
46232  protected void composeInvoice(String name, Invoice element) throws IOException {
46233    if (element != null) {
46234      prop("resourceType", name);
46235      composeInvoiceInner(element);
46236    }
46237  }
46238
46239  protected void composeInvoiceInner(Invoice element) throws IOException {
46240      composeDomainResourceElements(element);
46241      if (element.hasIdentifier()) {
46242        openArray("identifier");
46243        for (Identifier e : element.getIdentifier()) 
46244          composeIdentifier(null, e);
46245        closeArray();
46246      };
46247      if (element.hasStatusElement()) {
46248        composeEnumerationCore("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
46249        composeEnumerationExtras("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
46250      }
46251      if (element.hasCancelledReasonElement()) {
46252        composeStringCore("cancelledReason", element.getCancelledReasonElement(), false);
46253        composeStringExtras("cancelledReason", element.getCancelledReasonElement(), false);
46254      }
46255      if (element.hasType()) {
46256        composeCodeableConcept("type", element.getType());
46257      }
46258      if (element.hasSubject()) {
46259        composeReference("subject", element.getSubject());
46260      }
46261      if (element.hasRecipient()) {
46262        composeReference("recipient", element.getRecipient());
46263      }
46264      if (element.hasDateElement()) {
46265        composeDateTimeCore("date", element.getDateElement(), false);
46266        composeDateTimeExtras("date", element.getDateElement(), false);
46267      }
46268      if (element.hasParticipant()) {
46269        openArray("participant");
46270        for (Invoice.InvoiceParticipantComponent e : element.getParticipant()) 
46271          composeInvoiceInvoiceParticipantComponent(null, e);
46272        closeArray();
46273      };
46274      if (element.hasIssuer()) {
46275        composeReference("issuer", element.getIssuer());
46276      }
46277      if (element.hasAccount()) {
46278        composeReference("account", element.getAccount());
46279      }
46280      if (element.hasLineItem()) {
46281        openArray("lineItem");
46282        for (Invoice.InvoiceLineItemComponent e : element.getLineItem()) 
46283          composeInvoiceInvoiceLineItemComponent(null, e);
46284        closeArray();
46285      };
46286      if (element.hasTotalPriceComponent()) {
46287        openArray("totalPriceComponent");
46288        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getTotalPriceComponent()) 
46289          composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
46290        closeArray();
46291      };
46292      if (element.hasTotalNet()) {
46293        composeMoney("totalNet", element.getTotalNet());
46294  }
46295      if (element.hasTotalGross()) {
46296        composeMoney("totalGross", element.getTotalGross());
46297    }
46298      if (element.hasPaymentTermsElement()) {
46299        composeMarkdownCore("paymentTerms", element.getPaymentTermsElement(), false);
46300        composeMarkdownExtras("paymentTerms", element.getPaymentTermsElement(), false);
46301  }
46302      if (element.hasNote()) {
46303        openArray("note");
46304        for (Annotation e : element.getNote()) 
46305          composeAnnotation(null, e);
46306        closeArray();
46307      };
46308  }
46309
46310  protected void composeInvoiceInvoiceParticipantComponent(String name, Invoice.InvoiceParticipantComponent element) throws IOException {
46311    if (element != null) {
46312      open(name);
46313      composeInvoiceInvoiceParticipantComponentInner(element);
46314      close();
46315    }
46316  }
46317
46318  protected void composeInvoiceInvoiceParticipantComponentInner(Invoice.InvoiceParticipantComponent element) throws IOException {
46319      composeBackbone(element);
46320      if (element.hasRole()) {
46321        composeCodeableConcept("role", element.getRole());
46322      }
46323      if (element.hasActor()) {
46324        composeReference("actor", element.getActor());
46325      }
46326  }
46327
46328  protected void composeInvoiceInvoiceLineItemComponent(String name, Invoice.InvoiceLineItemComponent element) throws IOException {
46329    if (element != null) {
46330      open(name);
46331      composeInvoiceInvoiceLineItemComponentInner(element);
46332      close();
46333    }
46334  }
46335
46336  protected void composeInvoiceInvoiceLineItemComponentInner(Invoice.InvoiceLineItemComponent element) throws IOException {
46337      composeBackbone(element);
46338      if (element.hasSequenceElement()) {
46339        composePositiveIntCore("sequence", element.getSequenceElement(), false);
46340        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
46341  }
46342      if (element.hasChargeItem()) {
46343        composeType("chargeItem", element.getChargeItem());
46344    }
46345      if (element.hasPriceComponent()) {
46346        openArray("priceComponent");
46347        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getPriceComponent()) 
46348          composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
46349        closeArray();
46350      };
46351  }
46352
46353  protected void composeInvoiceInvoiceLineItemPriceComponentComponent(String name, Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
46354    if (element != null) {
46355      open(name);
46356      composeInvoiceInvoiceLineItemPriceComponentComponentInner(element);
46357      close();
46358    }
46359  }
46360
46361  protected void composeInvoiceInvoiceLineItemPriceComponentComponentInner(Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
46362      composeBackbone(element);
46363      if (element.hasTypeElement()) {
46364        composeEnumerationCore("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(), false);
46365        composeEnumerationExtras("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(), false);
46366    }
46367      if (element.hasCode()) {
46368        composeCodeableConcept("code", element.getCode());
46369      }
46370      if (element.hasFactorElement()) {
46371        composeDecimalCore("factor", element.getFactorElement(), false);
46372        composeDecimalExtras("factor", element.getFactorElement(), false);
46373      }
46374      if (element.hasAmount()) {
46375        composeMoney("amount", element.getAmount());
46376      }
46377  }
46378
46379  protected void composeLibrary(String name, Library element) throws IOException {
46380    if (element != null) {
46381      prop("resourceType", name);
46382      composeLibraryInner(element);
46383    }
46384  }
46385
46386  protected void composeLibraryInner(Library element) throws IOException {
46387      composeDomainResourceElements(element);
46388      if (element.hasUrlElement()) {
46389        composeUriCore("url", element.getUrlElement(), false);
46390        composeUriExtras("url", element.getUrlElement(), false);
46391      }
46392      if (element.hasIdentifier()) {
46393        openArray("identifier");
46394        for (Identifier e : element.getIdentifier()) 
46395          composeIdentifier(null, e);
46396        closeArray();
46397      };
46398      if (element.hasVersionElement()) {
46399        composeStringCore("version", element.getVersionElement(), false);
46400        composeStringExtras("version", element.getVersionElement(), false);
46401      }
46402      if (element.hasNameElement()) {
46403        composeStringCore("name", element.getNameElement(), false);
46404        composeStringExtras("name", element.getNameElement(), false);
46405      }
46406      if (element.hasTitleElement()) {
46407        composeStringCore("title", element.getTitleElement(), false);
46408        composeStringExtras("title", element.getTitleElement(), false);
46409      }
46410      if (element.hasSubtitleElement()) {
46411        composeStringCore("subtitle", element.getSubtitleElement(), false);
46412        composeStringExtras("subtitle", element.getSubtitleElement(), false);
46413      }
46414      if (element.hasStatusElement()) {
46415        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46416        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46417      }
46418      if (element.hasExperimentalElement()) {
46419        composeBooleanCore("experimental", element.getExperimentalElement(), false);
46420        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
46421      }
46422      if (element.hasType()) {
46423        composeCodeableConcept("type", element.getType());
46424      }
46425      if (element.hasSubject()) {
46426        composeType("subject", element.getSubject());
46427      }
46428      if (element.hasDateElement()) {
46429        composeDateTimeCore("date", element.getDateElement(), false);
46430        composeDateTimeExtras("date", element.getDateElement(), false);
46431      }
46432      if (element.hasPublisherElement()) {
46433        composeStringCore("publisher", element.getPublisherElement(), false);
46434        composeStringExtras("publisher", element.getPublisherElement(), false);
46435      }
46436      if (element.hasContact()) {
46437        openArray("contact");
46438        for (ContactDetail e : element.getContact()) 
46439          composeContactDetail(null, e);
46440        closeArray();
46441      };
46442      if (element.hasDescriptionElement()) {
46443        composeMarkdownCore("description", element.getDescriptionElement(), false);
46444        composeMarkdownExtras("description", element.getDescriptionElement(), false);
46445      }
46446      if (element.hasUseContext()) {
46447        openArray("useContext");
46448        for (UsageContext e : element.getUseContext()) 
46449          composeUsageContext(null, e);
46450        closeArray();
46451      };
46452      if (element.hasJurisdiction()) {
46453        openArray("jurisdiction");
46454        for (CodeableConcept e : element.getJurisdiction()) 
46455          composeCodeableConcept(null, e);
46456        closeArray();
46457      };
46458      if (element.hasPurposeElement()) {
46459        composeMarkdownCore("purpose", element.getPurposeElement(), false);
46460        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
46461      }
46462      if (element.hasUsageElement()) {
46463        composeStringCore("usage", element.getUsageElement(), false);
46464        composeStringExtras("usage", element.getUsageElement(), false);
46465      }
46466      if (element.hasCopyrightElement()) {
46467        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
46468        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
46469      }
46470      if (element.hasApprovalDateElement()) {
46471        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
46472        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
46473      }
46474      if (element.hasLastReviewDateElement()) {
46475        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
46476        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
46477      }
46478      if (element.hasEffectivePeriod()) {
46479        composePeriod("effectivePeriod", element.getEffectivePeriod());
46480      }
46481      if (element.hasTopic()) {
46482        openArray("topic");
46483        for (CodeableConcept e : element.getTopic()) 
46484          composeCodeableConcept(null, e);
46485        closeArray();
46486      };
46487      if (element.hasAuthor()) {
46488        openArray("author");
46489        for (ContactDetail e : element.getAuthor()) 
46490          composeContactDetail(null, e);
46491        closeArray();
46492      };
46493      if (element.hasEditor()) {
46494        openArray("editor");
46495        for (ContactDetail e : element.getEditor()) 
46496          composeContactDetail(null, e);
46497        closeArray();
46498      };
46499      if (element.hasReviewer()) {
46500        openArray("reviewer");
46501        for (ContactDetail e : element.getReviewer()) 
46502          composeContactDetail(null, e);
46503        closeArray();
46504      };
46505      if (element.hasEndorser()) {
46506        openArray("endorser");
46507        for (ContactDetail e : element.getEndorser()) 
46508          composeContactDetail(null, e);
46509        closeArray();
46510      };
46511      if (element.hasRelatedArtifact()) {
46512        openArray("relatedArtifact");
46513        for (RelatedArtifact e : element.getRelatedArtifact()) 
46514          composeRelatedArtifact(null, e);
46515        closeArray();
46516      };
46517      if (element.hasParameter()) {
46518        openArray("parameter");
46519        for (ParameterDefinition e : element.getParameter()) 
46520          composeParameterDefinition(null, e);
46521        closeArray();
46522      };
46523      if (element.hasDataRequirement()) {
46524        openArray("dataRequirement");
46525        for (DataRequirement e : element.getDataRequirement()) 
46526          composeDataRequirement(null, e);
46527        closeArray();
46528      };
46529      if (element.hasContent()) {
46530        openArray("content");
46531        for (Attachment e : element.getContent()) 
46532          composeAttachment(null, e);
46533        closeArray();
46534      };
46535  }
46536
46537  protected void composeLinkage(String name, Linkage element) throws IOException {
46538    if (element != null) {
46539      prop("resourceType", name);
46540      composeLinkageInner(element);
46541    }
46542  }
46543
46544  protected void composeLinkageInner(Linkage element) throws IOException {
46545      composeDomainResourceElements(element);
46546      if (element.hasActiveElement()) {
46547        composeBooleanCore("active", element.getActiveElement(), false);
46548        composeBooleanExtras("active", element.getActiveElement(), false);
46549      }
46550      if (element.hasAuthor()) {
46551        composeReference("author", element.getAuthor());
46552      }
46553      if (element.hasItem()) {
46554        openArray("item");
46555        for (Linkage.LinkageItemComponent e : element.getItem()) 
46556          composeLinkageLinkageItemComponent(null, e);
46557        closeArray();
46558      };
46559  }
46560
46561  protected void composeLinkageLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
46562    if (element != null) {
46563      open(name);
46564      composeLinkageLinkageItemComponentInner(element);
46565      close();
46566    }
46567  }
46568
46569  protected void composeLinkageLinkageItemComponentInner(Linkage.LinkageItemComponent element) throws IOException {
46570      composeBackbone(element);
46571      if (element.hasTypeElement()) {
46572        composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
46573        composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
46574      }
46575      if (element.hasResource()) {
46576        composeReference("resource", element.getResource());
46577      }
46578  }
46579
46580  protected void composeListResource(String name, ListResource element) throws IOException {
46581    if (element != null) {
46582      prop("resourceType", name);
46583      composeListResourceInner(element);
46584    }
46585  }
46586
46587  protected void composeListResourceInner(ListResource element) throws IOException {
46588      composeDomainResourceElements(element);
46589      if (element.hasIdentifier()) {
46590        openArray("identifier");
46591        for (Identifier e : element.getIdentifier()) 
46592          composeIdentifier(null, e);
46593        closeArray();
46594      };
46595      if (element.hasStatusElement()) {
46596        composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
46597        composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
46598        }
46599      if (element.hasModeElement()) {
46600        composeEnumerationCore("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
46601        composeEnumerationExtras("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
46602      }
46603      if (element.hasTitleElement()) {
46604        composeStringCore("title", element.getTitleElement(), false);
46605        composeStringExtras("title", element.getTitleElement(), false);
46606      }
46607      if (element.hasCode()) {
46608        composeCodeableConcept("code", element.getCode());
46609      }
46610      if (element.hasSubject()) {
46611        composeReference("subject", element.getSubject());
46612      }
46613      if (element.hasEncounter()) {
46614        composeReference("encounter", element.getEncounter());
46615      }
46616      if (element.hasDateElement()) {
46617        composeDateTimeCore("date", element.getDateElement(), false);
46618        composeDateTimeExtras("date", element.getDateElement(), false);
46619      }
46620      if (element.hasSource()) {
46621        composeReference("source", element.getSource());
46622      }
46623      if (element.hasOrderedBy()) {
46624        composeCodeableConcept("orderedBy", element.getOrderedBy());
46625      }
46626      if (element.hasNote()) {
46627        openArray("note");
46628        for (Annotation e : element.getNote()) 
46629          composeAnnotation(null, e);
46630        closeArray();
46631      };
46632      if (element.hasEntry()) {
46633        openArray("entry");
46634        for (ListResource.ListEntryComponent e : element.getEntry()) 
46635          composeListResourceListEntryComponent(null, e);
46636        closeArray();
46637      };
46638      if (element.hasEmptyReason()) {
46639        composeCodeableConcept("emptyReason", element.getEmptyReason());
46640    }
46641  }
46642
46643  protected void composeListResourceListEntryComponent(String name, ListResource.ListEntryComponent element) throws IOException {
46644    if (element != null) {
46645      open(name);
46646      composeListResourceListEntryComponentInner(element);
46647      close();
46648    }
46649  }
46650
46651  protected void composeListResourceListEntryComponentInner(ListResource.ListEntryComponent element) throws IOException {
46652      composeBackbone(element);
46653      if (element.hasFlag()) {
46654        composeCodeableConcept("flag", element.getFlag());
46655      }
46656      if (element.hasDeletedElement()) {
46657        composeBooleanCore("deleted", element.getDeletedElement(), false);
46658        composeBooleanExtras("deleted", element.getDeletedElement(), false);
46659      }
46660      if (element.hasDateElement()) {
46661        composeDateTimeCore("date", element.getDateElement(), false);
46662        composeDateTimeExtras("date", element.getDateElement(), false);
46663      }
46664      if (element.hasItem()) {
46665        composeReference("item", element.getItem());
46666      }
46667  }
46668
46669  protected void composeLocation(String name, Location element) throws IOException {
46670    if (element != null) {
46671      prop("resourceType", name);
46672      composeLocationInner(element);
46673    }
46674  }
46675
46676  protected void composeLocationInner(Location element) throws IOException {
46677      composeDomainResourceElements(element);
46678      if (element.hasIdentifier()) {
46679        openArray("identifier");
46680        for (Identifier e : element.getIdentifier()) 
46681          composeIdentifier(null, e);
46682        closeArray();
46683      };
46684      if (element.hasStatusElement()) {
46685        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
46686        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
46687      }
46688      if (element.hasOperationalStatus()) {
46689        composeCoding("operationalStatus", element.getOperationalStatus());
46690      }
46691      if (element.hasNameElement()) {
46692        composeStringCore("name", element.getNameElement(), false);
46693        composeStringExtras("name", element.getNameElement(), false);
46694      }
46695      if (element.hasAlias()) {
46696        openArray("alias");
46697        for (StringType e : element.getAlias()) 
46698          composeStringCore(null, e, true);
46699        closeArray();
46700        if (anyHasExtras(element.getAlias())) {
46701          openArray("_alias");
46702          for (StringType e : element.getAlias()) 
46703            composeStringExtras(null, e, true);
46704          closeArray();
46705      }
46706      };
46707      if (element.hasDescriptionElement()) {
46708        composeStringCore("description", element.getDescriptionElement(), false);
46709        composeStringExtras("description", element.getDescriptionElement(), false);
46710      }
46711      if (element.hasModeElement()) {
46712        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
46713        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
46714      }
46715      if (element.hasType()) {
46716        openArray("type");
46717        for (CodeableConcept e : element.getType()) 
46718          composeCodeableConcept(null, e);
46719        closeArray();
46720      };
46721      if (element.hasTelecom()) {
46722        openArray("telecom");
46723        for (ContactPoint e : element.getTelecom()) 
46724          composeContactPoint(null, e);
46725        closeArray();
46726      };
46727      if (element.hasAddress()) {
46728        composeAddress("address", element.getAddress());
46729      }
46730      if (element.hasPhysicalType()) {
46731        composeCodeableConcept("physicalType", element.getPhysicalType());
46732      }
46733      if (element.hasPosition()) {
46734        composeLocationLocationPositionComponent("position", element.getPosition());
46735      }
46736      if (element.hasManagingOrganization()) {
46737        composeReference("managingOrganization", element.getManagingOrganization());
46738      }
46739      if (element.hasPartOf()) {
46740        composeReference("partOf", element.getPartOf());
46741      }
46742      if (element.hasHoursOfOperation()) {
46743        openArray("hoursOfOperation");
46744        for (Location.LocationHoursOfOperationComponent e : element.getHoursOfOperation()) 
46745          composeLocationLocationHoursOfOperationComponent(null, e);
46746        closeArray();
46747      };
46748      if (element.hasAvailabilityExceptionsElement()) {
46749        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
46750        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
46751      }
46752      if (element.hasEndpoint()) {
46753        openArray("endpoint");
46754        for (Reference e : element.getEndpoint()) 
46755          composeReference(null, e);
46756        closeArray();
46757      };
46758  }
46759
46760  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
46761    if (element != null) {
46762      open(name);
46763      composeLocationLocationPositionComponentInner(element);
46764      close();
46765    }
46766  }
46767
46768  protected void composeLocationLocationPositionComponentInner(Location.LocationPositionComponent element) throws IOException {
46769      composeBackbone(element);
46770      if (element.hasLongitudeElement()) {
46771        composeDecimalCore("longitude", element.getLongitudeElement(), false);
46772        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
46773      }
46774      if (element.hasLatitudeElement()) {
46775        composeDecimalCore("latitude", element.getLatitudeElement(), false);
46776        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
46777      }
46778      if (element.hasAltitudeElement()) {
46779        composeDecimalCore("altitude", element.getAltitudeElement(), false);
46780        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
46781      }
46782  }
46783
46784  protected void composeLocationLocationHoursOfOperationComponent(String name, Location.LocationHoursOfOperationComponent element) throws IOException {
46785    if (element != null) {
46786      open(name);
46787      composeLocationLocationHoursOfOperationComponentInner(element);
46788      close();
46789    }
46790  }
46791
46792  protected void composeLocationLocationHoursOfOperationComponentInner(Location.LocationHoursOfOperationComponent element) throws IOException {
46793      composeBackbone(element);
46794      if (element.hasDaysOfWeek()) {
46795        openArray("daysOfWeek");
46796        for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek()) 
46797          composeEnumerationCore(null, e, new Location.DaysOfWeekEnumFactory(), true);
46798        closeArray();
46799        if (anyHasExtras(element.getDaysOfWeek())) {
46800          openArray("_daysOfWeek");
46801          for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek()) 
46802            composeEnumerationExtras(null, e, new Location.DaysOfWeekEnumFactory(), true);
46803          closeArray();
46804        }
46805      };
46806      if (element.hasAllDayElement()) {
46807        composeBooleanCore("allDay", element.getAllDayElement(), false);
46808        composeBooleanExtras("allDay", element.getAllDayElement(), false);
46809      }
46810      if (element.hasOpeningTimeElement()) {
46811        composeTimeCore("openingTime", element.getOpeningTimeElement(), false);
46812        composeTimeExtras("openingTime", element.getOpeningTimeElement(), false);
46813      }
46814      if (element.hasClosingTimeElement()) {
46815        composeTimeCore("closingTime", element.getClosingTimeElement(), false);
46816        composeTimeExtras("closingTime", element.getClosingTimeElement(), false);
46817      }
46818  }
46819
46820  protected void composeManufacturedItemDefinition(String name, ManufacturedItemDefinition element) throws IOException {
46821    if (element != null) {
46822      prop("resourceType", name);
46823      composeManufacturedItemDefinitionInner(element);
46824    }
46825  }
46826
46827  protected void composeManufacturedItemDefinitionInner(ManufacturedItemDefinition element) throws IOException {
46828      composeDomainResourceElements(element);
46829      if (element.hasManufacturedDoseForm()) {
46830        composeCodeableConcept("manufacturedDoseForm", element.getManufacturedDoseForm());
46831      }
46832      if (element.hasUnitOfPresentation()) {
46833        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
46834      }
46835      if (element.hasManufacturer()) {
46836        openArray("manufacturer");
46837        for (Reference e : element.getManufacturer()) 
46838          composeReference(null, e);
46839        closeArray();
46840      };
46841      if (element.hasIngredient()) {
46842        openArray("ingredient");
46843        for (Reference e : element.getIngredient()) 
46844          composeReference(null, e);
46845        closeArray();
46846      };
46847      if (element.hasPhysicalCharacteristics()) {
46848        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
46849      }
46850      if (element.hasOtherCharacteristics()) {
46851        openArray("otherCharacteristics");
46852        for (CodeableConcept e : element.getOtherCharacteristics()) 
46853          composeCodeableConcept(null, e);
46854        closeArray();
46855      };
46856  }
46857
46858  protected void composeMeasure(String name, Measure element) throws IOException {
46859    if (element != null) {
46860      prop("resourceType", name);
46861      composeMeasureInner(element);
46862    }
46863  }
46864
46865  protected void composeMeasureInner(Measure element) throws IOException {
46866      composeDomainResourceElements(element);
46867      if (element.hasUrlElement()) {
46868        composeUriCore("url", element.getUrlElement(), false);
46869        composeUriExtras("url", element.getUrlElement(), false);
46870      }
46871      if (element.hasIdentifier()) {
46872        openArray("identifier");
46873        for (Identifier e : element.getIdentifier()) 
46874          composeIdentifier(null, e);
46875        closeArray();
46876      };
46877      if (element.hasVersionElement()) {
46878        composeStringCore("version", element.getVersionElement(), false);
46879        composeStringExtras("version", element.getVersionElement(), false);
46880      }
46881      if (element.hasNameElement()) {
46882        composeStringCore("name", element.getNameElement(), false);
46883        composeStringExtras("name", element.getNameElement(), false);
46884    }
46885      if (element.hasTitleElement()) {
46886        composeStringCore("title", element.getTitleElement(), false);
46887        composeStringExtras("title", element.getTitleElement(), false);
46888  }
46889      if (element.hasSubtitleElement()) {
46890        composeStringCore("subtitle", element.getSubtitleElement(), false);
46891        composeStringExtras("subtitle", element.getSubtitleElement(), false);
46892      }
46893      if (element.hasStatusElement()) {
46894        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46895        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46896      }
46897      if (element.hasExperimentalElement()) {
46898        composeBooleanCore("experimental", element.getExperimentalElement(), false);
46899        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
46900      }
46901      if (element.hasSubject()) {
46902        composeType("subject", element.getSubject());
46903      }
46904      if (element.hasDateElement()) {
46905        composeDateTimeCore("date", element.getDateElement(), false);
46906        composeDateTimeExtras("date", element.getDateElement(), false);
46907      }
46908      if (element.hasPublisherElement()) {
46909        composeStringCore("publisher", element.getPublisherElement(), false);
46910        composeStringExtras("publisher", element.getPublisherElement(), false);
46911      }
46912      if (element.hasContact()) {
46913        openArray("contact");
46914        for (ContactDetail e : element.getContact()) 
46915          composeContactDetail(null, e);
46916          closeArray();
46917      };
46918      if (element.hasDescriptionElement()) {
46919        composeMarkdownCore("description", element.getDescriptionElement(), false);
46920        composeMarkdownExtras("description", element.getDescriptionElement(), false);
46921        }
46922      if (element.hasUseContext()) {
46923        openArray("useContext");
46924        for (UsageContext e : element.getUseContext()) 
46925          composeUsageContext(null, e);
46926        closeArray();
46927      };
46928      if (element.hasJurisdiction()) {
46929        openArray("jurisdiction");
46930        for (CodeableConcept e : element.getJurisdiction()) 
46931          composeCodeableConcept(null, e);
46932        closeArray();
46933      };
46934      if (element.hasPurposeElement()) {
46935        composeMarkdownCore("purpose", element.getPurposeElement(), false);
46936        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
46937      }
46938      if (element.hasUsageElement()) {
46939        composeStringCore("usage", element.getUsageElement(), false);
46940        composeStringExtras("usage", element.getUsageElement(), false);
46941      }
46942      if (element.hasCopyrightElement()) {
46943        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
46944        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
46945      }
46946      if (element.hasApprovalDateElement()) {
46947        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
46948        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
46949      }
46950      if (element.hasLastReviewDateElement()) {
46951        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
46952        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
46953      }
46954      if (element.hasEffectivePeriod()) {
46955        composePeriod("effectivePeriod", element.getEffectivePeriod());
46956      }
46957      if (element.hasTopic()) {
46958        openArray("topic");
46959        for (CodeableConcept e : element.getTopic()) 
46960          composeCodeableConcept(null, e);
46961        closeArray();
46962      };
46963      if (element.hasAuthor()) {
46964        openArray("author");
46965        for (ContactDetail e : element.getAuthor()) 
46966          composeContactDetail(null, e);
46967        closeArray();
46968      };
46969      if (element.hasEditor()) {
46970        openArray("editor");
46971        for (ContactDetail e : element.getEditor()) 
46972          composeContactDetail(null, e);
46973        closeArray();
46974      };
46975      if (element.hasReviewer()) {
46976        openArray("reviewer");
46977        for (ContactDetail e : element.getReviewer()) 
46978          composeContactDetail(null, e);
46979        closeArray();
46980      };
46981      if (element.hasEndorser()) {
46982        openArray("endorser");
46983        for (ContactDetail e : element.getEndorser()) 
46984          composeContactDetail(null, e);
46985        closeArray();
46986      };
46987      if (element.hasRelatedArtifact()) {
46988        openArray("relatedArtifact");
46989        for (RelatedArtifact e : element.getRelatedArtifact()) 
46990          composeRelatedArtifact(null, e);
46991        closeArray();
46992      };
46993      if (element.hasLibrary()) {
46994        openArray("library");
46995        for (CanonicalType e : element.getLibrary()) 
46996          composeCanonicalCore(null, e, true);
46997        closeArray();
46998        if (anyHasExtras(element.getLibrary())) {
46999          openArray("_library");
47000          for (CanonicalType e : element.getLibrary()) 
47001            composeCanonicalExtras(null, e, true);
47002          closeArray();
47003        }
47004      };
47005      if (element.hasDisclaimerElement()) {
47006        composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
47007        composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
47008      }
47009      if (element.hasScoring()) {
47010        composeCodeableConcept("scoring", element.getScoring());
47011      }
47012      if (element.hasCompositeScoring()) {
47013        composeCodeableConcept("compositeScoring", element.getCompositeScoring());
47014      }
47015      if (element.hasType()) {
47016        openArray("type");
47017        for (CodeableConcept e : element.getType()) 
47018          composeCodeableConcept(null, e);
47019        closeArray();
47020      };
47021      if (element.hasRiskAdjustmentElement()) {
47022        composeStringCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
47023        composeStringExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
47024      }
47025      if (element.hasRateAggregationElement()) {
47026        composeStringCore("rateAggregation", element.getRateAggregationElement(), false);
47027        composeStringExtras("rateAggregation", element.getRateAggregationElement(), false);
47028      }
47029      if (element.hasRationaleElement()) {
47030        composeMarkdownCore("rationale", element.getRationaleElement(), false);
47031        composeMarkdownExtras("rationale", element.getRationaleElement(), false);
47032      }
47033      if (element.hasClinicalRecommendationStatementElement()) {
47034        composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
47035        composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
47036      }
47037      if (element.hasImprovementNotation()) {
47038        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
47039      }
47040      if (element.hasDefinition()) {
47041        openArray("definition");
47042        for (MarkdownType e : element.getDefinition()) 
47043          composeMarkdownCore(null, e, true);
47044        closeArray();
47045        if (anyHasExtras(element.getDefinition())) {
47046          openArray("_definition");
47047          for (MarkdownType e : element.getDefinition()) 
47048            composeMarkdownExtras(null, e, true);
47049        closeArray();
47050        }
47051      };
47052      if (element.hasGuidanceElement()) {
47053        composeMarkdownCore("guidance", element.getGuidanceElement(), false);
47054        composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
47055      }
47056      if (element.hasGroup()) {
47057        openArray("group");
47058        for (Measure.MeasureGroupComponent e : element.getGroup()) 
47059          composeMeasureMeasureGroupComponent(null, e);
47060        closeArray();
47061      };
47062      if (element.hasSupplementalData()) {
47063        openArray("supplementalData");
47064        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
47065          composeMeasureMeasureSupplementalDataComponent(null, e);
47066        closeArray();
47067      };
47068  }
47069
47070  protected void composeMeasureMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
47071    if (element != null) {
47072      open(name);
47073      composeMeasureMeasureGroupComponentInner(element);
47074      close();
47075    }
47076  }
47077
47078  protected void composeMeasureMeasureGroupComponentInner(Measure.MeasureGroupComponent element) throws IOException {
47079      composeBackbone(element);
47080      if (element.hasCode()) {
47081        composeCodeableConcept("code", element.getCode());
47082      }
47083      if (element.hasDescriptionElement()) {
47084        composeStringCore("description", element.getDescriptionElement(), false);
47085        composeStringExtras("description", element.getDescriptionElement(), false);
47086      }
47087      if (element.hasPopulation()) {
47088        openArray("population");
47089        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
47090          composeMeasureMeasureGroupPopulationComponent(null, e);
47091        closeArray();
47092      };
47093      if (element.hasStratifier()) {
47094        openArray("stratifier");
47095        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
47096          composeMeasureMeasureGroupStratifierComponent(null, e);
47097        closeArray();
47098      };
47099  }
47100
47101  protected void composeMeasureMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
47102    if (element != null) {
47103      open(name);
47104      composeMeasureMeasureGroupPopulationComponentInner(element);
47105      close();
47106    }
47107  }
47108
47109  protected void composeMeasureMeasureGroupPopulationComponentInner(Measure.MeasureGroupPopulationComponent element) throws IOException {
47110      composeBackbone(element);
47111      if (element.hasCode()) {
47112        composeCodeableConcept("code", element.getCode());
47113      }
47114      if (element.hasDescriptionElement()) {
47115        composeStringCore("description", element.getDescriptionElement(), false);
47116        composeStringExtras("description", element.getDescriptionElement(), false);
47117      }
47118      if (element.hasCriteria()) {
47119        composeExpression("criteria", element.getCriteria());
47120      }
47121  }
47122
47123  protected void composeMeasureMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
47124    if (element != null) {
47125      open(name);
47126      composeMeasureMeasureGroupStratifierComponentInner(element);
47127      close();
47128    }
47129  }
47130
47131  protected void composeMeasureMeasureGroupStratifierComponentInner(Measure.MeasureGroupStratifierComponent element) throws IOException {
47132      composeBackbone(element);
47133      if (element.hasCode()) {
47134        composeCodeableConcept("code", element.getCode());
47135      }
47136      if (element.hasDescriptionElement()) {
47137        composeStringCore("description", element.getDescriptionElement(), false);
47138        composeStringExtras("description", element.getDescriptionElement(), false);
47139      }
47140      if (element.hasCriteria()) {
47141        composeExpression("criteria", element.getCriteria());
47142      }
47143      if (element.hasComponent()) {
47144        openArray("component");
47145        for (Measure.MeasureGroupStratifierComponentComponent e : element.getComponent()) 
47146          composeMeasureMeasureGroupStratifierComponentComponent(null, e);
47147        closeArray();
47148      };
47149  }
47150
47151  protected void composeMeasureMeasureGroupStratifierComponentComponent(String name, Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
47152    if (element != null) {
47153      open(name);
47154      composeMeasureMeasureGroupStratifierComponentComponentInner(element);
47155      close();
47156    }
47157  }
47158
47159  protected void composeMeasureMeasureGroupStratifierComponentComponentInner(Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
47160      composeBackbone(element);
47161      if (element.hasCode()) {
47162        composeCodeableConcept("code", element.getCode());
47163      }
47164      if (element.hasDescriptionElement()) {
47165        composeStringCore("description", element.getDescriptionElement(), false);
47166        composeStringExtras("description", element.getDescriptionElement(), false);
47167      }
47168      if (element.hasCriteria()) {
47169        composeExpression("criteria", element.getCriteria());
47170      }
47171  }
47172
47173  protected void composeMeasureMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
47174    if (element != null) {
47175      open(name);
47176      composeMeasureMeasureSupplementalDataComponentInner(element);
47177      close();
47178    }
47179  }
47180
47181  protected void composeMeasureMeasureSupplementalDataComponentInner(Measure.MeasureSupplementalDataComponent element) throws IOException {
47182      composeBackbone(element);
47183      if (element.hasCode()) {
47184        composeCodeableConcept("code", element.getCode());
47185      }
47186      if (element.hasUsage()) {
47187        openArray("usage");
47188        for (CodeableConcept e : element.getUsage()) 
47189          composeCodeableConcept(null, e);
47190        closeArray();
47191      };
47192      if (element.hasDescriptionElement()) {
47193        composeStringCore("description", element.getDescriptionElement(), false);
47194        composeStringExtras("description", element.getDescriptionElement(), false);
47195      }
47196      if (element.hasCriteria()) {
47197        composeExpression("criteria", element.getCriteria());
47198      }
47199  }
47200
47201  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
47202    if (element != null) {
47203      prop("resourceType", name);
47204      composeMeasureReportInner(element);
47205    }
47206  }
47207
47208  protected void composeMeasureReportInner(MeasureReport element) throws IOException {
47209      composeDomainResourceElements(element);
47210      if (element.hasIdentifier()) {
47211        openArray("identifier");
47212        for (Identifier e : element.getIdentifier()) 
47213          composeIdentifier(null, e);
47214        closeArray();
47215      };
47216      if (element.hasStatusElement()) {
47217        composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
47218        composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
47219      }
47220      if (element.hasTypeElement()) {
47221        composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
47222        composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
47223  }
47224      if (element.hasMeasureElement()) {
47225        composeCanonicalCore("measure", element.getMeasureElement(), false);
47226        composeCanonicalExtras("measure", element.getMeasureElement(), false);
47227    }
47228      if (element.hasSubject()) {
47229        composeReference("subject", element.getSubject());
47230  }
47231      if (element.hasDateElement()) {
47232        composeDateTimeCore("date", element.getDateElement(), false);
47233        composeDateTimeExtras("date", element.getDateElement(), false);
47234      }
47235      if (element.hasReporter()) {
47236        composeReference("reporter", element.getReporter());
47237  }
47238      if (element.hasPeriod()) {
47239        composePeriod("period", element.getPeriod());
47240    }
47241      if (element.hasImprovementNotation()) {
47242        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
47243  }
47244      if (element.hasGroup()) {
47245        openArray("group");
47246        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
47247          composeMeasureReportMeasureReportGroupComponent(null, e);
47248        closeArray();
47249      };
47250      if (element.hasEvaluatedResource()) {
47251        openArray("evaluatedResource");
47252        for (Reference e : element.getEvaluatedResource()) 
47253          composeReference(null, e);
47254          closeArray();
47255      };
47256  }
47257
47258  protected void composeMeasureReportMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
47259    if (element != null) {
47260      open(name);
47261      composeMeasureReportMeasureReportGroupComponentInner(element);
47262      close();
47263    }
47264  }
47265
47266  protected void composeMeasureReportMeasureReportGroupComponentInner(MeasureReport.MeasureReportGroupComponent element) throws IOException {
47267      composeBackbone(element);
47268      if (element.hasCode()) {
47269        composeCodeableConcept("code", element.getCode());
47270      }
47271      if (element.hasPopulation()) {
47272        openArray("population");
47273        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
47274          composeMeasureReportMeasureReportGroupPopulationComponent(null, e);
47275        closeArray();
47276      };
47277      if (element.hasMeasureScore()) {
47278        composeQuantity("measureScore", element.getMeasureScore());
47279      }
47280      if (element.hasStratifier()) {
47281        openArray("stratifier");
47282        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
47283          composeMeasureReportMeasureReportGroupStratifierComponent(null, e);
47284        closeArray();
47285      };
47286  }
47287
47288  protected void composeMeasureReportMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
47289    if (element != null) {
47290      open(name);
47291      composeMeasureReportMeasureReportGroupPopulationComponentInner(element);
47292      close();
47293    }
47294  }
47295
47296  protected void composeMeasureReportMeasureReportGroupPopulationComponentInner(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
47297      composeBackbone(element);
47298      if (element.hasCode()) {
47299        composeCodeableConcept("code", element.getCode());
47300      }
47301      if (element.hasCountElement()) {
47302        composeIntegerCore("count", element.getCountElement(), false);
47303        composeIntegerExtras("count", element.getCountElement(), false);
47304      }
47305      if (element.hasSubjectResults()) {
47306        composeReference("subjectResults", element.getSubjectResults());
47307      }
47308  }
47309
47310  protected void composeMeasureReportMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
47311    if (element != null) {
47312      open(name);
47313      composeMeasureReportMeasureReportGroupStratifierComponentInner(element);
47314      close();
47315    }
47316  }
47317
47318  protected void composeMeasureReportMeasureReportGroupStratifierComponentInner(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
47319      composeBackbone(element);
47320      if (element.hasCode()) {
47321        openArray("code");
47322        for (CodeableConcept e : element.getCode()) 
47323          composeCodeableConcept(null, e);
47324        closeArray();
47325      };
47326      if (element.hasStratum()) {
47327        openArray("stratum");
47328        for (MeasureReport.StratifierGroupComponent e : element.getStratum()) 
47329          composeMeasureReportStratifierGroupComponent(null, e);
47330        closeArray();
47331      };
47332  }
47333
47334  protected void composeMeasureReportStratifierGroupComponent(String name, MeasureReport.StratifierGroupComponent element) throws IOException {
47335    if (element != null) {
47336      open(name);
47337      composeMeasureReportStratifierGroupComponentInner(element);
47338      close();
47339    }
47340  }
47341
47342  protected void composeMeasureReportStratifierGroupComponentInner(MeasureReport.StratifierGroupComponent element) throws IOException {
47343      composeBackbone(element);
47344      if (element.hasValue()) {
47345        composeCodeableConcept("value", element.getValue());
47346      }
47347      if (element.hasComponent()) {
47348        openArray("component");
47349        for (MeasureReport.StratifierGroupComponentComponent e : element.getComponent()) 
47350          composeMeasureReportStratifierGroupComponentComponent(null, e);
47351        closeArray();
47352      };
47353      if (element.hasPopulation()) {
47354        openArray("population");
47355        for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation()) 
47356          composeMeasureReportStratifierGroupPopulationComponent(null, e);
47357        closeArray();
47358      };
47359      if (element.hasMeasureScore()) {
47360        composeQuantity("measureScore", element.getMeasureScore());
47361      }
47362  }
47363
47364  protected void composeMeasureReportStratifierGroupComponentComponent(String name, MeasureReport.StratifierGroupComponentComponent element) throws IOException {
47365    if (element != null) {
47366      open(name);
47367      composeMeasureReportStratifierGroupComponentComponentInner(element);
47368      close();
47369    }
47370  }
47371
47372  protected void composeMeasureReportStratifierGroupComponentComponentInner(MeasureReport.StratifierGroupComponentComponent element) throws IOException {
47373      composeBackbone(element);
47374      if (element.hasCode()) {
47375        composeCodeableConcept("code", element.getCode());
47376      }
47377      if (element.hasValue()) {
47378        composeCodeableConcept("value", element.getValue());
47379      }
47380  }
47381
47382  protected void composeMeasureReportStratifierGroupPopulationComponent(String name, MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
47383    if (element != null) {
47384      open(name);
47385      composeMeasureReportStratifierGroupPopulationComponentInner(element);
47386      close();
47387    }
47388  }
47389
47390  protected void composeMeasureReportStratifierGroupPopulationComponentInner(MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
47391      composeBackbone(element);
47392      if (element.hasCode()) {
47393        composeCodeableConcept("code", element.getCode());
47394      }
47395      if (element.hasCountElement()) {
47396        composeIntegerCore("count", element.getCountElement(), false);
47397        composeIntegerExtras("count", element.getCountElement(), false);
47398      }
47399      if (element.hasSubjectResults()) {
47400        composeReference("subjectResults", element.getSubjectResults());
47401      }
47402  }
47403
47404  protected void composeMedication(String name, Medication element) throws IOException {
47405    if (element != null) {
47406      prop("resourceType", name);
47407      composeMedicationInner(element);
47408    }
47409  }
47410
47411  protected void composeMedicationInner(Medication element) throws IOException {
47412      composeDomainResourceElements(element);
47413      if (element.hasIdentifier()) {
47414        openArray("identifier");
47415        for (Identifier e : element.getIdentifier()) 
47416          composeIdentifier(null, e);
47417        closeArray();
47418      };
47419      if (element.hasCode()) {
47420        composeCodeableConcept("code", element.getCode());
47421      }
47422      if (element.hasStatusElement()) {
47423        composeEnumerationCore("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
47424        composeEnumerationExtras("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
47425      }
47426      if (element.hasManufacturer()) {
47427        composeReference("manufacturer", element.getManufacturer());
47428      }
47429      if (element.hasDoseForm()) {
47430        composeCodeableConcept("doseForm", element.getDoseForm());
47431      }
47432      if (element.hasAmount()) {
47433        composeRatio("amount", element.getAmount());
47434      }
47435      if (element.hasIngredient()) {
47436        openArray("ingredient");
47437        for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
47438          composeMedicationMedicationIngredientComponent(null, e);
47439        closeArray();
47440      };
47441      if (element.hasBatch()) {
47442        composeMedicationMedicationBatchComponent("batch", element.getBatch());
47443      }
47444  }
47445
47446  protected void composeMedicationMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
47447    if (element != null) {
47448      open(name);
47449      composeMedicationMedicationIngredientComponentInner(element);
47450      close();
47451    }
47452  }
47453
47454  protected void composeMedicationMedicationIngredientComponentInner(Medication.MedicationIngredientComponent element) throws IOException {
47455      composeBackbone(element);
47456      if (element.hasItem()) {
47457        composeType("item", element.getItem());
47458      }
47459      if (element.hasIsActiveElement()) {
47460        composeBooleanCore("isActive", element.getIsActiveElement(), false);
47461        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
47462      }
47463      if (element.hasStrength()) {
47464        composeType("strength", element.getStrength());
47465      }
47466  }
47467
47468  protected void composeMedicationMedicationBatchComponent(String name, Medication.MedicationBatchComponent element) throws IOException {
47469    if (element != null) {
47470      open(name);
47471      composeMedicationMedicationBatchComponentInner(element);
47472      close();
47473    }
47474  }
47475
47476  protected void composeMedicationMedicationBatchComponentInner(Medication.MedicationBatchComponent element) throws IOException {
47477      composeBackbone(element);
47478      if (element.hasLotNumberElement()) {
47479        composeStringCore("lotNumber", element.getLotNumberElement(), false);
47480        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
47481      }
47482      if (element.hasExpirationDateElement()) {
47483        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
47484        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
47485      }
47486  }
47487
47488  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
47489    if (element != null) {
47490      prop("resourceType", name);
47491      composeMedicationAdministrationInner(element);
47492    }
47493  }
47494
47495  protected void composeMedicationAdministrationInner(MedicationAdministration element) throws IOException {
47496      composeDomainResourceElements(element);
47497      if (element.hasIdentifier()) {
47498        openArray("identifier");
47499        for (Identifier e : element.getIdentifier()) 
47500          composeIdentifier(null, e);
47501        closeArray();
47502      };
47503      if (element.hasInstantiatesCanonical()) {
47504        openArray("instantiatesCanonical");
47505        for (CanonicalType e : element.getInstantiatesCanonical()) 
47506          composeCanonicalCore(null, e, true);
47507        closeArray();
47508        if (anyHasExtras(element.getInstantiatesCanonical())) {
47509          openArray("_instantiatesCanonical");
47510          for (CanonicalType e : element.getInstantiatesCanonical()) 
47511            composeCanonicalExtras(null, e, true);
47512          closeArray();
47513        }
47514      };
47515      if (element.hasInstantiatesUri()) {
47516        openArray("instantiatesUri");
47517        for (UriType e : element.getInstantiatesUri()) 
47518          composeUriCore(null, e, true);
47519        closeArray();
47520        if (anyHasExtras(element.getInstantiatesUri())) {
47521          openArray("_instantiatesUri");
47522          for (UriType e : element.getInstantiatesUri()) 
47523            composeUriExtras(null, e, true);
47524          closeArray();
47525        }
47526      };
47527      if (element.hasBasedOn()) {
47528        openArray("basedOn");
47529        for (Reference e : element.getBasedOn()) 
47530          composeReference(null, e);
47531        closeArray();
47532      };
47533      if (element.hasPartOf()) {
47534        openArray("partOf");
47535        for (Reference e : element.getPartOf()) 
47536          composeReference(null, e);
47537        closeArray();
47538      };
47539      if (element.hasStatusElement()) {
47540        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
47541        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
47542      }
47543      if (element.hasStatusReason()) {
47544        openArray("statusReason");
47545        for (CodeableConcept e : element.getStatusReason()) 
47546          composeCodeableConcept(null, e);
47547        closeArray();
47548      };
47549      if (element.hasCategory()) {
47550        openArray("category");
47551        for (CodeableConcept e : element.getCategory()) 
47552          composeCodeableConcept(null, e);
47553        closeArray();
47554      };
47555      if (element.hasMedication()) {
47556        composeType("medication", element.getMedication());
47557      }
47558      if (element.hasSubject()) {
47559        composeReference("subject", element.getSubject());
47560      }
47561      if (element.hasEncounter()) {
47562        composeReference("encounter", element.getEncounter());
47563      }
47564      if (element.hasSupportingInformation()) {
47565        openArray("supportingInformation");
47566        for (Reference e : element.getSupportingInformation()) 
47567          composeReference(null, e);
47568        closeArray();
47569      };
47570      if (element.hasOccurence()) {
47571        composeType("occurence", element.getOccurence());
47572      }
47573      if (element.hasRecordedElement()) {
47574        composeDateTimeCore("recorded", element.getRecordedElement(), false);
47575        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
47576      }
47577      if (element.hasPerformer()) {
47578        openArray("performer");
47579        for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
47580          composeMedicationAdministrationMedicationAdministrationPerformerComponent(null, e);
47581        closeArray();
47582      };
47583      if (element.hasReasonCode()) {
47584        openArray("reasonCode");
47585        for (CodeableConcept e : element.getReasonCode()) 
47586          composeCodeableConcept(null, e);
47587        closeArray();
47588      };
47589      if (element.hasReasonReference()) {
47590        openArray("reasonReference");
47591        for (Reference e : element.getReasonReference()) 
47592          composeReference(null, e);
47593        closeArray();
47594      };
47595      if (element.hasRequest()) {
47596        composeReference("request", element.getRequest());
47597        }
47598      if (element.hasDevice()) {
47599        openArray("device");
47600        for (Reference e : element.getDevice()) 
47601          composeReference(null, e);
47602        closeArray();
47603      };
47604      if (element.hasNote()) {
47605        openArray("note");
47606        for (Annotation e : element.getNote()) 
47607          composeAnnotation(null, e);
47608        closeArray();
47609      };
47610      if (element.hasDosage()) {
47611        composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
47612      }
47613      if (element.hasEventHistory()) {
47614        openArray("eventHistory");
47615        for (Reference e : element.getEventHistory()) 
47616          composeReference(null, e);
47617        closeArray();
47618      };
47619  }
47620
47621  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
47622    if (element != null) {
47623      open(name);
47624      composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(element);
47625      close();
47626    }
47627  }
47628
47629  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
47630      composeBackbone(element);
47631      if (element.hasFunction()) {
47632        composeCodeableConcept("function", element.getFunction());
47633      }
47634      if (element.hasActor()) {
47635        composeReference("actor", element.getActor());
47636      }
47637  }
47638
47639  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
47640    if (element != null) {
47641      open(name);
47642      composeMedicationAdministrationMedicationAdministrationDosageComponentInner(element);
47643      close();
47644    }
47645  }
47646
47647  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentInner(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
47648      composeBackbone(element);
47649      if (element.hasTextElement()) {
47650        composeStringCore("text", element.getTextElement(), false);
47651        composeStringExtras("text", element.getTextElement(), false);
47652      }
47653      if (element.hasSite()) {
47654        composeCodeableConcept("site", element.getSite());
47655      }
47656      if (element.hasRoute()) {
47657        composeCodeableConcept("route", element.getRoute());
47658  }
47659      if (element.hasMethod()) {
47660        composeCodeableConcept("method", element.getMethod());
47661    }
47662      if (element.hasDose()) {
47663        composeQuantity("dose", element.getDose());
47664  }
47665      if (element.hasRate()) {
47666        composeType("rate", element.getRate());
47667      }
47668  }
47669
47670  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
47671    if (element != null) {
47672      prop("resourceType", name);
47673      composeMedicationDispenseInner(element);
47674    }
47675  }
47676
47677  protected void composeMedicationDispenseInner(MedicationDispense element) throws IOException {
47678      composeDomainResourceElements(element);
47679      if (element.hasIdentifier()) {
47680        openArray("identifier");
47681        for (Identifier e : element.getIdentifier()) 
47682          composeIdentifier(null, e);
47683        closeArray();
47684      };
47685      if (element.hasBasedOn()) {
47686        openArray("basedOn");
47687        for (Reference e : element.getBasedOn()) 
47688          composeReference(null, e);
47689        closeArray();
47690      };
47691      if (element.hasPartOf()) {
47692        openArray("partOf");
47693        for (Reference e : element.getPartOf()) 
47694          composeReference(null, e);
47695        closeArray();
47696      };
47697      if (element.hasStatusElement()) {
47698        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
47699        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
47700      }
47701      if (element.hasStatusReason()) {
47702        composeType("statusReason", element.getStatusReason());
47703      }
47704      if (element.hasCategory()) {
47705        openArray("category");
47706        for (CodeableConcept e : element.getCategory()) 
47707          composeCodeableConcept(null, e);
47708        closeArray();
47709      };
47710      if (element.hasMedication()) {
47711        composeType("medication", element.getMedication());
47712      }
47713      if (element.hasSubject()) {
47714        composeReference("subject", element.getSubject());
47715      }
47716      if (element.hasEncounter()) {
47717        composeReference("encounter", element.getEncounter());
47718      }
47719      if (element.hasSupportingInformation()) {
47720        openArray("supportingInformation");
47721        for (Reference e : element.getSupportingInformation()) 
47722          composeReference(null, e);
47723        closeArray();
47724      };
47725      if (element.hasPerformer()) {
47726        openArray("performer");
47727        for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
47728          composeMedicationDispenseMedicationDispensePerformerComponent(null, e);
47729        closeArray();
47730      };
47731      if (element.hasLocation()) {
47732        composeReference("location", element.getLocation());
47733      }
47734      if (element.hasAuthorizingPrescription()) {
47735        openArray("authorizingPrescription");
47736        for (Reference e : element.getAuthorizingPrescription()) 
47737          composeReference(null, e);
47738        closeArray();
47739      };
47740      if (element.hasType()) {
47741        composeCodeableConcept("type", element.getType());
47742      }
47743      if (element.hasQuantity()) {
47744        composeQuantity("quantity", element.getQuantity());
47745      }
47746      if (element.hasDaysSupply()) {
47747        composeQuantity("daysSupply", element.getDaysSupply());
47748      }
47749      if (element.hasWhenPreparedElement()) {
47750        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
47751        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
47752      }
47753      if (element.hasWhenHandedOverElement()) {
47754        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
47755        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
47756      }
47757      if (element.hasDestination()) {
47758        composeReference("destination", element.getDestination());
47759      }
47760      if (element.hasReceiver()) {
47761        openArray("receiver");
47762        for (Reference e : element.getReceiver()) 
47763          composeReference(null, e);
47764        closeArray();
47765      };
47766      if (element.hasNote()) {
47767        openArray("note");
47768        for (Annotation e : element.getNote()) 
47769          composeAnnotation(null, e);
47770        closeArray();
47771      };
47772      if (element.hasDosageInstruction()) {
47773        openArray("dosageInstruction");
47774        for (Dosage e : element.getDosageInstruction()) 
47775          composeDosage(null, e);
47776        closeArray();
47777      };
47778      if (element.hasSubstitution()) {
47779        composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
47780      }
47781      if (element.hasDetectedIssue()) {
47782        openArray("detectedIssue");
47783        for (Reference e : element.getDetectedIssue()) 
47784          composeReference(null, e);
47785        closeArray();
47786      };
47787      if (element.hasEventHistory()) {
47788        openArray("eventHistory");
47789        for (Reference e : element.getEventHistory()) 
47790          composeReference(null, e);
47791        closeArray();
47792      };
47793  }
47794
47795  protected void composeMedicationDispenseMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
47796    if (element != null) {
47797      open(name);
47798      composeMedicationDispenseMedicationDispensePerformerComponentInner(element);
47799      close();
47800    }
47801  }
47802
47803  protected void composeMedicationDispenseMedicationDispensePerformerComponentInner(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
47804      composeBackbone(element);
47805      if (element.hasFunction()) {
47806        composeCodeableConcept("function", element.getFunction());
47807      }
47808      if (element.hasActor()) {
47809        composeReference("actor", element.getActor());
47810      }
47811  }
47812
47813  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
47814    if (element != null) {
47815      open(name);
47816      composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(element);
47817      close();
47818    }
47819  }
47820
47821  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
47822      composeBackbone(element);
47823      if (element.hasWasSubstitutedElement()) {
47824        composeBooleanCore("wasSubstituted", element.getWasSubstitutedElement(), false);
47825        composeBooleanExtras("wasSubstituted", element.getWasSubstitutedElement(), false);
47826      }
47827      if (element.hasType()) {
47828        composeCodeableConcept("type", element.getType());
47829      }
47830      if (element.hasReason()) {
47831        openArray("reason");
47832        for (CodeableConcept e : element.getReason()) 
47833          composeCodeableConcept(null, e);
47834        closeArray();
47835      };
47836      if (element.hasResponsibleParty()) {
47837        composeReference("responsibleParty", element.getResponsibleParty());
47838      }
47839  }
47840
47841  protected void composeMedicationKnowledge(String name, MedicationKnowledge element) throws IOException {
47842    if (element != null) {
47843      prop("resourceType", name);
47844      composeMedicationKnowledgeInner(element);
47845    }
47846  }
47847
47848  protected void composeMedicationKnowledgeInner(MedicationKnowledge element) throws IOException {
47849      composeDomainResourceElements(element);
47850      if (element.hasIdentifier()) {
47851        openArray("identifier");
47852        for (Identifier e : element.getIdentifier()) 
47853          composeIdentifier(null, e);
47854        closeArray();
47855      };
47856      if (element.hasCode()) {
47857        composeCodeableConcept("code", element.getCode());
47858      }
47859      if (element.hasStatusElement()) {
47860        composeEnumerationCore("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory(), false);
47861        composeEnumerationExtras("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory(), false);
47862      }
47863      if (element.hasManufacturer()) {
47864        composeReference("manufacturer", element.getManufacturer());
47865      }
47866      if (element.hasDoseForm()) {
47867        composeCodeableConcept("doseForm", element.getDoseForm());
47868      }
47869      if (element.hasAmount()) {
47870        composeQuantity("amount", element.getAmount());
47871      }
47872      if (element.hasSynonym()) {
47873        openArray("synonym");
47874        for (StringType e : element.getSynonym()) 
47875          composeStringCore(null, e, true);
47876        closeArray();
47877        if (anyHasExtras(element.getSynonym())) {
47878          openArray("_synonym");
47879          for (StringType e : element.getSynonym()) 
47880            composeStringExtras(null, e, true);
47881          closeArray();
47882        }
47883      };
47884      if (element.hasRelatedMedicationKnowledge()) {
47885        openArray("relatedMedicationKnowledge");
47886        for (MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent e : element.getRelatedMedicationKnowledge()) 
47887          composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(null, e);
47888        closeArray();
47889      };
47890      if (element.hasAssociatedMedication()) {
47891        openArray("associatedMedication");
47892        for (Reference e : element.getAssociatedMedication()) 
47893          composeReference(null, e);
47894        closeArray();
47895      };
47896      if (element.hasProductType()) {
47897        openArray("productType");
47898        for (CodeableConcept e : element.getProductType()) 
47899          composeCodeableConcept(null, e);
47900        closeArray();
47901      };
47902      if (element.hasMonograph()) {
47903        openArray("monograph");
47904        for (MedicationKnowledge.MedicationKnowledgeMonographComponent e : element.getMonograph()) 
47905          composeMedicationKnowledgeMedicationKnowledgeMonographComponent(null, e);
47906        closeArray();
47907      };
47908      if (element.hasIngredient()) {
47909        openArray("ingredient");
47910        for (MedicationKnowledge.MedicationKnowledgeIngredientComponent e : element.getIngredient()) 
47911          composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(null, e);
47912        closeArray();
47913      };
47914      if (element.hasDevice()) {
47915        openArray("device");
47916        for (Reference e : element.getDevice()) 
47917          composeReference(null, e);
47918        closeArray();
47919      };
47920      if (element.hasPreparationInstructionElement()) {
47921        composeMarkdownCore("preparationInstruction", element.getPreparationInstructionElement(), false);
47922        composeMarkdownExtras("preparationInstruction", element.getPreparationInstructionElement(), false);
47923      }
47924      if (element.hasIntendedRoute()) {
47925        openArray("intendedRoute");
47926        for (CodeableConcept e : element.getIntendedRoute()) 
47927          composeCodeableConcept(null, e);
47928        closeArray();
47929      };
47930      if (element.hasCost()) {
47931        openArray("cost");
47932        for (MedicationKnowledge.MedicationKnowledgeCostComponent e : element.getCost()) 
47933          composeMedicationKnowledgeMedicationKnowledgeCostComponent(null, e);
47934        closeArray();
47935      };
47936      if (element.hasMonitoringProgram()) {
47937        openArray("monitoringProgram");
47938        for (MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent e : element.getMonitoringProgram()) 
47939          composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(null, e);
47940        closeArray();
47941      };
47942      if (element.hasAdministrationGuideline()) {
47943        openArray("administrationGuideline");
47944        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent e : element.getAdministrationGuideline()) 
47945          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineComponent(null, e);
47946        closeArray();
47947      };
47948      if (element.hasMedicineClassification()) {
47949        openArray("medicineClassification");
47950        for (MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent e : element.getMedicineClassification()) 
47951          composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(null, e);
47952        closeArray();
47953      };
47954      if (element.hasPackaging()) {
47955        composeMedicationKnowledgeMedicationKnowledgePackagingComponent("packaging", element.getPackaging());
47956      }
47957      if (element.hasDrugCharacteristic()) {
47958        openArray("drugCharacteristic");
47959        for (MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent e : element.getDrugCharacteristic()) 
47960          composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(null, e);
47961        closeArray();
47962      };
47963      if (element.hasClinicalUseIssue()) {
47964        openArray("clinicalUseIssue");
47965        for (Reference e : element.getClinicalUseIssue()) 
47966          composeReference(null, e);
47967        closeArray();
47968      };
47969      if (element.hasRegulatory()) {
47970        openArray("regulatory");
47971        for (MedicationKnowledge.MedicationKnowledgeRegulatoryComponent e : element.getRegulatory()) 
47972          composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(null, e);
47973        closeArray();
47974      };
47975      if (element.hasKineticCharacteristic()) {
47976        openArray("kineticCharacteristic");
47977        for (MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent e : element.getKineticCharacteristic()) 
47978          composeMedicationKnowledgeMedicationKnowledgeKineticCharacteristicComponent(null, e);
47979        closeArray();
47980      };
47981  }
47982
47983  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(String name, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
47984    if (element != null) {
47985      open(name);
47986      composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentInner(element);
47987      close();
47988    }
47989  }
47990
47991  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentInner(MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
47992      composeBackbone(element);
47993      if (element.hasType()) {
47994        composeCodeableConcept("type", element.getType());
47995      }
47996      if (element.hasReference()) {
47997        openArray("reference");
47998        for (Reference e : element.getReference()) 
47999          composeReference(null, e);
48000        closeArray();
48001      };
48002  }
48003
48004  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponent(String name, MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
48005    if (element != null) {
48006      open(name);
48007      composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(element);
48008      close();
48009    }
48010  }
48011
48012  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
48013      composeBackbone(element);
48014      if (element.hasType()) {
48015        composeCodeableConcept("type", element.getType());
48016      }
48017      if (element.hasSource()) {
48018        composeReference("source", element.getSource());
48019      }
48020  }
48021
48022  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(String name, MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
48023    if (element != null) {
48024      open(name);
48025      composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(element);
48026      close();
48027    }
48028  }
48029
48030  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
48031      composeBackbone(element);
48032      if (element.hasItem()) {
48033        composeType("item", element.getItem());
48034      }
48035      if (element.hasIsActiveElement()) {
48036        composeBooleanCore("isActive", element.getIsActiveElement(), false);
48037        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
48038      }
48039      if (element.hasStrength()) {
48040        composeRatio("strength", element.getStrength());
48041      }
48042  }
48043
48044  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponent(String name, MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
48045    if (element != null) {
48046      open(name);
48047      composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(element);
48048      close();
48049    }
48050  }
48051
48052  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
48053      composeBackbone(element);
48054      if (element.hasType()) {
48055        composeCodeableConcept("type", element.getType());
48056      }
48057      if (element.hasSourceElement()) {
48058        composeStringCore("source", element.getSourceElement(), false);
48059        composeStringExtras("source", element.getSourceElement(), false);
48060      }
48061      if (element.hasCost()) {
48062        composeMoney("cost", element.getCost());
48063      }
48064  }
48065
48066  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(String name, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
48067    if (element != null) {
48068      open(name);
48069      composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(element);
48070      close();
48071    }
48072  }
48073
48074  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
48075      composeBackbone(element);
48076      if (element.hasType()) {
48077        composeCodeableConcept("type", element.getType());
48078      }
48079      if (element.hasNameElement()) {
48080        composeStringCore("name", element.getNameElement(), false);
48081        composeStringExtras("name", element.getNameElement(), false);
48082      }
48083      }
48084
48085  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent element) throws IOException {
48086    if (element != null) {
48087      open(name);
48088      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineComponentInner(element);
48089      close();
48090      }
48091      }
48092
48093  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent element) throws IOException {
48094      composeBackbone(element);
48095      if (element.hasDosage()) {
48096        openArray("dosage");
48097        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent e : element.getDosage()) 
48098          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineDosageComponent(null, e);
48099        closeArray();
48100      };
48101      if (element.hasIndication()) {
48102        composeType("indication", element.getIndication());
48103      }
48104      if (element.hasPatientCharacteristic()) {
48105        openArray("patientCharacteristic");
48106        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent e : element.getPatientCharacteristic()) 
48107          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent(null, e);
48108        closeArray();
48109      };
48110  }
48111
48112  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineDosageComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent element) throws IOException {
48113    if (element != null) {
48114      open(name);
48115      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineDosageComponentInner(element);
48116      close();
48117    }
48118  }
48119
48120  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelineDosageComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent element) throws IOException {
48121      composeBackbone(element);
48122      if (element.hasType()) {
48123        composeCodeableConcept("type", element.getType());
48124      }
48125      if (element.hasDosage()) {
48126        openArray("dosage");
48127        for (Dosage e : element.getDosage()) 
48128          composeDosage(null, e);
48129        closeArray();
48130      };
48131      }
48132
48133  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent element) throws IOException {
48134    if (element != null) {
48135      open(name);
48136      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponentInner(element);
48137      close();
48138      }
48139      }
48140
48141  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent element) throws IOException {
48142      composeBackbone(element);
48143      if (element.hasCharacteristic()) {
48144        composeType("characteristic", element.getCharacteristic());
48145      }
48146      if (element.hasValue()) {
48147        openArray("value");
48148        for (StringType e : element.getValue()) 
48149          composeStringCore(null, e, true);
48150        closeArray();
48151        if (anyHasExtras(element.getValue())) {
48152          openArray("_value");
48153          for (StringType e : element.getValue()) 
48154            composeStringExtras(null, e, true);
48155          closeArray();
48156      }
48157      };
48158  }
48159
48160  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(String name, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
48161    if (element != null) {
48162      open(name);
48163      composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(element);
48164      close();
48165    }
48166  }
48167
48168  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
48169      composeBackbone(element);
48170      if (element.hasType()) {
48171        composeCodeableConcept("type", element.getType());
48172      }
48173      if (element.hasClassification()) {
48174        openArray("classification");
48175        for (CodeableConcept e : element.getClassification()) 
48176          composeCodeableConcept(null, e);
48177        closeArray();
48178      };
48179      }
48180
48181  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponent(String name, MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
48182    if (element != null) {
48183      open(name);
48184      composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(element);
48185      close();
48186      }
48187      }
48188
48189  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
48190      composeBackbone(element);
48191      if (element.hasType()) {
48192        composeCodeableConcept("type", element.getType());
48193      }
48194      if (element.hasQuantity()) {
48195        composeQuantity("quantity", element.getQuantity());
48196      }
48197      if (element.hasDevice()) {
48198        composeReference("device", element.getDevice());
48199      }
48200      if (element.hasMaterial()) {
48201        composeCodeableConcept("material", element.getMaterial());
48202      }
48203      if (element.hasPackaging()) {
48204        openArray("packaging");
48205        for (MedicationKnowledge.MedicationKnowledgePackagingComponent e : element.getPackaging()) 
48206          composeMedicationKnowledgeMedicationKnowledgePackagingComponent(null, e);
48207        closeArray();
48208      };
48209      }
48210
48211  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
48212    if (element != null) {
48213      open(name);
48214      composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(element);
48215      close();
48216    }
48217  }
48218
48219  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
48220      composeBackbone(element);
48221      if (element.hasType()) {
48222        composeCodeableConcept("type", element.getType());
48223      }
48224      if (element.hasValue()) {
48225        composeType("value", element.getValue());
48226      }
48227  }
48228
48229  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
48230    if (element != null) {
48231      open(name);
48232      composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentInner(element);
48233      close();
48234    }
48235  }
48236
48237  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
48238      composeBackbone(element);
48239      if (element.hasRegulatoryAuthority()) {
48240        composeReference("regulatoryAuthority", element.getRegulatoryAuthority());
48241      }
48242      if (element.hasSubstitution()) {
48243        openArray("substitution");
48244        for (MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent e : element.getSubstitution()) 
48245          composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(null, e);
48246        closeArray();
48247      };
48248      if (element.hasSchedule()) {
48249        openArray("schedule");
48250        for (CodeableConcept e : element.getSchedule()) 
48251          composeCodeableConcept(null, e);
48252        closeArray();
48253      };
48254      if (element.hasMaxDispense()) {
48255        composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent("maxDispense", element.getMaxDispense());
48256      }
48257  }
48258
48259  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
48260    if (element != null) {
48261      open(name);
48262      composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentInner(element);
48263      close();
48264    }
48265  }
48266
48267  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
48268      composeBackbone(element);
48269      if (element.hasType()) {
48270        composeCodeableConcept("type", element.getType());
48271      }
48272      if (element.hasAllowedElement()) {
48273        composeBooleanCore("allowed", element.getAllowedElement(), false);
48274        composeBooleanExtras("allowed", element.getAllowedElement(), false);
48275      }
48276  }
48277
48278  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
48279    if (element != null) {
48280      open(name);
48281      composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentInner(element);
48282      close();
48283    }
48284  }
48285
48286  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
48287      composeBackbone(element);
48288      if (element.hasQuantity()) {
48289        composeQuantity("quantity", element.getQuantity());
48290      }
48291      if (element.hasPeriod()) {
48292        composeDuration("period", element.getPeriod());
48293      }
48294  }
48295
48296  protected void composeMedicationKnowledgeMedicationKnowledgeKineticCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent element) throws IOException {
48297    if (element != null) {
48298      open(name);
48299      composeMedicationKnowledgeMedicationKnowledgeKineticCharacteristicComponentInner(element);
48300      close();
48301    }
48302  }
48303
48304  protected void composeMedicationKnowledgeMedicationKnowledgeKineticCharacteristicComponentInner(MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent element) throws IOException {
48305      composeBackbone(element);
48306      if (element.hasType()) {
48307        composeCodeableConcept("type", element.getType());
48308      }
48309      if (element.hasValue()) {
48310        composeType("value", element.getValue());
48311      }
48312  }
48313
48314  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
48315    if (element != null) {
48316      prop("resourceType", name);
48317      composeMedicationRequestInner(element);
48318    }
48319  }
48320
48321  protected void composeMedicationRequestInner(MedicationRequest element) throws IOException {
48322      composeDomainResourceElements(element);
48323      if (element.hasIdentifier()) {
48324        openArray("identifier");
48325        for (Identifier e : element.getIdentifier()) 
48326          composeIdentifier(null, e);
48327        closeArray();
48328      };
48329      if (element.hasStatusElement()) {
48330        composeEnumerationCore("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
48331        composeEnumerationExtras("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
48332      }
48333      if (element.hasStatusReason()) {
48334        composeCodeableConcept("statusReason", element.getStatusReason());
48335      }
48336      if (element.hasIntentElement()) {
48337        composeEnumerationCore("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
48338        composeEnumerationExtras("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
48339      }
48340      if (element.hasCategory()) {
48341        openArray("category");
48342        for (CodeableConcept e : element.getCategory()) 
48343          composeCodeableConcept(null, e);
48344        closeArray();
48345      };
48346      if (element.hasPriorityElement()) {
48347        composeEnumerationCore("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
48348        composeEnumerationExtras("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
48349      }
48350      if (element.hasDoNotPerformElement()) {
48351        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
48352        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
48353      }
48354      if (element.hasReportedElement()) {
48355        composeBooleanCore("reported", element.getReportedElement(), false);
48356        composeBooleanExtras("reported", element.getReportedElement(), false);
48357      }
48358      if (element.hasInformationSource()) {
48359        composeReference("informationSource", element.getInformationSource());
48360      }
48361      if (element.hasMedication()) {
48362        composeType("medication", element.getMedication());
48363      }
48364      if (element.hasSubject()) {
48365        composeReference("subject", element.getSubject());
48366      }
48367      if (element.hasEncounter()) {
48368        composeReference("encounter", element.getEncounter());
48369      }
48370      if (element.hasSupportingInformation()) {
48371        openArray("supportingInformation");
48372        for (Reference e : element.getSupportingInformation()) 
48373          composeReference(null, e);
48374        closeArray();
48375      };
48376      if (element.hasAuthoredOnElement()) {
48377        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
48378        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
48379      }
48380      if (element.hasRequester()) {
48381        composeReference("requester", element.getRequester());
48382      }
48383      if (element.hasPerformer()) {
48384        composeReference("performer", element.getPerformer());
48385      }
48386      if (element.hasPerformerType()) {
48387        composeCodeableConcept("performerType", element.getPerformerType());
48388      }
48389      if (element.hasRecorder()) {
48390        composeReference("recorder", element.getRecorder());
48391      }
48392      if (element.hasReasonCode()) {
48393        openArray("reasonCode");
48394        for (CodeableConcept e : element.getReasonCode()) 
48395          composeCodeableConcept(null, e);
48396        closeArray();
48397      };
48398      if (element.hasReasonReference()) {
48399        openArray("reasonReference");
48400        for (Reference e : element.getReasonReference()) 
48401          composeReference(null, e);
48402        closeArray();
48403      };
48404      if (element.hasInstantiatesCanonical()) {
48405        openArray("instantiatesCanonical");
48406        for (CanonicalType e : element.getInstantiatesCanonical()) 
48407          composeCanonicalCore(null, e, true);
48408        closeArray();
48409        if (anyHasExtras(element.getInstantiatesCanonical())) {
48410          openArray("_instantiatesCanonical");
48411          for (CanonicalType e : element.getInstantiatesCanonical()) 
48412            composeCanonicalExtras(null, e, true);
48413          closeArray();
48414        }
48415      };
48416      if (element.hasInstantiatesUri()) {
48417        openArray("instantiatesUri");
48418        for (UriType e : element.getInstantiatesUri()) 
48419          composeUriCore(null, e, true);
48420        closeArray();
48421        if (anyHasExtras(element.getInstantiatesUri())) {
48422          openArray("_instantiatesUri");
48423          for (UriType e : element.getInstantiatesUri()) 
48424            composeUriExtras(null, e, true);
48425          closeArray();
48426        }
48427      };
48428      if (element.hasBasedOn()) {
48429        openArray("basedOn");
48430        for (Reference e : element.getBasedOn()) 
48431          composeReference(null, e);
48432        closeArray();
48433      };
48434      if (element.hasGroupIdentifier()) {
48435        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
48436      }
48437      if (element.hasCourseOfTherapyType()) {
48438        composeCodeableConcept("courseOfTherapyType", element.getCourseOfTherapyType());
48439      }
48440      if (element.hasInsurance()) {
48441        openArray("insurance");
48442        for (Reference e : element.getInsurance()) 
48443          composeReference(null, e);
48444        closeArray();
48445      };
48446      if (element.hasNote()) {
48447        openArray("note");
48448        for (Annotation e : element.getNote()) 
48449          composeAnnotation(null, e);
48450        closeArray();
48451      };
48452      if (element.hasDosageInstruction()) {
48453        openArray("dosageInstruction");
48454        for (Dosage e : element.getDosageInstruction()) 
48455          composeDosage(null, e);
48456        closeArray();
48457      };
48458      if (element.hasDispenseRequest()) {
48459        composeMedicationRequestMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
48460  }
48461      if (element.hasSubstitution()) {
48462        composeMedicationRequestMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
48463    }
48464      if (element.hasPriorPrescription()) {
48465        composeReference("priorPrescription", element.getPriorPrescription());
48466  }
48467      if (element.hasDetectedIssue()) {
48468        openArray("detectedIssue");
48469        for (Reference e : element.getDetectedIssue()) 
48470          composeReference(null, e);
48471        closeArray();
48472      };
48473      if (element.hasEventHistory()) {
48474        openArray("eventHistory");
48475        for (Reference e : element.getEventHistory()) 
48476          composeReference(null, e);
48477        closeArray();
48478      };
48479  }
48480
48481  protected void composeMedicationRequestMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
48482    if (element != null) {
48483      open(name);
48484      composeMedicationRequestMedicationRequestDispenseRequestComponentInner(element);
48485      close();
48486    }
48487  }
48488
48489  protected void composeMedicationRequestMedicationRequestDispenseRequestComponentInner(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
48490      composeBackbone(element);
48491      if (element.hasInitialFill()) {
48492        composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent("initialFill", element.getInitialFill());
48493      }
48494      if (element.hasDispenseInterval()) {
48495        composeDuration("dispenseInterval", element.getDispenseInterval());
48496      }
48497      if (element.hasValidityPeriod()) {
48498        composePeriod("validityPeriod", element.getValidityPeriod());
48499      }
48500      if (element.hasNumberOfRepeatsAllowedElement()) {
48501        composeUnsignedIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
48502        composeUnsignedIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
48503  }
48504      if (element.hasQuantity()) {
48505        composeQuantity("quantity", element.getQuantity());
48506    }
48507      if (element.hasExpectedSupplyDuration()) {
48508        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
48509  }
48510      if (element.hasPerformer()) {
48511        composeReference("performer", element.getPerformer());
48512      }
48513  }
48514
48515  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(String name, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
48516    if (element != null) {
48517      open(name);
48518      composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentInner(element);
48519      close();
48520    }
48521  }
48522
48523  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentInner(MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
48524      composeBackbone(element);
48525      if (element.hasQuantity()) {
48526        composeQuantity("quantity", element.getQuantity());
48527      }
48528      if (element.hasDuration()) {
48529        composeDuration("duration", element.getDuration());
48530      }
48531  }
48532
48533  protected void composeMedicationRequestMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
48534    if (element != null) {
48535      open(name);
48536      composeMedicationRequestMedicationRequestSubstitutionComponentInner(element);
48537      close();
48538    }
48539  }
48540
48541  protected void composeMedicationRequestMedicationRequestSubstitutionComponentInner(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
48542      composeBackbone(element);
48543      if (element.hasAllowed()) {
48544        composeType("allowed", element.getAllowed());
48545      }
48546      if (element.hasReason()) {
48547        composeCodeableConcept("reason", element.getReason());
48548      }
48549  }
48550
48551  protected void composeMedicationUsage(String name, MedicationUsage element) throws IOException {
48552    if (element != null) {
48553      prop("resourceType", name);
48554      composeMedicationUsageInner(element);
48555    }
48556  }
48557
48558  protected void composeMedicationUsageInner(MedicationUsage element) throws IOException {
48559      composeDomainResourceElements(element);
48560      if (element.hasIdentifier()) {
48561        openArray("identifier");
48562        for (Identifier e : element.getIdentifier()) 
48563          composeIdentifier(null, e);
48564        closeArray();
48565      };
48566      if (element.hasBasedOn()) {
48567        openArray("basedOn");
48568        for (Reference e : element.getBasedOn()) 
48569          composeReference(null, e);
48570        closeArray();
48571      };
48572      if (element.hasPartOf()) {
48573        openArray("partOf");
48574        for (Reference e : element.getPartOf()) 
48575          composeReference(null, e);
48576        closeArray();
48577      };
48578      if (element.hasStatusElement()) {
48579        composeEnumerationCore("status", element.getStatusElement(), new MedicationUsage.MedicationUsageStatusEnumFactory(), false);
48580        composeEnumerationExtras("status", element.getStatusElement(), new MedicationUsage.MedicationUsageStatusEnumFactory(), false);
48581      }
48582      if (element.hasStatusReason()) {
48583        openArray("statusReason");
48584        for (CodeableConcept e : element.getStatusReason()) 
48585          composeCodeableConcept(null, e);
48586        closeArray();
48587      };
48588      if (element.hasCategory()) {
48589        openArray("category");
48590        for (CodeableConcept e : element.getCategory()) 
48591          composeCodeableConcept(null, e);
48592        closeArray();
48593      };
48594      if (element.hasMedication()) {
48595        composeType("medication", element.getMedication());
48596      }
48597      if (element.hasSubject()) {
48598        composeReference("subject", element.getSubject());
48599      }
48600      if (element.hasEncounter()) {
48601        composeReference("encounter", element.getEncounter());
48602      }
48603      if (element.hasEffective()) {
48604        composeType("effective", element.getEffective());
48605      }
48606      if (element.hasDateAssertedElement()) {
48607        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
48608        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
48609  }
48610      if (element.hasInformationSource()) {
48611        composeReference("informationSource", element.getInformationSource());
48612    }
48613      if (element.hasDerivedFrom()) {
48614        openArray("derivedFrom");
48615        for (Reference e : element.getDerivedFrom()) 
48616          composeReference(null, e);
48617        closeArray();
48618      };
48619      if (element.hasReasonCode()) {
48620        openArray("reasonCode");
48621        for (CodeableConcept e : element.getReasonCode()) 
48622          composeCodeableConcept(null, e);
48623        closeArray();
48624      };
48625      if (element.hasReasonReference()) {
48626        openArray("reasonReference");
48627        for (Reference e : element.getReasonReference()) 
48628          composeReference(null, e);
48629        closeArray();
48630      };
48631      if (element.hasNote()) {
48632        openArray("note");
48633        for (Annotation e : element.getNote()) 
48634          composeAnnotation(null, e);
48635        closeArray();
48636      };
48637      if (element.hasDosage()) {
48638        openArray("dosage");
48639        for (Dosage e : element.getDosage()) 
48640          composeDosage(null, e);
48641        closeArray();
48642      };
48643      if (element.hasTakenAsOrderedElement()) {
48644        composeBooleanCore("takenAsOrdered", element.getTakenAsOrderedElement(), false);
48645        composeBooleanExtras("takenAsOrdered", element.getTakenAsOrderedElement(), false);
48646      }
48647  }
48648
48649  protected void composeMedicinalProductDefinition(String name, MedicinalProductDefinition element) throws IOException {
48650    if (element != null) {
48651      prop("resourceType", name);
48652      composeMedicinalProductDefinitionInner(element);
48653    }
48654  }
48655
48656  protected void composeMedicinalProductDefinitionInner(MedicinalProductDefinition element) throws IOException {
48657      composeDomainResourceElements(element);
48658      if (element.hasIdentifier()) {
48659        openArray("identifier");
48660        for (Identifier e : element.getIdentifier()) 
48661          composeIdentifier(null, e);
48662        closeArray();
48663      };
48664      if (element.hasType()) {
48665        composeCodeableConcept("type", element.getType());
48666      }
48667      if (element.hasDomain()) {
48668        composeCoding("domain", element.getDomain());
48669      }
48670      if (element.hasDescriptionElement()) {
48671        composeStringCore("description", element.getDescriptionElement(), false);
48672        composeStringExtras("description", element.getDescriptionElement(), false);
48673      }
48674      if (element.hasCombinedPharmaceuticalDoseForm()) {
48675        composeCodeableConcept("combinedPharmaceuticalDoseForm", element.getCombinedPharmaceuticalDoseForm());
48676      }
48677      if (element.hasIndicationElement()) {
48678        composeMarkdownCore("indication", element.getIndicationElement(), false);
48679        composeMarkdownExtras("indication", element.getIndicationElement(), false);
48680      }
48681      if (element.hasLegalStatusOfSupply()) {
48682        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
48683      }
48684      if (element.hasAdditionalMonitoringIndicator()) {
48685        composeCodeableConcept("additionalMonitoringIndicator", element.getAdditionalMonitoringIndicator());
48686      }
48687      if (element.hasSpecialMeasure()) {
48688        openArray("specialMeasure");
48689        for (StringType e : element.getSpecialMeasure()) 
48690          composeStringCore(null, e, true);
48691        closeArray();
48692        if (anyHasExtras(element.getSpecialMeasure())) {
48693          openArray("_specialMeasure");
48694          for (StringType e : element.getSpecialMeasure()) 
48695            composeStringExtras(null, e, true);
48696        closeArray();
48697    }
48698      };
48699      if (element.hasPaediatricUseIndicator()) {
48700        composeCodeableConcept("paediatricUseIndicator", element.getPaediatricUseIndicator());
48701      }
48702      if (element.hasProductClassification()) {
48703        openArray("productClassification");
48704        for (CodeableConcept e : element.getProductClassification()) 
48705          composeCodeableConcept(null, e);
48706        closeArray();
48707      };
48708      if (element.hasMarketingStatus()) {
48709        openArray("marketingStatus");
48710        for (MarketingStatus e : element.getMarketingStatus()) 
48711          composeMarketingStatus(null, e);
48712        closeArray();
48713      };
48714      if (element.hasPharmaceuticalProduct()) {
48715        openArray("pharmaceuticalProduct");
48716        for (Reference e : element.getPharmaceuticalProduct()) 
48717          composeReference(null, e);
48718        closeArray();
48719      };
48720      if (element.hasPackagedMedicinalProduct()) {
48721        openArray("packagedMedicinalProduct");
48722        for (Reference e : element.getPackagedMedicinalProduct()) 
48723          composeReference(null, e);
48724        closeArray();
48725      };
48726      if (element.hasIngredient()) {
48727        openArray("ingredient");
48728        for (Reference e : element.getIngredient()) 
48729          composeReference(null, e);
48730        closeArray();
48731      };
48732      if (element.hasAttachedDocument()) {
48733        openArray("attachedDocument");
48734        for (Reference e : element.getAttachedDocument()) 
48735          composeReference(null, e);
48736        closeArray();
48737      };
48738      if (element.hasMasterFile()) {
48739        openArray("masterFile");
48740        for (Reference e : element.getMasterFile()) 
48741          composeReference(null, e);
48742        closeArray();
48743      };
48744      if (element.hasContact()) {
48745        openArray("contact");
48746        for (MedicinalProductDefinition.MedicinalProductDefinitionContactComponent e : element.getContact()) 
48747          composeMedicinalProductDefinitionMedicinalProductDefinitionContactComponent(null, e);
48748        closeArray();
48749      };
48750      if (element.hasClinicalTrial()) {
48751        openArray("clinicalTrial");
48752        for (Reference e : element.getClinicalTrial()) 
48753          composeReference(null, e);
48754        closeArray();
48755      };
48756      if (element.hasName()) {
48757        openArray("name");
48758        for (MedicinalProductDefinition.MedicinalProductDefinitionNameComponent e : element.getName()) 
48759          composeMedicinalProductDefinitionMedicinalProductDefinitionNameComponent(null, e);
48760        closeArray();
48761      };
48762      if (element.hasCrossReference()) {
48763        openArray("crossReference");
48764        for (Identifier e : element.getCrossReference()) 
48765          composeIdentifier(null, e);
48766        closeArray();
48767      };
48768      if (element.hasManufacturingBusinessOperation()) {
48769        openArray("manufacturingBusinessOperation");
48770        for (MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent e : element.getManufacturingBusinessOperation()) 
48771          composeMedicinalProductDefinitionMedicinalProductDefinitionManufacturingBusinessOperationComponent(null, e);
48772        closeArray();
48773      };
48774      if (element.hasSpecialDesignation()) {
48775        openArray("specialDesignation");
48776        for (MedicinalProductDefinition.MedicinalProductDefinitionSpecialDesignationComponent e : element.getSpecialDesignation()) 
48777          composeMedicinalProductDefinitionMedicinalProductDefinitionSpecialDesignationComponent(null, e);
48778        closeArray();
48779      };
48780  }
48781
48782  protected void composeMedicinalProductDefinitionMedicinalProductDefinitionContactComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionContactComponent element) throws IOException {
48783    if (element != null) {
48784      open(name);
48785      composeMedicinalProductDefinitionMedicinalProductDefinitionContactComponentInner(element);
48786      close();
48787    }
48788  }
48789
48790  protected void composeMedicinalProductDefinitionMedicinalProductDefinitionContactComponentInner(MedicinalProductDefinition.MedicinalProductDefinitionContactComponent element) throws IOException {
48791      composeBackbone(element);
48792      if (element.hasType()) {
48793        composeCodeableConcept("type", element.getType());
48794      }
48795      if (element.hasContact()) {
48796        composeReference("contact", element.getContact());
48797      }
48798  }
48799
48800  protected void composeMedicinalProductDefinitionMedicinalProductDefinitionNameComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameComponent element) throws IOException {
48801    if (element != null) {
48802      open(name);
48803      composeMedicinalProductDefinitionMedicinalProductDefinitionNameComponentInner(element);
48804      close();
48805    }
48806  }
48807
48808  protected void composeMedicinalProductDefinitionMedicinalProductDefinitionNameComponentInner(MedicinalProductDefinition.MedicinalProductDefinitionNameComponent element) throws IOException {
48809      composeBackbone(element);
48810      if (element.hasProductNameElement()) {
48811        composeStringCore("productName", element.getProductNameElement(), false);
48812        composeStringExtras("productName", element.getProductNameElement(), false);
48813      }
48814      if (element.hasType()) {
48815        composeCoding("type", element.getType());
48816      }
48817      if (element.hasNamePart()) {
48818        openArray("namePart");
48819        for (MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent e : element.getNamePart()) 
48820          composeMedicinalProductDefinitionMedicinalProductDefinitionNameNamePartComponent(null, e);
48821        closeArray();
48822      };
48823      if (element.hasCountryLanguage()) {
48824        openArray("countryLanguage");
48825        for (MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent e : element.getCountryLanguage()) 
48826          composeMedicinalProductDefinitionMedicinalProductDefinitionNameCountryLanguageComponent(null, e);
48827        closeArray();
48828      };
48829      }
48830
48831  protected void composeMedicinalProductDefinitionMedicinalProductDefinitionNameNamePartComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent element) throws IOException {
48832    if (element != null) {
48833      open(name);
48834      composeMedicinalProductDefinitionMedicinalProductDefinitionNameNamePartComponentInner(element);
48835      close();
48836      }
48837      }
48838
48839  protected void composeMedicinalProductDefinitionMedicinalProductDefinitionNameNamePartComponentInner(MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent element) throws IOException {
48840      composeBackbone(element);
48841      if (element.hasPartElement()) {
48842        composeStringCore("part", element.getPartElement(), false);
48843        composeStringExtras("part", element.getPartElement(), false);
48844      }
48845      if (element.hasType()) {
48846        composeCoding("type", element.getType());
48847      }
48848  }
48849
48850  protected void composeMedicinalProductDefinitionMedicinalProductDefinitionNameCountryLanguageComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent element) throws IOException {
48851    if (element != null) {
48852      open(name);
48853      composeMedicinalProductDefinitionMedicinalProductDefinitionNameCountryLanguageComponentInner(element);
48854      close();
48855    }
48856  }
48857
48858  protected void composeMedicinalProductDefinitionMedicinalProductDefinitionNameCountryLanguageComponentInner(MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent element) throws IOException {
48859      composeBackbone(element);
48860      if (element.hasCountry()) {
48861        composeCodeableConcept("country", element.getCountry());
48862      }
48863      if (element.hasJurisdiction()) {
48864        composeCodeableConcept("jurisdiction", element.getJurisdiction());
48865      }
48866      if (element.hasLanguage()) {
48867        composeCodeableConcept("language", element.getLanguage());
48868      }
48869  }
48870
48871  protected void composeMedicinalProductDefinitionMedicinalProductDefinitionManufacturingBusinessOperationComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent element) throws IOException {
48872    if (element != null) {
48873      open(name);
48874      composeMedicinalProductDefinitionMedicinalProductDefinitionManufacturingBusinessOperationComponentInner(element);
48875      close();
48876    }
48877  }
48878
48879  protected void composeMedicinalProductDefinitionMedicinalProductDefinitionManufacturingBusinessOperationComponentInner(MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent element) throws IOException {
48880      composeBackbone(element);
48881      if (element.hasOperationType()) {
48882        composeCodeableConcept("operationType", element.getOperationType());
48883      }
48884      if (element.hasAuthorisationReferenceNumber()) {
48885        composeIdentifier("authorisationReferenceNumber", element.getAuthorisationReferenceNumber());
48886      }
48887      if (element.hasEffectiveDate()) {
48888        composePeriod("effectiveDate", element.getEffectiveDate());
48889      }
48890      if (element.hasConfidentialityIndicator()) {
48891        composeCodeableConcept("confidentialityIndicator", element.getConfidentialityIndicator());
48892      }
48893      if (element.hasManufacturer()) {
48894        openArray("manufacturer");
48895        for (Reference e : element.getManufacturer()) 
48896          composeReference(null, e);
48897        closeArray();
48898      };
48899      if (element.hasRegulator()) {
48900        composeReference("regulator", element.getRegulator());
48901      }
48902  }
48903
48904  protected void composeMedicinalProductDefinitionMedicinalProductDefinitionSpecialDesignationComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionSpecialDesignationComponent element) throws IOException {
48905    if (element != null) {
48906      open(name);
48907      composeMedicinalProductDefinitionMedicinalProductDefinitionSpecialDesignationComponentInner(element);
48908      close();
48909    }
48910  }
48911
48912  protected void composeMedicinalProductDefinitionMedicinalProductDefinitionSpecialDesignationComponentInner(MedicinalProductDefinition.MedicinalProductDefinitionSpecialDesignationComponent element) throws IOException {
48913      composeBackbone(element);
48914      if (element.hasIdentifier()) {
48915        openArray("identifier");
48916        for (Identifier e : element.getIdentifier()) 
48917          composeIdentifier(null, e);
48918        closeArray();
48919      };
48920      if (element.hasType()) {
48921        composeCodeableConcept("type", element.getType());
48922      }
48923      if (element.hasIntendedUse()) {
48924        composeCodeableConcept("intendedUse", element.getIntendedUse());
48925      }
48926      if (element.hasIndication()) {
48927        composeType("indication", element.getIndication());
48928      }
48929      if (element.hasStatus()) {
48930        composeCodeableConcept("status", element.getStatus());
48931      }
48932      if (element.hasDateElement()) {
48933        composeDateTimeCore("date", element.getDateElement(), false);
48934        composeDateTimeExtras("date", element.getDateElement(), false);
48935      }
48936      if (element.hasSpecies()) {
48937        composeCodeableConcept("species", element.getSpecies());
48938      }
48939  }
48940
48941  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
48942    if (element != null) {
48943      prop("resourceType", name);
48944      composeMessageDefinitionInner(element);
48945    }
48946  }
48947
48948  protected void composeMessageDefinitionInner(MessageDefinition element) throws IOException {
48949      composeDomainResourceElements(element);
48950      if (element.hasUrlElement()) {
48951        composeUriCore("url", element.getUrlElement(), false);
48952        composeUriExtras("url", element.getUrlElement(), false);
48953      }
48954      if (element.hasIdentifier()) {
48955        openArray("identifier");
48956        for (Identifier e : element.getIdentifier()) 
48957          composeIdentifier(null, e);
48958        closeArray();
48959      };
48960      if (element.hasVersionElement()) {
48961        composeStringCore("version", element.getVersionElement(), false);
48962        composeStringExtras("version", element.getVersionElement(), false);
48963      }
48964      if (element.hasNameElement()) {
48965        composeStringCore("name", element.getNameElement(), false);
48966        composeStringExtras("name", element.getNameElement(), false);
48967      }
48968      if (element.hasTitleElement()) {
48969        composeStringCore("title", element.getTitleElement(), false);
48970        composeStringExtras("title", element.getTitleElement(), false);
48971      }
48972      if (element.hasReplaces()) {
48973        openArray("replaces");
48974        for (CanonicalType e : element.getReplaces()) 
48975          composeCanonicalCore(null, e, true);
48976        closeArray();
48977        if (anyHasExtras(element.getReplaces())) {
48978          openArray("_replaces");
48979          for (CanonicalType e : element.getReplaces()) 
48980            composeCanonicalExtras(null, e, true);
48981          closeArray();
48982        }
48983      };
48984      if (element.hasStatusElement()) {
48985        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48986        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48987      }
48988      if (element.hasExperimentalElement()) {
48989        composeBooleanCore("experimental", element.getExperimentalElement(), false);
48990        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
48991      }
48992      if (element.hasDateElement()) {
48993        composeDateTimeCore("date", element.getDateElement(), false);
48994        composeDateTimeExtras("date", element.getDateElement(), false);
48995      }
48996      if (element.hasPublisherElement()) {
48997        composeStringCore("publisher", element.getPublisherElement(), false);
48998        composeStringExtras("publisher", element.getPublisherElement(), false);
48999      }
49000      if (element.hasContact()) {
49001        openArray("contact");
49002        for (ContactDetail e : element.getContact()) 
49003          composeContactDetail(null, e);
49004        closeArray();
49005      };
49006      if (element.hasDescriptionElement()) {
49007        composeMarkdownCore("description", element.getDescriptionElement(), false);
49008        composeMarkdownExtras("description", element.getDescriptionElement(), false);
49009      }
49010      if (element.hasUseContext()) {
49011        openArray("useContext");
49012        for (UsageContext e : element.getUseContext()) 
49013          composeUsageContext(null, e);
49014        closeArray();
49015      };
49016      if (element.hasJurisdiction()) {
49017        openArray("jurisdiction");
49018        for (CodeableConcept e : element.getJurisdiction()) 
49019          composeCodeableConcept(null, e);
49020        closeArray();
49021      };
49022      if (element.hasPurposeElement()) {
49023        composeMarkdownCore("purpose", element.getPurposeElement(), false);
49024        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
49025      }
49026      if (element.hasCopyrightElement()) {
49027        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
49028        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
49029      }
49030      if (element.hasBaseElement()) {
49031        composeCanonicalCore("base", element.getBaseElement(), false);
49032        composeCanonicalExtras("base", element.getBaseElement(), false);
49033      }
49034      if (element.hasParent()) {
49035        openArray("parent");
49036        for (CanonicalType e : element.getParent()) 
49037          composeCanonicalCore(null, e, true);
49038        closeArray();
49039        if (anyHasExtras(element.getParent())) {
49040          openArray("_parent");
49041          for (CanonicalType e : element.getParent()) 
49042            composeCanonicalExtras(null, e, true);
49043          closeArray();
49044        }
49045      };
49046      if (element.hasEvent()) {
49047        composeType("event", element.getEvent());
49048      }
49049      if (element.hasCategoryElement()) {
49050        composeEnumerationCore("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
49051        composeEnumerationExtras("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
49052      }
49053      if (element.hasFocus()) {
49054        openArray("focus");
49055        for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus()) 
49056          composeMessageDefinitionMessageDefinitionFocusComponent(null, e);
49057        closeArray();
49058      };
49059      if (element.hasResponseRequiredElement()) {
49060        composeEnumerationCore("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
49061        composeEnumerationExtras("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
49062      }
49063      if (element.hasAllowedResponse()) {
49064        openArray("allowedResponse");
49065        for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
49066          composeMessageDefinitionMessageDefinitionAllowedResponseComponent(null, e);
49067        closeArray();
49068      };
49069      if (element.hasGraph()) {
49070        openArray("graph");
49071        for (CanonicalType e : element.getGraph()) 
49072          composeCanonicalCore(null, e, true);
49073        closeArray();
49074        if (anyHasExtras(element.getGraph())) {
49075          openArray("_graph");
49076          for (CanonicalType e : element.getGraph()) 
49077            composeCanonicalExtras(null, e, true);
49078          closeArray();
49079        }
49080      };
49081  }
49082
49083  protected void composeMessageDefinitionMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
49084    if (element != null) {
49085      open(name);
49086      composeMessageDefinitionMessageDefinitionFocusComponentInner(element);
49087      close();
49088    }
49089  }
49090
49091  protected void composeMessageDefinitionMessageDefinitionFocusComponentInner(MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
49092      composeBackbone(element);
49093      if (element.hasCodeElement()) {
49094        composeCodeCore("code", element.getCodeElement(), false);
49095        composeCodeExtras("code", element.getCodeElement(), false);
49096      }
49097      if (element.hasProfileElement()) {
49098        composeCanonicalCore("profile", element.getProfileElement(), false);
49099        composeCanonicalExtras("profile", element.getProfileElement(), false);
49100      }
49101      if (element.hasMinElement()) {
49102        composeUnsignedIntCore("min", element.getMinElement(), false);
49103        composeUnsignedIntExtras("min", element.getMinElement(), false);
49104      }
49105      if (element.hasMaxElement()) {
49106        composeStringCore("max", element.getMaxElement(), false);
49107        composeStringExtras("max", element.getMaxElement(), false);
49108      }
49109  }
49110
49111  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
49112    if (element != null) {
49113      open(name);
49114      composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(element);
49115      close();
49116    }
49117  }
49118
49119  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
49120      composeBackbone(element);
49121      if (element.hasMessageElement()) {
49122        composeCanonicalCore("message", element.getMessageElement(), false);
49123        composeCanonicalExtras("message", element.getMessageElement(), false);
49124      }
49125      if (element.hasSituationElement()) {
49126        composeMarkdownCore("situation", element.getSituationElement(), false);
49127        composeMarkdownExtras("situation", element.getSituationElement(), false);
49128      }
49129  }
49130
49131  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
49132    if (element != null) {
49133      prop("resourceType", name);
49134      composeMessageHeaderInner(element);
49135    }
49136  }
49137
49138  protected void composeMessageHeaderInner(MessageHeader element) throws IOException {
49139      composeDomainResourceElements(element);
49140      if (element.hasEvent()) {
49141        composeType("event", element.getEvent());
49142      }
49143      if (element.hasDestination()) {
49144        openArray("destination");
49145        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
49146          composeMessageHeaderMessageDestinationComponent(null, e);
49147        closeArray();
49148      };
49149      if (element.hasSender()) {
49150        composeReference("sender", element.getSender());
49151      }
49152      if (element.hasEnterer()) {
49153        composeReference("enterer", element.getEnterer());
49154      }
49155      if (element.hasAuthor()) {
49156        composeReference("author", element.getAuthor());
49157      }
49158      if (element.hasSource()) {
49159        composeMessageHeaderMessageSourceComponent("source", element.getSource());
49160      }
49161      if (element.hasResponsible()) {
49162        composeReference("responsible", element.getResponsible());
49163      }
49164      if (element.hasReason()) {
49165        composeCodeableConcept("reason", element.getReason());
49166      }
49167      if (element.hasResponse()) {
49168        composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
49169      }
49170      if (element.hasFocus()) {
49171        openArray("focus");
49172        for (Reference e : element.getFocus()) 
49173          composeReference(null, e);
49174        closeArray();
49175      };
49176      if (element.hasDefinitionElement()) {
49177        composeCanonicalCore("definition", element.getDefinitionElement(), false);
49178        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
49179      }
49180  }
49181
49182  protected void composeMessageHeaderMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
49183    if (element != null) {
49184      open(name);
49185      composeMessageHeaderMessageDestinationComponentInner(element);
49186      close();
49187    }
49188  }
49189
49190  protected void composeMessageHeaderMessageDestinationComponentInner(MessageHeader.MessageDestinationComponent element) throws IOException {
49191      composeBackbone(element);
49192      if (element.hasNameElement()) {
49193        composeStringCore("name", element.getNameElement(), false);
49194        composeStringExtras("name", element.getNameElement(), false);
49195      }
49196      if (element.hasTarget()) {
49197        composeReference("target", element.getTarget());
49198      }
49199      if (element.hasEndpointElement()) {
49200        composeUrlCore("endpoint", element.getEndpointElement(), false);
49201        composeUrlExtras("endpoint", element.getEndpointElement(), false);
49202      }
49203      if (element.hasReceiver()) {
49204        composeReference("receiver", element.getReceiver());
49205      }
49206  }
49207
49208  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
49209    if (element != null) {
49210      open(name);
49211      composeMessageHeaderMessageSourceComponentInner(element);
49212      close();
49213    }
49214  }
49215
49216  protected void composeMessageHeaderMessageSourceComponentInner(MessageHeader.MessageSourceComponent element) throws IOException {
49217      composeBackbone(element);
49218      if (element.hasNameElement()) {
49219        composeStringCore("name", element.getNameElement(), false);
49220        composeStringExtras("name", element.getNameElement(), false);
49221      }
49222      if (element.hasSoftwareElement()) {
49223        composeStringCore("software", element.getSoftwareElement(), false);
49224        composeStringExtras("software", element.getSoftwareElement(), false);
49225      }
49226      if (element.hasVersionElement()) {
49227        composeStringCore("version", element.getVersionElement(), false);
49228        composeStringExtras("version", element.getVersionElement(), false);
49229      }
49230      if (element.hasContact()) {
49231        composeContactPoint("contact", element.getContact());
49232      }
49233      if (element.hasEndpointElement()) {
49234        composeUrlCore("endpoint", element.getEndpointElement(), false);
49235        composeUrlExtras("endpoint", element.getEndpointElement(), false);
49236      }
49237  }
49238
49239  protected void composeMessageHeaderMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
49240    if (element != null) {
49241      open(name);
49242      composeMessageHeaderMessageHeaderResponseComponentInner(element);
49243      close();
49244    }
49245  }
49246
49247  protected void composeMessageHeaderMessageHeaderResponseComponentInner(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
49248      composeBackbone(element);
49249      if (element.hasIdentifierElement()) {
49250        composeIdCore("identifier", element.getIdentifierElement(), false);
49251        composeIdExtras("identifier", element.getIdentifierElement(), false);
49252      }
49253      if (element.hasCodeElement()) {
49254        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
49255        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
49256      }
49257      if (element.hasDetails()) {
49258        composeReference("details", element.getDetails());
49259      }
49260  }
49261
49262  protected void composeMolecularSequence(String name, MolecularSequence element) throws IOException {
49263    if (element != null) {
49264      prop("resourceType", name);
49265      composeMolecularSequenceInner(element);
49266    }
49267  }
49268
49269  protected void composeMolecularSequenceInner(MolecularSequence element) throws IOException {
49270      composeDomainResourceElements(element);
49271      if (element.hasIdentifier()) {
49272        openArray("identifier");
49273        for (Identifier e : element.getIdentifier()) 
49274          composeIdentifier(null, e);
49275        closeArray();
49276      };
49277      if (element.hasTypeElement()) {
49278        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
49279        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
49280      }
49281      if (element.hasCoordinateSystemElement()) {
49282        composeIntegerCore("coordinateSystem", element.getCoordinateSystemElement(), false);
49283        composeIntegerExtras("coordinateSystem", element.getCoordinateSystemElement(), false);
49284      }
49285      if (element.hasPatient()) {
49286        composeReference("patient", element.getPatient());
49287      }
49288      if (element.hasSpecimen()) {
49289        composeReference("specimen", element.getSpecimen());
49290      }
49291      if (element.hasDevice()) {
49292        composeReference("device", element.getDevice());
49293      }
49294      if (element.hasPerformer()) {
49295        composeReference("performer", element.getPerformer());
49296      }
49297      if (element.hasQuantity()) {
49298        composeQuantity("quantity", element.getQuantity());
49299      }
49300      if (element.hasReferenceSeq()) {
49301        composeMolecularSequenceMolecularSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
49302      }
49303      if (element.hasVariant()) {
49304        openArray("variant");
49305        for (MolecularSequence.MolecularSequenceVariantComponent e : element.getVariant()) 
49306          composeMolecularSequenceMolecularSequenceVariantComponent(null, e);
49307        closeArray();
49308      };
49309      if (element.hasObservedSeqElement()) {
49310        composeStringCore("observedSeq", element.getObservedSeqElement(), false);
49311        composeStringExtras("observedSeq", element.getObservedSeqElement(), false);
49312      }
49313      if (element.hasQuality()) {
49314        openArray("quality");
49315        for (MolecularSequence.MolecularSequenceQualityComponent e : element.getQuality()) 
49316          composeMolecularSequenceMolecularSequenceQualityComponent(null, e);
49317        closeArray();
49318      };
49319      if (element.hasReadCoverageElement()) {
49320        composeIntegerCore("readCoverage", element.getReadCoverageElement(), false);
49321        composeIntegerExtras("readCoverage", element.getReadCoverageElement(), false);
49322      }
49323      if (element.hasRepository()) {
49324        openArray("repository");
49325        for (MolecularSequence.MolecularSequenceRepositoryComponent e : element.getRepository()) 
49326          composeMolecularSequenceMolecularSequenceRepositoryComponent(null, e);
49327        closeArray();
49328      };
49329      if (element.hasPointer()) {
49330        openArray("pointer");
49331        for (Reference e : element.getPointer()) 
49332          composeReference(null, e);
49333        closeArray();
49334      };
49335      if (element.hasStructureVariant()) {
49336        openArray("structureVariant");
49337        for (MolecularSequence.MolecularSequenceStructureVariantComponent e : element.getStructureVariant()) 
49338          composeMolecularSequenceMolecularSequenceStructureVariantComponent(null, e);
49339        closeArray();
49340      };
49341  }
49342
49343  protected void composeMolecularSequenceMolecularSequenceReferenceSeqComponent(String name, MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
49344    if (element != null) {
49345      open(name);
49346      composeMolecularSequenceMolecularSequenceReferenceSeqComponentInner(element);
49347      close();
49348    }
49349  }
49350
49351  protected void composeMolecularSequenceMolecularSequenceReferenceSeqComponentInner(MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
49352      composeBackbone(element);
49353      if (element.hasChromosome()) {
49354        composeCodeableConcept("chromosome", element.getChromosome());
49355      }
49356      if (element.hasGenomeBuildElement()) {
49357        composeStringCore("genomeBuild", element.getGenomeBuildElement(), false);
49358        composeStringExtras("genomeBuild", element.getGenomeBuildElement(), false);
49359      }
49360      if (element.hasOrientationElement()) {
49361        composeEnumerationCore("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
49362        composeEnumerationExtras("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
49363      }
49364      if (element.hasReferenceSeqId()) {
49365        composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
49366      }
49367      if (element.hasReferenceSeqPointer()) {
49368        composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
49369      }
49370      if (element.hasReferenceSeqStringElement()) {
49371        composeStringCore("referenceSeqString", element.getReferenceSeqStringElement(), false);
49372        composeStringExtras("referenceSeqString", element.getReferenceSeqStringElement(), false);
49373      }
49374      if (element.hasStrandElement()) {
49375        composeEnumerationCore("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
49376        composeEnumerationExtras("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
49377      }
49378      if (element.hasWindowStartElement()) {
49379        composeIntegerCore("windowStart", element.getWindowStartElement(), false);
49380        composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
49381      }
49382      if (element.hasWindowEndElement()) {
49383        composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
49384        composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
49385      }
49386  }
49387
49388  protected void composeMolecularSequenceMolecularSequenceVariantComponent(String name, MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
49389    if (element != null) {
49390      open(name);
49391      composeMolecularSequenceMolecularSequenceVariantComponentInner(element);
49392      close();
49393    }
49394  }
49395
49396  protected void composeMolecularSequenceMolecularSequenceVariantComponentInner(MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
49397      composeBackbone(element);
49398      if (element.hasStartElement()) {
49399        composeIntegerCore("start", element.getStartElement(), false);
49400        composeIntegerExtras("start", element.getStartElement(), false);
49401      }
49402      if (element.hasEndElement()) {
49403        composeIntegerCore("end", element.getEndElement(), false);
49404        composeIntegerExtras("end", element.getEndElement(), false);
49405      }
49406      if (element.hasObservedAlleleElement()) {
49407        composeStringCore("observedAllele", element.getObservedAlleleElement(), false);
49408        composeStringExtras("observedAllele", element.getObservedAlleleElement(), false);
49409      }
49410      if (element.hasReferenceAlleleElement()) {
49411        composeStringCore("referenceAllele", element.getReferenceAlleleElement(), false);
49412        composeStringExtras("referenceAllele", element.getReferenceAlleleElement(), false);
49413      }
49414      if (element.hasCigarElement()) {
49415        composeStringCore("cigar", element.getCigarElement(), false);
49416        composeStringExtras("cigar", element.getCigarElement(), false);
49417      }
49418      if (element.hasVariantPointer()) {
49419        composeReference("variantPointer", element.getVariantPointer());
49420      }
49421  }
49422
49423  protected void composeMolecularSequenceMolecularSequenceQualityComponent(String name, MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
49424    if (element != null) {
49425      open(name);
49426      composeMolecularSequenceMolecularSequenceQualityComponentInner(element);
49427      close();
49428    }
49429  }
49430
49431  protected void composeMolecularSequenceMolecularSequenceQualityComponentInner(MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
49432      composeBackbone(element);
49433      if (element.hasTypeElement()) {
49434        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
49435        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
49436      }
49437      if (element.hasStandardSequence()) {
49438        composeCodeableConcept("standardSequence", element.getStandardSequence());
49439      }
49440      if (element.hasStartElement()) {
49441        composeIntegerCore("start", element.getStartElement(), false);
49442        composeIntegerExtras("start", element.getStartElement(), false);
49443      }
49444      if (element.hasEndElement()) {
49445        composeIntegerCore("end", element.getEndElement(), false);
49446        composeIntegerExtras("end", element.getEndElement(), false);
49447      }
49448      if (element.hasScore()) {
49449        composeQuantity("score", element.getScore());
49450      }
49451      if (element.hasMethod()) {
49452        composeCodeableConcept("method", element.getMethod());
49453      }
49454      if (element.hasTruthTPElement()) {
49455        composeDecimalCore("truthTP", element.getTruthTPElement(), false);
49456        composeDecimalExtras("truthTP", element.getTruthTPElement(), false);
49457      }
49458      if (element.hasQueryTPElement()) {
49459        composeDecimalCore("queryTP", element.getQueryTPElement(), false);
49460        composeDecimalExtras("queryTP", element.getQueryTPElement(), false);
49461      }
49462      if (element.hasTruthFNElement()) {
49463        composeDecimalCore("truthFN", element.getTruthFNElement(), false);
49464        composeDecimalExtras("truthFN", element.getTruthFNElement(), false);
49465      }
49466      if (element.hasQueryFPElement()) {
49467        composeDecimalCore("queryFP", element.getQueryFPElement(), false);
49468        composeDecimalExtras("queryFP", element.getQueryFPElement(), false);
49469      }
49470      if (element.hasGtFPElement()) {
49471        composeDecimalCore("gtFP", element.getGtFPElement(), false);
49472        composeDecimalExtras("gtFP", element.getGtFPElement(), false);
49473      }
49474      if (element.hasPrecisionElement()) {
49475        composeDecimalCore("precision", element.getPrecisionElement(), false);
49476        composeDecimalExtras("precision", element.getPrecisionElement(), false);
49477      }
49478      if (element.hasRecallElement()) {
49479        composeDecimalCore("recall", element.getRecallElement(), false);
49480        composeDecimalExtras("recall", element.getRecallElement(), false);
49481      }
49482      if (element.hasFScoreElement()) {
49483        composeDecimalCore("fScore", element.getFScoreElement(), false);
49484        composeDecimalExtras("fScore", element.getFScoreElement(), false);
49485      }
49486      if (element.hasRoc()) {
49487        composeMolecularSequenceMolecularSequenceQualityRocComponent("roc", element.getRoc());
49488      }
49489  }
49490
49491  protected void composeMolecularSequenceMolecularSequenceQualityRocComponent(String name, MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
49492    if (element != null) {
49493      open(name);
49494      composeMolecularSequenceMolecularSequenceQualityRocComponentInner(element);
49495      close();
49496    }
49497  }
49498
49499  protected void composeMolecularSequenceMolecularSequenceQualityRocComponentInner(MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
49500      composeBackbone(element);
49501      if (element.hasScore()) {
49502        openArray("score");
49503        for (IntegerType e : element.getScore()) 
49504          composeIntegerCore(null, e, true);
49505        closeArray();
49506        if (anyHasExtras(element.getScore())) {
49507          openArray("_score");
49508          for (IntegerType e : element.getScore()) 
49509            composeIntegerExtras(null, e, true);
49510          closeArray();
49511        }
49512      };
49513      if (element.hasNumTP()) {
49514        openArray("numTP");
49515        for (IntegerType e : element.getNumTP()) 
49516          composeIntegerCore(null, e, true);
49517        closeArray();
49518        if (anyHasExtras(element.getNumTP())) {
49519          openArray("_numTP");
49520          for (IntegerType e : element.getNumTP()) 
49521            composeIntegerExtras(null, e, true);
49522          closeArray();
49523        }
49524      };
49525      if (element.hasNumFP()) {
49526        openArray("numFP");
49527        for (IntegerType e : element.getNumFP()) 
49528          composeIntegerCore(null, e, true);
49529        closeArray();
49530        if (anyHasExtras(element.getNumFP())) {
49531          openArray("_numFP");
49532          for (IntegerType e : element.getNumFP()) 
49533            composeIntegerExtras(null, e, true);
49534          closeArray();
49535        }
49536      };
49537      if (element.hasNumFN()) {
49538        openArray("numFN");
49539        for (IntegerType e : element.getNumFN()) 
49540          composeIntegerCore(null, e, true);
49541        closeArray();
49542        if (anyHasExtras(element.getNumFN())) {
49543          openArray("_numFN");
49544          for (IntegerType e : element.getNumFN()) 
49545            composeIntegerExtras(null, e, true);
49546          closeArray();
49547        }
49548      };
49549      if (element.hasPrecision()) {
49550        openArray("precision");
49551        for (DecimalType e : element.getPrecision()) 
49552          composeDecimalCore(null, e, true);
49553        closeArray();
49554        if (anyHasExtras(element.getPrecision())) {
49555          openArray("_precision");
49556          for (DecimalType e : element.getPrecision()) 
49557            composeDecimalExtras(null, e, true);
49558          closeArray();
49559        }
49560      };
49561      if (element.hasSensitivity()) {
49562        openArray("sensitivity");
49563        for (DecimalType e : element.getSensitivity()) 
49564          composeDecimalCore(null, e, true);
49565        closeArray();
49566        if (anyHasExtras(element.getSensitivity())) {
49567          openArray("_sensitivity");
49568          for (DecimalType e : element.getSensitivity()) 
49569            composeDecimalExtras(null, e, true);
49570          closeArray();
49571        }
49572      };
49573      if (element.hasFMeasure()) {
49574        openArray("fMeasure");
49575        for (DecimalType e : element.getFMeasure()) 
49576          composeDecimalCore(null, e, true);
49577        closeArray();
49578        if (anyHasExtras(element.getFMeasure())) {
49579          openArray("_fMeasure");
49580          for (DecimalType e : element.getFMeasure()) 
49581            composeDecimalExtras(null, e, true);
49582          closeArray();
49583        }
49584      };
49585  }
49586
49587  protected void composeMolecularSequenceMolecularSequenceRepositoryComponent(String name, MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
49588    if (element != null) {
49589      open(name);
49590      composeMolecularSequenceMolecularSequenceRepositoryComponentInner(element);
49591      close();
49592    }
49593  }
49594
49595  protected void composeMolecularSequenceMolecularSequenceRepositoryComponentInner(MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
49596      composeBackbone(element);
49597      if (element.hasTypeElement()) {
49598        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(), false);
49599        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(), false);
49600      }
49601      if (element.hasUrlElement()) {
49602        composeUriCore("url", element.getUrlElement(), false);
49603        composeUriExtras("url", element.getUrlElement(), false);
49604      }
49605      if (element.hasNameElement()) {
49606        composeStringCore("name", element.getNameElement(), false);
49607        composeStringExtras("name", element.getNameElement(), false);
49608      }
49609      if (element.hasDatasetIdElement()) {
49610        composeStringCore("datasetId", element.getDatasetIdElement(), false);
49611        composeStringExtras("datasetId", element.getDatasetIdElement(), false);
49612      }
49613      if (element.hasVariantsetIdElement()) {
49614        composeStringCore("variantsetId", element.getVariantsetIdElement(), false);
49615        composeStringExtras("variantsetId", element.getVariantsetIdElement(), false);
49616      }
49617      if (element.hasReadsetIdElement()) {
49618        composeStringCore("readsetId", element.getReadsetIdElement(), false);
49619        composeStringExtras("readsetId", element.getReadsetIdElement(), false);
49620      }
49621  }
49622
49623  protected void composeMolecularSequenceMolecularSequenceStructureVariantComponent(String name, MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
49624    if (element != null) {
49625      open(name);
49626      composeMolecularSequenceMolecularSequenceStructureVariantComponentInner(element);
49627      close();
49628    }
49629  }
49630
49631  protected void composeMolecularSequenceMolecularSequenceStructureVariantComponentInner(MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
49632      composeBackbone(element);
49633      if (element.hasVariantType()) {
49634        composeCodeableConcept("variantType", element.getVariantType());
49635      }
49636      if (element.hasExactElement()) {
49637        composeBooleanCore("exact", element.getExactElement(), false);
49638        composeBooleanExtras("exact", element.getExactElement(), false);
49639      }
49640      if (element.hasLengthElement()) {
49641        composeIntegerCore("length", element.getLengthElement(), false);
49642        composeIntegerExtras("length", element.getLengthElement(), false);
49643      }
49644      if (element.hasOuter()) {
49645        composeMolecularSequenceMolecularSequenceStructureVariantOuterComponent("outer", element.getOuter());
49646      }
49647      if (element.hasInner()) {
49648        composeMolecularSequenceMolecularSequenceStructureVariantInnerComponent("inner", element.getInner());
49649      }
49650  }
49651
49652  protected void composeMolecularSequenceMolecularSequenceStructureVariantOuterComponent(String name, MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
49653    if (element != null) {
49654      open(name);
49655      composeMolecularSequenceMolecularSequenceStructureVariantOuterComponentInner(element);
49656      close();
49657    }
49658  }
49659
49660  protected void composeMolecularSequenceMolecularSequenceStructureVariantOuterComponentInner(MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
49661      composeBackbone(element);
49662      if (element.hasStartElement()) {
49663        composeIntegerCore("start", element.getStartElement(), false);
49664        composeIntegerExtras("start", element.getStartElement(), false);
49665      }
49666      if (element.hasEndElement()) {
49667        composeIntegerCore("end", element.getEndElement(), false);
49668        composeIntegerExtras("end", element.getEndElement(), false);
49669      }
49670  }
49671
49672  protected void composeMolecularSequenceMolecularSequenceStructureVariantInnerComponent(String name, MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
49673    if (element != null) {
49674      open(name);
49675      composeMolecularSequenceMolecularSequenceStructureVariantInnerComponentInner(element);
49676      close();
49677    }
49678  }
49679
49680  protected void composeMolecularSequenceMolecularSequenceStructureVariantInnerComponentInner(MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
49681      composeBackbone(element);
49682      if (element.hasStartElement()) {
49683        composeIntegerCore("start", element.getStartElement(), false);
49684        composeIntegerExtras("start", element.getStartElement(), false);
49685      }
49686      if (element.hasEndElement()) {
49687        composeIntegerCore("end", element.getEndElement(), false);
49688        composeIntegerExtras("end", element.getEndElement(), false);
49689      }
49690  }
49691
49692  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
49693    if (element != null) {
49694      prop("resourceType", name);
49695      composeNamingSystemInner(element);
49696    }
49697  }
49698
49699  protected void composeNamingSystemInner(NamingSystem element) throws IOException {
49700      composeDomainResourceElements(element);
49701      if (element.hasNameElement()) {
49702        composeStringCore("name", element.getNameElement(), false);
49703        composeStringExtras("name", element.getNameElement(), false);
49704      }
49705      if (element.hasStatusElement()) {
49706        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49707        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49708      }
49709      if (element.hasKindElement()) {
49710        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
49711        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
49712      }
49713      if (element.hasDateElement()) {
49714        composeDateTimeCore("date", element.getDateElement(), false);
49715        composeDateTimeExtras("date", element.getDateElement(), false);
49716      }
49717      if (element.hasPublisherElement()) {
49718        composeStringCore("publisher", element.getPublisherElement(), false);
49719        composeStringExtras("publisher", element.getPublisherElement(), false);
49720      }
49721      if (element.hasContact()) {
49722        openArray("contact");
49723        for (ContactDetail e : element.getContact()) 
49724          composeContactDetail(null, e);
49725        closeArray();
49726      };
49727      if (element.hasResponsibleElement()) {
49728        composeStringCore("responsible", element.getResponsibleElement(), false);
49729        composeStringExtras("responsible", element.getResponsibleElement(), false);
49730      }
49731      if (element.hasType()) {
49732        composeCodeableConcept("type", element.getType());
49733      }
49734      if (element.hasDescriptionElement()) {
49735        composeMarkdownCore("description", element.getDescriptionElement(), false);
49736        composeMarkdownExtras("description", element.getDescriptionElement(), false);
49737      }
49738      if (element.hasUseContext()) {
49739        openArray("useContext");
49740        for (UsageContext e : element.getUseContext()) 
49741          composeUsageContext(null, e);
49742        closeArray();
49743      };
49744      if (element.hasJurisdiction()) {
49745        openArray("jurisdiction");
49746        for (CodeableConcept e : element.getJurisdiction()) 
49747          composeCodeableConcept(null, e);
49748        closeArray();
49749      };
49750      if (element.hasUsageElement()) {
49751        composeStringCore("usage", element.getUsageElement(), false);
49752        composeStringExtras("usage", element.getUsageElement(), false);
49753      }
49754      if (element.hasUniqueId()) {
49755        openArray("uniqueId");
49756        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
49757          composeNamingSystemNamingSystemUniqueIdComponent(null, e);
49758        closeArray();
49759      };
49760  }
49761
49762  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
49763    if (element != null) {
49764      open(name);
49765      composeNamingSystemNamingSystemUniqueIdComponentInner(element);
49766      close();
49767    }
49768  }
49769
49770  protected void composeNamingSystemNamingSystemUniqueIdComponentInner(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
49771      composeBackbone(element);
49772      if (element.hasTypeElement()) {
49773        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
49774        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
49775      }
49776      if (element.hasValueElement()) {
49777        composeStringCore("value", element.getValueElement(), false);
49778        composeStringExtras("value", element.getValueElement(), false);
49779      }
49780      if (element.hasPreferredElement()) {
49781        composeBooleanCore("preferred", element.getPreferredElement(), false);
49782        composeBooleanExtras("preferred", element.getPreferredElement(), false);
49783      }
49784      if (element.hasCommentElement()) {
49785        composeStringCore("comment", element.getCommentElement(), false);
49786        composeStringExtras("comment", element.getCommentElement(), false);
49787      }
49788      if (element.hasPeriod()) {
49789        composePeriod("period", element.getPeriod());
49790      }
49791  }
49792
49793  protected void composeNutritionIntake(String name, NutritionIntake element) throws IOException {
49794    if (element != null) {
49795      prop("resourceType", name);
49796      composeNutritionIntakeInner(element);
49797    }
49798  }
49799
49800  protected void composeNutritionIntakeInner(NutritionIntake element) throws IOException {
49801      composeDomainResourceElements(element);
49802      if (element.hasIdentifier()) {
49803        openArray("identifier");
49804        for (Identifier e : element.getIdentifier()) 
49805          composeIdentifier(null, e);
49806        closeArray();
49807      };
49808      if (element.hasBasedOn()) {
49809        openArray("basedOn");
49810        for (Reference e : element.getBasedOn()) 
49811          composeReference(null, e);
49812        closeArray();
49813      };
49814      if (element.hasPartOf()) {
49815        openArray("partOf");
49816        for (Reference e : element.getPartOf()) 
49817          composeReference(null, e);
49818        closeArray();
49819      };
49820      if (element.hasStatusElement()) {
49821        composeEnumerationCore("status", element.getStatusElement(), new NutritionIntake.NutritionIntakeStatusEnumFactory(), false);
49822        composeEnumerationExtras("status", element.getStatusElement(), new NutritionIntake.NutritionIntakeStatusEnumFactory(), false);
49823      }
49824      if (element.hasStatusReason()) {
49825        openArray("statusReason");
49826        for (CodeableConcept e : element.getStatusReason()) 
49827          composeCodeableConcept(null, e);
49828        closeArray();
49829      };
49830      if (element.hasCategory()) {
49831        openArray("category");
49832        for (CodeableConcept e : element.getCategory()) 
49833          composeCodeableConcept(null, e);
49834        closeArray();
49835      };
49836      if (element.hasConsumedItem()) {
49837        openArray("consumedItem");
49838        for (NutritionIntake.NutritionIntakeConsumedItemComponent e : element.getConsumedItem()) 
49839          composeNutritionIntakeNutritionIntakeConsumedItemComponent(null, e);
49840        closeArray();
49841      };
49842      if (element.hasIngredientLabel()) {
49843        openArray("ingredientLabel");
49844        for (NutritionIntake.NutritionIntakeIngredientLabelComponent e : element.getIngredientLabel()) 
49845          composeNutritionIntakeNutritionIntakeIngredientLabelComponent(null, e);
49846        closeArray();
49847      };
49848      if (element.hasSubject()) {
49849        composeReference("subject", element.getSubject());
49850      }
49851      if (element.hasEncounter()) {
49852        composeReference("encounter", element.getEncounter());
49853      }
49854      if (element.hasEffective()) {
49855        composeType("effective", element.getEffective());
49856      }
49857      if (element.hasDateAssertedElement()) {
49858        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
49859        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
49860      }
49861      if (element.hasInformationSource()) {
49862        composeReference("informationSource", element.getInformationSource());
49863      }
49864      if (element.hasDerivedFrom()) {
49865        openArray("derivedFrom");
49866        for (Reference e : element.getDerivedFrom()) 
49867          composeReference(null, e);
49868        closeArray();
49869      };
49870      if (element.hasReasonCode()) {
49871        openArray("reasonCode");
49872        for (CodeableConcept e : element.getReasonCode()) 
49873          composeCodeableConcept(null, e);
49874        closeArray();
49875      };
49876      if (element.hasReasonReference()) {
49877        openArray("reasonReference");
49878        for (Reference e : element.getReasonReference()) 
49879          composeReference(null, e);
49880        closeArray();
49881      };
49882      if (element.hasNote()) {
49883        openArray("note");
49884        for (Annotation e : element.getNote()) 
49885          composeAnnotation(null, e);
49886        closeArray();
49887      };
49888  }
49889
49890  protected void composeNutritionIntakeNutritionIntakeConsumedItemComponent(String name, NutritionIntake.NutritionIntakeConsumedItemComponent element) throws IOException {
49891    if (element != null) {
49892      open(name);
49893      composeNutritionIntakeNutritionIntakeConsumedItemComponentInner(element);
49894      close();
49895    }
49896  }
49897
49898  protected void composeNutritionIntakeNutritionIntakeConsumedItemComponentInner(NutritionIntake.NutritionIntakeConsumedItemComponent element) throws IOException {
49899      composeBackbone(element);
49900      if (element.hasType()) {
49901        composeCodeableConcept("type", element.getType());
49902      }
49903      if (element.hasNutritionProduct()) {
49904        composeCodeableConcept("nutritionProduct", element.getNutritionProduct());
49905      }
49906      if (element.hasSchedule()) {
49907        composeTiming("schedule", element.getSchedule());
49908      }
49909      if (element.hasAmount()) {
49910        composeQuantity("amount", element.getAmount());
49911      }
49912      if (element.hasRate()) {
49913        composeQuantity("rate", element.getRate());
49914      }
49915      if (element.hasNotConsumedElement()) {
49916        composeBooleanCore("notConsumed", element.getNotConsumedElement(), false);
49917        composeBooleanExtras("notConsumed", element.getNotConsumedElement(), false);
49918      }
49919      if (element.hasNotConsumedReason()) {
49920        composeCodeableConcept("notConsumedReason", element.getNotConsumedReason());
49921      }
49922  }
49923
49924  protected void composeNutritionIntakeNutritionIntakeIngredientLabelComponent(String name, NutritionIntake.NutritionIntakeIngredientLabelComponent element) throws IOException {
49925    if (element != null) {
49926      open(name);
49927      composeNutritionIntakeNutritionIntakeIngredientLabelComponentInner(element);
49928      close();
49929    }
49930  }
49931
49932  protected void composeNutritionIntakeNutritionIntakeIngredientLabelComponentInner(NutritionIntake.NutritionIntakeIngredientLabelComponent element) throws IOException {
49933      composeBackbone(element);
49934      if (element.hasNutrient()) {
49935        composeCodeableConcept("nutrient", element.getNutrient());
49936      }
49937      if (element.hasAmount()) {
49938        composeQuantity("amount", element.getAmount());
49939      }
49940  }
49941
49942  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
49943    if (element != null) {
49944      prop("resourceType", name);
49945      composeNutritionOrderInner(element);
49946    }
49947  }
49948
49949  protected void composeNutritionOrderInner(NutritionOrder element) throws IOException {
49950      composeDomainResourceElements(element);
49951      if (element.hasIdentifier()) {
49952        openArray("identifier");
49953        for (Identifier e : element.getIdentifier()) 
49954          composeIdentifier(null, e);
49955        closeArray();
49956      };
49957      if (element.hasInstantiatesCanonical()) {
49958        openArray("instantiatesCanonical");
49959        for (CanonicalType e : element.getInstantiatesCanonical()) 
49960          composeCanonicalCore(null, e, true);
49961        closeArray();
49962        if (anyHasExtras(element.getInstantiatesCanonical())) {
49963          openArray("_instantiatesCanonical");
49964          for (CanonicalType e : element.getInstantiatesCanonical()) 
49965            composeCanonicalExtras(null, e, true);
49966          closeArray();
49967        }
49968      };
49969      if (element.hasInstantiatesUri()) {
49970        openArray("instantiatesUri");
49971        for (UriType e : element.getInstantiatesUri()) 
49972          composeUriCore(null, e, true);
49973        closeArray();
49974        if (anyHasExtras(element.getInstantiatesUri())) {
49975          openArray("_instantiatesUri");
49976          for (UriType e : element.getInstantiatesUri()) 
49977            composeUriExtras(null, e, true);
49978          closeArray();
49979        }
49980      };
49981      if (element.hasInstantiates()) {
49982        openArray("instantiates");
49983        for (UriType e : element.getInstantiates()) 
49984          composeUriCore(null, e, true);
49985        closeArray();
49986        if (anyHasExtras(element.getInstantiates())) {
49987          openArray("_instantiates");
49988          for (UriType e : element.getInstantiates()) 
49989            composeUriExtras(null, e, true);
49990          closeArray();
49991        }
49992      };
49993      if (element.hasStatusElement()) {
49994        composeEnumerationCore("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
49995        composeEnumerationExtras("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
49996      }
49997      if (element.hasIntentElement()) {
49998        composeEnumerationCore("intent", element.getIntentElement(), new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
49999        composeEnumerationExtras("intent", element.getIntentElement(), new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
50000      }
50001      if (element.hasPatient()) {
50002        composeReference("patient", element.getPatient());
50003      }
50004      if (element.hasEncounter()) {
50005        composeReference("encounter", element.getEncounter());
50006      }
50007      if (element.hasDateTimeElement()) {
50008        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
50009        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
50010      }
50011      if (element.hasOrderer()) {
50012        composeReference("orderer", element.getOrderer());
50013      }
50014      if (element.hasAllergyIntolerance()) {
50015        openArray("allergyIntolerance");
50016        for (Reference e : element.getAllergyIntolerance()) 
50017          composeReference(null, e);
50018        closeArray();
50019      };
50020      if (element.hasFoodPreferenceModifier()) {
50021        openArray("foodPreferenceModifier");
50022        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
50023          composeCodeableConcept(null, e);
50024        closeArray();
50025      };
50026      if (element.hasExcludeFoodModifier()) {
50027        openArray("excludeFoodModifier");
50028        for (CodeableConcept e : element.getExcludeFoodModifier()) 
50029          composeCodeableConcept(null, e);
50030        closeArray();
50031      };
50032      if (element.hasOralDiet()) {
50033        composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
50034      }
50035      if (element.hasSupplement()) {
50036        openArray("supplement");
50037        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
50038          composeNutritionOrderNutritionOrderSupplementComponent(null, e);
50039        closeArray();
50040      };
50041      if (element.hasEnteralFormula()) {
50042        composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
50043      }
50044      if (element.hasNote()) {
50045        openArray("note");
50046        for (Annotation e : element.getNote()) 
50047          composeAnnotation(null, e);
50048        closeArray();
50049      };
50050  }
50051
50052  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
50053    if (element != null) {
50054      open(name);
50055      composeNutritionOrderNutritionOrderOralDietComponentInner(element);
50056      close();
50057    }
50058  }
50059
50060  protected void composeNutritionOrderNutritionOrderOralDietComponentInner(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
50061      composeBackbone(element);
50062      if (element.hasType()) {
50063        openArray("type");
50064        for (CodeableConcept e : element.getType()) 
50065          composeCodeableConcept(null, e);
50066        closeArray();
50067      };
50068      if (element.hasSchedule()) {
50069        openArray("schedule");
50070        for (Timing e : element.getSchedule()) 
50071          composeTiming(null, e);
50072        closeArray();
50073      };
50074      if (element.hasNutrient()) {
50075        openArray("nutrient");
50076        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
50077          composeNutritionOrderNutritionOrderOralDietNutrientComponent(null, e);
50078        closeArray();
50079      };
50080      if (element.hasTexture()) {
50081        openArray("texture");
50082        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
50083          composeNutritionOrderNutritionOrderOralDietTextureComponent(null, e);
50084        closeArray();
50085      };
50086      if (element.hasFluidConsistencyType()) {
50087        openArray("fluidConsistencyType");
50088        for (CodeableConcept e : element.getFluidConsistencyType()) 
50089          composeCodeableConcept(null, e);
50090        closeArray();
50091      };
50092      if (element.hasInstructionElement()) {
50093        composeStringCore("instruction", element.getInstructionElement(), false);
50094        composeStringExtras("instruction", element.getInstructionElement(), false);
50095      }
50096  }
50097
50098  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
50099    if (element != null) {
50100      open(name);
50101      composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(element);
50102      close();
50103    }
50104  }
50105
50106  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
50107      composeBackbone(element);
50108      if (element.hasModifier()) {
50109        composeCodeableConcept("modifier", element.getModifier());
50110      }
50111      if (element.hasAmount()) {
50112        composeQuantity("amount", element.getAmount());
50113      }
50114  }
50115
50116  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
50117    if (element != null) {
50118      open(name);
50119      composeNutritionOrderNutritionOrderOralDietTextureComponentInner(element);
50120      close();
50121    }
50122  }
50123
50124  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentInner(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
50125      composeBackbone(element);
50126      if (element.hasModifier()) {
50127        composeCodeableConcept("modifier", element.getModifier());
50128      }
50129      if (element.hasFoodType()) {
50130        composeCodeableConcept("foodType", element.getFoodType());
50131      }
50132  }
50133
50134  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
50135    if (element != null) {
50136      open(name);
50137      composeNutritionOrderNutritionOrderSupplementComponentInner(element);
50138      close();
50139    }
50140  }
50141
50142  protected void composeNutritionOrderNutritionOrderSupplementComponentInner(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
50143      composeBackbone(element);
50144      if (element.hasType()) {
50145        composeCodeableConcept("type", element.getType());
50146      }
50147      if (element.hasProductNameElement()) {
50148        composeStringCore("productName", element.getProductNameElement(), false);
50149        composeStringExtras("productName", element.getProductNameElement(), false);
50150      }
50151      if (element.hasSchedule()) {
50152        openArray("schedule");
50153        for (Timing e : element.getSchedule()) 
50154          composeTiming(null, e);
50155        closeArray();
50156      };
50157      if (element.hasQuantity()) {
50158        composeQuantity("quantity", element.getQuantity());
50159      }
50160      if (element.hasInstructionElement()) {
50161        composeStringCore("instruction", element.getInstructionElement(), false);
50162        composeStringExtras("instruction", element.getInstructionElement(), false);
50163      }
50164  }
50165
50166  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
50167    if (element != null) {
50168      open(name);
50169      composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(element);
50170      close();
50171    }
50172  }
50173
50174  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
50175      composeBackbone(element);
50176      if (element.hasBaseFormulaType()) {
50177        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
50178      }
50179      if (element.hasBaseFormulaProductNameElement()) {
50180        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
50181        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
50182      }
50183      if (element.hasAdditiveType()) {
50184        composeCodeableConcept("additiveType", element.getAdditiveType());
50185      }
50186      if (element.hasAdditiveProductNameElement()) {
50187        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
50188        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
50189      }
50190      if (element.hasCaloricDensity()) {
50191        composeQuantity("caloricDensity", element.getCaloricDensity());
50192      }
50193      if (element.hasRouteofAdministration()) {
50194        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
50195      }
50196      if (element.hasAdministration()) {
50197        openArray("administration");
50198        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
50199          composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(null, e);
50200        closeArray();
50201      };
50202      if (element.hasMaxVolumeToDeliver()) {
50203        composeQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
50204      }
50205      if (element.hasAdministrationInstructionElement()) {
50206        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
50207        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
50208      }
50209  }
50210
50211  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
50212    if (element != null) {
50213      open(name);
50214      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(element);
50215      close();
50216    }
50217  }
50218
50219  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
50220      composeBackbone(element);
50221      if (element.hasSchedule()) {
50222        composeTiming("schedule", element.getSchedule());
50223      }
50224      if (element.hasQuantity()) {
50225        composeQuantity("quantity", element.getQuantity());
50226      }
50227      if (element.hasRate()) {
50228        composeType("rate", element.getRate());
50229      }
50230  }
50231
50232  protected void composeObservation(String name, Observation element) throws IOException {
50233    if (element != null) {
50234      prop("resourceType", name);
50235      composeObservationInner(element);
50236    }
50237  }
50238
50239  protected void composeObservationInner(Observation element) throws IOException {
50240      composeDomainResourceElements(element);
50241      if (element.hasIdentifier()) {
50242        openArray("identifier");
50243        for (Identifier e : element.getIdentifier()) 
50244          composeIdentifier(null, e);
50245        closeArray();
50246      };
50247      if (element.hasBasedOn()) {
50248        openArray("basedOn");
50249        for (Reference e : element.getBasedOn()) 
50250          composeReference(null, e);
50251        closeArray();
50252      };
50253      if (element.hasPartOf()) {
50254        openArray("partOf");
50255        for (Reference e : element.getPartOf()) 
50256          composeReference(null, e);
50257        closeArray();
50258      };
50259      if (element.hasStatusElement()) {
50260        composeEnumerationCore("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
50261        composeEnumerationExtras("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
50262      }
50263      if (element.hasCategory()) {
50264        openArray("category");
50265        for (CodeableConcept e : element.getCategory()) 
50266          composeCodeableConcept(null, e);
50267        closeArray();
50268      };
50269      if (element.hasCode()) {
50270        composeCodeableConcept("code", element.getCode());
50271      }
50272      if (element.hasSubject()) {
50273        composeReference("subject", element.getSubject());
50274      }
50275      if (element.hasFocus()) {
50276        openArray("focus");
50277        for (Reference e : element.getFocus()) 
50278          composeReference(null, e);
50279        closeArray();
50280      };
50281      if (element.hasEncounter()) {
50282        composeReference("encounter", element.getEncounter());
50283      }
50284      if (element.hasEffective()) {
50285        composeType("effective", element.getEffective());
50286      }
50287      if (element.hasIssuedElement()) {
50288        composeInstantCore("issued", element.getIssuedElement(), false);
50289        composeInstantExtras("issued", element.getIssuedElement(), false);
50290      }
50291      if (element.hasPerformer()) {
50292        openArray("performer");
50293        for (Reference e : element.getPerformer()) 
50294          composeReference(null, e);
50295        closeArray();
50296      };
50297      if (element.hasValue()) {
50298        composeType("value", element.getValue());
50299      }
50300      if (element.hasDataAbsentReason()) {
50301        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
50302      }
50303      if (element.hasInterpretation()) {
50304        openArray("interpretation");
50305        for (CodeableConcept e : element.getInterpretation()) 
50306          composeCodeableConcept(null, e);
50307        closeArray();
50308      };
50309      if (element.hasNote()) {
50310        openArray("note");
50311        for (Annotation e : element.getNote()) 
50312          composeAnnotation(null, e);
50313        closeArray();
50314      };
50315      if (element.hasBodySite()) {
50316        composeCodeableConcept("bodySite", element.getBodySite());
50317      }
50318      if (element.hasMethod()) {
50319        composeCodeableConcept("method", element.getMethod());
50320      }
50321      if (element.hasSpecimen()) {
50322        composeReference("specimen", element.getSpecimen());
50323      }
50324      if (element.hasDevice()) {
50325        composeReference("device", element.getDevice());
50326      }
50327      if (element.hasReferenceRange()) {
50328        openArray("referenceRange");
50329        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
50330          composeObservationObservationReferenceRangeComponent(null, e);
50331        closeArray();
50332      };
50333      if (element.hasHasMember()) {
50334        openArray("hasMember");
50335        for (Reference e : element.getHasMember()) 
50336          composeReference(null, e);
50337        closeArray();
50338      };
50339      if (element.hasDerivedFrom()) {
50340        openArray("derivedFrom");
50341        for (Reference e : element.getDerivedFrom()) 
50342          composeReference(null, e);
50343        closeArray();
50344      };
50345      if (element.hasComponent()) {
50346        openArray("component");
50347        for (Observation.ObservationComponentComponent e : element.getComponent()) 
50348          composeObservationObservationComponentComponent(null, e);
50349        closeArray();
50350      };
50351  }
50352
50353  protected void composeObservationObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
50354    if (element != null) {
50355      open(name);
50356      composeObservationObservationReferenceRangeComponentInner(element);
50357      close();
50358    }
50359  }
50360
50361  protected void composeObservationObservationReferenceRangeComponentInner(Observation.ObservationReferenceRangeComponent element) throws IOException {
50362      composeBackbone(element);
50363      if (element.hasLow()) {
50364        composeQuantity("low", element.getLow());
50365      }
50366      if (element.hasHigh()) {
50367        composeQuantity("high", element.getHigh());
50368      }
50369      if (element.hasType()) {
50370        composeCodeableConcept("type", element.getType());
50371      }
50372      if (element.hasAppliesTo()) {
50373        openArray("appliesTo");
50374        for (CodeableConcept e : element.getAppliesTo()) 
50375          composeCodeableConcept(null, e);
50376        closeArray();
50377      };
50378      if (element.hasAge()) {
50379        composeRange("age", element.getAge());
50380      }
50381      if (element.hasTextElement()) {
50382        composeStringCore("text", element.getTextElement(), false);
50383        composeStringExtras("text", element.getTextElement(), false);
50384      }
50385  }
50386
50387  protected void composeObservationObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
50388    if (element != null) {
50389      open(name);
50390      composeObservationObservationComponentComponentInner(element);
50391      close();
50392    }
50393  }
50394
50395  protected void composeObservationObservationComponentComponentInner(Observation.ObservationComponentComponent element) throws IOException {
50396      composeBackbone(element);
50397      if (element.hasCode()) {
50398        composeCodeableConcept("code", element.getCode());
50399      }
50400      if (element.hasValue()) {
50401        composeType("value", element.getValue());
50402      }
50403      if (element.hasDataAbsentReason()) {
50404        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
50405      }
50406      if (element.hasInterpretation()) {
50407        openArray("interpretation");
50408        for (CodeableConcept e : element.getInterpretation()) 
50409          composeCodeableConcept(null, e);
50410        closeArray();
50411      };
50412      if (element.hasReferenceRange()) {
50413        openArray("referenceRange");
50414        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
50415          composeObservationObservationReferenceRangeComponent(null, e);
50416        closeArray();
50417      };
50418  }
50419
50420  protected void composeObservationDefinition(String name, ObservationDefinition element) throws IOException {
50421    if (element != null) {
50422      prop("resourceType", name);
50423      composeObservationDefinitionInner(element);
50424    }
50425  }
50426
50427  protected void composeObservationDefinitionInner(ObservationDefinition element) throws IOException {
50428      composeDomainResourceElements(element);
50429      if (element.hasUrlElement()) {
50430        composeUriCore("url", element.getUrlElement(), false);
50431        composeUriExtras("url", element.getUrlElement(), false);
50432      }
50433      if (element.hasIdentifier()) {
50434        composeIdentifier("identifier", element.getIdentifier());
50435      }
50436      if (element.hasVersionElement()) {
50437        composeStringCore("version", element.getVersionElement(), false);
50438        composeStringExtras("version", element.getVersionElement(), false);
50439      }
50440      if (element.hasTitleElement()) {
50441        composeStringCore("title", element.getTitleElement(), false);
50442        composeStringExtras("title", element.getTitleElement(), false);
50443      }
50444      if (element.hasDerivedFromCanonical()) {
50445        openArray("derivedFromCanonical");
50446        for (CanonicalType e : element.getDerivedFromCanonical()) 
50447          composeCanonicalCore(null, e, true);
50448        closeArray();
50449        if (anyHasExtras(element.getDerivedFromCanonical())) {
50450          openArray("_derivedFromCanonical");
50451          for (CanonicalType e : element.getDerivedFromCanonical()) 
50452            composeCanonicalExtras(null, e, true);
50453          closeArray();
50454        }
50455      };
50456      if (element.hasDerivedFromUri()) {
50457        openArray("derivedFromUri");
50458        for (UriType e : element.getDerivedFromUri()) 
50459          composeUriCore(null, e, true);
50460        closeArray();
50461        if (anyHasExtras(element.getDerivedFromUri())) {
50462          openArray("_derivedFromUri");
50463          for (UriType e : element.getDerivedFromUri()) 
50464            composeUriExtras(null, e, true);
50465          closeArray();
50466        }
50467      };
50468      if (element.hasStatusElement()) {
50469        composeEnumerationCore("status", element.getStatusElement(), new ObservationDefinition.PublicationStatusEnumFactory(), false);
50470        composeEnumerationExtras("status", element.getStatusElement(), new ObservationDefinition.PublicationStatusEnumFactory(), false);
50471      }
50472      if (element.hasExperimentalElement()) {
50473        composeBooleanCore("experimental", element.getExperimentalElement(), false);
50474        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
50475      }
50476      if (element.hasSubject()) {
50477        composeType("subject", element.getSubject());
50478      }
50479      if (element.hasDateElement()) {
50480        composeDateTimeCore("date", element.getDateElement(), false);
50481        composeDateTimeExtras("date", element.getDateElement(), false);
50482      }
50483      if (element.hasPublisher()) {
50484        composeReference("publisher", element.getPublisher());
50485      }
50486      if (element.hasContact()) {
50487        openArray("contact");
50488        for (ContactDetail e : element.getContact()) 
50489          composeContactDetail(null, e);
50490        closeArray();
50491      };
50492      if (element.hasDescriptionElement()) {
50493        composeMarkdownCore("description", element.getDescriptionElement(), false);
50494        composeMarkdownExtras("description", element.getDescriptionElement(), false);
50495      }
50496      if (element.hasUseContext()) {
50497        openArray("useContext");
50498        for (UsageContext e : element.getUseContext()) 
50499          composeUsageContext(null, e);
50500        closeArray();
50501      };
50502      if (element.hasJurisdiction()) {
50503        openArray("jurisdiction");
50504        for (CodeableConcept e : element.getJurisdiction()) 
50505          composeCodeableConcept(null, e);
50506        closeArray();
50507      };
50508      if (element.hasPurposeElement()) {
50509        composeMarkdownCore("purpose", element.getPurposeElement(), false);
50510        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
50511      }
50512      if (element.hasCopyrightElement()) {
50513        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
50514        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
50515      }
50516      if (element.hasApprovalDateElement()) {
50517        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
50518        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
50519      }
50520      if (element.hasLastReviewDateElement()) {
50521        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
50522        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
50523      }
50524      if (element.hasEffectivePeriod()) {
50525        composePeriod("effectivePeriod", element.getEffectivePeriod());
50526      }
50527      if (element.hasPerformerType()) {
50528        composeCodeableConcept("performerType", element.getPerformerType());
50529      }
50530      if (element.hasCategory()) {
50531        openArray("category");
50532        for (CodeableConcept e : element.getCategory()) 
50533          composeCodeableConcept(null, e);
50534        closeArray();
50535      };
50536      if (element.hasCode()) {
50537        composeCodeableConcept("code", element.getCode());
50538      }
50539      if (element.hasPermittedDataType()) {
50540        openArray("permittedDataType");
50541        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
50542          composeEnumerationCore(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
50543        closeArray();
50544        if (anyHasExtras(element.getPermittedDataType())) {
50545          openArray("_permittedDataType");
50546          for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
50547            composeEnumerationExtras(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
50548          closeArray();
50549        }
50550      };
50551      if (element.hasMultipleResultsAllowedElement()) {
50552        composeBooleanCore("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
50553        composeBooleanExtras("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
50554      }
50555      if (element.hasBodySite()) {
50556        composeCodeableConcept("bodySite", element.getBodySite());
50557      }
50558      if (element.hasMethod()) {
50559        composeCodeableConcept("method", element.getMethod());
50560      }
50561      if (element.hasSpecimen()) {
50562        composeReference("specimen", element.getSpecimen());
50563      }
50564      if (element.hasDevice()) {
50565        composeReference("device", element.getDevice());
50566      }
50567      if (element.hasPreferredReportNameElement()) {
50568        composeStringCore("preferredReportName", element.getPreferredReportNameElement(), false);
50569        composeStringExtras("preferredReportName", element.getPreferredReportNameElement(), false);
50570      }
50571      if (element.hasQuantitativeDetails()) {
50572        composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent("quantitativeDetails", element.getQuantitativeDetails());
50573      }
50574      if (element.hasQualifiedInterval()) {
50575        openArray("qualifiedInterval");
50576        for (ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent e : element.getQualifiedInterval()) 
50577          composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(null, e);
50578        closeArray();
50579      };
50580      if (element.hasValidCodedValueSet()) {
50581        composeReference("validCodedValueSet", element.getValidCodedValueSet());
50582      }
50583      if (element.hasNormalCodedValueSet()) {
50584        composeReference("normalCodedValueSet", element.getNormalCodedValueSet());
50585      }
50586      if (element.hasAbnormalCodedValueSet()) {
50587        composeReference("abnormalCodedValueSet", element.getAbnormalCodedValueSet());
50588      }
50589      if (element.hasCriticalCodedValueSet()) {
50590        composeReference("criticalCodedValueSet", element.getCriticalCodedValueSet());
50591      }
50592      if (element.hasHasMember()) {
50593        openArray("hasMember");
50594        for (Reference e : element.getHasMember()) 
50595          composeReference(null, e);
50596        closeArray();
50597      };
50598      if (element.hasComponent()) {
50599        openArray("component");
50600        for (ObservationDefinition.ObservationDefinitionComponentComponent e : element.getComponent()) 
50601          composeObservationDefinitionObservationDefinitionComponentComponent(null, e);
50602        closeArray();
50603      };
50604  }
50605
50606  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(String name, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
50607    if (element != null) {
50608      open(name);
50609      composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(element);
50610      close();
50611    }
50612  }
50613
50614  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
50615      composeBackbone(element);
50616      if (element.hasCustomaryUnit()) {
50617        composeCodeableConcept("customaryUnit", element.getCustomaryUnit());
50618      }
50619      if (element.hasUnit()) {
50620        composeCodeableConcept("unit", element.getUnit());
50621      }
50622      if (element.hasConversionFactorElement()) {
50623        composeDecimalCore("conversionFactor", element.getConversionFactorElement(), false);
50624        composeDecimalExtras("conversionFactor", element.getConversionFactorElement(), false);
50625      }
50626      if (element.hasDecimalPrecisionElement()) {
50627        composeIntegerCore("decimalPrecision", element.getDecimalPrecisionElement(), false);
50628        composeIntegerExtras("decimalPrecision", element.getDecimalPrecisionElement(), false);
50629      }
50630  }
50631
50632  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(String name, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
50633    if (element != null) {
50634      open(name);
50635      composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(element);
50636      close();
50637    }
50638  }
50639
50640  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
50641      composeBackbone(element);
50642      if (element.hasCategoryElement()) {
50643        composeEnumerationCore("category", element.getCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
50644        composeEnumerationExtras("category", element.getCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
50645      }
50646      if (element.hasRange()) {
50647        composeRange("range", element.getRange());
50648      }
50649      if (element.hasContext()) {
50650        composeCodeableConcept("context", element.getContext());
50651      }
50652      if (element.hasAppliesTo()) {
50653        openArray("appliesTo");
50654        for (CodeableConcept e : element.getAppliesTo()) 
50655          composeCodeableConcept(null, e);
50656        closeArray();
50657      };
50658      if (element.hasGenderElement()) {
50659        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50660        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50661      }
50662      if (element.hasAge()) {
50663        composeRange("age", element.getAge());
50664      }
50665      if (element.hasGestationalAge()) {
50666        composeRange("gestationalAge", element.getGestationalAge());
50667      }
50668      if (element.hasConditionElement()) {
50669        composeStringCore("condition", element.getConditionElement(), false);
50670        composeStringExtras("condition", element.getConditionElement(), false);
50671      }
50672  }
50673
50674  protected void composeObservationDefinitionObservationDefinitionComponentComponent(String name, ObservationDefinition.ObservationDefinitionComponentComponent element) throws IOException {
50675    if (element != null) {
50676      open(name);
50677      composeObservationDefinitionObservationDefinitionComponentComponentInner(element);
50678      close();
50679    }
50680  }
50681
50682  protected void composeObservationDefinitionObservationDefinitionComponentComponentInner(ObservationDefinition.ObservationDefinitionComponentComponent element) throws IOException {
50683      composeBackbone(element);
50684      if (element.hasCode()) {
50685        composeCodeableConcept("code", element.getCode());
50686      }
50687      if (element.hasPermittedDataType()) {
50688        openArray("permittedDataType");
50689        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
50690          composeEnumerationCore(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
50691        closeArray();
50692        if (anyHasExtras(element.getPermittedDataType())) {
50693          openArray("_permittedDataType");
50694          for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
50695            composeEnumerationExtras(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
50696          closeArray();
50697        }
50698      };
50699      if (element.hasQuantitativeDetails()) {
50700        composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent("quantitativeDetails", element.getQuantitativeDetails());
50701      }
50702      if (element.hasQualifiedInterval()) {
50703        openArray("qualifiedInterval");
50704        for (ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent e : element.getQualifiedInterval()) 
50705          composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(null, e);
50706        closeArray();
50707      };
50708  }
50709
50710  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
50711    if (element != null) {
50712      prop("resourceType", name);
50713      composeOperationDefinitionInner(element);
50714    }
50715  }
50716
50717  protected void composeOperationDefinitionInner(OperationDefinition element) throws IOException {
50718      composeDomainResourceElements(element);
50719      if (element.hasUrlElement()) {
50720        composeUriCore("url", element.getUrlElement(), false);
50721        composeUriExtras("url", element.getUrlElement(), false);
50722      }
50723      if (element.hasVersionElement()) {
50724        composeStringCore("version", element.getVersionElement(), false);
50725        composeStringExtras("version", element.getVersionElement(), false);
50726      }
50727      if (element.hasNameElement()) {
50728        composeStringCore("name", element.getNameElement(), false);
50729        composeStringExtras("name", element.getNameElement(), false);
50730      }
50731      if (element.hasTitleElement()) {
50732        composeStringCore("title", element.getTitleElement(), false);
50733        composeStringExtras("title", element.getTitleElement(), false);
50734      }
50735      if (element.hasStatusElement()) {
50736        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50737        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50738      }
50739      if (element.hasKindElement()) {
50740        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
50741        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
50742      }
50743      if (element.hasExperimentalElement()) {
50744        composeBooleanCore("experimental", element.getExperimentalElement(), false);
50745        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
50746      }
50747      if (element.hasDateElement()) {
50748        composeDateTimeCore("date", element.getDateElement(), false);
50749        composeDateTimeExtras("date", element.getDateElement(), false);
50750      }
50751      if (element.hasPublisherElement()) {
50752        composeStringCore("publisher", element.getPublisherElement(), false);
50753        composeStringExtras("publisher", element.getPublisherElement(), false);
50754      }
50755      if (element.hasContact()) {
50756        openArray("contact");
50757        for (ContactDetail e : element.getContact()) 
50758          composeContactDetail(null, e);
50759        closeArray();
50760      };
50761      if (element.hasDescriptionElement()) {
50762        composeMarkdownCore("description", element.getDescriptionElement(), false);
50763        composeMarkdownExtras("description", element.getDescriptionElement(), false);
50764      }
50765      if (element.hasUseContext()) {
50766        openArray("useContext");
50767        for (UsageContext e : element.getUseContext()) 
50768          composeUsageContext(null, e);
50769        closeArray();
50770      };
50771      if (element.hasJurisdiction()) {
50772        openArray("jurisdiction");
50773        for (CodeableConcept e : element.getJurisdiction()) 
50774          composeCodeableConcept(null, e);
50775        closeArray();
50776      };
50777      if (element.hasPurposeElement()) {
50778        composeMarkdownCore("purpose", element.getPurposeElement(), false);
50779        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
50780      }
50781      if (element.hasAffectsStateElement()) {
50782        composeBooleanCore("affectsState", element.getAffectsStateElement(), false);
50783        composeBooleanExtras("affectsState", element.getAffectsStateElement(), false);
50784      }
50785      if (element.hasCodeElement()) {
50786        composeCodeCore("code", element.getCodeElement(), false);
50787        composeCodeExtras("code", element.getCodeElement(), false);
50788      }
50789      if (element.hasCommentElement()) {
50790        composeMarkdownCore("comment", element.getCommentElement(), false);
50791        composeMarkdownExtras("comment", element.getCommentElement(), false);
50792      }
50793      if (element.hasBaseElement()) {
50794        composeCanonicalCore("base", element.getBaseElement(), false);
50795        composeCanonicalExtras("base", element.getBaseElement(), false);
50796      }
50797      if (element.hasResource()) {
50798        openArray("resource");
50799        for (CodeType e : element.getResource()) 
50800          composeCodeCore(null, e, true);
50801        closeArray();
50802        if (anyHasExtras(element.getResource())) {
50803          openArray("_resource");
50804          for (CodeType e : element.getResource()) 
50805            composeCodeExtras(null, e, true);
50806          closeArray();
50807        }
50808      };
50809      if (element.hasSystemElement()) {
50810        composeBooleanCore("system", element.getSystemElement(), false);
50811        composeBooleanExtras("system", element.getSystemElement(), false);
50812      }
50813      if (element.hasTypeElement()) {
50814        composeBooleanCore("type", element.getTypeElement(), false);
50815        composeBooleanExtras("type", element.getTypeElement(), false);
50816      }
50817      if (element.hasInstanceElement()) {
50818        composeBooleanCore("instance", element.getInstanceElement(), false);
50819        composeBooleanExtras("instance", element.getInstanceElement(), false);
50820      }
50821      if (element.hasInputProfileElement()) {
50822        composeCanonicalCore("inputProfile", element.getInputProfileElement(), false);
50823        composeCanonicalExtras("inputProfile", element.getInputProfileElement(), false);
50824      }
50825      if (element.hasOutputProfileElement()) {
50826        composeCanonicalCore("outputProfile", element.getOutputProfileElement(), false);
50827        composeCanonicalExtras("outputProfile", element.getOutputProfileElement(), false);
50828      }
50829      if (element.hasParameter()) {
50830        openArray("parameter");
50831        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
50832          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
50833        closeArray();
50834      };
50835      if (element.hasOverload()) {
50836        openArray("overload");
50837        for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
50838          composeOperationDefinitionOperationDefinitionOverloadComponent(null, e);
50839        closeArray();
50840      };
50841  }
50842
50843  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
50844    if (element != null) {
50845      open(name);
50846      composeOperationDefinitionOperationDefinitionParameterComponentInner(element);
50847      close();
50848    }
50849  }
50850
50851  protected void composeOperationDefinitionOperationDefinitionParameterComponentInner(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
50852      composeBackbone(element);
50853      if (element.hasNameElement()) {
50854        composeCodeCore("name", element.getNameElement(), false);
50855        composeCodeExtras("name", element.getNameElement(), false);
50856      }
50857      if (element.hasUseElement()) {
50858        composeEnumerationCore("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
50859        composeEnumerationExtras("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
50860      }
50861      if (element.hasMinElement()) {
50862        composeIntegerCore("min", element.getMinElement(), false);
50863        composeIntegerExtras("min", element.getMinElement(), false);
50864      }
50865      if (element.hasMaxElement()) {
50866        composeStringCore("max", element.getMaxElement(), false);
50867        composeStringExtras("max", element.getMaxElement(), false);
50868      }
50869      if (element.hasDocumentationElement()) {
50870        composeStringCore("documentation", element.getDocumentationElement(), false);
50871        composeStringExtras("documentation", element.getDocumentationElement(), false);
50872      }
50873      if (element.hasTypeElement()) {
50874        composeCodeCore("type", element.getTypeElement(), false);
50875        composeCodeExtras("type", element.getTypeElement(), false);
50876      }
50877      if (element.hasTargetProfile()) {
50878        openArray("targetProfile");
50879        for (CanonicalType e : element.getTargetProfile()) 
50880          composeCanonicalCore(null, e, true);
50881        closeArray();
50882        if (anyHasExtras(element.getTargetProfile())) {
50883          openArray("_targetProfile");
50884          for (CanonicalType e : element.getTargetProfile()) 
50885            composeCanonicalExtras(null, e, true);
50886          closeArray();
50887        }
50888      };
50889      if (element.hasSearchTypeElement()) {
50890        composeEnumerationCore("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
50891        composeEnumerationExtras("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
50892      }
50893      if (element.hasBinding()) {
50894        composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
50895      }
50896      if (element.hasReferencedFrom()) {
50897        openArray("referencedFrom");
50898        for (OperationDefinition.OperationDefinitionParameterReferencedFromComponent e : element.getReferencedFrom()) 
50899          composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent(null, e);
50900        closeArray();
50901      };
50902      if (element.hasPart()) {
50903        openArray("part");
50904        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
50905          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
50906        closeArray();
50907      };
50908  }
50909
50910  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
50911    if (element != null) {
50912      open(name);
50913      composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(element);
50914      close();
50915    }
50916  }
50917
50918  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
50919      composeBackbone(element);
50920      if (element.hasStrengthElement()) {
50921        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
50922        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
50923      }
50924      if (element.hasValueSetElement()) {
50925        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
50926        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
50927      }
50928  }
50929
50930  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent(String name, OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
50931    if (element != null) {
50932      open(name);
50933      composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentInner(element);
50934      close();
50935    }
50936  }
50937
50938  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentInner(OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
50939      composeBackbone(element);
50940      if (element.hasSourceElement()) {
50941        composeStringCore("source", element.getSourceElement(), false);
50942        composeStringExtras("source", element.getSourceElement(), false);
50943      }
50944      if (element.hasSourceIdElement()) {
50945        composeStringCore("sourceId", element.getSourceIdElement(), false);
50946        composeStringExtras("sourceId", element.getSourceIdElement(), false);
50947      }
50948  }
50949
50950  protected void composeOperationDefinitionOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
50951    if (element != null) {
50952      open(name);
50953      composeOperationDefinitionOperationDefinitionOverloadComponentInner(element);
50954      close();
50955    }
50956  }
50957
50958  protected void composeOperationDefinitionOperationDefinitionOverloadComponentInner(OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
50959      composeBackbone(element);
50960      if (element.hasParameterName()) {
50961        openArray("parameterName");
50962        for (StringType e : element.getParameterName()) 
50963          composeStringCore(null, e, true);
50964        closeArray();
50965        if (anyHasExtras(element.getParameterName())) {
50966          openArray("_parameterName");
50967          for (StringType e : element.getParameterName()) 
50968            composeStringExtras(null, e, true);
50969          closeArray();
50970        }
50971      };
50972      if (element.hasCommentElement()) {
50973        composeStringCore("comment", element.getCommentElement(), false);
50974        composeStringExtras("comment", element.getCommentElement(), false);
50975      }
50976  }
50977
50978  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
50979    if (element != null) {
50980      prop("resourceType", name);
50981      composeOperationOutcomeInner(element);
50982    }
50983  }
50984
50985  protected void composeOperationOutcomeInner(OperationOutcome element) throws IOException {
50986      composeDomainResourceElements(element);
50987      if (element.hasIssue()) {
50988        openArray("issue");
50989        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
50990          composeOperationOutcomeOperationOutcomeIssueComponent(null, e);
50991        closeArray();
50992      };
50993  }
50994
50995  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
50996    if (element != null) {
50997      open(name);
50998      composeOperationOutcomeOperationOutcomeIssueComponentInner(element);
50999      close();
51000    }
51001  }
51002
51003  protected void composeOperationOutcomeOperationOutcomeIssueComponentInner(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
51004      composeBackbone(element);
51005      if (element.hasSeverityElement()) {
51006        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
51007        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
51008      }
51009      if (element.hasCodeElement()) {
51010        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
51011        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
51012      }
51013      if (element.hasDetails()) {
51014        composeCodeableConcept("details", element.getDetails());
51015      }
51016      if (element.hasDiagnosticsElement()) {
51017        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
51018        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
51019      }
51020      if (element.hasLocation()) {
51021        openArray("location");
51022        for (StringType e : element.getLocation()) 
51023          composeStringCore(null, e, true);
51024        closeArray();
51025        if (anyHasExtras(element.getLocation())) {
51026          openArray("_location");
51027          for (StringType e : element.getLocation()) 
51028            composeStringExtras(null, e, true);
51029          closeArray();
51030        }
51031      };
51032      if (element.hasExpression()) {
51033        openArray("expression");
51034        for (StringType e : element.getExpression()) 
51035          composeStringCore(null, e, true);
51036        closeArray();
51037        if (anyHasExtras(element.getExpression())) {
51038          openArray("_expression");
51039          for (StringType e : element.getExpression()) 
51040            composeStringExtras(null, e, true);
51041          closeArray();
51042        }
51043      };
51044  }
51045
51046  protected void composeOrganization(String name, Organization element) throws IOException {
51047    if (element != null) {
51048      prop("resourceType", name);
51049      composeOrganizationInner(element);
51050    }
51051  }
51052
51053  protected void composeOrganizationInner(Organization element) throws IOException {
51054      composeDomainResourceElements(element);
51055      if (element.hasIdentifier()) {
51056        openArray("identifier");
51057        for (Identifier e : element.getIdentifier()) 
51058          composeIdentifier(null, e);
51059        closeArray();
51060      };
51061      if (element.hasActiveElement()) {
51062        composeBooleanCore("active", element.getActiveElement(), false);
51063        composeBooleanExtras("active", element.getActiveElement(), false);
51064      }
51065      if (element.hasType()) {
51066        openArray("type");
51067        for (CodeableConcept e : element.getType()) 
51068          composeCodeableConcept(null, e);
51069        closeArray();
51070      };
51071      if (element.hasNameElement()) {
51072        composeStringCore("name", element.getNameElement(), false);
51073        composeStringExtras("name", element.getNameElement(), false);
51074      }
51075      if (element.hasAlias()) {
51076        openArray("alias");
51077        for (StringType e : element.getAlias()) 
51078          composeStringCore(null, e, true);
51079        closeArray();
51080        if (anyHasExtras(element.getAlias())) {
51081          openArray("_alias");
51082          for (StringType e : element.getAlias()) 
51083            composeStringExtras(null, e, true);
51084          closeArray();
51085        }
51086      };
51087      if (element.hasTelecom()) {
51088        openArray("telecom");
51089        for (ContactPoint e : element.getTelecom()) 
51090          composeContactPoint(null, e);
51091        closeArray();
51092      };
51093      if (element.hasAddress()) {
51094        openArray("address");
51095        for (Address e : element.getAddress()) 
51096          composeAddress(null, e);
51097        closeArray();
51098      };
51099      if (element.hasPartOf()) {
51100        composeReference("partOf", element.getPartOf());
51101      }
51102      if (element.hasContact()) {
51103        openArray("contact");
51104        for (Organization.OrganizationContactComponent e : element.getContact()) 
51105          composeOrganizationOrganizationContactComponent(null, e);
51106        closeArray();
51107      };
51108      if (element.hasEndpoint()) {
51109        openArray("endpoint");
51110        for (Reference e : element.getEndpoint()) 
51111          composeReference(null, e);
51112        closeArray();
51113      };
51114  }
51115
51116  protected void composeOrganizationOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
51117    if (element != null) {
51118      open(name);
51119      composeOrganizationOrganizationContactComponentInner(element);
51120      close();
51121    }
51122  }
51123
51124  protected void composeOrganizationOrganizationContactComponentInner(Organization.OrganizationContactComponent element) throws IOException {
51125      composeBackbone(element);
51126      if (element.hasPurpose()) {
51127        composeCodeableConcept("purpose", element.getPurpose());
51128      }
51129      if (element.hasName()) {
51130        composeHumanName("name", element.getName());
51131      }
51132      if (element.hasTelecom()) {
51133        openArray("telecom");
51134        for (ContactPoint e : element.getTelecom()) 
51135          composeContactPoint(null, e);
51136        closeArray();
51137      };
51138      if (element.hasAddress()) {
51139        composeAddress("address", element.getAddress());
51140      }
51141  }
51142
51143  protected void composeOrganizationAffiliation(String name, OrganizationAffiliation element) throws IOException {
51144    if (element != null) {
51145      prop("resourceType", name);
51146      composeOrganizationAffiliationInner(element);
51147    }
51148  }
51149
51150  protected void composeOrganizationAffiliationInner(OrganizationAffiliation element) throws IOException {
51151      composeDomainResourceElements(element);
51152      if (element.hasIdentifier()) {
51153        openArray("identifier");
51154        for (Identifier e : element.getIdentifier()) 
51155          composeIdentifier(null, e);
51156        closeArray();
51157      };
51158      if (element.hasActiveElement()) {
51159        composeBooleanCore("active", element.getActiveElement(), false);
51160        composeBooleanExtras("active", element.getActiveElement(), false);
51161      }
51162      if (element.hasPeriod()) {
51163        composePeriod("period", element.getPeriod());
51164      }
51165      if (element.hasOrganization()) {
51166        composeReference("organization", element.getOrganization());
51167      }
51168      if (element.hasParticipatingOrganization()) {
51169        composeReference("participatingOrganization", element.getParticipatingOrganization());
51170      }
51171      if (element.hasNetwork()) {
51172        openArray("network");
51173        for (Reference e : element.getNetwork()) 
51174          composeReference(null, e);
51175        closeArray();
51176      };
51177      if (element.hasCode()) {
51178        openArray("code");
51179        for (CodeableConcept e : element.getCode()) 
51180          composeCodeableConcept(null, e);
51181        closeArray();
51182      };
51183      if (element.hasSpecialty()) {
51184        openArray("specialty");
51185        for (CodeableConcept e : element.getSpecialty()) 
51186          composeCodeableConcept(null, e);
51187        closeArray();
51188      };
51189      if (element.hasLocation()) {
51190        openArray("location");
51191        for (Reference e : element.getLocation()) 
51192          composeReference(null, e);
51193        closeArray();
51194      };
51195      if (element.hasHealthcareService()) {
51196        openArray("healthcareService");
51197        for (Reference e : element.getHealthcareService()) 
51198          composeReference(null, e);
51199        closeArray();
51200      };
51201      if (element.hasTelecom()) {
51202        openArray("telecom");
51203        for (ContactPoint e : element.getTelecom()) 
51204          composeContactPoint(null, e);
51205        closeArray();
51206      };
51207      if (element.hasEndpoint()) {
51208        openArray("endpoint");
51209        for (Reference e : element.getEndpoint()) 
51210          composeReference(null, e);
51211        closeArray();
51212      };
51213  }
51214
51215  protected void composePackagedProductDefinition(String name, PackagedProductDefinition element) throws IOException {
51216    if (element != null) {
51217      prop("resourceType", name);
51218      composePackagedProductDefinitionInner(element);
51219    }
51220  }
51221
51222  protected void composePackagedProductDefinitionInner(PackagedProductDefinition element) throws IOException {
51223      composeDomainResourceElements(element);
51224      if (element.hasIdentifier()) {
51225        openArray("identifier");
51226        for (Identifier e : element.getIdentifier()) 
51227          composeIdentifier(null, e);
51228        closeArray();
51229      };
51230      if (element.hasSubject()) {
51231        openArray("subject");
51232        for (Reference e : element.getSubject()) 
51233          composeReference(null, e);
51234        closeArray();
51235      };
51236      if (element.hasDescriptionElement()) {
51237        composeStringCore("description", element.getDescriptionElement(), false);
51238        composeStringExtras("description", element.getDescriptionElement(), false);
51239      }
51240      if (element.hasLegalStatusOfSupply()) {
51241        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
51242      }
51243      if (element.hasMarketingStatus()) {
51244        openArray("marketingStatus");
51245        for (MarketingStatus e : element.getMarketingStatus()) 
51246          composeMarketingStatus(null, e);
51247        closeArray();
51248      };
51249      if (element.hasMarketingAuthorization()) {
51250        composeReference("marketingAuthorization", element.getMarketingAuthorization());
51251      }
51252      if (element.hasManufacturer()) {
51253        openArray("manufacturer");
51254        for (Reference e : element.getManufacturer()) 
51255          composeReference(null, e);
51256        closeArray();
51257      };
51258      if (element.hasBatchIdentifier()) {
51259        openArray("batchIdentifier");
51260        for (PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent e : element.getBatchIdentifier()) 
51261          composePackagedProductDefinitionPackagedProductDefinitionBatchIdentifierComponent(null, e);
51262        closeArray();
51263      };
51264      if (element.hasPackage()) {
51265        openArray("package");
51266        for (PackagedProductDefinition.PackagedProductDefinitionPackageComponent e : element.getPackage()) 
51267          composePackagedProductDefinitionPackagedProductDefinitionPackageComponent(null, e);
51268        closeArray();
51269      };
51270  }
51271
51272  protected void composePackagedProductDefinitionPackagedProductDefinitionBatchIdentifierComponent(String name, PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent element) throws IOException {
51273    if (element != null) {
51274      open(name);
51275      composePackagedProductDefinitionPackagedProductDefinitionBatchIdentifierComponentInner(element);
51276      close();
51277    }
51278  }
51279
51280  protected void composePackagedProductDefinitionPackagedProductDefinitionBatchIdentifierComponentInner(PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent element) throws IOException {
51281      composeBackbone(element);
51282      if (element.hasOuterPackaging()) {
51283        composeIdentifier("outerPackaging", element.getOuterPackaging());
51284      }
51285      if (element.hasImmediatePackaging()) {
51286        composeIdentifier("immediatePackaging", element.getImmediatePackaging());
51287      }
51288  }
51289
51290  protected void composePackagedProductDefinitionPackagedProductDefinitionPackageComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackageComponent element) throws IOException {
51291    if (element != null) {
51292      open(name);
51293      composePackagedProductDefinitionPackagedProductDefinitionPackageComponentInner(element);
51294      close();
51295    }
51296  }
51297
51298  protected void composePackagedProductDefinitionPackagedProductDefinitionPackageComponentInner(PackagedProductDefinition.PackagedProductDefinitionPackageComponent element) throws IOException {
51299      composeBackbone(element);
51300      if (element.hasIdentifier()) {
51301        openArray("identifier");
51302        for (Identifier e : element.getIdentifier()) 
51303          composeIdentifier(null, e);
51304        closeArray();
51305      };
51306      if (element.hasType()) {
51307        composeCodeableConcept("type", element.getType());
51308      }
51309      if (element.hasQuantity()) {
51310        composeQuantity("quantity", element.getQuantity());
51311      }
51312      if (element.hasMaterial()) {
51313        openArray("material");
51314        for (CodeableConcept e : element.getMaterial()) 
51315          composeCodeableConcept(null, e);
51316        closeArray();
51317      };
51318      if (element.hasAlternateMaterial()) {
51319        openArray("alternateMaterial");
51320        for (CodeableConcept e : element.getAlternateMaterial()) 
51321          composeCodeableConcept(null, e);
51322        closeArray();
51323      };
51324      if (element.hasShelfLifeStorage()) {
51325        openArray("shelfLifeStorage");
51326        for (ProductShelfLife e : element.getShelfLifeStorage()) 
51327          composeProductShelfLife(null, e);
51328        closeArray();
51329      };
51330      if (element.hasManufacturer()) {
51331        openArray("manufacturer");
51332        for (Reference e : element.getManufacturer()) 
51333          composeReference(null, e);
51334        closeArray();
51335      };
51336      if (element.hasCharacteristic()) {
51337        openArray("characteristic");
51338        for (PackagedProductDefinition.PackagedProductDefinitionPackageCharacteristicComponent e : element.getCharacteristic()) 
51339          composePackagedProductDefinitionPackagedProductDefinitionPackageCharacteristicComponent(null, e);
51340        closeArray();
51341      };
51342      if (element.hasContainedItem()) {
51343        openArray("containedItem");
51344        for (PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent e : element.getContainedItem()) 
51345          composePackagedProductDefinitionPackagedProductDefinitionPackageContainedItemComponent(null, e);
51346        closeArray();
51347      };
51348      if (element.hasPackage()) {
51349        openArray("package");
51350        for (PackagedProductDefinition.PackagedProductDefinitionPackageComponent e : element.getPackage()) 
51351          composePackagedProductDefinitionPackagedProductDefinitionPackageComponent(null, e);
51352        closeArray();
51353      };
51354  }
51355
51356  protected void composePackagedProductDefinitionPackagedProductDefinitionPackageCharacteristicComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackageCharacteristicComponent element) throws IOException {
51357    if (element != null) {
51358      open(name);
51359      composePackagedProductDefinitionPackagedProductDefinitionPackageCharacteristicComponentInner(element);
51360      close();
51361    }
51362  }
51363
51364  protected void composePackagedProductDefinitionPackagedProductDefinitionPackageCharacteristicComponentInner(PackagedProductDefinition.PackagedProductDefinitionPackageCharacteristicComponent element) throws IOException {
51365      composeBackbone(element);
51366      if (element.hasCode()) {
51367        composeCodeableConcept("code", element.getCode());
51368      }
51369      if (element.hasValue()) {
51370        composeType("value", element.getValue());
51371      }
51372  }
51373
51374  protected void composePackagedProductDefinitionPackagedProductDefinitionPackageContainedItemComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent element) throws IOException {
51375    if (element != null) {
51376      open(name);
51377      composePackagedProductDefinitionPackagedProductDefinitionPackageContainedItemComponentInner(element);
51378      close();
51379    }
51380  }
51381
51382  protected void composePackagedProductDefinitionPackagedProductDefinitionPackageContainedItemComponentInner(PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent element) throws IOException {
51383      composeBackbone(element);
51384      if (element.hasItem()) {
51385        openArray("item");
51386        for (Reference e : element.getItem()) 
51387          composeReference(null, e);
51388        closeArray();
51389      };
51390      if (element.hasAmount()) {
51391        composeType("amount", element.getAmount());
51392      }
51393  }
51394
51395  protected void composePatient(String name, Patient element) throws IOException {
51396    if (element != null) {
51397      prop("resourceType", name);
51398      composePatientInner(element);
51399    }
51400  }
51401
51402  protected void composePatientInner(Patient element) throws IOException {
51403      composeDomainResourceElements(element);
51404      if (element.hasIdentifier()) {
51405        openArray("identifier");
51406        for (Identifier e : element.getIdentifier()) 
51407          composeIdentifier(null, e);
51408        closeArray();
51409      };
51410      if (element.hasActiveElement()) {
51411        composeBooleanCore("active", element.getActiveElement(), false);
51412        composeBooleanExtras("active", element.getActiveElement(), false);
51413      }
51414      if (element.hasName()) {
51415        openArray("name");
51416        for (HumanName e : element.getName()) 
51417          composeHumanName(null, e);
51418        closeArray();
51419      };
51420      if (element.hasTelecom()) {
51421        openArray("telecom");
51422        for (ContactPoint e : element.getTelecom()) 
51423          composeContactPoint(null, e);
51424        closeArray();
51425      };
51426      if (element.hasGenderElement()) {
51427        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51428        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51429      }
51430      if (element.hasBirthDateElement()) {
51431        composeDateCore("birthDate", element.getBirthDateElement(), false);
51432        composeDateExtras("birthDate", element.getBirthDateElement(), false);
51433      }
51434      if (element.hasDeceased()) {
51435        composeType("deceased", element.getDeceased());
51436      }
51437      if (element.hasAddress()) {
51438        openArray("address");
51439        for (Address e : element.getAddress()) 
51440          composeAddress(null, e);
51441        closeArray();
51442      };
51443      if (element.hasMaritalStatus()) {
51444        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
51445      }
51446      if (element.hasMultipleBirth()) {
51447        composeType("multipleBirth", element.getMultipleBirth());
51448      }
51449      if (element.hasPhoto()) {
51450        openArray("photo");
51451        for (Attachment e : element.getPhoto()) 
51452          composeAttachment(null, e);
51453        closeArray();
51454      };
51455      if (element.hasContact()) {
51456        openArray("contact");
51457        for (Patient.ContactComponent e : element.getContact()) 
51458          composePatientContactComponent(null, e);
51459        closeArray();
51460      };
51461      if (element.hasCommunication()) {
51462        openArray("communication");
51463        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
51464          composePatientPatientCommunicationComponent(null, e);
51465        closeArray();
51466      };
51467      if (element.hasGeneralPractitioner()) {
51468        openArray("generalPractitioner");
51469        for (Reference e : element.getGeneralPractitioner()) 
51470          composeReference(null, e);
51471        closeArray();
51472      };
51473      if (element.hasManagingOrganization()) {
51474        composeReference("managingOrganization", element.getManagingOrganization());
51475      }
51476      if (element.hasLink()) {
51477        openArray("link");
51478        for (Patient.PatientLinkComponent e : element.getLink()) 
51479          composePatientPatientLinkComponent(null, e);
51480        closeArray();
51481      };
51482  }
51483
51484  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
51485    if (element != null) {
51486      open(name);
51487      composePatientContactComponentInner(element);
51488      close();
51489    }
51490  }
51491
51492  protected void composePatientContactComponentInner(Patient.ContactComponent element) throws IOException {
51493      composeBackbone(element);
51494      if (element.hasRelationship()) {
51495        openArray("relationship");
51496        for (CodeableConcept e : element.getRelationship()) 
51497          composeCodeableConcept(null, e);
51498        closeArray();
51499      };
51500      if (element.hasName()) {
51501        composeHumanName("name", element.getName());
51502      }
51503      if (element.hasTelecom()) {
51504        openArray("telecom");
51505        for (ContactPoint e : element.getTelecom()) 
51506          composeContactPoint(null, e);
51507        closeArray();
51508      };
51509      if (element.hasAddress()) {
51510        composeAddress("address", element.getAddress());
51511      }
51512      if (element.hasGenderElement()) {
51513        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51514        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51515      }
51516      if (element.hasOrganization()) {
51517        composeReference("organization", element.getOrganization());
51518      }
51519      if (element.hasPeriod()) {
51520        composePeriod("period", element.getPeriod());
51521      }
51522  }
51523
51524  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
51525    if (element != null) {
51526      open(name);
51527      composePatientPatientCommunicationComponentInner(element);
51528      close();
51529    }
51530  }
51531
51532  protected void composePatientPatientCommunicationComponentInner(Patient.PatientCommunicationComponent element) throws IOException {
51533      composeBackbone(element);
51534      if (element.hasLanguage()) {
51535        composeCodeableConcept("language", element.getLanguage());
51536      }
51537      if (element.hasPreferredElement()) {
51538        composeBooleanCore("preferred", element.getPreferredElement(), false);
51539        composeBooleanExtras("preferred", element.getPreferredElement(), false);
51540      }
51541  }
51542
51543  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
51544    if (element != null) {
51545      open(name);
51546      composePatientPatientLinkComponentInner(element);
51547      close();
51548    }
51549  }
51550
51551  protected void composePatientPatientLinkComponentInner(Patient.PatientLinkComponent element) throws IOException {
51552      composeBackbone(element);
51553      if (element.hasOther()) {
51554        composeReference("other", element.getOther());
51555      }
51556      if (element.hasTypeElement()) {
51557        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
51558        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
51559      }
51560  }
51561
51562  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
51563    if (element != null) {
51564      prop("resourceType", name);
51565      composePaymentNoticeInner(element);
51566    }
51567  }
51568
51569  protected void composePaymentNoticeInner(PaymentNotice element) throws IOException {
51570      composeDomainResourceElements(element);
51571      if (element.hasIdentifier()) {
51572        openArray("identifier");
51573        for (Identifier e : element.getIdentifier()) 
51574          composeIdentifier(null, e);
51575        closeArray();
51576      };
51577      if (element.hasStatusElement()) {
51578        composeEnumerationCore("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
51579        composeEnumerationExtras("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
51580      }
51581      if (element.hasRequest()) {
51582        composeReference("request", element.getRequest());
51583      }
51584      if (element.hasResponse()) {
51585        composeReference("response", element.getResponse());
51586      }
51587      if (element.hasCreatedElement()) {
51588        composeDateTimeCore("created", element.getCreatedElement(), false);
51589        composeDateTimeExtras("created", element.getCreatedElement(), false);
51590      }
51591      if (element.hasProvider()) {
51592        composeReference("provider", element.getProvider());
51593      }
51594      if (element.hasPayment()) {
51595        composeReference("payment", element.getPayment());
51596      }
51597      if (element.hasPaymentDateElement()) {
51598        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
51599        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
51600      }
51601      if (element.hasPayee()) {
51602        composeReference("payee", element.getPayee());
51603      }
51604      if (element.hasRecipient()) {
51605        composeReference("recipient", element.getRecipient());
51606      }
51607      if (element.hasAmount()) {
51608        composeMoney("amount", element.getAmount());
51609      }
51610      if (element.hasPaymentStatus()) {
51611        composeCodeableConcept("paymentStatus", element.getPaymentStatus());
51612      }
51613  }
51614
51615  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
51616    if (element != null) {
51617      prop("resourceType", name);
51618      composePaymentReconciliationInner(element);
51619    }
51620  }
51621
51622  protected void composePaymentReconciliationInner(PaymentReconciliation element) throws IOException {
51623      composeDomainResourceElements(element);
51624      if (element.hasIdentifier()) {
51625        openArray("identifier");
51626        for (Identifier e : element.getIdentifier()) 
51627          composeIdentifier(null, e);
51628        closeArray();
51629      };
51630      if (element.hasStatusElement()) {
51631        composeEnumerationCore("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
51632        composeEnumerationExtras("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
51633      }
51634      if (element.hasPeriod()) {
51635        composePeriod("period", element.getPeriod());
51636      }
51637      if (element.hasCreatedElement()) {
51638        composeDateTimeCore("created", element.getCreatedElement(), false);
51639        composeDateTimeExtras("created", element.getCreatedElement(), false);
51640      }
51641      if (element.hasPaymentIssuer()) {
51642        composeReference("paymentIssuer", element.getPaymentIssuer());
51643      }
51644      if (element.hasRequest()) {
51645        composeReference("request", element.getRequest());
51646      }
51647      if (element.hasRequestor()) {
51648        composeReference("requestor", element.getRequestor());
51649      }
51650      if (element.hasOutcomeElement()) {
51651        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
51652        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
51653      }
51654      if (element.hasDispositionElement()) {
51655        composeStringCore("disposition", element.getDispositionElement(), false);
51656        composeStringExtras("disposition", element.getDispositionElement(), false);
51657      }
51658      if (element.hasPaymentDateElement()) {
51659        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
51660        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
51661      }
51662      if (element.hasPaymentAmount()) {
51663        composeMoney("paymentAmount", element.getPaymentAmount());
51664      }
51665      if (element.hasPaymentIdentifier()) {
51666        composeIdentifier("paymentIdentifier", element.getPaymentIdentifier());
51667      }
51668      if (element.hasDetail()) {
51669        openArray("detail");
51670        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
51671          composePaymentReconciliationDetailsComponent(null, e);
51672        closeArray();
51673      };
51674      if (element.hasFormCode()) {
51675        composeCodeableConcept("formCode", element.getFormCode());
51676      }
51677      if (element.hasProcessNote()) {
51678        openArray("processNote");
51679        for (PaymentReconciliation.NotesComponent e : element.getProcessNote()) 
51680          composePaymentReconciliationNotesComponent(null, e);
51681        closeArray();
51682      };
51683  }
51684
51685  protected void composePaymentReconciliationDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
51686    if (element != null) {
51687      open(name);
51688      composePaymentReconciliationDetailsComponentInner(element);
51689      close();
51690    }
51691  }
51692
51693  protected void composePaymentReconciliationDetailsComponentInner(PaymentReconciliation.DetailsComponent element) throws IOException {
51694      composeBackbone(element);
51695      if (element.hasIdentifier()) {
51696        composeIdentifier("identifier", element.getIdentifier());
51697      }
51698      if (element.hasPredecessor()) {
51699        composeIdentifier("predecessor", element.getPredecessor());
51700      }
51701      if (element.hasType()) {
51702        composeCodeableConcept("type", element.getType());
51703      }
51704      if (element.hasRequest()) {
51705        composeReference("request", element.getRequest());
51706      }
51707      if (element.hasSubmitter()) {
51708        composeReference("submitter", element.getSubmitter());
51709      }
51710      if (element.hasResponse()) {
51711        composeReference("response", element.getResponse());
51712      }
51713      if (element.hasDateElement()) {
51714        composeDateCore("date", element.getDateElement(), false);
51715        composeDateExtras("date", element.getDateElement(), false);
51716      }
51717      if (element.hasResponsible()) {
51718        composeReference("responsible", element.getResponsible());
51719      }
51720      if (element.hasPayee()) {
51721        composeReference("payee", element.getPayee());
51722      }
51723      if (element.hasAmount()) {
51724        composeMoney("amount", element.getAmount());
51725      }
51726  }
51727
51728  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
51729    if (element != null) {
51730      open(name);
51731      composePaymentReconciliationNotesComponentInner(element);
51732      close();
51733    }
51734  }
51735
51736  protected void composePaymentReconciliationNotesComponentInner(PaymentReconciliation.NotesComponent element) throws IOException {
51737      composeBackbone(element);
51738      if (element.hasTypeElement()) {
51739        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
51740        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
51741      }
51742      if (element.hasTextElement()) {
51743        composeStringCore("text", element.getTextElement(), false);
51744        composeStringExtras("text", element.getTextElement(), false);
51745      }
51746  }
51747
51748  protected void composePerson(String name, Person element) throws IOException {
51749    if (element != null) {
51750      prop("resourceType", name);
51751      composePersonInner(element);
51752    }
51753  }
51754
51755  protected void composePersonInner(Person element) throws IOException {
51756      composeDomainResourceElements(element);
51757      if (element.hasIdentifier()) {
51758        openArray("identifier");
51759        for (Identifier e : element.getIdentifier()) 
51760          composeIdentifier(null, e);
51761        closeArray();
51762      };
51763      if (element.hasName()) {
51764        openArray("name");
51765        for (HumanName e : element.getName()) 
51766          composeHumanName(null, e);
51767        closeArray();
51768      };
51769      if (element.hasTelecom()) {
51770        openArray("telecom");
51771        for (ContactPoint e : element.getTelecom()) 
51772          composeContactPoint(null, e);
51773        closeArray();
51774      };
51775      if (element.hasGenderElement()) {
51776        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51777        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51778      }
51779      if (element.hasBirthDateElement()) {
51780        composeDateCore("birthDate", element.getBirthDateElement(), false);
51781        composeDateExtras("birthDate", element.getBirthDateElement(), false);
51782      }
51783      if (element.hasAddress()) {
51784        openArray("address");
51785        for (Address e : element.getAddress()) 
51786          composeAddress(null, e);
51787        closeArray();
51788      };
51789      if (element.hasPhoto()) {
51790        composeAttachment("photo", element.getPhoto());
51791      }
51792      if (element.hasManagingOrganization()) {
51793        composeReference("managingOrganization", element.getManagingOrganization());
51794      }
51795      if (element.hasActiveElement()) {
51796        composeBooleanCore("active", element.getActiveElement(), false);
51797        composeBooleanExtras("active", element.getActiveElement(), false);
51798      }
51799      if (element.hasLink()) {
51800        openArray("link");
51801        for (Person.PersonLinkComponent e : element.getLink()) 
51802          composePersonPersonLinkComponent(null, e);
51803        closeArray();
51804      };
51805  }
51806
51807  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
51808    if (element != null) {
51809      open(name);
51810      composePersonPersonLinkComponentInner(element);
51811      close();
51812    }
51813  }
51814
51815  protected void composePersonPersonLinkComponentInner(Person.PersonLinkComponent element) throws IOException {
51816      composeBackbone(element);
51817      if (element.hasTarget()) {
51818        composeReference("target", element.getTarget());
51819      }
51820      if (element.hasAssuranceElement()) {
51821        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
51822        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
51823      }
51824  }
51825
51826  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
51827    if (element != null) {
51828      prop("resourceType", name);
51829      composePlanDefinitionInner(element);
51830    }
51831  }
51832
51833  protected void composePlanDefinitionInner(PlanDefinition element) throws IOException {
51834      composeDomainResourceElements(element);
51835      if (element.hasUrlElement()) {
51836        composeUriCore("url", element.getUrlElement(), false);
51837        composeUriExtras("url", element.getUrlElement(), false);
51838      }
51839      if (element.hasIdentifier()) {
51840        openArray("identifier");
51841        for (Identifier e : element.getIdentifier()) 
51842          composeIdentifier(null, e);
51843        closeArray();
51844      };
51845      if (element.hasVersionElement()) {
51846        composeStringCore("version", element.getVersionElement(), false);
51847        composeStringExtras("version", element.getVersionElement(), false);
51848      }
51849      if (element.hasNameElement()) {
51850        composeStringCore("name", element.getNameElement(), false);
51851        composeStringExtras("name", element.getNameElement(), false);
51852      }
51853      if (element.hasTitleElement()) {
51854        composeStringCore("title", element.getTitleElement(), false);
51855        composeStringExtras("title", element.getTitleElement(), false);
51856      }
51857      if (element.hasSubtitleElement()) {
51858        composeStringCore("subtitle", element.getSubtitleElement(), false);
51859        composeStringExtras("subtitle", element.getSubtitleElement(), false);
51860      }
51861      if (element.hasType()) {
51862        composeCodeableConcept("type", element.getType());
51863      }
51864      if (element.hasStatusElement()) {
51865        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51866        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51867      }
51868      if (element.hasExperimentalElement()) {
51869        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51870        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51871      }
51872      if (element.hasSubject()) {
51873        composeType("subject", element.getSubject());
51874      }
51875      if (element.hasDateElement()) {
51876        composeDateTimeCore("date", element.getDateElement(), false);
51877        composeDateTimeExtras("date", element.getDateElement(), false);
51878      }
51879      if (element.hasPublisherElement()) {
51880        composeStringCore("publisher", element.getPublisherElement(), false);
51881        composeStringExtras("publisher", element.getPublisherElement(), false);
51882      }
51883      if (element.hasContact()) {
51884        openArray("contact");
51885        for (ContactDetail e : element.getContact()) 
51886          composeContactDetail(null, e);
51887        closeArray();
51888      };
51889      if (element.hasDescriptionElement()) {
51890        composeMarkdownCore("description", element.getDescriptionElement(), false);
51891        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51892      }
51893      if (element.hasUseContext()) {
51894        openArray("useContext");
51895        for (UsageContext e : element.getUseContext()) 
51896          composeUsageContext(null, e);
51897        closeArray();
51898      };
51899      if (element.hasJurisdiction()) {
51900        openArray("jurisdiction");
51901        for (CodeableConcept e : element.getJurisdiction()) 
51902          composeCodeableConcept(null, e);
51903        closeArray();
51904      };
51905      if (element.hasPurposeElement()) {
51906        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51907        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51908      }
51909      if (element.hasUsageElement()) {
51910        composeStringCore("usage", element.getUsageElement(), false);
51911        composeStringExtras("usage", element.getUsageElement(), false);
51912      }
51913      if (element.hasCopyrightElement()) {
51914        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51915        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51916      }
51917      if (element.hasApprovalDateElement()) {
51918        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
51919        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
51920      }
51921      if (element.hasLastReviewDateElement()) {
51922        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
51923        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
51924      }
51925      if (element.hasEffectivePeriod()) {
51926        composePeriod("effectivePeriod", element.getEffectivePeriod());
51927      }
51928      if (element.hasTopic()) {
51929        openArray("topic");
51930        for (CodeableConcept e : element.getTopic()) 
51931          composeCodeableConcept(null, e);
51932        closeArray();
51933      };
51934      if (element.hasAuthor()) {
51935        openArray("author");
51936        for (ContactDetail e : element.getAuthor()) 
51937          composeContactDetail(null, e);
51938        closeArray();
51939      };
51940      if (element.hasEditor()) {
51941        openArray("editor");
51942        for (ContactDetail e : element.getEditor()) 
51943          composeContactDetail(null, e);
51944        closeArray();
51945      };
51946      if (element.hasReviewer()) {
51947        openArray("reviewer");
51948        for (ContactDetail e : element.getReviewer()) 
51949          composeContactDetail(null, e);
51950        closeArray();
51951      };
51952      if (element.hasEndorser()) {
51953        openArray("endorser");
51954        for (ContactDetail e : element.getEndorser()) 
51955          composeContactDetail(null, e);
51956        closeArray();
51957      };
51958      if (element.hasRelatedArtifact()) {
51959        openArray("relatedArtifact");
51960        for (RelatedArtifact e : element.getRelatedArtifact()) 
51961          composeRelatedArtifact(null, e);
51962        closeArray();
51963      };
51964      if (element.hasLibrary()) {
51965        openArray("library");
51966        for (CanonicalType e : element.getLibrary()) 
51967          composeCanonicalCore(null, e, true);
51968        closeArray();
51969        if (anyHasExtras(element.getLibrary())) {
51970          openArray("_library");
51971          for (CanonicalType e : element.getLibrary()) 
51972            composeCanonicalExtras(null, e, true);
51973          closeArray();
51974        }
51975      };
51976      if (element.hasGoal()) {
51977        openArray("goal");
51978        for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal()) 
51979          composePlanDefinitionPlanDefinitionGoalComponent(null, e);
51980        closeArray();
51981      };
51982      if (element.hasAction()) {
51983        openArray("action");
51984        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
51985          composePlanDefinitionPlanDefinitionActionComponent(null, e);
51986        closeArray();
51987      };
51988  }
51989
51990  protected void composePlanDefinitionPlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
51991    if (element != null) {
51992      open(name);
51993      composePlanDefinitionPlanDefinitionGoalComponentInner(element);
51994      close();
51995    }
51996  }
51997
51998  protected void composePlanDefinitionPlanDefinitionGoalComponentInner(PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
51999      composeBackbone(element);
52000      if (element.hasCategory()) {
52001        composeCodeableConcept("category", element.getCategory());
52002      }
52003      if (element.hasDescription()) {
52004        composeCodeableConcept("description", element.getDescription());
52005      }
52006      if (element.hasPriority()) {
52007        composeCodeableConcept("priority", element.getPriority());
52008      }
52009      if (element.hasStart()) {
52010        composeCodeableConcept("start", element.getStart());
52011      }
52012      if (element.hasAddresses()) {
52013        openArray("addresses");
52014        for (CodeableConcept e : element.getAddresses()) 
52015          composeCodeableConcept(null, e);
52016        closeArray();
52017      };
52018      if (element.hasDocumentation()) {
52019        openArray("documentation");
52020        for (RelatedArtifact e : element.getDocumentation()) 
52021          composeRelatedArtifact(null, e);
52022        closeArray();
52023      };
52024      if (element.hasTarget()) {
52025        openArray("target");
52026        for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget()) 
52027          composePlanDefinitionPlanDefinitionGoalTargetComponent(null, e);
52028        closeArray();
52029      };
52030  }
52031
52032  protected void composePlanDefinitionPlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
52033    if (element != null) {
52034      open(name);
52035      composePlanDefinitionPlanDefinitionGoalTargetComponentInner(element);
52036      close();
52037    }
52038  }
52039
52040  protected void composePlanDefinitionPlanDefinitionGoalTargetComponentInner(PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
52041      composeBackbone(element);
52042      if (element.hasMeasure()) {
52043        composeCodeableConcept("measure", element.getMeasure());
52044      }
52045      if (element.hasDetail()) {
52046        composeType("detail", element.getDetail());
52047      }
52048      if (element.hasDue()) {
52049        composeDuration("due", element.getDue());
52050      }
52051  }
52052
52053  protected void composePlanDefinitionPlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
52054    if (element != null) {
52055      open(name);
52056      composePlanDefinitionPlanDefinitionActionComponentInner(element);
52057      close();
52058    }
52059  }
52060
52061  protected void composePlanDefinitionPlanDefinitionActionComponentInner(PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
52062      composeBackbone(element);
52063      if (element.hasPrefixElement()) {
52064        composeStringCore("prefix", element.getPrefixElement(), false);
52065        composeStringExtras("prefix", element.getPrefixElement(), false);
52066      }
52067      if (element.hasTitleElement()) {
52068        composeStringCore("title", element.getTitleElement(), false);
52069        composeStringExtras("title", element.getTitleElement(), false);
52070      }
52071      if (element.hasDescriptionElement()) {
52072        composeStringCore("description", element.getDescriptionElement(), false);
52073        composeStringExtras("description", element.getDescriptionElement(), false);
52074      }
52075      if (element.hasTextEquivalentElement()) {
52076        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
52077        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
52078      }
52079      if (element.hasPriorityElement()) {
52080        composeEnumerationCore("priority", element.getPriorityElement(), new PlanDefinition.RequestPriorityEnumFactory(), false);
52081        composeEnumerationExtras("priority", element.getPriorityElement(), new PlanDefinition.RequestPriorityEnumFactory(), false);
52082      }
52083      if (element.hasCode()) {
52084        openArray("code");
52085        for (CodeableConcept e : element.getCode()) 
52086          composeCodeableConcept(null, e);
52087        closeArray();
52088      };
52089      if (element.hasReason()) {
52090        openArray("reason");
52091        for (CodeableConcept e : element.getReason()) 
52092          composeCodeableConcept(null, e);
52093        closeArray();
52094      };
52095      if (element.hasDocumentation()) {
52096        openArray("documentation");
52097        for (RelatedArtifact e : element.getDocumentation()) 
52098          composeRelatedArtifact(null, e);
52099        closeArray();
52100      };
52101      if (element.hasGoalId()) {
52102        openArray("goalId");
52103        for (IdType e : element.getGoalId()) 
52104          composeIdCore(null, e, true);
52105        closeArray();
52106        if (anyHasExtras(element.getGoalId())) {
52107          openArray("_goalId");
52108          for (IdType e : element.getGoalId()) 
52109            composeIdExtras(null, e, true);
52110          closeArray();
52111        }
52112      };
52113      if (element.hasSubject()) {
52114        composeType("subject", element.getSubject());
52115      }
52116      if (element.hasTrigger()) {
52117        openArray("trigger");
52118        for (TriggerDefinition e : element.getTrigger()) 
52119          composeTriggerDefinition(null, e);
52120        closeArray();
52121      };
52122      if (element.hasCondition()) {
52123        openArray("condition");
52124        for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition()) 
52125          composePlanDefinitionPlanDefinitionActionConditionComponent(null, e);
52126        closeArray();
52127      };
52128      if (element.hasInput()) {
52129        openArray("input");
52130        for (DataRequirement e : element.getInput()) 
52131          composeDataRequirement(null, e);
52132        closeArray();
52133      };
52134      if (element.hasOutput()) {
52135        openArray("output");
52136        for (DataRequirement e : element.getOutput()) 
52137          composeDataRequirement(null, e);
52138        closeArray();
52139      };
52140      if (element.hasRelatedAction()) {
52141        openArray("relatedAction");
52142        for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction()) 
52143          composePlanDefinitionPlanDefinitionActionRelatedActionComponent(null, e);
52144        closeArray();
52145      };
52146      if (element.hasTiming()) {
52147        composeType("timing", element.getTiming());
52148      }
52149      if (element.hasParticipant()) {
52150        openArray("participant");
52151        for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
52152          composePlanDefinitionPlanDefinitionActionParticipantComponent(null, e);
52153        closeArray();
52154      };
52155      if (element.hasType()) {
52156        composeCodeableConcept("type", element.getType());
52157      }
52158      if (element.hasGroupingBehaviorElement()) {
52159        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
52160        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
52161      }
52162      if (element.hasSelectionBehaviorElement()) {
52163        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
52164        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
52165      }
52166      if (element.hasRequiredBehaviorElement()) {
52167        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
52168        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
52169      }
52170      if (element.hasPrecheckBehaviorElement()) {
52171        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
52172        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
52173      }
52174      if (element.hasCardinalityBehaviorElement()) {
52175        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
52176        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
52177      }
52178      if (element.hasDefinition()) {
52179        composeType("definition", element.getDefinition());
52180      }
52181      if (element.hasTransformElement()) {
52182        composeCanonicalCore("transform", element.getTransformElement(), false);
52183        composeCanonicalExtras("transform", element.getTransformElement(), false);
52184      }
52185      if (element.hasDynamicValue()) {
52186        openArray("dynamicValue");
52187        for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
52188          composePlanDefinitionPlanDefinitionActionDynamicValueComponent(null, e);
52189        closeArray();
52190      };
52191      if (element.hasAction()) {
52192        openArray("action");
52193        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
52194          composePlanDefinitionPlanDefinitionActionComponent(null, e);
52195        closeArray();
52196      };
52197  }
52198
52199  protected void composePlanDefinitionPlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
52200    if (element != null) {
52201      open(name);
52202      composePlanDefinitionPlanDefinitionActionConditionComponentInner(element);
52203      close();
52204    }
52205  }
52206
52207  protected void composePlanDefinitionPlanDefinitionActionConditionComponentInner(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
52208      composeBackbone(element);
52209      if (element.hasKindElement()) {
52210        composeEnumerationCore("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
52211        composeEnumerationExtras("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
52212      }
52213      if (element.hasExpression()) {
52214        composeExpression("expression", element.getExpression());
52215      }
52216  }
52217
52218  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
52219    if (element != null) {
52220      open(name);
52221      composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(element);
52222      close();
52223    }
52224  }
52225
52226  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
52227      composeBackbone(element);
52228      if (element.hasActionIdElement()) {
52229        composeIdCore("actionId", element.getActionIdElement(), false);
52230        composeIdExtras("actionId", element.getActionIdElement(), false);
52231      }
52232      if (element.hasRelationshipElement()) {
52233        composeEnumerationCore("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
52234        composeEnumerationExtras("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
52235      }
52236      if (element.hasOffset()) {
52237        composeType("offset", element.getOffset());
52238      }
52239  }
52240
52241  protected void composePlanDefinitionPlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
52242    if (element != null) {
52243      open(name);
52244      composePlanDefinitionPlanDefinitionActionParticipantComponentInner(element);
52245      close();
52246    }
52247  }
52248
52249  protected void composePlanDefinitionPlanDefinitionActionParticipantComponentInner(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
52250      composeBackbone(element);
52251      if (element.hasTypeElement()) {
52252        composeEnumerationCore("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
52253        composeEnumerationExtras("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
52254      }
52255      if (element.hasRole()) {
52256        composeCodeableConcept("role", element.getRole());
52257      }
52258  }
52259
52260  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
52261    if (element != null) {
52262      open(name);
52263      composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(element);
52264      close();
52265    }
52266  }
52267
52268  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
52269      composeBackbone(element);
52270      if (element.hasPathElement()) {
52271        composeStringCore("path", element.getPathElement(), false);
52272        composeStringExtras("path", element.getPathElement(), false);
52273      }
52274      if (element.hasExpression()) {
52275        composeExpression("expression", element.getExpression());
52276      }
52277  }
52278
52279  protected void composePractitioner(String name, Practitioner element) throws IOException {
52280    if (element != null) {
52281      prop("resourceType", name);
52282      composePractitionerInner(element);
52283    }
52284  }
52285
52286  protected void composePractitionerInner(Practitioner element) throws IOException {
52287      composeDomainResourceElements(element);
52288      if (element.hasIdentifier()) {
52289        openArray("identifier");
52290        for (Identifier e : element.getIdentifier()) 
52291          composeIdentifier(null, e);
52292        closeArray();
52293      };
52294      if (element.hasActiveElement()) {
52295        composeBooleanCore("active", element.getActiveElement(), false);
52296        composeBooleanExtras("active", element.getActiveElement(), false);
52297      }
52298      if (element.hasName()) {
52299        openArray("name");
52300        for (HumanName e : element.getName()) 
52301          composeHumanName(null, e);
52302        closeArray();
52303      };
52304      if (element.hasTelecom()) {
52305        openArray("telecom");
52306        for (ContactPoint e : element.getTelecom()) 
52307          composeContactPoint(null, e);
52308        closeArray();
52309      };
52310      if (element.hasAddress()) {
52311        openArray("address");
52312        for (Address e : element.getAddress()) 
52313          composeAddress(null, e);
52314        closeArray();
52315      };
52316      if (element.hasGenderElement()) {
52317        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
52318        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
52319      }
52320      if (element.hasBirthDateElement()) {
52321        composeDateCore("birthDate", element.getBirthDateElement(), false);
52322        composeDateExtras("birthDate", element.getBirthDateElement(), false);
52323      }
52324      if (element.hasPhoto()) {
52325        openArray("photo");
52326        for (Attachment e : element.getPhoto()) 
52327          composeAttachment(null, e);
52328        closeArray();
52329      };
52330      if (element.hasQualification()) {
52331        openArray("qualification");
52332        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
52333          composePractitionerPractitionerQualificationComponent(null, e);
52334        closeArray();
52335      };
52336      if (element.hasCommunication()) {
52337        openArray("communication");
52338        for (CodeableConcept e : element.getCommunication()) 
52339          composeCodeableConcept(null, e);
52340        closeArray();
52341      };
52342  }
52343
52344  protected void composePractitionerPractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
52345    if (element != null) {
52346      open(name);
52347      composePractitionerPractitionerQualificationComponentInner(element);
52348      close();
52349    }
52350  }
52351
52352  protected void composePractitionerPractitionerQualificationComponentInner(Practitioner.PractitionerQualificationComponent element) throws IOException {
52353      composeBackbone(element);
52354      if (element.hasIdentifier()) {
52355        openArray("identifier");
52356        for (Identifier e : element.getIdentifier()) 
52357          composeIdentifier(null, e);
52358        closeArray();
52359      };
52360      if (element.hasCode()) {
52361        composeCodeableConcept("code", element.getCode());
52362      }
52363      if (element.hasPeriod()) {
52364        composePeriod("period", element.getPeriod());
52365      }
52366      if (element.hasIssuer()) {
52367        composeReference("issuer", element.getIssuer());
52368      }
52369  }
52370
52371  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
52372    if (element != null) {
52373      prop("resourceType", name);
52374      composePractitionerRoleInner(element);
52375    }
52376  }
52377
52378  protected void composePractitionerRoleInner(PractitionerRole element) throws IOException {
52379      composeDomainResourceElements(element);
52380      if (element.hasIdentifier()) {
52381        openArray("identifier");
52382        for (Identifier e : element.getIdentifier()) 
52383          composeIdentifier(null, e);
52384        closeArray();
52385      };
52386      if (element.hasActiveElement()) {
52387        composeBooleanCore("active", element.getActiveElement(), false);
52388        composeBooleanExtras("active", element.getActiveElement(), false);
52389      }
52390      if (element.hasPeriod()) {
52391        composePeriod("period", element.getPeriod());
52392      }
52393      if (element.hasPractitioner()) {
52394        composeReference("practitioner", element.getPractitioner());
52395      }
52396      if (element.hasOrganization()) {
52397        composeReference("organization", element.getOrganization());
52398      }
52399      if (element.hasCode()) {
52400        openArray("code");
52401        for (CodeableConcept e : element.getCode()) 
52402          composeCodeableConcept(null, e);
52403        closeArray();
52404      };
52405      if (element.hasSpecialty()) {
52406        openArray("specialty");
52407        for (CodeableConcept e : element.getSpecialty()) 
52408          composeCodeableConcept(null, e);
52409        closeArray();
52410      };
52411      if (element.hasLocation()) {
52412        openArray("location");
52413        for (Reference e : element.getLocation()) 
52414          composeReference(null, e);
52415        closeArray();
52416      };
52417      if (element.hasHealthcareService()) {
52418        openArray("healthcareService");
52419        for (Reference e : element.getHealthcareService()) 
52420          composeReference(null, e);
52421        closeArray();
52422      };
52423      if (element.hasTelecom()) {
52424        openArray("telecom");
52425        for (ContactPoint e : element.getTelecom()) 
52426          composeContactPoint(null, e);
52427        closeArray();
52428      };
52429      if (element.hasAvailableTime()) {
52430        openArray("availableTime");
52431        for (PractitionerRole.PractitionerRoleAvailableTimeComponent e : element.getAvailableTime()) 
52432          composePractitionerRolePractitionerRoleAvailableTimeComponent(null, e);
52433        closeArray();
52434      };
52435      if (element.hasNotAvailable()) {
52436        openArray("notAvailable");
52437        for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable()) 
52438          composePractitionerRolePractitionerRoleNotAvailableComponent(null, e);
52439        closeArray();
52440      };
52441      if (element.hasAvailabilityExceptionsElement()) {
52442        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
52443        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
52444      }
52445      if (element.hasEndpoint()) {
52446        openArray("endpoint");
52447        for (Reference e : element.getEndpoint()) 
52448          composeReference(null, e);
52449        closeArray();
52450      };
52451  }
52452
52453  protected void composePractitionerRolePractitionerRoleAvailableTimeComponent(String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
52454    if (element != null) {
52455      open(name);
52456      composePractitionerRolePractitionerRoleAvailableTimeComponentInner(element);
52457      close();
52458    }
52459  }
52460
52461  protected void composePractitionerRolePractitionerRoleAvailableTimeComponentInner(PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
52462      composeBackbone(element);
52463      if (element.hasDaysOfWeek()) {
52464        openArray("daysOfWeek");
52465        for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
52466          composeEnumerationCore(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
52467        closeArray();
52468        if (anyHasExtras(element.getDaysOfWeek())) {
52469          openArray("_daysOfWeek");
52470          for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
52471            composeEnumerationExtras(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
52472          closeArray();
52473        }
52474      };
52475      if (element.hasAllDayElement()) {
52476        composeBooleanCore("allDay", element.getAllDayElement(), false);
52477        composeBooleanExtras("allDay", element.getAllDayElement(), false);
52478      }
52479      if (element.hasAvailableStartTimeElement()) {
52480        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
52481        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
52482      }
52483      if (element.hasAvailableEndTimeElement()) {
52484        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
52485        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
52486      }
52487  }
52488
52489  protected void composePractitionerRolePractitionerRoleNotAvailableComponent(String name, PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
52490    if (element != null) {
52491      open(name);
52492      composePractitionerRolePractitionerRoleNotAvailableComponentInner(element);
52493      close();
52494    }
52495  }
52496
52497  protected void composePractitionerRolePractitionerRoleNotAvailableComponentInner(PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
52498      composeBackbone(element);
52499      if (element.hasDescriptionElement()) {
52500        composeStringCore("description", element.getDescriptionElement(), false);
52501        composeStringExtras("description", element.getDescriptionElement(), false);
52502      }
52503      if (element.hasDuring()) {
52504        composePeriod("during", element.getDuring());
52505      }
52506  }
52507
52508  protected void composeProcedure(String name, Procedure element) throws IOException {
52509    if (element != null) {
52510      prop("resourceType", name);
52511      composeProcedureInner(element);
52512    }
52513  }
52514
52515  protected void composeProcedureInner(Procedure element) throws IOException {
52516      composeDomainResourceElements(element);
52517      if (element.hasIdentifier()) {
52518        openArray("identifier");
52519        for (Identifier e : element.getIdentifier()) 
52520          composeIdentifier(null, e);
52521        closeArray();
52522      };
52523      if (element.hasInstantiatesCanonical()) {
52524        openArray("instantiatesCanonical");
52525        for (CanonicalType e : element.getInstantiatesCanonical()) 
52526          composeCanonicalCore(null, e, true);
52527        closeArray();
52528        if (anyHasExtras(element.getInstantiatesCanonical())) {
52529          openArray("_instantiatesCanonical");
52530          for (CanonicalType e : element.getInstantiatesCanonical()) 
52531            composeCanonicalExtras(null, e, true);
52532          closeArray();
52533        }
52534      };
52535      if (element.hasInstantiatesUri()) {
52536        openArray("instantiatesUri");
52537        for (UriType e : element.getInstantiatesUri()) 
52538          composeUriCore(null, e, true);
52539        closeArray();
52540        if (anyHasExtras(element.getInstantiatesUri())) {
52541          openArray("_instantiatesUri");
52542          for (UriType e : element.getInstantiatesUri()) 
52543            composeUriExtras(null, e, true);
52544          closeArray();
52545        }
52546      };
52547      if (element.hasBasedOn()) {
52548        openArray("basedOn");
52549        for (Reference e : element.getBasedOn()) 
52550          composeReference(null, e);
52551        closeArray();
52552      };
52553      if (element.hasPartOf()) {
52554        openArray("partOf");
52555        for (Reference e : element.getPartOf()) 
52556          composeReference(null, e);
52557        closeArray();
52558      };
52559      if (element.hasStatusElement()) {
52560        composeEnumerationCore("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
52561        composeEnumerationExtras("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
52562      }
52563      if (element.hasStatusReason()) {
52564        composeCodeableConcept("statusReason", element.getStatusReason());
52565      }
52566      if (element.hasCategory()) {
52567        openArray("category");
52568        for (CodeableConcept e : element.getCategory()) 
52569          composeCodeableConcept(null, e);
52570        closeArray();
52571      };
52572      if (element.hasCode()) {
52573        composeCodeableConcept("code", element.getCode());
52574      }
52575      if (element.hasSubject()) {
52576        composeReference("subject", element.getSubject());
52577      }
52578      if (element.hasEncounter()) {
52579        composeReference("encounter", element.getEncounter());
52580      }
52581      if (element.hasOccurrence()) {
52582        composeType("occurrence", element.getOccurrence());
52583      }
52584      if (element.hasRecordedElement()) {
52585        composeDateTimeCore("recorded", element.getRecordedElement(), false);
52586        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
52587      }
52588      if (element.hasRecorder()) {
52589        composeReference("recorder", element.getRecorder());
52590      }
52591      if (element.hasReported()) {
52592        composeType("reported", element.getReported());
52593      }
52594      if (element.hasPerformer()) {
52595        openArray("performer");
52596        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
52597          composeProcedureProcedurePerformerComponent(null, e);
52598        closeArray();
52599      };
52600      if (element.hasLocation()) {
52601        composeReference("location", element.getLocation());
52602      }
52603      if (element.hasReasonCode()) {
52604        openArray("reasonCode");
52605        for (CodeableConcept e : element.getReasonCode()) 
52606          composeCodeableConcept(null, e);
52607        closeArray();
52608      };
52609      if (element.hasReasonReference()) {
52610        openArray("reasonReference");
52611        for (Reference e : element.getReasonReference()) 
52612          composeReference(null, e);
52613        closeArray();
52614      };
52615      if (element.hasBodySite()) {
52616        openArray("bodySite");
52617        for (CodeableConcept e : element.getBodySite()) 
52618          composeCodeableConcept(null, e);
52619        closeArray();
52620      };
52621      if (element.hasOutcome()) {
52622        composeCodeableConcept("outcome", element.getOutcome());
52623      }
52624      if (element.hasReport()) {
52625        openArray("report");
52626        for (Reference e : element.getReport()) 
52627          composeReference(null, e);
52628        closeArray();
52629      };
52630      if (element.hasComplication()) {
52631        openArray("complication");
52632        for (CodeableConcept e : element.getComplication()) 
52633          composeCodeableConcept(null, e);
52634        closeArray();
52635      };
52636      if (element.hasComplicationDetail()) {
52637        openArray("complicationDetail");
52638        for (Reference e : element.getComplicationDetail()) 
52639          composeReference(null, e);
52640        closeArray();
52641      };
52642      if (element.hasFollowUp()) {
52643        openArray("followUp");
52644        for (CodeableConcept e : element.getFollowUp()) 
52645          composeCodeableConcept(null, e);
52646        closeArray();
52647      };
52648      if (element.hasNote()) {
52649        openArray("note");
52650        for (Annotation e : element.getNote()) 
52651          composeAnnotation(null, e);
52652        closeArray();
52653      };
52654      if (element.hasFocalDevice()) {
52655        openArray("focalDevice");
52656        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
52657          composeProcedureProcedureFocalDeviceComponent(null, e);
52658        closeArray();
52659      };
52660      if (element.hasUsedReference()) {
52661        openArray("usedReference");
52662        for (Reference e : element.getUsedReference()) 
52663          composeReference(null, e);
52664        closeArray();
52665      };
52666      if (element.hasUsedCode()) {
52667        openArray("usedCode");
52668        for (CodeableConcept e : element.getUsedCode()) 
52669          composeCodeableConcept(null, e);
52670        closeArray();
52671      };
52672  }
52673
52674  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
52675    if (element != null) {
52676      open(name);
52677      composeProcedureProcedurePerformerComponentInner(element);
52678      close();
52679    }
52680  }
52681
52682  protected void composeProcedureProcedurePerformerComponentInner(Procedure.ProcedurePerformerComponent element) throws IOException {
52683      composeBackbone(element);
52684      if (element.hasFunction()) {
52685        composeCodeableConcept("function", element.getFunction());
52686      }
52687      if (element.hasActor()) {
52688        composeReference("actor", element.getActor());
52689      }
52690      if (element.hasOnBehalfOf()) {
52691        composeReference("onBehalfOf", element.getOnBehalfOf());
52692      }
52693  }
52694
52695  protected void composeProcedureProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
52696    if (element != null) {
52697      open(name);
52698      composeProcedureProcedureFocalDeviceComponentInner(element);
52699      close();
52700    }
52701  }
52702
52703  protected void composeProcedureProcedureFocalDeviceComponentInner(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
52704      composeBackbone(element);
52705      if (element.hasAction()) {
52706        composeCodeableConcept("action", element.getAction());
52707      }
52708      if (element.hasManipulated()) {
52709        composeReference("manipulated", element.getManipulated());
52710      }
52711  }
52712
52713  protected void composeProvenance(String name, Provenance element) throws IOException {
52714    if (element != null) {
52715      prop("resourceType", name);
52716      composeProvenanceInner(element);
52717    }
52718  }
52719
52720  protected void composeProvenanceInner(Provenance element) throws IOException {
52721      composeDomainResourceElements(element);
52722      if (element.hasTarget()) {
52723        openArray("target");
52724        for (Reference e : element.getTarget()) 
52725          composeReference(null, e);
52726        closeArray();
52727      };
52728      if (element.hasOccurred()) {
52729        composeType("occurred", element.getOccurred());
52730      }
52731      if (element.hasRecordedElement()) {
52732        composeInstantCore("recorded", element.getRecordedElement(), false);
52733        composeInstantExtras("recorded", element.getRecordedElement(), false);
52734      }
52735      if (element.hasPolicy()) {
52736        openArray("policy");
52737        for (UriType e : element.getPolicy()) 
52738          composeUriCore(null, e, true);
52739        closeArray();
52740        if (anyHasExtras(element.getPolicy())) {
52741          openArray("_policy");
52742          for (UriType e : element.getPolicy()) 
52743            composeUriExtras(null, e, true);
52744          closeArray();
52745        }
52746      };
52747      if (element.hasLocation()) {
52748        composeReference("location", element.getLocation());
52749      }
52750      if (element.hasReason()) {
52751        openArray("reason");
52752        for (CodeableConcept e : element.getReason()) 
52753          composeCodeableConcept(null, e);
52754        closeArray();
52755      };
52756      if (element.hasActivity()) {
52757        composeCodeableConcept("activity", element.getActivity());
52758      }
52759      if (element.hasAgent()) {
52760        openArray("agent");
52761        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
52762          composeProvenanceProvenanceAgentComponent(null, e);
52763        closeArray();
52764      };
52765      if (element.hasEntity()) {
52766        openArray("entity");
52767        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
52768          composeProvenanceProvenanceEntityComponent(null, e);
52769        closeArray();
52770      };
52771      if (element.hasSignature()) {
52772        openArray("signature");
52773        for (Signature e : element.getSignature()) 
52774          composeSignature(null, e);
52775        closeArray();
52776      };
52777  }
52778
52779  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
52780    if (element != null) {
52781      open(name);
52782      composeProvenanceProvenanceAgentComponentInner(element);
52783      close();
52784    }
52785  }
52786
52787  protected void composeProvenanceProvenanceAgentComponentInner(Provenance.ProvenanceAgentComponent element) throws IOException {
52788      composeBackbone(element);
52789      if (element.hasType()) {
52790        composeCodeableConcept("type", element.getType());
52791      }
52792      if (element.hasRole()) {
52793        openArray("role");
52794        for (CodeableConcept e : element.getRole()) 
52795          composeCodeableConcept(null, e);
52796        closeArray();
52797      };
52798      if (element.hasWho()) {
52799        composeReference("who", element.getWho());
52800      }
52801      if (element.hasOnBehalfOf()) {
52802        composeReference("onBehalfOf", element.getOnBehalfOf());
52803      }
52804  }
52805
52806  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
52807    if (element != null) {
52808      open(name);
52809      composeProvenanceProvenanceEntityComponentInner(element);
52810      close();
52811    }
52812  }
52813
52814  protected void composeProvenanceProvenanceEntityComponentInner(Provenance.ProvenanceEntityComponent element) throws IOException {
52815      composeBackbone(element);
52816      if (element.hasRoleElement()) {
52817        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
52818        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
52819      }
52820      if (element.hasWhat()) {
52821        composeReference("what", element.getWhat());
52822      }
52823      if (element.hasAgent()) {
52824        openArray("agent");
52825        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
52826          composeProvenanceProvenanceAgentComponent(null, e);
52827        closeArray();
52828      };
52829  }
52830
52831  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
52832    if (element != null) {
52833      prop("resourceType", name);
52834      composeQuestionnaireInner(element);
52835    }
52836  }
52837
52838  protected void composeQuestionnaireInner(Questionnaire element) throws IOException {
52839      composeDomainResourceElements(element);
52840      if (element.hasUrlElement()) {
52841        composeUriCore("url", element.getUrlElement(), false);
52842        composeUriExtras("url", element.getUrlElement(), false);
52843      }
52844      if (element.hasIdentifier()) {
52845        openArray("identifier");
52846        for (Identifier e : element.getIdentifier()) 
52847          composeIdentifier(null, e);
52848        closeArray();
52849      };
52850      if (element.hasVersionElement()) {
52851        composeStringCore("version", element.getVersionElement(), false);
52852        composeStringExtras("version", element.getVersionElement(), false);
52853      }
52854      if (element.hasNameElement()) {
52855        composeStringCore("name", element.getNameElement(), false);
52856        composeStringExtras("name", element.getNameElement(), false);
52857      }
52858      if (element.hasTitleElement()) {
52859        composeStringCore("title", element.getTitleElement(), false);
52860        composeStringExtras("title", element.getTitleElement(), false);
52861      }
52862      if (element.hasDerivedFrom()) {
52863        openArray("derivedFrom");
52864        for (CanonicalType e : element.getDerivedFrom()) 
52865          composeCanonicalCore(null, e, true);
52866        closeArray();
52867        if (anyHasExtras(element.getDerivedFrom())) {
52868          openArray("_derivedFrom");
52869          for (CanonicalType e : element.getDerivedFrom()) 
52870            composeCanonicalExtras(null, e, true);
52871          closeArray();
52872        }
52873      };
52874      if (element.hasStatusElement()) {
52875        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52876        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52877      }
52878      if (element.hasExperimentalElement()) {
52879        composeBooleanCore("experimental", element.getExperimentalElement(), false);
52880        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
52881      }
52882      if (element.hasSubjectType()) {
52883        openArray("subjectType");
52884        for (CodeType e : element.getSubjectType()) 
52885          composeCodeCore(null, e, true);
52886        closeArray();
52887        if (anyHasExtras(element.getSubjectType())) {
52888          openArray("_subjectType");
52889          for (CodeType e : element.getSubjectType()) 
52890            composeCodeExtras(null, e, true);
52891          closeArray();
52892        }
52893      };
52894      if (element.hasDateElement()) {
52895        composeDateTimeCore("date", element.getDateElement(), false);
52896        composeDateTimeExtras("date", element.getDateElement(), false);
52897      }
52898      if (element.hasPublisherElement()) {
52899        composeStringCore("publisher", element.getPublisherElement(), false);
52900        composeStringExtras("publisher", element.getPublisherElement(), false);
52901      }
52902      if (element.hasContact()) {
52903        openArray("contact");
52904        for (ContactDetail e : element.getContact()) 
52905          composeContactDetail(null, e);
52906        closeArray();
52907      };
52908      if (element.hasDescriptionElement()) {
52909        composeMarkdownCore("description", element.getDescriptionElement(), false);
52910        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52911      }
52912      if (element.hasUseContext()) {
52913        openArray("useContext");
52914        for (UsageContext e : element.getUseContext()) 
52915          composeUsageContext(null, e);
52916        closeArray();
52917      };
52918      if (element.hasJurisdiction()) {
52919        openArray("jurisdiction");
52920        for (CodeableConcept e : element.getJurisdiction()) 
52921          composeCodeableConcept(null, e);
52922        closeArray();
52923      };
52924      if (element.hasPurposeElement()) {
52925        composeMarkdownCore("purpose", element.getPurposeElement(), false);
52926        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
52927      }
52928      if (element.hasCopyrightElement()) {
52929        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
52930        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
52931      }
52932      if (element.hasApprovalDateElement()) {
52933        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
52934        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
52935      }
52936      if (element.hasLastReviewDateElement()) {
52937        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
52938        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
52939      }
52940      if (element.hasEffectivePeriod()) {
52941        composePeriod("effectivePeriod", element.getEffectivePeriod());
52942      }
52943      if (element.hasCode()) {
52944        openArray("code");
52945        for (Coding e : element.getCode()) 
52946          composeCoding(null, e);
52947        closeArray();
52948      };
52949      if (element.hasItem()) {
52950        openArray("item");
52951        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
52952          composeQuestionnaireQuestionnaireItemComponent(null, e);
52953        closeArray();
52954      };
52955  }
52956
52957  protected void composeQuestionnaireQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
52958    if (element != null) {
52959      open(name);
52960      composeQuestionnaireQuestionnaireItemComponentInner(element);
52961      close();
52962    }
52963  }
52964
52965  protected void composeQuestionnaireQuestionnaireItemComponentInner(Questionnaire.QuestionnaireItemComponent element) throws IOException {
52966      composeBackbone(element);
52967      if (element.hasLinkIdElement()) {
52968        composeStringCore("linkId", element.getLinkIdElement(), false);
52969        composeStringExtras("linkId", element.getLinkIdElement(), false);
52970      }
52971      if (element.hasDefinitionElement()) {
52972        composeUriCore("definition", element.getDefinitionElement(), false);
52973        composeUriExtras("definition", element.getDefinitionElement(), false);
52974      }
52975      if (element.hasCode()) {
52976        openArray("code");
52977        for (Coding e : element.getCode()) 
52978          composeCoding(null, e);
52979        closeArray();
52980      };
52981      if (element.hasPrefixElement()) {
52982        composeStringCore("prefix", element.getPrefixElement(), false);
52983        composeStringExtras("prefix", element.getPrefixElement(), false);
52984      }
52985      if (element.hasTextElement()) {
52986        composeStringCore("text", element.getTextElement(), false);
52987        composeStringExtras("text", element.getTextElement(), false);
52988      }
52989      if (element.hasTypeElement()) {
52990        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
52991        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
52992      }
52993      if (element.hasEnableWhen()) {
52994        openArray("enableWhen");
52995        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
52996          composeQuestionnaireQuestionnaireItemEnableWhenComponent(null, e);
52997        closeArray();
52998      };
52999      if (element.hasEnableBehaviorElement()) {
53000        composeEnumerationCore("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
53001        composeEnumerationExtras("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
53002      }
53003      if (element.hasRequiredElement()) {
53004        composeBooleanCore("required", element.getRequiredElement(), false);
53005        composeBooleanExtras("required", element.getRequiredElement(), false);
53006      }
53007      if (element.hasRepeatsElement()) {
53008        composeBooleanCore("repeats", element.getRepeatsElement(), false);
53009        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
53010      }
53011      if (element.hasReadOnlyElement()) {
53012        composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
53013        composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
53014      }
53015      if (element.hasMaxLengthElement()) {
53016        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
53017        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
53018      }
53019      if (element.hasAnswerValueSetElement()) {
53020        composeCanonicalCore("answerValueSet", element.getAnswerValueSetElement(), false);
53021        composeCanonicalExtras("answerValueSet", element.getAnswerValueSetElement(), false);
53022      }
53023      if (element.hasAnswerOption()) {
53024        openArray("answerOption");
53025        for (Questionnaire.QuestionnaireItemAnswerOptionComponent e : element.getAnswerOption()) 
53026          composeQuestionnaireQuestionnaireItemAnswerOptionComponent(null, e);
53027        closeArray();
53028      };
53029      if (element.hasInitial()) {
53030        openArray("initial");
53031        for (Questionnaire.QuestionnaireItemInitialComponent e : element.getInitial()) 
53032          composeQuestionnaireQuestionnaireItemInitialComponent(null, e);
53033        closeArray();
53034      };
53035      if (element.hasItem()) {
53036        openArray("item");
53037        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
53038          composeQuestionnaireQuestionnaireItemComponent(null, e);
53039        closeArray();
53040      };
53041  }
53042
53043  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
53044    if (element != null) {
53045      open(name);
53046      composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(element);
53047      close();
53048    }
53049  }
53050
53051  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
53052      composeBackbone(element);
53053      if (element.hasQuestionElement()) {
53054        composeStringCore("question", element.getQuestionElement(), false);
53055        composeStringExtras("question", element.getQuestionElement(), false);
53056      }
53057      if (element.hasOperatorElement()) {
53058        composeEnumerationCore("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
53059        composeEnumerationExtras("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
53060      }
53061      if (element.hasAnswer()) {
53062        composeType("answer", element.getAnswer());
53063      }
53064  }
53065
53066  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponent(String name, Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
53067    if (element != null) {
53068      open(name);
53069      composeQuestionnaireQuestionnaireItemAnswerOptionComponentInner(element);
53070      close();
53071    }
53072  }
53073
53074  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponentInner(Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
53075      composeBackbone(element);
53076      if (element.hasValue()) {
53077        composeType("value", element.getValue());
53078      }
53079      if (element.hasInitialSelectedElement()) {
53080        composeBooleanCore("initialSelected", element.getInitialSelectedElement(), false);
53081        composeBooleanExtras("initialSelected", element.getInitialSelectedElement(), false);
53082      }
53083  }
53084
53085  protected void composeQuestionnaireQuestionnaireItemInitialComponent(String name, Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
53086    if (element != null) {
53087      open(name);
53088      composeQuestionnaireQuestionnaireItemInitialComponentInner(element);
53089      close();
53090    }
53091  }
53092
53093  protected void composeQuestionnaireQuestionnaireItemInitialComponentInner(Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
53094      composeBackbone(element);
53095      if (element.hasValue()) {
53096        composeType("value", element.getValue());
53097      }
53098  }
53099
53100  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
53101    if (element != null) {
53102      prop("resourceType", name);
53103      composeQuestionnaireResponseInner(element);
53104    }
53105  }
53106
53107  protected void composeQuestionnaireResponseInner(QuestionnaireResponse element) throws IOException {
53108      composeDomainResourceElements(element);
53109      if (element.hasIdentifier()) {
53110        composeIdentifier("identifier", element.getIdentifier());
53111      }
53112      if (element.hasBasedOn()) {
53113        openArray("basedOn");
53114        for (Reference e : element.getBasedOn()) 
53115          composeReference(null, e);
53116        closeArray();
53117      };
53118      if (element.hasPartOf()) {
53119        openArray("partOf");
53120        for (Reference e : element.getPartOf()) 
53121          composeReference(null, e);
53122        closeArray();
53123      };
53124      if (element.hasQuestionnaireElement()) {
53125        composeCanonicalCore("questionnaire", element.getQuestionnaireElement(), false);
53126        composeCanonicalExtras("questionnaire", element.getQuestionnaireElement(), false);
53127      }
53128      if (element.hasStatusElement()) {
53129        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
53130        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
53131      }
53132      if (element.hasSubject()) {
53133        composeReference("subject", element.getSubject());
53134      }
53135      if (element.hasEncounter()) {
53136        composeReference("encounter", element.getEncounter());
53137      }
53138      if (element.hasAuthoredElement()) {
53139        composeDateTimeCore("authored", element.getAuthoredElement(), false);
53140        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
53141      }
53142      if (element.hasAuthor()) {
53143        composeReference("author", element.getAuthor());
53144      }
53145      if (element.hasSource()) {
53146        composeReference("source", element.getSource());
53147      }
53148      if (element.hasItem()) {
53149        openArray("item");
53150        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
53151          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
53152        closeArray();
53153      };
53154  }
53155
53156  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
53157    if (element != null) {
53158      open(name);
53159      composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(element);
53160      close();
53161    }
53162  }
53163
53164  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
53165      composeBackbone(element);
53166      if (element.hasLinkIdElement()) {
53167        composeStringCore("linkId", element.getLinkIdElement(), false);
53168        composeStringExtras("linkId", element.getLinkIdElement(), false);
53169      }
53170      if (element.hasDefinitionElement()) {
53171        composeUriCore("definition", element.getDefinitionElement(), false);
53172        composeUriExtras("definition", element.getDefinitionElement(), false);
53173      }
53174      if (element.hasTextElement()) {
53175        composeStringCore("text", element.getTextElement(), false);
53176        composeStringExtras("text", element.getTextElement(), false);
53177      }
53178      if (element.hasAnswer()) {
53179        openArray("answer");
53180        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
53181          composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(null, e);
53182        closeArray();
53183      };
53184      if (element.hasItem()) {
53185        openArray("item");
53186        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
53187          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
53188        closeArray();
53189      };
53190  }
53191
53192  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
53193    if (element != null) {
53194      open(name);
53195      composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(element);
53196      close();
53197    }
53198  }
53199
53200  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
53201      composeBackbone(element);
53202      if (element.hasValue()) {
53203        composeType("value", element.getValue());
53204      }
53205      if (element.hasItem()) {
53206        openArray("item");
53207        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
53208          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
53209        closeArray();
53210      };
53211  }
53212
53213  protected void composeRegulatedAuthorization(String name, RegulatedAuthorization element) throws IOException {
53214    if (element != null) {
53215      prop("resourceType", name);
53216      composeRegulatedAuthorizationInner(element);
53217    }
53218  }
53219
53220  protected void composeRegulatedAuthorizationInner(RegulatedAuthorization element) throws IOException {
53221      composeDomainResourceElements(element);
53222      if (element.hasIdentifier()) {
53223        openArray("identifier");
53224        for (Identifier e : element.getIdentifier()) 
53225          composeIdentifier(null, e);
53226        closeArray();
53227      };
53228      if (element.hasSubject()) {
53229        composeReference("subject", element.getSubject());
53230      }
53231      if (element.hasType()) {
53232        composeCodeableConcept("type", element.getType());
53233      }
53234      if (element.hasDescriptionElement()) {
53235        composeStringCore("description", element.getDescriptionElement(), false);
53236        composeStringExtras("description", element.getDescriptionElement(), false);
53237      }
53238      if (element.hasRegion()) {
53239        openArray("region");
53240        for (CodeableConcept e : element.getRegion()) 
53241          composeCodeableConcept(null, e);
53242        closeArray();
53243      };
53244      if (element.hasStatus()) {
53245        composeCodeableConcept("status", element.getStatus());
53246      }
53247      if (element.hasStatusDateElement()) {
53248        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
53249        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
53250      }
53251      if (element.hasValidityPeriod()) {
53252        composePeriod("validityPeriod", element.getValidityPeriod());
53253      }
53254      if (element.hasBasis()) {
53255        openArray("basis");
53256        for (CodeableConcept e : element.getBasis()) 
53257          composeCodeableConcept(null, e);
53258        closeArray();
53259      };
53260      if (element.hasRelatedDate()) {
53261        openArray("relatedDate");
53262        for (RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent e : element.getRelatedDate()) 
53263          composeRegulatedAuthorizationRegulatedAuthorizationRelatedDateComponent(null, e);
53264        closeArray();
53265      };
53266      if (element.hasJurisdictionalAuthorization()) {
53267        openArray("jurisdictionalAuthorization");
53268        for (Reference e : element.getJurisdictionalAuthorization()) 
53269          composeReference(null, e);
53270        closeArray();
53271      };
53272      if (element.hasHolder()) {
53273        composeReference("holder", element.getHolder());
53274      }
53275      if (element.hasRegulator()) {
53276        composeReference("regulator", element.getRegulator());
53277      }
53278      if (element.hasCase()) {
53279        composeRegulatedAuthorizationRegulatedAuthorizationCaseComponent("case", element.getCase());
53280      }
53281  }
53282
53283  protected void composeRegulatedAuthorizationRegulatedAuthorizationRelatedDateComponent(String name, RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent element) throws IOException {
53284    if (element != null) {
53285      open(name);
53286      composeRegulatedAuthorizationRegulatedAuthorizationRelatedDateComponentInner(element);
53287      close();
53288    }
53289  }
53290
53291  protected void composeRegulatedAuthorizationRegulatedAuthorizationRelatedDateComponentInner(RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent element) throws IOException {
53292      composeBackbone(element);
53293      if (element.hasDate()) {
53294        composeType("date", element.getDate());
53295      }
53296      if (element.hasType()) {
53297        composeCodeableConcept("type", element.getType());
53298      }
53299  }
53300
53301  protected void composeRegulatedAuthorizationRegulatedAuthorizationCaseComponent(String name, RegulatedAuthorization.RegulatedAuthorizationCaseComponent element) throws IOException {
53302    if (element != null) {
53303      open(name);
53304      composeRegulatedAuthorizationRegulatedAuthorizationCaseComponentInner(element);
53305      close();
53306    }
53307  }
53308
53309  protected void composeRegulatedAuthorizationRegulatedAuthorizationCaseComponentInner(RegulatedAuthorization.RegulatedAuthorizationCaseComponent element) throws IOException {
53310      composeBackbone(element);
53311      if (element.hasIdentifier()) {
53312        composeIdentifier("identifier", element.getIdentifier());
53313      }
53314      if (element.hasType()) {
53315        composeCodeableConcept("type", element.getType());
53316      }
53317      if (element.hasStatus()) {
53318        composeCodeableConcept("status", element.getStatus());
53319      }
53320      if (element.hasDate()) {
53321        composeType("date", element.getDate());
53322      }
53323      if (element.hasApplication()) {
53324        openArray("application");
53325        for (RegulatedAuthorization.RegulatedAuthorizationCaseComponent e : element.getApplication()) 
53326          composeRegulatedAuthorizationRegulatedAuthorizationCaseComponent(null, e);
53327        closeArray();
53328      };
53329  }
53330
53331  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
53332    if (element != null) {
53333      prop("resourceType", name);
53334      composeRelatedPersonInner(element);
53335    }
53336  }
53337
53338  protected void composeRelatedPersonInner(RelatedPerson element) throws IOException {
53339      composeDomainResourceElements(element);
53340      if (element.hasIdentifier()) {
53341        openArray("identifier");
53342        for (Identifier e : element.getIdentifier()) 
53343          composeIdentifier(null, e);
53344        closeArray();
53345      };
53346      if (element.hasActiveElement()) {
53347        composeBooleanCore("active", element.getActiveElement(), false);
53348        composeBooleanExtras("active", element.getActiveElement(), false);
53349      }
53350      if (element.hasPatient()) {
53351        composeReference("patient", element.getPatient());
53352      }
53353      if (element.hasRelationship()) {
53354        openArray("relationship");
53355        for (CodeableConcept e : element.getRelationship()) 
53356          composeCodeableConcept(null, e);
53357        closeArray();
53358      };
53359      if (element.hasName()) {
53360        openArray("name");
53361        for (HumanName e : element.getName()) 
53362          composeHumanName(null, e);
53363        closeArray();
53364      };
53365      if (element.hasTelecom()) {
53366        openArray("telecom");
53367        for (ContactPoint e : element.getTelecom()) 
53368          composeContactPoint(null, e);
53369        closeArray();
53370      };
53371      if (element.hasGenderElement()) {
53372        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
53373        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
53374      }
53375      if (element.hasBirthDateElement()) {
53376        composeDateCore("birthDate", element.getBirthDateElement(), false);
53377        composeDateExtras("birthDate", element.getBirthDateElement(), false);
53378      }
53379      if (element.hasAddress()) {
53380        openArray("address");
53381        for (Address e : element.getAddress()) 
53382          composeAddress(null, e);
53383        closeArray();
53384      };
53385      if (element.hasPhoto()) {
53386        openArray("photo");
53387        for (Attachment e : element.getPhoto()) 
53388          composeAttachment(null, e);
53389        closeArray();
53390      };
53391      if (element.hasPeriod()) {
53392        composePeriod("period", element.getPeriod());
53393      }
53394      if (element.hasCommunication()) {
53395        openArray("communication");
53396        for (RelatedPerson.RelatedPersonCommunicationComponent e : element.getCommunication()) 
53397          composeRelatedPersonRelatedPersonCommunicationComponent(null, e);
53398        closeArray();
53399      };
53400  }
53401
53402  protected void composeRelatedPersonRelatedPersonCommunicationComponent(String name, RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
53403    if (element != null) {
53404      open(name);
53405      composeRelatedPersonRelatedPersonCommunicationComponentInner(element);
53406      close();
53407    }
53408  }
53409
53410  protected void composeRelatedPersonRelatedPersonCommunicationComponentInner(RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
53411      composeBackbone(element);
53412      if (element.hasLanguage()) {
53413        composeCodeableConcept("language", element.getLanguage());
53414      }
53415      if (element.hasPreferredElement()) {
53416        composeBooleanCore("preferred", element.getPreferredElement(), false);
53417        composeBooleanExtras("preferred", element.getPreferredElement(), false);
53418      }
53419  }
53420
53421  protected void composeRequestGroup(String name, RequestGroup element) throws IOException {
53422    if (element != null) {
53423      prop("resourceType", name);
53424      composeRequestGroupInner(element);
53425    }
53426  }
53427
53428  protected void composeRequestGroupInner(RequestGroup element) throws IOException {
53429      composeDomainResourceElements(element);
53430      if (element.hasIdentifier()) {
53431        openArray("identifier");
53432        for (Identifier e : element.getIdentifier()) 
53433          composeIdentifier(null, e);
53434        closeArray();
53435      };
53436      if (element.hasInstantiatesCanonical()) {
53437        openArray("instantiatesCanonical");
53438        for (CanonicalType e : element.getInstantiatesCanonical()) 
53439          composeCanonicalCore(null, e, true);
53440        closeArray();
53441        if (anyHasExtras(element.getInstantiatesCanonical())) {
53442          openArray("_instantiatesCanonical");
53443          for (CanonicalType e : element.getInstantiatesCanonical()) 
53444            composeCanonicalExtras(null, e, true);
53445          closeArray();
53446        }
53447      };
53448      if (element.hasInstantiatesUri()) {
53449        openArray("instantiatesUri");
53450        for (UriType e : element.getInstantiatesUri()) 
53451          composeUriCore(null, e, true);
53452        closeArray();
53453        if (anyHasExtras(element.getInstantiatesUri())) {
53454          openArray("_instantiatesUri");
53455          for (UriType e : element.getInstantiatesUri()) 
53456            composeUriExtras(null, e, true);
53457          closeArray();
53458        }
53459      };
53460      if (element.hasBasedOn()) {
53461        openArray("basedOn");
53462        for (Reference e : element.getBasedOn()) 
53463          composeReference(null, e);
53464        closeArray();
53465      };
53466      if (element.hasReplaces()) {
53467        openArray("replaces");
53468        for (Reference e : element.getReplaces()) 
53469          composeReference(null, e);
53470        closeArray();
53471      };
53472      if (element.hasGroupIdentifier()) {
53473        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
53474      }
53475      if (element.hasStatusElement()) {
53476        composeEnumerationCore("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
53477        composeEnumerationExtras("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
53478      }
53479      if (element.hasIntentElement()) {
53480        composeEnumerationCore("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
53481        composeEnumerationExtras("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
53482      }
53483      if (element.hasPriorityElement()) {
53484        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
53485        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
53486      }
53487      if (element.hasCode()) {
53488        composeCodeableConcept("code", element.getCode());
53489      }
53490      if (element.hasSubject()) {
53491        composeReference("subject", element.getSubject());
53492      }
53493      if (element.hasEncounter()) {
53494        composeReference("encounter", element.getEncounter());
53495      }
53496      if (element.hasAuthoredOnElement()) {
53497        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
53498        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
53499      }
53500      if (element.hasAuthor()) {
53501        composeReference("author", element.getAuthor());
53502      }
53503      if (element.hasReasonCode()) {
53504        openArray("reasonCode");
53505        for (CodeableConcept e : element.getReasonCode()) 
53506          composeCodeableConcept(null, e);
53507        closeArray();
53508      };
53509      if (element.hasReasonReference()) {
53510        openArray("reasonReference");
53511        for (Reference e : element.getReasonReference()) 
53512          composeReference(null, e);
53513        closeArray();
53514      };
53515      if (element.hasNote()) {
53516        openArray("note");
53517        for (Annotation e : element.getNote()) 
53518          composeAnnotation(null, e);
53519        closeArray();
53520      };
53521      if (element.hasAction()) {
53522        openArray("action");
53523        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
53524          composeRequestGroupRequestGroupActionComponent(null, e);
53525        closeArray();
53526      };
53527  }
53528
53529  protected void composeRequestGroupRequestGroupActionComponent(String name, RequestGroup.RequestGroupActionComponent element) throws IOException {
53530    if (element != null) {
53531      open(name);
53532      composeRequestGroupRequestGroupActionComponentInner(element);
53533      close();
53534    }
53535  }
53536
53537  protected void composeRequestGroupRequestGroupActionComponentInner(RequestGroup.RequestGroupActionComponent element) throws IOException {
53538      composeBackbone(element);
53539      if (element.hasPrefixElement()) {
53540        composeStringCore("prefix", element.getPrefixElement(), false);
53541        composeStringExtras("prefix", element.getPrefixElement(), false);
53542      }
53543      if (element.hasTitleElement()) {
53544        composeStringCore("title", element.getTitleElement(), false);
53545        composeStringExtras("title", element.getTitleElement(), false);
53546      }
53547      if (element.hasDescriptionElement()) {
53548        composeStringCore("description", element.getDescriptionElement(), false);
53549        composeStringExtras("description", element.getDescriptionElement(), false);
53550      }
53551      if (element.hasTextEquivalentElement()) {
53552        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
53553        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
53554      }
53555      if (element.hasPriorityElement()) {
53556        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
53557        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
53558      }
53559      if (element.hasCode()) {
53560        openArray("code");
53561        for (CodeableConcept e : element.getCode()) 
53562          composeCodeableConcept(null, e);
53563        closeArray();
53564      };
53565      if (element.hasDocumentation()) {
53566        openArray("documentation");
53567        for (RelatedArtifact e : element.getDocumentation()) 
53568          composeRelatedArtifact(null, e);
53569        closeArray();
53570      };
53571      if (element.hasCondition()) {
53572        openArray("condition");
53573        for (RequestGroup.RequestGroupActionConditionComponent e : element.getCondition()) 
53574          composeRequestGroupRequestGroupActionConditionComponent(null, e);
53575        closeArray();
53576      };
53577      if (element.hasRelatedAction()) {
53578        openArray("relatedAction");
53579        for (RequestGroup.RequestGroupActionRelatedActionComponent e : element.getRelatedAction()) 
53580          composeRequestGroupRequestGroupActionRelatedActionComponent(null, e);
53581        closeArray();
53582      };
53583      if (element.hasTiming()) {
53584        composeType("timing", element.getTiming());
53585      }
53586      if (element.hasParticipant()) {
53587        openArray("participant");
53588        for (Reference e : element.getParticipant()) 
53589          composeReference(null, e);
53590        closeArray();
53591      };
53592      if (element.hasType()) {
53593        composeCodeableConcept("type", element.getType());
53594      }
53595      if (element.hasGroupingBehaviorElement()) {
53596        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
53597        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
53598      }
53599      if (element.hasSelectionBehaviorElement()) {
53600        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
53601        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
53602      }
53603      if (element.hasRequiredBehaviorElement()) {
53604        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
53605        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
53606      }
53607      if (element.hasPrecheckBehaviorElement()) {
53608        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
53609        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
53610        }
53611      if (element.hasCardinalityBehaviorElement()) {
53612        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
53613        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
53614      }
53615      if (element.hasResource()) {
53616        composeReference("resource", element.getResource());
53617      }
53618      if (element.hasAction()) {
53619        openArray("action");
53620        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
53621          composeRequestGroupRequestGroupActionComponent(null, e);
53622        closeArray();
53623      };
53624  }
53625
53626  protected void composeRequestGroupRequestGroupActionConditionComponent(String name, RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
53627    if (element != null) {
53628      open(name);
53629      composeRequestGroupRequestGroupActionConditionComponentInner(element);
53630      close();
53631    }
53632  }
53633
53634  protected void composeRequestGroupRequestGroupActionConditionComponentInner(RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
53635      composeBackbone(element);
53636      if (element.hasKindElement()) {
53637        composeEnumerationCore("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
53638        composeEnumerationExtras("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
53639      }
53640      if (element.hasExpression()) {
53641        composeExpression("expression", element.getExpression());
53642      }
53643      }
53644
53645  protected void composeRequestGroupRequestGroupActionRelatedActionComponent(String name, RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
53646    if (element != null) {
53647      open(name);
53648      composeRequestGroupRequestGroupActionRelatedActionComponentInner(element);
53649      close();
53650      }
53651      }
53652
53653  protected void composeRequestGroupRequestGroupActionRelatedActionComponentInner(RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
53654      composeBackbone(element);
53655      if (element.hasActionIdElement()) {
53656        composeIdCore("actionId", element.getActionIdElement(), false);
53657        composeIdExtras("actionId", element.getActionIdElement(), false);
53658      }
53659      if (element.hasRelationshipElement()) {
53660        composeEnumerationCore("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
53661        composeEnumerationExtras("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
53662      }
53663      if (element.hasOffset()) {
53664        composeType("offset", element.getOffset());
53665      }
53666  }
53667
53668  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
53669    if (element != null) {
53670      prop("resourceType", name);
53671      composeResearchStudyInner(element);
53672    }
53673  }
53674
53675  protected void composeResearchStudyInner(ResearchStudy element) throws IOException {
53676      composeDomainResourceElements(element);
53677      if (element.hasIdentifier()) {
53678        openArray("identifier");
53679        for (Identifier e : element.getIdentifier()) 
53680          composeIdentifier(null, e);
53681        closeArray();
53682      };
53683      if (element.hasTitleElement()) {
53684        composeStringCore("title", element.getTitleElement(), false);
53685        composeStringExtras("title", element.getTitleElement(), false);
53686      }
53687      if (element.hasProtocol()) {
53688        openArray("protocol");
53689        for (Reference e : element.getProtocol()) 
53690          composeReference(null, e);
53691        closeArray();
53692      };
53693      if (element.hasPartOf()) {
53694        openArray("partOf");
53695        for (Reference e : element.getPartOf()) 
53696          composeReference(null, e);
53697        closeArray();
53698      };
53699      if (element.hasStatusElement()) {
53700        composeEnumerationCore("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
53701        composeEnumerationExtras("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
53702      }
53703      if (element.hasPrimaryPurposeType()) {
53704        composeCodeableConcept("primaryPurposeType", element.getPrimaryPurposeType());
53705      }
53706      if (element.hasPhase()) {
53707        composeCodeableConcept("phase", element.getPhase());
53708      }
53709      if (element.hasCategory()) {
53710        openArray("category");
53711        for (CodeableConcept e : element.getCategory()) 
53712          composeCodeableConcept(null, e);
53713        closeArray();
53714      };
53715      if (element.hasFocus()) {
53716        openArray("focus");
53717        for (CodeableConcept e : element.getFocus()) 
53718          composeCodeableConcept(null, e);
53719        closeArray();
53720      };
53721      if (element.hasCondition()) {
53722        openArray("condition");
53723        for (CodeableConcept e : element.getCondition()) 
53724          composeCodeableConcept(null, e);
53725        closeArray();
53726      };
53727      if (element.hasContact()) {
53728        openArray("contact");
53729        for (ContactDetail e : element.getContact()) 
53730          composeContactDetail(null, e);
53731        closeArray();
53732      };
53733      if (element.hasRelatedArtifact()) {
53734        openArray("relatedArtifact");
53735        for (RelatedArtifact e : element.getRelatedArtifact()) 
53736          composeRelatedArtifact(null, e);
53737        closeArray();
53738      };
53739      if (element.hasKeyword()) {
53740        openArray("keyword");
53741        for (CodeableConcept e : element.getKeyword()) 
53742          composeCodeableConcept(null, e);
53743        closeArray();
53744      };
53745      if (element.hasLocation()) {
53746        openArray("location");
53747        for (CodeableConcept e : element.getLocation()) 
53748          composeCodeableConcept(null, e);
53749        closeArray();
53750      };
53751      if (element.hasDescriptionElement()) {
53752        composeMarkdownCore("description", element.getDescriptionElement(), false);
53753        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53754      }
53755      if (element.hasEnrollment()) {
53756        openArray("enrollment");
53757        for (Reference e : element.getEnrollment()) 
53758          composeReference(null, e);
53759        closeArray();
53760      };
53761      if (element.hasPeriod()) {
53762        composePeriod("period", element.getPeriod());
53763      }
53764      if (element.hasSponsor()) {
53765        composeReference("sponsor", element.getSponsor());
53766      }
53767      if (element.hasPrincipalInvestigator()) {
53768        composeReference("principalInvestigator", element.getPrincipalInvestigator());
53769      }
53770      if (element.hasSite()) {
53771        openArray("site");
53772        for (Reference e : element.getSite()) 
53773          composeReference(null, e);
53774        closeArray();
53775      };
53776      if (element.hasReasonStopped()) {
53777        composeCodeableConcept("reasonStopped", element.getReasonStopped());
53778      }
53779      if (element.hasNote()) {
53780        openArray("note");
53781        for (Annotation e : element.getNote()) 
53782          composeAnnotation(null, e);
53783        closeArray();
53784      };
53785      if (element.hasArm()) {
53786        openArray("arm");
53787        for (ResearchStudy.ResearchStudyArmComponent e : element.getArm()) 
53788          composeResearchStudyResearchStudyArmComponent(null, e);
53789        closeArray();
53790      };
53791      if (element.hasObjective()) {
53792        openArray("objective");
53793        for (ResearchStudy.ResearchStudyObjectiveComponent e : element.getObjective()) 
53794          composeResearchStudyResearchStudyObjectiveComponent(null, e);
53795        closeArray();
53796      };
53797  }
53798
53799  protected void composeResearchStudyResearchStudyArmComponent(String name, ResearchStudy.ResearchStudyArmComponent element) throws IOException {
53800    if (element != null) {
53801      open(name);
53802      composeResearchStudyResearchStudyArmComponentInner(element);
53803      close();
53804    }
53805  }
53806
53807  protected void composeResearchStudyResearchStudyArmComponentInner(ResearchStudy.ResearchStudyArmComponent element) throws IOException {
53808      composeBackbone(element);
53809      if (element.hasNameElement()) {
53810        composeStringCore("name", element.getNameElement(), false);
53811        composeStringExtras("name", element.getNameElement(), false);
53812      }
53813      if (element.hasType()) {
53814        composeCodeableConcept("type", element.getType());
53815      }
53816      if (element.hasDescriptionElement()) {
53817        composeStringCore("description", element.getDescriptionElement(), false);
53818        composeStringExtras("description", element.getDescriptionElement(), false);
53819      }
53820  }
53821
53822  protected void composeResearchStudyResearchStudyObjectiveComponent(String name, ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
53823    if (element != null) {
53824      open(name);
53825      composeResearchStudyResearchStudyObjectiveComponentInner(element);
53826      close();
53827    }
53828  }
53829
53830  protected void composeResearchStudyResearchStudyObjectiveComponentInner(ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
53831      composeBackbone(element);
53832      if (element.hasNameElement()) {
53833        composeStringCore("name", element.getNameElement(), false);
53834        composeStringExtras("name", element.getNameElement(), false);
53835      }
53836      if (element.hasType()) {
53837        composeCodeableConcept("type", element.getType());
53838      }
53839  }
53840
53841  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
53842    if (element != null) {
53843      prop("resourceType", name);
53844      composeResearchSubjectInner(element);
53845    }
53846  }
53847
53848  protected void composeResearchSubjectInner(ResearchSubject element) throws IOException {
53849      composeDomainResourceElements(element);
53850      if (element.hasIdentifier()) {
53851        openArray("identifier");
53852        for (Identifier e : element.getIdentifier()) 
53853          composeIdentifier(null, e);
53854        closeArray();
53855      };
53856      if (element.hasStatusElement()) {
53857        composeEnumerationCore("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
53858        composeEnumerationExtras("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
53859      }
53860      if (element.hasPeriod()) {
53861        composePeriod("period", element.getPeriod());
53862      }
53863      if (element.hasStudy()) {
53864        composeReference("study", element.getStudy());
53865      }
53866      if (element.hasIndividual()) {
53867        composeReference("individual", element.getIndividual());
53868      }
53869      if (element.hasAssignedArmElement()) {
53870        composeStringCore("assignedArm", element.getAssignedArmElement(), false);
53871        composeStringExtras("assignedArm", element.getAssignedArmElement(), false);
53872      }
53873      if (element.hasActualArmElement()) {
53874        composeStringCore("actualArm", element.getActualArmElement(), false);
53875        composeStringExtras("actualArm", element.getActualArmElement(), false);
53876      }
53877      if (element.hasConsent()) {
53878        composeReference("consent", element.getConsent());
53879      }
53880  }
53881
53882  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
53883    if (element != null) {
53884      prop("resourceType", name);
53885      composeRiskAssessmentInner(element);
53886    }
53887  }
53888
53889  protected void composeRiskAssessmentInner(RiskAssessment element) throws IOException {
53890      composeDomainResourceElements(element);
53891      if (element.hasIdentifier()) {
53892        openArray("identifier");
53893        for (Identifier e : element.getIdentifier()) 
53894          composeIdentifier(null, e);
53895        closeArray();
53896      };
53897      if (element.hasBasedOn()) {
53898        composeReference("basedOn", element.getBasedOn());
53899      }
53900      if (element.hasParent()) {
53901        composeReference("parent", element.getParent());
53902      }
53903      if (element.hasStatusElement()) {
53904        composeEnumerationCore("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
53905        composeEnumerationExtras("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
53906      }
53907      if (element.hasMethod()) {
53908        composeCodeableConcept("method", element.getMethod());
53909      }
53910      if (element.hasCode()) {
53911        composeCodeableConcept("code", element.getCode());
53912      }
53913      if (element.hasSubject()) {
53914        composeReference("subject", element.getSubject());
53915      }
53916      if (element.hasEncounter()) {
53917        composeReference("encounter", element.getEncounter());
53918      }
53919      if (element.hasOccurrence()) {
53920        composeType("occurrence", element.getOccurrence());
53921      }
53922      if (element.hasCondition()) {
53923        composeReference("condition", element.getCondition());
53924      }
53925      if (element.hasPerformer()) {
53926        composeReference("performer", element.getPerformer());
53927      }
53928      if (element.hasReasonCode()) {
53929        openArray("reasonCode");
53930        for (CodeableConcept e : element.getReasonCode()) 
53931          composeCodeableConcept(null, e);
53932        closeArray();
53933      };
53934      if (element.hasReasonReference()) {
53935        openArray("reasonReference");
53936        for (Reference e : element.getReasonReference()) 
53937          composeReference(null, e);
53938        closeArray();
53939      };
53940      if (element.hasBasis()) {
53941        openArray("basis");
53942        for (Reference e : element.getBasis()) 
53943          composeReference(null, e);
53944        closeArray();
53945      };
53946      if (element.hasPrediction()) {
53947        openArray("prediction");
53948        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
53949          composeRiskAssessmentRiskAssessmentPredictionComponent(null, e);
53950        closeArray();
53951      };
53952      if (element.hasMitigationElement()) {
53953        composeStringCore("mitigation", element.getMitigationElement(), false);
53954        composeStringExtras("mitigation", element.getMitigationElement(), false);
53955      }
53956      if (element.hasNote()) {
53957        openArray("note");
53958        for (Annotation e : element.getNote()) 
53959          composeAnnotation(null, e);
53960        closeArray();
53961      };
53962  }
53963
53964  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
53965    if (element != null) {
53966      open(name);
53967      composeRiskAssessmentRiskAssessmentPredictionComponentInner(element);
53968      close();
53969    }
53970  }
53971
53972  protected void composeRiskAssessmentRiskAssessmentPredictionComponentInner(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
53973      composeBackbone(element);
53974      if (element.hasOutcome()) {
53975        composeCodeableConcept("outcome", element.getOutcome());
53976      }
53977      if (element.hasProbability()) {
53978        composeType("probability", element.getProbability());
53979      }
53980      if (element.hasQualitativeRisk()) {
53981        composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
53982      }
53983      if (element.hasRelativeRiskElement()) {
53984        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
53985        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
53986      }
53987      if (element.hasWhen()) {
53988        composeType("when", element.getWhen());
53989      }
53990      if (element.hasRationaleElement()) {
53991        composeStringCore("rationale", element.getRationaleElement(), false);
53992        composeStringExtras("rationale", element.getRationaleElement(), false);
53993      }
53994  }
53995
53996  protected void composeSchedule(String name, Schedule element) throws IOException {
53997    if (element != null) {
53998      prop("resourceType", name);
53999      composeScheduleInner(element);
54000    }
54001  }
54002
54003  protected void composeScheduleInner(Schedule element) throws IOException {
54004      composeDomainResourceElements(element);
54005      if (element.hasIdentifier()) {
54006        openArray("identifier");
54007        for (Identifier e : element.getIdentifier()) 
54008          composeIdentifier(null, e);
54009        closeArray();
54010      };
54011      if (element.hasActiveElement()) {
54012        composeBooleanCore("active", element.getActiveElement(), false);
54013        composeBooleanExtras("active", element.getActiveElement(), false);
54014      }
54015      if (element.hasServiceCategory()) {
54016        openArray("serviceCategory");
54017        for (CodeableConcept e : element.getServiceCategory()) 
54018          composeCodeableConcept(null, e);
54019        closeArray();
54020      };
54021      if (element.hasServiceType()) {
54022        openArray("serviceType");
54023        for (CodeableConcept e : element.getServiceType()) 
54024          composeCodeableConcept(null, e);
54025        closeArray();
54026      };
54027      if (element.hasSpecialty()) {
54028        openArray("specialty");
54029        for (CodeableConcept e : element.getSpecialty()) 
54030          composeCodeableConcept(null, e);
54031        closeArray();
54032      };
54033      if (element.hasActor()) {
54034        openArray("actor");
54035        for (Reference e : element.getActor()) 
54036          composeReference(null, e);
54037        closeArray();
54038      };
54039      if (element.hasPlanningHorizon()) {
54040        composePeriod("planningHorizon", element.getPlanningHorizon());
54041      }
54042      if (element.hasCommentElement()) {
54043        composeStringCore("comment", element.getCommentElement(), false);
54044        composeStringExtras("comment", element.getCommentElement(), false);
54045      }
54046  }
54047
54048  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
54049    if (element != null) {
54050      prop("resourceType", name);
54051      composeSearchParameterInner(element);
54052    }
54053  }
54054
54055  protected void composeSearchParameterInner(SearchParameter element) throws IOException {
54056      composeDomainResourceElements(element);
54057      if (element.hasUrlElement()) {
54058        composeUriCore("url", element.getUrlElement(), false);
54059        composeUriExtras("url", element.getUrlElement(), false);
54060      }
54061      if (element.hasVersionElement()) {
54062        composeStringCore("version", element.getVersionElement(), false);
54063        composeStringExtras("version", element.getVersionElement(), false);
54064      }
54065      if (element.hasNameElement()) {
54066        composeStringCore("name", element.getNameElement(), false);
54067        composeStringExtras("name", element.getNameElement(), false);
54068      }
54069      if (element.hasDerivedFromElement()) {
54070        composeCanonicalCore("derivedFrom", element.getDerivedFromElement(), false);
54071        composeCanonicalExtras("derivedFrom", element.getDerivedFromElement(), false);
54072      }
54073      if (element.hasStatusElement()) {
54074        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54075        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54076      }
54077      if (element.hasExperimentalElement()) {
54078        composeBooleanCore("experimental", element.getExperimentalElement(), false);
54079        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
54080      }
54081      if (element.hasDateElement()) {
54082        composeDateTimeCore("date", element.getDateElement(), false);
54083        composeDateTimeExtras("date", element.getDateElement(), false);
54084      }
54085      if (element.hasPublisherElement()) {
54086        composeStringCore("publisher", element.getPublisherElement(), false);
54087        composeStringExtras("publisher", element.getPublisherElement(), false);
54088      }
54089      if (element.hasContact()) {
54090        openArray("contact");
54091        for (ContactDetail e : element.getContact()) 
54092          composeContactDetail(null, e);
54093        closeArray();
54094      };
54095      if (element.hasDescriptionElement()) {
54096        composeMarkdownCore("description", element.getDescriptionElement(), false);
54097        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54098      }
54099      if (element.hasUseContext()) {
54100        openArray("useContext");
54101        for (UsageContext e : element.getUseContext()) 
54102          composeUsageContext(null, e);
54103        closeArray();
54104      };
54105      if (element.hasJurisdiction()) {
54106        openArray("jurisdiction");
54107        for (CodeableConcept e : element.getJurisdiction()) 
54108          composeCodeableConcept(null, e);
54109        closeArray();
54110      };
54111      if (element.hasPurposeElement()) {
54112        composeMarkdownCore("purpose", element.getPurposeElement(), false);
54113        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
54114      }
54115      if (element.hasCodeElement()) {
54116        composeCodeCore("code", element.getCodeElement(), false);
54117        composeCodeExtras("code", element.getCodeElement(), false);
54118      }
54119      if (element.hasBase()) {
54120        openArray("base");
54121        for (CodeType e : element.getBase()) 
54122          composeCodeCore(null, e, true);
54123        closeArray();
54124        if (anyHasExtras(element.getBase())) {
54125          openArray("_base");
54126          for (CodeType e : element.getBase()) 
54127            composeCodeExtras(null, e, true);
54128          closeArray();
54129        }
54130      };
54131      if (element.hasTypeElement()) {
54132        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
54133        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
54134      }
54135      if (element.hasExpressionElement()) {
54136        composeStringCore("expression", element.getExpressionElement(), false);
54137        composeStringExtras("expression", element.getExpressionElement(), false);
54138      }
54139      if (element.hasXpathElement()) {
54140        composeStringCore("xpath", element.getXpathElement(), false);
54141        composeStringExtras("xpath", element.getXpathElement(), false);
54142      }
54143      if (element.hasXpathUsageElement()) {
54144        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
54145        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
54146      }
54147      if (element.hasTarget()) {
54148        openArray("target");
54149        for (CodeType e : element.getTarget()) 
54150          composeCodeCore(null, e, true);
54151        closeArray();
54152        if (anyHasExtras(element.getTarget())) {
54153          openArray("_target");
54154          for (CodeType e : element.getTarget()) 
54155            composeCodeExtras(null, e, true);
54156          closeArray();
54157        }
54158      };
54159      if (element.hasMultipleOrElement()) {
54160        composeBooleanCore("multipleOr", element.getMultipleOrElement(), false);
54161        composeBooleanExtras("multipleOr", element.getMultipleOrElement(), false);
54162      }
54163      if (element.hasMultipleAndElement()) {
54164        composeBooleanCore("multipleAnd", element.getMultipleAndElement(), false);
54165        composeBooleanExtras("multipleAnd", element.getMultipleAndElement(), false);
54166      }
54167      if (element.hasComparator()) {
54168        openArray("comparator");
54169        for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
54170          composeEnumerationCore(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
54171        closeArray();
54172        if (anyHasExtras(element.getComparator())) {
54173          openArray("_comparator");
54174          for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
54175            composeEnumerationExtras(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
54176          closeArray();
54177        }
54178      };
54179      if (element.hasModifier()) {
54180        openArray("modifier");
54181        for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
54182          composeEnumerationCore(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
54183        closeArray();
54184        if (anyHasExtras(element.getModifier())) {
54185          openArray("_modifier");
54186          for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
54187            composeEnumerationExtras(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
54188          closeArray();
54189        }
54190      };
54191      if (element.hasChain()) {
54192        openArray("chain");
54193        for (StringType e : element.getChain()) 
54194          composeStringCore(null, e, true);
54195        closeArray();
54196        if (anyHasExtras(element.getChain())) {
54197          openArray("_chain");
54198          for (StringType e : element.getChain()) 
54199            composeStringExtras(null, e, true);
54200          closeArray();
54201        }
54202      };
54203      if (element.hasComponent()) {
54204        openArray("component");
54205        for (SearchParameter.SearchParameterComponentComponent e : element.getComponent()) 
54206          composeSearchParameterSearchParameterComponentComponent(null, e);
54207        closeArray();
54208      };
54209  }
54210
54211  protected void composeSearchParameterSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
54212    if (element != null) {
54213      open(name);
54214      composeSearchParameterSearchParameterComponentComponentInner(element);
54215      close();
54216    }
54217  }
54218
54219  protected void composeSearchParameterSearchParameterComponentComponentInner(SearchParameter.SearchParameterComponentComponent element) throws IOException {
54220      composeBackbone(element);
54221      if (element.hasDefinitionElement()) {
54222        composeCanonicalCore("definition", element.getDefinitionElement(), false);
54223        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
54224      }
54225      if (element.hasExpressionElement()) {
54226        composeStringCore("expression", element.getExpressionElement(), false);
54227        composeStringExtras("expression", element.getExpressionElement(), false);
54228      }
54229  }
54230
54231  protected void composeServiceRequest(String name, ServiceRequest element) throws IOException {
54232    if (element != null) {
54233      prop("resourceType", name);
54234      composeServiceRequestInner(element);
54235    }
54236  }
54237
54238  protected void composeServiceRequestInner(ServiceRequest element) throws IOException {
54239      composeDomainResourceElements(element);
54240      if (element.hasIdentifier()) {
54241        openArray("identifier");
54242        for (Identifier e : element.getIdentifier()) 
54243          composeIdentifier(null, e);
54244        closeArray();
54245      };
54246      if (element.hasInstantiatesCanonical()) {
54247        openArray("instantiatesCanonical");
54248        for (CanonicalType e : element.getInstantiatesCanonical()) 
54249          composeCanonicalCore(null, e, true);
54250        closeArray();
54251        if (anyHasExtras(element.getInstantiatesCanonical())) {
54252          openArray("_instantiatesCanonical");
54253          for (CanonicalType e : element.getInstantiatesCanonical()) 
54254            composeCanonicalExtras(null, e, true);
54255          closeArray();
54256        }
54257      };
54258      if (element.hasInstantiatesUri()) {
54259        openArray("instantiatesUri");
54260        for (UriType e : element.getInstantiatesUri()) 
54261          composeUriCore(null, e, true);
54262        closeArray();
54263        if (anyHasExtras(element.getInstantiatesUri())) {
54264          openArray("_instantiatesUri");
54265          for (UriType e : element.getInstantiatesUri()) 
54266            composeUriExtras(null, e, true);
54267          closeArray();
54268        }
54269      };
54270      if (element.hasBasedOn()) {
54271        openArray("basedOn");
54272        for (Reference e : element.getBasedOn()) 
54273          composeReference(null, e);
54274        closeArray();
54275      };
54276      if (element.hasReplaces()) {
54277        openArray("replaces");
54278        for (Reference e : element.getReplaces()) 
54279          composeReference(null, e);
54280        closeArray();
54281      };
54282      if (element.hasRequisition()) {
54283        composeIdentifier("requisition", element.getRequisition());
54284      }
54285      if (element.hasStatusElement()) {
54286        composeEnumerationCore("status", element.getStatusElement(), new ServiceRequest.ServiceRequestStatusEnumFactory(), false);
54287        composeEnumerationExtras("status", element.getStatusElement(), new ServiceRequest.ServiceRequestStatusEnumFactory(), false);
54288      }
54289      if (element.hasIntentElement()) {
54290        composeEnumerationCore("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory(), false);
54291        composeEnumerationExtras("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory(), false);
54292      }
54293      if (element.hasCategory()) {
54294        openArray("category");
54295        for (CodeableConcept e : element.getCategory()) 
54296          composeCodeableConcept(null, e);
54297        closeArray();
54298      };
54299      if (element.hasPriorityElement()) {
54300        composeEnumerationCore("priority", element.getPriorityElement(), new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
54301        composeEnumerationExtras("priority", element.getPriorityElement(), new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
54302      }
54303      if (element.hasDoNotPerformElement()) {
54304        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
54305        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
54306      }
54307      if (element.hasCode()) {
54308        composeCodeableConcept("code", element.getCode());
54309      }
54310      if (element.hasOrderDetail()) {
54311        openArray("orderDetail");
54312        for (CodeableConcept e : element.getOrderDetail()) 
54313          composeCodeableConcept(null, e);
54314        closeArray();
54315      };
54316      if (element.hasQuantity()) {
54317        composeType("quantity", element.getQuantity());
54318      }
54319      if (element.hasSubject()) {
54320        composeReference("subject", element.getSubject());
54321      }
54322      if (element.hasEncounter()) {
54323        composeReference("encounter", element.getEncounter());
54324      }
54325      if (element.hasOccurrence()) {
54326        composeType("occurrence", element.getOccurrence());
54327      }
54328      if (element.hasAsNeeded()) {
54329        composeType("asNeeded", element.getAsNeeded());
54330      }
54331      if (element.hasAuthoredOnElement()) {
54332        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
54333        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
54334      }
54335      if (element.hasRequester()) {
54336        composeReference("requester", element.getRequester());
54337      }
54338      if (element.hasPerformerType()) {
54339        composeCodeableConcept("performerType", element.getPerformerType());
54340      }
54341      if (element.hasPerformer()) {
54342        openArray("performer");
54343        for (Reference e : element.getPerformer()) 
54344          composeReference(null, e);
54345        closeArray();
54346      };
54347      if (element.hasLocationCode()) {
54348        openArray("locationCode");
54349        for (CodeableConcept e : element.getLocationCode()) 
54350          composeCodeableConcept(null, e);
54351        closeArray();
54352      };
54353      if (element.hasLocationReference()) {
54354        openArray("locationReference");
54355        for (Reference e : element.getLocationReference()) 
54356          composeReference(null, e);
54357        closeArray();
54358      };
54359      if (element.hasReasonCode()) {
54360        openArray("reasonCode");
54361        for (CodeableConcept e : element.getReasonCode()) 
54362          composeCodeableConcept(null, e);
54363        closeArray();
54364      };
54365      if (element.hasReasonReference()) {
54366        openArray("reasonReference");
54367        for (Reference e : element.getReasonReference()) 
54368          composeReference(null, e);
54369        closeArray();
54370      };
54371      if (element.hasInsurance()) {
54372        openArray("insurance");
54373        for (Reference e : element.getInsurance()) 
54374          composeReference(null, e);
54375        closeArray();
54376      };
54377      if (element.hasSupportingInfo()) {
54378        openArray("supportingInfo");
54379        for (Reference e : element.getSupportingInfo()) 
54380          composeReference(null, e);
54381        closeArray();
54382      };
54383      if (element.hasSpecimen()) {
54384        openArray("specimen");
54385        for (Reference e : element.getSpecimen()) 
54386          composeReference(null, e);
54387        closeArray();
54388      };
54389      if (element.hasBodySite()) {
54390        openArray("bodySite");
54391        for (CodeableConcept e : element.getBodySite()) 
54392          composeCodeableConcept(null, e);
54393        closeArray();
54394      };
54395      if (element.hasNote()) {
54396        openArray("note");
54397        for (Annotation e : element.getNote()) 
54398          composeAnnotation(null, e);
54399        closeArray();
54400      };
54401      if (element.hasPatientInstructionElement()) {
54402        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
54403        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
54404      }
54405      if (element.hasRelevantHistory()) {
54406        openArray("relevantHistory");
54407        for (Reference e : element.getRelevantHistory()) 
54408          composeReference(null, e);
54409        closeArray();
54410      };
54411  }
54412
54413  protected void composeSlot(String name, Slot element) throws IOException {
54414    if (element != null) {
54415      prop("resourceType", name);
54416      composeSlotInner(element);
54417    }
54418  }
54419
54420  protected void composeSlotInner(Slot element) throws IOException {
54421      composeDomainResourceElements(element);
54422      if (element.hasIdentifier()) {
54423        openArray("identifier");
54424        for (Identifier e : element.getIdentifier()) 
54425          composeIdentifier(null, e);
54426        closeArray();
54427      };
54428      if (element.hasServiceCategory()) {
54429        openArray("serviceCategory");
54430        for (CodeableConcept e : element.getServiceCategory()) 
54431          composeCodeableConcept(null, e);
54432        closeArray();
54433      };
54434      if (element.hasServiceType()) {
54435        openArray("serviceType");
54436        for (CodeableConcept e : element.getServiceType()) 
54437          composeCodeableConcept(null, e);
54438        closeArray();
54439      };
54440      if (element.hasSpecialty()) {
54441        openArray("specialty");
54442        for (CodeableConcept e : element.getSpecialty()) 
54443          composeCodeableConcept(null, e);
54444        closeArray();
54445      };
54446      if (element.hasAppointmentType()) {
54447        composeCodeableConcept("appointmentType", element.getAppointmentType());
54448      }
54449      if (element.hasSchedule()) {
54450        composeReference("schedule", element.getSchedule());
54451      }
54452      if (element.hasStatusElement()) {
54453        composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
54454        composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
54455      }
54456      if (element.hasStartElement()) {
54457        composeInstantCore("start", element.getStartElement(), false);
54458        composeInstantExtras("start", element.getStartElement(), false);
54459      }
54460      if (element.hasEndElement()) {
54461        composeInstantCore("end", element.getEndElement(), false);
54462        composeInstantExtras("end", element.getEndElement(), false);
54463      }
54464      if (element.hasOverbookedElement()) {
54465        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
54466        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
54467      }
54468      if (element.hasCommentElement()) {
54469        composeStringCore("comment", element.getCommentElement(), false);
54470        composeStringExtras("comment", element.getCommentElement(), false);
54471      }
54472  }
54473
54474  protected void composeSpecimen(String name, Specimen element) throws IOException {
54475    if (element != null) {
54476      prop("resourceType", name);
54477      composeSpecimenInner(element);
54478    }
54479  }
54480
54481  protected void composeSpecimenInner(Specimen element) throws IOException {
54482      composeDomainResourceElements(element);
54483      if (element.hasIdentifier()) {
54484        openArray("identifier");
54485        for (Identifier e : element.getIdentifier()) 
54486          composeIdentifier(null, e);
54487        closeArray();
54488      };
54489      if (element.hasAccessionIdentifier()) {
54490        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
54491      }
54492      if (element.hasStatusElement()) {
54493        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
54494        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
54495      }
54496      if (element.hasType()) {
54497        composeCodeableConcept("type", element.getType());
54498      }
54499      if (element.hasSubject()) {
54500        composeReference("subject", element.getSubject());
54501      }
54502      if (element.hasReceivedTimeElement()) {
54503        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
54504        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
54505      }
54506      if (element.hasParent()) {
54507        openArray("parent");
54508        for (Reference e : element.getParent()) 
54509          composeReference(null, e);
54510        closeArray();
54511      };
54512      if (element.hasRequest()) {
54513        openArray("request");
54514        for (Reference e : element.getRequest()) 
54515          composeReference(null, e);
54516        closeArray();
54517      };
54518      if (element.hasCollection()) {
54519        composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
54520      }
54521      if (element.hasProcessing()) {
54522        openArray("processing");
54523        for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
54524          composeSpecimenSpecimenProcessingComponent(null, e);
54525        closeArray();
54526      };
54527      if (element.hasContainer()) {
54528        openArray("container");
54529        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
54530          composeSpecimenSpecimenContainerComponent(null, e);
54531        closeArray();
54532      };
54533      if (element.hasCondition()) {
54534        openArray("condition");
54535        for (CodeableConcept e : element.getCondition()) 
54536          composeCodeableConcept(null, e);
54537        closeArray();
54538      };
54539      if (element.hasNote()) {
54540        openArray("note");
54541        for (Annotation e : element.getNote()) 
54542          composeAnnotation(null, e);
54543        closeArray();
54544      };
54545  }
54546
54547  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
54548    if (element != null) {
54549      open(name);
54550      composeSpecimenSpecimenCollectionComponentInner(element);
54551      close();
54552    }
54553  }
54554
54555  protected void composeSpecimenSpecimenCollectionComponentInner(Specimen.SpecimenCollectionComponent element) throws IOException {
54556      composeBackbone(element);
54557      if (element.hasCollector()) {
54558        composeReference("collector", element.getCollector());
54559      }
54560      if (element.hasCollected()) {
54561        composeType("collected", element.getCollected());
54562      }
54563      if (element.hasDuration()) {
54564        composeDuration("duration", element.getDuration());
54565      }
54566      if (element.hasQuantity()) {
54567        composeQuantity("quantity", element.getQuantity());
54568      }
54569      if (element.hasMethod()) {
54570        composeCodeableConcept("method", element.getMethod());
54571      }
54572      if (element.hasBodySite()) {
54573        composeCodeableConcept("bodySite", element.getBodySite());
54574      }
54575      if (element.hasFastingStatus()) {
54576        composeType("fastingStatus", element.getFastingStatus());
54577      }
54578  }
54579
54580  protected void composeSpecimenSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
54581    if (element != null) {
54582      open(name);
54583      composeSpecimenSpecimenProcessingComponentInner(element);
54584      close();
54585    }
54586  }
54587
54588  protected void composeSpecimenSpecimenProcessingComponentInner(Specimen.SpecimenProcessingComponent element) throws IOException {
54589      composeBackbone(element);
54590      if (element.hasDescriptionElement()) {
54591        composeStringCore("description", element.getDescriptionElement(), false);
54592        composeStringExtras("description", element.getDescriptionElement(), false);
54593      }
54594      if (element.hasProcedure()) {
54595        composeCodeableConcept("procedure", element.getProcedure());
54596      }
54597      if (element.hasAdditive()) {
54598        openArray("additive");
54599        for (Reference e : element.getAdditive()) 
54600          composeReference(null, e);
54601        closeArray();
54602      };
54603      if (element.hasTime()) {
54604        composeType("time", element.getTime());
54605      }
54606  }
54607
54608  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
54609    if (element != null) {
54610      open(name);
54611      composeSpecimenSpecimenContainerComponentInner(element);
54612      close();
54613    }
54614  }
54615
54616  protected void composeSpecimenSpecimenContainerComponentInner(Specimen.SpecimenContainerComponent element) throws IOException {
54617      composeBackbone(element);
54618      if (element.hasIdentifier()) {
54619        openArray("identifier");
54620        for (Identifier e : element.getIdentifier()) 
54621          composeIdentifier(null, e);
54622        closeArray();
54623      };
54624      if (element.hasDescriptionElement()) {
54625        composeStringCore("description", element.getDescriptionElement(), false);
54626        composeStringExtras("description", element.getDescriptionElement(), false);
54627      }
54628      if (element.hasType()) {
54629        composeCodeableConcept("type", element.getType());
54630      }
54631      if (element.hasCapacity()) {
54632        composeQuantity("capacity", element.getCapacity());
54633      }
54634      if (element.hasSpecimenQuantity()) {
54635        composeQuantity("specimenQuantity", element.getSpecimenQuantity());
54636      }
54637      if (element.hasAdditive()) {
54638        composeType("additive", element.getAdditive());
54639      }
54640  }
54641
54642  protected void composeSpecimenDefinition(String name, SpecimenDefinition element) throws IOException {
54643    if (element != null) {
54644      prop("resourceType", name);
54645      composeSpecimenDefinitionInner(element);
54646    }
54647  }
54648
54649  protected void composeSpecimenDefinitionInner(SpecimenDefinition element) throws IOException {
54650      composeDomainResourceElements(element);
54651      if (element.hasUrlElement()) {
54652        composeUriCore("url", element.getUrlElement(), false);
54653        composeUriExtras("url", element.getUrlElement(), false);
54654      }
54655      if (element.hasIdentifier()) {
54656        composeIdentifier("identifier", element.getIdentifier());
54657      }
54658      if (element.hasVersionElement()) {
54659        composeStringCore("version", element.getVersionElement(), false);
54660        composeStringExtras("version", element.getVersionElement(), false);
54661      }
54662      if (element.hasTitleElement()) {
54663        composeStringCore("title", element.getTitleElement(), false);
54664        composeStringExtras("title", element.getTitleElement(), false);
54665      }
54666      if (element.hasDerivedFromCanonical()) {
54667        openArray("derivedFromCanonical");
54668        for (CanonicalType e : element.getDerivedFromCanonical()) 
54669          composeCanonicalCore(null, e, true);
54670        closeArray();
54671        if (anyHasExtras(element.getDerivedFromCanonical())) {
54672          openArray("_derivedFromCanonical");
54673          for (CanonicalType e : element.getDerivedFromCanonical()) 
54674            composeCanonicalExtras(null, e, true);
54675          closeArray();
54676        }
54677      };
54678      if (element.hasDerivedFromUri()) {
54679        openArray("derivedFromUri");
54680        for (UriType e : element.getDerivedFromUri()) 
54681          composeUriCore(null, e, true);
54682        closeArray();
54683        if (anyHasExtras(element.getDerivedFromUri())) {
54684          openArray("_derivedFromUri");
54685          for (UriType e : element.getDerivedFromUri()) 
54686            composeUriExtras(null, e, true);
54687          closeArray();
54688        }
54689      };
54690      if (element.hasStatusElement()) {
54691        composeEnumerationCore("status", element.getStatusElement(), new SpecimenDefinition.PublicationStatusEnumFactory(), false);
54692        composeEnumerationExtras("status", element.getStatusElement(), new SpecimenDefinition.PublicationStatusEnumFactory(), false);
54693      }
54694      if (element.hasExperimentalElement()) {
54695        composeBooleanCore("experimental", element.getExperimentalElement(), false);
54696        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
54697      }
54698      if (element.hasSubject()) {
54699        composeType("subject", element.getSubject());
54700      }
54701      if (element.hasDateElement()) {
54702        composeDateTimeCore("date", element.getDateElement(), false);
54703        composeDateTimeExtras("date", element.getDateElement(), false);
54704      }
54705      if (element.hasPublisher()) {
54706        composeReference("publisher", element.getPublisher());
54707      }
54708      if (element.hasContact()) {
54709        openArray("contact");
54710        for (ContactDetail e : element.getContact()) 
54711          composeContactDetail(null, e);
54712        closeArray();
54713      };
54714      if (element.hasDescriptionElement()) {
54715        composeMarkdownCore("description", element.getDescriptionElement(), false);
54716        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54717      }
54718      if (element.hasUseContext()) {
54719        openArray("useContext");
54720        for (UsageContext e : element.getUseContext()) 
54721          composeUsageContext(null, e);
54722        closeArray();
54723      };
54724      if (element.hasJurisdiction()) {
54725        openArray("jurisdiction");
54726        for (CodeableConcept e : element.getJurisdiction()) 
54727          composeCodeableConcept(null, e);
54728        closeArray();
54729      };
54730      if (element.hasPurposeElement()) {
54731        composeMarkdownCore("purpose", element.getPurposeElement(), false);
54732        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
54733      }
54734      if (element.hasCopyrightElement()) {
54735        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
54736        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
54737      }
54738      if (element.hasApprovalDateElement()) {
54739        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
54740        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
54741      }
54742      if (element.hasLastReviewDateElement()) {
54743        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
54744        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
54745      }
54746      if (element.hasEffectivePeriod()) {
54747        composePeriod("effectivePeriod", element.getEffectivePeriod());
54748      }
54749      if (element.hasTypeCollected()) {
54750        composeCodeableConcept("typeCollected", element.getTypeCollected());
54751      }
54752      if (element.hasPatientPreparation()) {
54753        openArray("patientPreparation");
54754        for (CodeableConcept e : element.getPatientPreparation()) 
54755          composeCodeableConcept(null, e);
54756        closeArray();
54757      };
54758      if (element.hasTimeAspectElement()) {
54759        composeStringCore("timeAspect", element.getTimeAspectElement(), false);
54760        composeStringExtras("timeAspect", element.getTimeAspectElement(), false);
54761      }
54762      if (element.hasCollection()) {
54763        openArray("collection");
54764        for (CodeableConcept e : element.getCollection()) 
54765          composeCodeableConcept(null, e);
54766        closeArray();
54767      };
54768      if (element.hasTypeTested()) {
54769        openArray("typeTested");
54770        for (SpecimenDefinition.SpecimenDefinitionTypeTestedComponent e : element.getTypeTested()) 
54771          composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(null, e);
54772        closeArray();
54773      };
54774  }
54775
54776  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
54777    if (element != null) {
54778      open(name);
54779      composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentInner(element);
54780      close();
54781    }
54782  }
54783
54784  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
54785      composeBackbone(element);
54786      if (element.hasIsDerivedElement()) {
54787        composeBooleanCore("isDerived", element.getIsDerivedElement(), false);
54788        composeBooleanExtras("isDerived", element.getIsDerivedElement(), false);
54789      }
54790      if (element.hasType()) {
54791        composeCodeableConcept("type", element.getType());
54792      }
54793      if (element.hasPreferenceElement()) {
54794        composeEnumerationCore("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
54795        composeEnumerationExtras("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
54796      }
54797      if (element.hasContainer()) {
54798        composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent("container", element.getContainer());
54799      }
54800      if (element.hasRequirementElement()) {
54801        composeStringCore("requirement", element.getRequirementElement(), false);
54802        composeStringExtras("requirement", element.getRequirementElement(), false);
54803      }
54804      if (element.hasRetentionTime()) {
54805        composeDuration("retentionTime", element.getRetentionTime());
54806      }
54807      if (element.hasSingleUseElement()) {
54808        composeBooleanCore("singleUse", element.getSingleUseElement(), false);
54809        composeBooleanExtras("singleUse", element.getSingleUseElement(), false);
54810      }
54811      if (element.hasRejectionCriterion()) {
54812        openArray("rejectionCriterion");
54813        for (CodeableConcept e : element.getRejectionCriterion()) 
54814          composeCodeableConcept(null, e);
54815        closeArray();
54816      };
54817      if (element.hasHandling()) {
54818        openArray("handling");
54819        for (SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent e : element.getHandling()) 
54820          composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(null, e);
54821        closeArray();
54822      };
54823      if (element.hasTestingDestination()) {
54824        openArray("testingDestination");
54825        for (CodeableConcept e : element.getTestingDestination()) 
54826          composeCodeableConcept(null, e);
54827        closeArray();
54828      };
54829  }
54830
54831  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
54832    if (element != null) {
54833      open(name);
54834      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentInner(element);
54835      close();
54836    }
54837  }
54838
54839  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
54840      composeBackbone(element);
54841      if (element.hasMaterial()) {
54842        composeCodeableConcept("material", element.getMaterial());
54843      }
54844      if (element.hasType()) {
54845        composeCodeableConcept("type", element.getType());
54846      }
54847      if (element.hasCap()) {
54848        composeCodeableConcept("cap", element.getCap());
54849      }
54850      if (element.hasDescriptionElement()) {
54851        composeStringCore("description", element.getDescriptionElement(), false);
54852        composeStringExtras("description", element.getDescriptionElement(), false);
54853      }
54854      if (element.hasCapacity()) {
54855        composeQuantity("capacity", element.getCapacity());
54856      }
54857      if (element.hasMinimumVolume()) {
54858        composeType("minimumVolume", element.getMinimumVolume());
54859      }
54860      if (element.hasAdditive()) {
54861        openArray("additive");
54862        for (SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent e : element.getAdditive()) 
54863          composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(null, e);
54864        closeArray();
54865      };
54866      if (element.hasPreparationElement()) {
54867        composeStringCore("preparation", element.getPreparationElement(), false);
54868        composeStringExtras("preparation", element.getPreparationElement(), false);
54869      }
54870  }
54871
54872  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
54873    if (element != null) {
54874      open(name);
54875      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentInner(element);
54876      close();
54877    }
54878  }
54879
54880  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
54881      composeBackbone(element);
54882      if (element.hasAdditive()) {
54883        composeType("additive", element.getAdditive());
54884      }
54885  }
54886
54887  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
54888    if (element != null) {
54889      open(name);
54890      composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentInner(element);
54891      close();
54892    }
54893  }
54894
54895  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
54896      composeBackbone(element);
54897      if (element.hasTemperatureQualifier()) {
54898        composeCodeableConcept("temperatureQualifier", element.getTemperatureQualifier());
54899      }
54900      if (element.hasTemperatureRange()) {
54901        composeRange("temperatureRange", element.getTemperatureRange());
54902      }
54903      if (element.hasMaxDuration()) {
54904        composeDuration("maxDuration", element.getMaxDuration());
54905      }
54906      if (element.hasInstructionElement()) {
54907        composeStringCore("instruction", element.getInstructionElement(), false);
54908        composeStringExtras("instruction", element.getInstructionElement(), false);
54909      }
54910  }
54911
54912  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
54913    if (element != null) {
54914      prop("resourceType", name);
54915      composeStructureDefinitionInner(element);
54916    }
54917  }
54918
54919  protected void composeStructureDefinitionInner(StructureDefinition element) throws IOException {
54920      composeDomainResourceElements(element);
54921      if (element.hasUrlElement()) {
54922        composeUriCore("url", element.getUrlElement(), false);
54923        composeUriExtras("url", element.getUrlElement(), false);
54924      }
54925      if (element.hasIdentifier()) {
54926        openArray("identifier");
54927        for (Identifier e : element.getIdentifier()) 
54928          composeIdentifier(null, e);
54929        closeArray();
54930      };
54931      if (element.hasVersionElement()) {
54932        composeStringCore("version", element.getVersionElement(), false);
54933        composeStringExtras("version", element.getVersionElement(), false);
54934      }
54935      if (element.hasNameElement()) {
54936        composeStringCore("name", element.getNameElement(), false);
54937        composeStringExtras("name", element.getNameElement(), false);
54938      }
54939      if (element.hasTitleElement()) {
54940        composeStringCore("title", element.getTitleElement(), false);
54941        composeStringExtras("title", element.getTitleElement(), false);
54942      }
54943      if (element.hasStatusElement()) {
54944        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54945        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54946      }
54947      if (element.hasExperimentalElement()) {
54948        composeBooleanCore("experimental", element.getExperimentalElement(), false);
54949        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
54950      }
54951      if (element.hasDateElement()) {
54952        composeDateTimeCore("date", element.getDateElement(), false);
54953        composeDateTimeExtras("date", element.getDateElement(), false);
54954      }
54955      if (element.hasPublisherElement()) {
54956        composeStringCore("publisher", element.getPublisherElement(), false);
54957        composeStringExtras("publisher", element.getPublisherElement(), false);
54958      }
54959      if (element.hasContact()) {
54960        openArray("contact");
54961        for (ContactDetail e : element.getContact()) 
54962          composeContactDetail(null, e);
54963        closeArray();
54964      };
54965      if (element.hasDescriptionElement()) {
54966        composeMarkdownCore("description", element.getDescriptionElement(), false);
54967        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54968      }
54969      if (element.hasUseContext()) {
54970        openArray("useContext");
54971        for (UsageContext e : element.getUseContext()) 
54972          composeUsageContext(null, e);
54973        closeArray();
54974      };
54975      if (element.hasJurisdiction()) {
54976        openArray("jurisdiction");
54977        for (CodeableConcept e : element.getJurisdiction()) 
54978          composeCodeableConcept(null, e);
54979        closeArray();
54980      };
54981      if (element.hasPurposeElement()) {
54982        composeMarkdownCore("purpose", element.getPurposeElement(), false);
54983        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
54984      }
54985      if (element.hasCopyrightElement()) {
54986        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
54987        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
54988      }
54989      if (element.hasKeyword()) {
54990        openArray("keyword");
54991        for (Coding e : element.getKeyword()) 
54992          composeCoding(null, e);
54993        closeArray();
54994      };
54995      if (element.hasFhirVersionElement()) {
54996        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
54997        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
54998      }
54999      if (element.hasMapping()) {
55000        openArray("mapping");
55001        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
55002          composeStructureDefinitionStructureDefinitionMappingComponent(null, e);
55003        closeArray();
55004      };
55005      if (element.hasKindElement()) {
55006        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
55007        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
55008      }
55009      if (element.hasAbstractElement()) {
55010        composeBooleanCore("abstract", element.getAbstractElement(), false);
55011        composeBooleanExtras("abstract", element.getAbstractElement(), false);
55012      }
55013      if (element.hasContext()) {
55014        openArray("context");
55015        for (StructureDefinition.StructureDefinitionContextComponent e : element.getContext()) 
55016          composeStructureDefinitionStructureDefinitionContextComponent(null, e);
55017        closeArray();
55018      };
55019      if (element.hasContextInvariant()) {
55020        openArray("contextInvariant");
55021        for (StringType e : element.getContextInvariant()) 
55022          composeStringCore(null, e, true);
55023        closeArray();
55024        if (anyHasExtras(element.getContextInvariant())) {
55025          openArray("_contextInvariant");
55026          for (StringType e : element.getContextInvariant()) 
55027            composeStringExtras(null, e, true);
55028          closeArray();
55029        }
55030      };
55031      if (element.hasTypeElement()) {
55032        composeUriCore("type", element.getTypeElement(), false);
55033        composeUriExtras("type", element.getTypeElement(), false);
55034      }
55035      if (element.hasBaseDefinitionElement()) {
55036        composeCanonicalCore("baseDefinition", element.getBaseDefinitionElement(), false);
55037        composeCanonicalExtras("baseDefinition", element.getBaseDefinitionElement(), false);
55038      }
55039      if (element.hasDerivationElement()) {
55040        composeEnumerationCore("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
55041        composeEnumerationExtras("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
55042      }
55043      if (element.hasSnapshot()) {
55044        composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
55045      }
55046      if (element.hasDifferential()) {
55047        composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
55048      }
55049  }
55050
55051  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
55052    if (element != null) {
55053      open(name);
55054      composeStructureDefinitionStructureDefinitionMappingComponentInner(element);
55055      close();
55056    }
55057  }
55058
55059  protected void composeStructureDefinitionStructureDefinitionMappingComponentInner(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
55060      composeBackbone(element);
55061      if (element.hasIdentityElement()) {
55062        composeIdCore("identity", element.getIdentityElement(), false);
55063        composeIdExtras("identity", element.getIdentityElement(), false);
55064      }
55065      if (element.hasUriElement()) {
55066        composeUriCore("uri", element.getUriElement(), false);
55067        composeUriExtras("uri", element.getUriElement(), false);
55068      }
55069      if (element.hasNameElement()) {
55070        composeStringCore("name", element.getNameElement(), false);
55071        composeStringExtras("name", element.getNameElement(), false);
55072      }
55073      if (element.hasCommentElement()) {
55074        composeStringCore("comment", element.getCommentElement(), false);
55075        composeStringExtras("comment", element.getCommentElement(), false);
55076      }
55077  }
55078
55079  protected void composeStructureDefinitionStructureDefinitionContextComponent(String name, StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
55080    if (element != null) {
55081      open(name);
55082      composeStructureDefinitionStructureDefinitionContextComponentInner(element);
55083      close();
55084    }
55085  }
55086
55087  protected void composeStructureDefinitionStructureDefinitionContextComponentInner(StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
55088      composeBackbone(element);
55089      if (element.hasTypeElement()) {
55090        composeEnumerationCore("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
55091        composeEnumerationExtras("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
55092      }
55093      if (element.hasExpressionElement()) {
55094        composeStringCore("expression", element.getExpressionElement(), false);
55095        composeStringExtras("expression", element.getExpressionElement(), false);
55096      }
55097  }
55098
55099  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
55100    if (element != null) {
55101      open(name);
55102      composeStructureDefinitionStructureDefinitionSnapshotComponentInner(element);
55103      close();
55104    }
55105  }
55106
55107  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentInner(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
55108      composeBackbone(element);
55109      if (element.hasElement()) {
55110        openArray("element");
55111        for (ElementDefinition e : element.getElement()) 
55112          composeElementDefinition(null, e);
55113        closeArray();
55114      };
55115  }
55116
55117  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
55118    if (element != null) {
55119      open(name);
55120      composeStructureDefinitionStructureDefinitionDifferentialComponentInner(element);
55121      close();
55122    }
55123  }
55124
55125  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentInner(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
55126      composeBackbone(element);
55127      if (element.hasElement()) {
55128        openArray("element");
55129        for (ElementDefinition e : element.getElement()) 
55130          composeElementDefinition(null, e);
55131        closeArray();
55132      };
55133  }
55134
55135  protected void composeStructureMap(String name, StructureMap element) throws IOException {
55136    if (element != null) {
55137      prop("resourceType", name);
55138      composeStructureMapInner(element);
55139    }
55140  }
55141
55142  protected void composeStructureMapInner(StructureMap element) throws IOException {
55143      composeDomainResourceElements(element);
55144      if (element.hasUrlElement()) {
55145        composeUriCore("url", element.getUrlElement(), false);
55146        composeUriExtras("url", element.getUrlElement(), false);
55147      }
55148      if (element.hasIdentifier()) {
55149        openArray("identifier");
55150        for (Identifier e : element.getIdentifier()) 
55151          composeIdentifier(null, e);
55152        closeArray();
55153      };
55154      if (element.hasVersionElement()) {
55155        composeStringCore("version", element.getVersionElement(), false);
55156        composeStringExtras("version", element.getVersionElement(), false);
55157      }
55158      if (element.hasNameElement()) {
55159        composeStringCore("name", element.getNameElement(), false);
55160        composeStringExtras("name", element.getNameElement(), false);
55161      }
55162      if (element.hasTitleElement()) {
55163        composeStringCore("title", element.getTitleElement(), false);
55164        composeStringExtras("title", element.getTitleElement(), false);
55165      }
55166      if (element.hasStatusElement()) {
55167        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55168        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55169      }
55170      if (element.hasExperimentalElement()) {
55171        composeBooleanCore("experimental", element.getExperimentalElement(), false);
55172        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
55173      }
55174      if (element.hasDateElement()) {
55175        composeDateTimeCore("date", element.getDateElement(), false);
55176        composeDateTimeExtras("date", element.getDateElement(), false);
55177      }
55178      if (element.hasPublisherElement()) {
55179        composeStringCore("publisher", element.getPublisherElement(), false);
55180        composeStringExtras("publisher", element.getPublisherElement(), false);
55181      }
55182      if (element.hasContact()) {
55183        openArray("contact");
55184        for (ContactDetail e : element.getContact()) 
55185          composeContactDetail(null, e);
55186        closeArray();
55187      };
55188      if (element.hasDescriptionElement()) {
55189        composeMarkdownCore("description", element.getDescriptionElement(), false);
55190        composeMarkdownExtras("description", element.getDescriptionElement(), false);
55191      }
55192      if (element.hasUseContext()) {
55193        openArray("useContext");
55194        for (UsageContext e : element.getUseContext()) 
55195          composeUsageContext(null, e);
55196        closeArray();
55197      };
55198      if (element.hasJurisdiction()) {
55199        openArray("jurisdiction");
55200        for (CodeableConcept e : element.getJurisdiction()) 
55201          composeCodeableConcept(null, e);
55202        closeArray();
55203      };
55204      if (element.hasPurposeElement()) {
55205        composeMarkdownCore("purpose", element.getPurposeElement(), false);
55206        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
55207      }
55208      if (element.hasCopyrightElement()) {
55209        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
55210        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
55211      }
55212      if (element.hasStructure()) {
55213        openArray("structure");
55214        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
55215          composeStructureMapStructureMapStructureComponent(null, e);
55216        closeArray();
55217      };
55218      if (element.hasImport()) {
55219        openArray("import");
55220        for (CanonicalType e : element.getImport()) 
55221          composeCanonicalCore(null, e, true);
55222        closeArray();
55223        if (anyHasExtras(element.getImport())) {
55224          openArray("_import");
55225          for (CanonicalType e : element.getImport()) 
55226            composeCanonicalExtras(null, e, true);
55227          closeArray();
55228        }
55229      };
55230      if (element.hasGroup()) {
55231        openArray("group");
55232        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
55233          composeStructureMapStructureMapGroupComponent(null, e);
55234        closeArray();
55235      };
55236  }
55237
55238  protected void composeStructureMapStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
55239    if (element != null) {
55240      open(name);
55241      composeStructureMapStructureMapStructureComponentInner(element);
55242      close();
55243    }
55244  }
55245
55246  protected void composeStructureMapStructureMapStructureComponentInner(StructureMap.StructureMapStructureComponent element) throws IOException {
55247      composeBackbone(element);
55248      if (element.hasUrlElement()) {
55249        composeCanonicalCore("url", element.getUrlElement(), false);
55250        composeCanonicalExtras("url", element.getUrlElement(), false);
55251      }
55252      if (element.hasModeElement()) {
55253        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
55254        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
55255      }
55256      if (element.hasAliasElement()) {
55257        composeStringCore("alias", element.getAliasElement(), false);
55258        composeStringExtras("alias", element.getAliasElement(), false);
55259      }
55260      if (element.hasDocumentationElement()) {
55261        composeStringCore("documentation", element.getDocumentationElement(), false);
55262        composeStringExtras("documentation", element.getDocumentationElement(), false);
55263      }
55264  }
55265
55266  protected void composeStructureMapStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
55267    if (element != null) {
55268      open(name);
55269      composeStructureMapStructureMapGroupComponentInner(element);
55270      close();
55271    }
55272  }
55273
55274  protected void composeStructureMapStructureMapGroupComponentInner(StructureMap.StructureMapGroupComponent element) throws IOException {
55275      composeBackbone(element);
55276      if (element.hasNameElement()) {
55277        composeIdCore("name", element.getNameElement(), false);
55278        composeIdExtras("name", element.getNameElement(), false);
55279      }
55280      if (element.hasExtendsElement()) {
55281        composeIdCore("extends", element.getExtendsElement(), false);
55282        composeIdExtras("extends", element.getExtendsElement(), false);
55283      }
55284      if (element.hasTypeModeElement()) {
55285        composeEnumerationCore("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
55286        composeEnumerationExtras("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
55287      }
55288      if (element.hasDocumentationElement()) {
55289        composeStringCore("documentation", element.getDocumentationElement(), false);
55290        composeStringExtras("documentation", element.getDocumentationElement(), false);
55291      }
55292      if (element.hasInput()) {
55293        openArray("input");
55294        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
55295          composeStructureMapStructureMapGroupInputComponent(null, e);
55296        closeArray();
55297      };
55298      if (element.hasRule()) {
55299        openArray("rule");
55300        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
55301          composeStructureMapStructureMapGroupRuleComponent(null, e);
55302        closeArray();
55303      };
55304  }
55305
55306  protected void composeStructureMapStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
55307    if (element != null) {
55308      open(name);
55309      composeStructureMapStructureMapGroupInputComponentInner(element);
55310      close();
55311    }
55312  }
55313
55314  protected void composeStructureMapStructureMapGroupInputComponentInner(StructureMap.StructureMapGroupInputComponent element) throws IOException {
55315      composeBackbone(element);
55316      if (element.hasNameElement()) {
55317        composeIdCore("name", element.getNameElement(), false);
55318        composeIdExtras("name", element.getNameElement(), false);
55319      }
55320      if (element.hasTypeElement()) {
55321        composeStringCore("type", element.getTypeElement(), false);
55322        composeStringExtras("type", element.getTypeElement(), false);
55323      }
55324      if (element.hasModeElement()) {
55325        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
55326        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
55327      }
55328      if (element.hasDocumentationElement()) {
55329        composeStringCore("documentation", element.getDocumentationElement(), false);
55330        composeStringExtras("documentation", element.getDocumentationElement(), false);
55331      }
55332  }
55333
55334  protected void composeStructureMapStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
55335    if (element != null) {
55336      open(name);
55337      composeStructureMapStructureMapGroupRuleComponentInner(element);
55338      close();
55339    }
55340  }
55341
55342  protected void composeStructureMapStructureMapGroupRuleComponentInner(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
55343      composeBackbone(element);
55344      if (element.hasNameElement()) {
55345        composeIdCore("name", element.getNameElement(), false);
55346        composeIdExtras("name", element.getNameElement(), false);
55347      }
55348      if (element.hasSource()) {
55349        openArray("source");
55350        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
55351          composeStructureMapStructureMapGroupRuleSourceComponent(null, e);
55352        closeArray();
55353      };
55354      if (element.hasTarget()) {
55355        openArray("target");
55356        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
55357          composeStructureMapStructureMapGroupRuleTargetComponent(null, e);
55358        closeArray();
55359      };
55360      if (element.hasRule()) {
55361        openArray("rule");
55362        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
55363          composeStructureMapStructureMapGroupRuleComponent(null, e);
55364        closeArray();
55365      };
55366      if (element.hasDependent()) {
55367        openArray("dependent");
55368        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
55369          composeStructureMapStructureMapGroupRuleDependentComponent(null, e);
55370        closeArray();
55371      };
55372      if (element.hasDocumentationElement()) {
55373        composeStringCore("documentation", element.getDocumentationElement(), false);
55374        composeStringExtras("documentation", element.getDocumentationElement(), false);
55375      }
55376  }
55377
55378  protected void composeStructureMapStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
55379    if (element != null) {
55380      open(name);
55381      composeStructureMapStructureMapGroupRuleSourceComponentInner(element);
55382      close();
55383    }
55384  }
55385
55386  protected void composeStructureMapStructureMapGroupRuleSourceComponentInner(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
55387      composeBackbone(element);
55388      if (element.hasContextElement()) {
55389        composeIdCore("context", element.getContextElement(), false);
55390        composeIdExtras("context", element.getContextElement(), false);
55391      }
55392      if (element.hasMinElement()) {
55393        composeIntegerCore("min", element.getMinElement(), false);
55394        composeIntegerExtras("min", element.getMinElement(), false);
55395      }
55396      if (element.hasMaxElement()) {
55397        composeStringCore("max", element.getMaxElement(), false);
55398        composeStringExtras("max", element.getMaxElement(), false);
55399      }
55400      if (element.hasTypeElement()) {
55401        composeStringCore("type", element.getTypeElement(), false);
55402        composeStringExtras("type", element.getTypeElement(), false);
55403      }
55404      if (element.hasDefaultValue()) {
55405        composeType("defaultValue", element.getDefaultValue());
55406      }
55407      if (element.hasElementElement()) {
55408        composeStringCore("element", element.getElementElement(), false);
55409        composeStringExtras("element", element.getElementElement(), false);
55410      }
55411      if (element.hasListModeElement()) {
55412        composeEnumerationCore("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
55413        composeEnumerationExtras("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
55414      }
55415      if (element.hasVariableElement()) {
55416        composeIdCore("variable", element.getVariableElement(), false);
55417        composeIdExtras("variable", element.getVariableElement(), false);
55418      }
55419      if (element.hasConditionElement()) {
55420        composeStringCore("condition", element.getConditionElement(), false);
55421        composeStringExtras("condition", element.getConditionElement(), false);
55422      }
55423      if (element.hasCheckElement()) {
55424        composeStringCore("check", element.getCheckElement(), false);
55425        composeStringExtras("check", element.getCheckElement(), false);
55426      }
55427      if (element.hasLogMessageElement()) {
55428        composeStringCore("logMessage", element.getLogMessageElement(), false);
55429        composeStringExtras("logMessage", element.getLogMessageElement(), false);
55430      }
55431  }
55432
55433  protected void composeStructureMapStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
55434    if (element != null) {
55435      open(name);
55436      composeStructureMapStructureMapGroupRuleTargetComponentInner(element);
55437      close();
55438    }
55439  }
55440
55441  protected void composeStructureMapStructureMapGroupRuleTargetComponentInner(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
55442      composeBackbone(element);
55443      if (element.hasContextElement()) {
55444        composeIdCore("context", element.getContextElement(), false);
55445        composeIdExtras("context", element.getContextElement(), false);
55446      }
55447      if (element.hasContextTypeElement()) {
55448        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
55449        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
55450      }
55451      if (element.hasElementElement()) {
55452        composeStringCore("element", element.getElementElement(), false);
55453        composeStringExtras("element", element.getElementElement(), false);
55454      }
55455      if (element.hasVariableElement()) {
55456        composeIdCore("variable", element.getVariableElement(), false);
55457        composeIdExtras("variable", element.getVariableElement(), false);
55458      }
55459      if (element.hasListMode()) {
55460        openArray("listMode");
55461        for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
55462          composeEnumerationCore(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
55463        closeArray();
55464        if (anyHasExtras(element.getListMode())) {
55465          openArray("_listMode");
55466          for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
55467            composeEnumerationExtras(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
55468          closeArray();
55469        }
55470      };
55471      if (element.hasListRuleIdElement()) {
55472        composeIdCore("listRuleId", element.getListRuleIdElement(), false);
55473        composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
55474      }
55475      if (element.hasTransformElement()) {
55476        composeEnumerationCore("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
55477        composeEnumerationExtras("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
55478      }
55479      if (element.hasParameter()) {
55480        openArray("parameter");
55481        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
55482          composeStructureMapStructureMapGroupRuleTargetParameterComponent(null, e);
55483        closeArray();
55484      };
55485  }
55486
55487  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
55488    if (element != null) {
55489      open(name);
55490      composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(element);
55491      close();
55492    }
55493  }
55494
55495  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
55496      composeBackbone(element);
55497      if (element.hasValue()) {
55498        composeType("value", element.getValue());
55499      }
55500  }
55501
55502  protected void composeStructureMapStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
55503    if (element != null) {
55504      open(name);
55505      composeStructureMapStructureMapGroupRuleDependentComponentInner(element);
55506      close();
55507    }
55508  }
55509
55510  protected void composeStructureMapStructureMapGroupRuleDependentComponentInner(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
55511      composeBackbone(element);
55512      if (element.hasNameElement()) {
55513        composeIdCore("name", element.getNameElement(), false);
55514        composeIdExtras("name", element.getNameElement(), false);
55515      }
55516      if (element.hasVariable()) {
55517        openArray("variable");
55518        for (StringType e : element.getVariable()) 
55519          composeStringCore(null, e, true);
55520        closeArray();
55521        if (anyHasExtras(element.getVariable())) {
55522          openArray("_variable");
55523          for (StringType e : element.getVariable()) 
55524            composeStringExtras(null, e, true);
55525          closeArray();
55526        }
55527      };
55528  }
55529
55530  protected void composeSubscription(String name, Subscription element) throws IOException {
55531    if (element != null) {
55532      prop("resourceType", name);
55533      composeSubscriptionInner(element);
55534    }
55535  }
55536
55537  protected void composeSubscriptionInner(Subscription element) throws IOException {
55538      composeDomainResourceElements(element);
55539      if (element.hasIdentifier()) {
55540        openArray("identifier");
55541        for (Identifier e : element.getIdentifier()) 
55542          composeIdentifier(null, e);
55543        closeArray();
55544      };
55545      if (element.hasNameElement()) {
55546        composeStringCore("name", element.getNameElement(), false);
55547        composeStringExtras("name", element.getNameElement(), false);
55548      }
55549      if (element.hasStatusElement()) {
55550        composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
55551        composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
55552      }
55553      if (element.hasTopic()) {
55554        composeReference("topic", element.getTopic());
55555      }
55556      if (element.hasContact()) {
55557        openArray("contact");
55558        for (ContactPoint e : element.getContact()) 
55559          composeContactPoint(null, e);
55560        closeArray();
55561      };
55562      if (element.hasEndElement()) {
55563        composeInstantCore("end", element.getEndElement(), false);
55564        composeInstantExtras("end", element.getEndElement(), false);
55565      }
55566      if (element.hasReasonElement()) {
55567        composeStringCore("reason", element.getReasonElement(), false);
55568        composeStringExtras("reason", element.getReasonElement(), false);
55569      }
55570      if (element.hasFilterBy()) {
55571        openArray("filterBy");
55572        for (Subscription.SubscriptionFilterByComponent e : element.getFilterBy()) 
55573          composeSubscriptionSubscriptionFilterByComponent(null, e);
55574        closeArray();
55575      };
55576      if (element.hasError()) {
55577        openArray("error");
55578        for (CodeableConcept e : element.getError()) 
55579          composeCodeableConcept(null, e);
55580        closeArray();
55581      };
55582      if (element.hasEventCountElement()) {
55583        composeUnsignedIntCore("eventCount", element.getEventCountElement(), false);
55584        composeUnsignedIntExtras("eventCount", element.getEventCountElement(), false);
55585      }
55586      if (element.hasChannel()) {
55587        composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
55588      }
55589  }
55590
55591  protected void composeSubscriptionSubscriptionFilterByComponent(String name, Subscription.SubscriptionFilterByComponent element) throws IOException {
55592    if (element != null) {
55593      open(name);
55594      composeSubscriptionSubscriptionFilterByComponentInner(element);
55595      close();
55596    }
55597  }
55598
55599  protected void composeSubscriptionSubscriptionFilterByComponentInner(Subscription.SubscriptionFilterByComponent element) throws IOException {
55600      composeBackbone(element);
55601      if (element.hasNameElement()) {
55602        composeStringCore("name", element.getNameElement(), false);
55603        composeStringExtras("name", element.getNameElement(), false);
55604      }
55605      if (element.hasMatchTypeElement()) {
55606        composeEnumerationCore("matchType", element.getMatchTypeElement(), new Subscription.SubscriptionFilterByMatchTypeEnumFactory(), false);
55607        composeEnumerationExtras("matchType", element.getMatchTypeElement(), new Subscription.SubscriptionFilterByMatchTypeEnumFactory(), false);
55608      }
55609      if (element.hasValueElement()) {
55610        composeStringCore("value", element.getValueElement(), false);
55611        composeStringExtras("value", element.getValueElement(), false);
55612      }
55613  }
55614
55615  protected void composeSubscriptionSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
55616    if (element != null) {
55617      open(name);
55618      composeSubscriptionSubscriptionChannelComponentInner(element);
55619      close();
55620    }
55621  }
55622
55623  protected void composeSubscriptionSubscriptionChannelComponentInner(Subscription.SubscriptionChannelComponent element) throws IOException {
55624      composeBackbone(element);
55625      if (element.hasType()) {
55626        composeCodeableConcept("type", element.getType());
55627      }
55628      if (element.hasEndpointElement()) {
55629        composeUrlCore("endpoint", element.getEndpointElement(), false);
55630        composeUrlExtras("endpoint", element.getEndpointElement(), false);
55631      }
55632      if (element.hasHeader()) {
55633        openArray("header");
55634        for (StringType e : element.getHeader()) 
55635          composeStringCore(null, e, true);
55636        closeArray();
55637        if (anyHasExtras(element.getHeader())) {
55638          openArray("_header");
55639          for (StringType e : element.getHeader()) 
55640            composeStringExtras(null, e, true);
55641          closeArray();
55642        }
55643      };
55644      if (element.hasHeartbeatPeriodElement()) {
55645        composeUnsignedIntCore("heartbeatPeriod", element.getHeartbeatPeriodElement(), false);
55646        composeUnsignedIntExtras("heartbeatPeriod", element.getHeartbeatPeriodElement(), false);
55647      }
55648      if (element.hasPayload()) {
55649        composeSubscriptionSubscriptionChannelPayloadComponent("payload", element.getPayload());
55650      }
55651  }
55652
55653  protected void composeSubscriptionSubscriptionChannelPayloadComponent(String name, Subscription.SubscriptionChannelPayloadComponent element) throws IOException {
55654    if (element != null) {
55655      open(name);
55656      composeSubscriptionSubscriptionChannelPayloadComponentInner(element);
55657      close();
55658    }
55659  }
55660
55661  protected void composeSubscriptionSubscriptionChannelPayloadComponentInner(Subscription.SubscriptionChannelPayloadComponent element) throws IOException {
55662      composeBackbone(element);
55663      if (element.hasContentTypeElement()) {
55664        composeCodeCore("contentType", element.getContentTypeElement(), false);
55665        composeCodeExtras("contentType", element.getContentTypeElement(), false);
55666      }
55667      if (element.hasContentElement()) {
55668        composeEnumerationCore("content", element.getContentElement(), new Subscription.SubscriptionPayloadContentEnumFactory(), false);
55669        composeEnumerationExtras("content", element.getContentElement(), new Subscription.SubscriptionPayloadContentEnumFactory(), false);
55670      }
55671  }
55672
55673  protected void composeSubstance(String name, Substance element) throws IOException {
55674    if (element != null) {
55675      prop("resourceType", name);
55676      composeSubstanceInner(element);
55677    }
55678  }
55679
55680  protected void composeSubstanceInner(Substance element) throws IOException {
55681      composeDomainResourceElements(element);
55682      if (element.hasIdentifier()) {
55683        openArray("identifier");
55684        for (Identifier e : element.getIdentifier()) 
55685          composeIdentifier(null, e);
55686        closeArray();
55687      };
55688      if (element.hasStatusElement()) {
55689        composeEnumerationCore("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
55690        composeEnumerationExtras("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
55691      }
55692      if (element.hasCategory()) {
55693        openArray("category");
55694        for (CodeableConcept e : element.getCategory()) 
55695          composeCodeableConcept(null, e);
55696        closeArray();
55697      };
55698      if (element.hasCode()) {
55699        composeCodeableConcept("code", element.getCode());
55700      }
55701      if (element.hasDescriptionElement()) {
55702        composeStringCore("description", element.getDescriptionElement(), false);
55703        composeStringExtras("description", element.getDescriptionElement(), false);
55704      }
55705      if (element.hasInstance()) {
55706        openArray("instance");
55707        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
55708          composeSubstanceSubstanceInstanceComponent(null, e);
55709        closeArray();
55710      };
55711      if (element.hasIngredient()) {
55712        openArray("ingredient");
55713        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
55714          composeSubstanceSubstanceIngredientComponent(null, e);
55715        closeArray();
55716      };
55717  }
55718
55719  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
55720    if (element != null) {
55721      open(name);
55722      composeSubstanceSubstanceInstanceComponentInner(element);
55723      close();
55724    }
55725  }
55726
55727  protected void composeSubstanceSubstanceInstanceComponentInner(Substance.SubstanceInstanceComponent element) throws IOException {
55728      composeBackbone(element);
55729      if (element.hasIdentifier()) {
55730        composeIdentifier("identifier", element.getIdentifier());
55731      }
55732      if (element.hasExpiryElement()) {
55733        composeDateTimeCore("expiry", element.getExpiryElement(), false);
55734        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
55735      }
55736      if (element.hasQuantity()) {
55737        composeQuantity("quantity", element.getQuantity());
55738      }
55739  }
55740
55741  protected void composeSubstanceSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
55742    if (element != null) {
55743      open(name);
55744      composeSubstanceSubstanceIngredientComponentInner(element);
55745      close();
55746    }
55747  }
55748
55749  protected void composeSubstanceSubstanceIngredientComponentInner(Substance.SubstanceIngredientComponent element) throws IOException {
55750      composeBackbone(element);
55751      if (element.hasQuantity()) {
55752        composeRatio("quantity", element.getQuantity());
55753      }
55754      if (element.hasSubstance()) {
55755        composeType("substance", element.getSubstance());
55756      }
55757  }
55758
55759  protected void composeSubstanceDefinition(String name, SubstanceDefinition element) throws IOException {
55760    if (element != null) {
55761      prop("resourceType", name);
55762      composeSubstanceDefinitionInner(element);
55763    }
55764  }
55765
55766  protected void composeSubstanceDefinitionInner(SubstanceDefinition element) throws IOException {
55767      composeDomainResourceElements(element);
55768      if (element.hasIdentifier()) {
55769        composeIdentifier("identifier", element.getIdentifier());
55770      }
55771      if (element.hasStatus()) {
55772        composeCodeableConcept("status", element.getStatus());
55773      }
55774      if (element.hasCategory()) {
55775        composeCodeableConcept("category", element.getCategory());
55776      }
55777      if (element.hasDomain()) {
55778        composeCodeableConcept("domain", element.getDomain());
55779      }
55780      if (element.hasDescriptionElement()) {
55781        composeStringCore("description", element.getDescriptionElement(), false);
55782        composeStringExtras("description", element.getDescriptionElement(), false);
55783      }
55784      if (element.hasSource()) {
55785        openArray("source");
55786        for (Reference e : element.getSource()) 
55787          composeReference(null, e);
55788        closeArray();
55789      };
55790      if (element.hasNote()) {
55791        openArray("note");
55792        for (Annotation e : element.getNote()) 
55793          composeAnnotation(null, e);
55794        closeArray();
55795      };
55796      if (element.hasMoiety()) {
55797        openArray("moiety");
55798        for (SubstanceDefinition.SubstanceDefinitionMoietyComponent e : element.getMoiety()) 
55799          composeSubstanceDefinitionSubstanceDefinitionMoietyComponent(null, e);
55800        closeArray();
55801      };
55802      if (element.hasProperty()) {
55803        openArray("property");
55804        for (SubstanceDefinition.SubstanceDefinitionPropertyComponent e : element.getProperty()) 
55805          composeSubstanceDefinitionSubstanceDefinitionPropertyComponent(null, e);
55806        closeArray();
55807      };
55808      if (element.hasReferenceInformation()) {
55809        composeReference("referenceInformation", element.getReferenceInformation());
55810      }
55811      if (element.hasStructure()) {
55812        composeSubstanceDefinitionSubstanceDefinitionStructureComponent("structure", element.getStructure());
55813      }
55814      if (element.hasCode()) {
55815        openArray("code");
55816        for (SubstanceDefinition.SubstanceDefinitionCodeComponent e : element.getCode()) 
55817          composeSubstanceDefinitionSubstanceDefinitionCodeComponent(null, e);
55818        closeArray();
55819      };
55820      if (element.hasName()) {
55821        openArray("name");
55822        for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getName()) 
55823          composeSubstanceDefinitionSubstanceDefinitionNameComponent(null, e);
55824        closeArray();
55825      };
55826      if (element.hasMolecularWeight()) {
55827        openArray("molecularWeight");
55828        for (SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent e : element.getMolecularWeight()) 
55829          composeSubstanceDefinitionSubstanceDefinitionStructureIsotopeMolecularWeightComponent(null, e);
55830        closeArray();
55831      };
55832      if (element.hasRelationship()) {
55833        openArray("relationship");
55834        for (SubstanceDefinition.SubstanceDefinitionRelationshipComponent e : element.getRelationship()) 
55835          composeSubstanceDefinitionSubstanceDefinitionRelationshipComponent(null, e);
55836        closeArray();
55837      };
55838      if (element.hasNucleicAcid()) {
55839        composeReference("nucleicAcid", element.getNucleicAcid());
55840      }
55841      if (element.hasPolymer()) {
55842        composeReference("polymer", element.getPolymer());
55843      }
55844      if (element.hasProtein()) {
55845        composeReference("protein", element.getProtein());
55846      }
55847      if (element.hasSourceMaterial()) {
55848        composeReference("sourceMaterial", element.getSourceMaterial());
55849      }
55850  }
55851
55852  protected void composeSubstanceDefinitionSubstanceDefinitionMoietyComponent(String name, SubstanceDefinition.SubstanceDefinitionMoietyComponent element) throws IOException {
55853    if (element != null) {
55854      open(name);
55855      composeSubstanceDefinitionSubstanceDefinitionMoietyComponentInner(element);
55856      close();
55857    }
55858  }
55859
55860  protected void composeSubstanceDefinitionSubstanceDefinitionMoietyComponentInner(SubstanceDefinition.SubstanceDefinitionMoietyComponent element) throws IOException {
55861      composeBackbone(element);
55862      if (element.hasRole()) {
55863        composeCodeableConcept("role", element.getRole());
55864      }
55865      if (element.hasIdentifier()) {
55866        composeIdentifier("identifier", element.getIdentifier());
55867      }
55868      if (element.hasNameElement()) {
55869        composeStringCore("name", element.getNameElement(), false);
55870        composeStringExtras("name", element.getNameElement(), false);
55871      }
55872      if (element.hasStereochemistry()) {
55873        composeCodeableConcept("stereochemistry", element.getStereochemistry());
55874      }
55875      if (element.hasOpticalActivity()) {
55876        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
55877      }
55878      if (element.hasMolecularFormulaElement()) {
55879        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
55880        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
55881      }
55882      if (element.hasAmount()) {
55883        composeType("amount", element.getAmount());
55884      }
55885      if (element.hasAmountType()) {
55886        composeCodeableConcept("amountType", element.getAmountType());
55887      }
55888  }
55889
55890  protected void composeSubstanceDefinitionSubstanceDefinitionPropertyComponent(String name, SubstanceDefinition.SubstanceDefinitionPropertyComponent element) throws IOException {
55891    if (element != null) {
55892      open(name);
55893      composeSubstanceDefinitionSubstanceDefinitionPropertyComponentInner(element);
55894      close();
55895    }
55896  }
55897
55898  protected void composeSubstanceDefinitionSubstanceDefinitionPropertyComponentInner(SubstanceDefinition.SubstanceDefinitionPropertyComponent element) throws IOException {
55899      composeBackbone(element);
55900      if (element.hasCategory()) {
55901        composeCodeableConcept("category", element.getCategory());
55902      }
55903      if (element.hasCode()) {
55904        composeCodeableConcept("code", element.getCode());
55905      }
55906      if (element.hasParametersElement()) {
55907        composeStringCore("parameters", element.getParametersElement(), false);
55908        composeStringExtras("parameters", element.getParametersElement(), false);
55909      }
55910      if (element.hasDefiningSubstance()) {
55911        composeType("definingSubstance", element.getDefiningSubstance());
55912      }
55913      if (element.hasAmount()) {
55914        composeType("amount", element.getAmount());
55915      }
55916      if (element.hasReferenceRange()) {
55917        composeRange("referenceRange", element.getReferenceRange());
55918      }
55919      if (element.hasSource()) {
55920        openArray("source");
55921        for (Reference e : element.getSource()) 
55922          composeReference(null, e);
55923        closeArray();
55924      };
55925  }
55926
55927  protected void composeSubstanceDefinitionSubstanceDefinitionStructureComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureComponent element) throws IOException {
55928    if (element != null) {
55929      open(name);
55930      composeSubstanceDefinitionSubstanceDefinitionStructureComponentInner(element);
55931      close();
55932    }
55933  }
55934
55935  protected void composeSubstanceDefinitionSubstanceDefinitionStructureComponentInner(SubstanceDefinition.SubstanceDefinitionStructureComponent element) throws IOException {
55936      composeBackbone(element);
55937      if (element.hasStereochemistry()) {
55938        composeCodeableConcept("stereochemistry", element.getStereochemistry());
55939      }
55940      if (element.hasOpticalActivity()) {
55941        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
55942      }
55943      if (element.hasMolecularFormulaElement()) {
55944        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
55945        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
55946      }
55947      if (element.hasMolecularFormulaByMoietyElement()) {
55948        composeStringCore("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
55949        composeStringExtras("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
55950      }
55951      if (element.hasIsotope()) {
55952        openArray("isotope");
55953        for (SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent e : element.getIsotope()) 
55954          composeSubstanceDefinitionSubstanceDefinitionStructureIsotopeComponent(null, e);
55955        closeArray();
55956      };
55957      if (element.hasMolecularWeight()) {
55958        composeSubstanceDefinitionSubstanceDefinitionStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
55959      }
55960      if (element.hasSource()) {
55961        openArray("source");
55962        for (Reference e : element.getSource()) 
55963          composeReference(null, e);
55964        closeArray();
55965      };
55966      if (element.hasRepresentation()) {
55967        openArray("representation");
55968        for (SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent e : element.getRepresentation()) 
55969          composeSubstanceDefinitionSubstanceDefinitionStructureRepresentationComponent(null, e);
55970        closeArray();
55971      };
55972  }
55973
55974  protected void composeSubstanceDefinitionSubstanceDefinitionStructureIsotopeComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent element) throws IOException {
55975    if (element != null) {
55976      open(name);
55977      composeSubstanceDefinitionSubstanceDefinitionStructureIsotopeComponentInner(element);
55978      close();
55979    }
55980  }
55981
55982  protected void composeSubstanceDefinitionSubstanceDefinitionStructureIsotopeComponentInner(SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent element) throws IOException {
55983      composeBackbone(element);
55984      if (element.hasIdentifier()) {
55985        composeIdentifier("identifier", element.getIdentifier());
55986      }
55987      if (element.hasName()) {
55988        composeCodeableConcept("name", element.getName());
55989      }
55990      if (element.hasSubstitution()) {
55991        composeCodeableConcept("substitution", element.getSubstitution());
55992      }
55993      if (element.hasHalfLife()) {
55994        composeQuantity("halfLife", element.getHalfLife());
55995      }
55996      if (element.hasMolecularWeight()) {
55997        composeSubstanceDefinitionSubstanceDefinitionStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
55998      }
55999  }
56000
56001  protected void composeSubstanceDefinitionSubstanceDefinitionStructureIsotopeMolecularWeightComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent element) throws IOException {
56002    if (element != null) {
56003      open(name);
56004      composeSubstanceDefinitionSubstanceDefinitionStructureIsotopeMolecularWeightComponentInner(element);
56005      close();
56006    }
56007  }
56008
56009  protected void composeSubstanceDefinitionSubstanceDefinitionStructureIsotopeMolecularWeightComponentInner(SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent element) throws IOException {
56010      composeBackbone(element);
56011      if (element.hasMethod()) {
56012        composeCodeableConcept("method", element.getMethod());
56013      }
56014      if (element.hasType()) {
56015        composeCodeableConcept("type", element.getType());
56016      }
56017      if (element.hasAmount()) {
56018        composeQuantity("amount", element.getAmount());
56019      }
56020  }
56021
56022  protected void composeSubstanceDefinitionSubstanceDefinitionStructureRepresentationComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent element) throws IOException {
56023    if (element != null) {
56024      open(name);
56025      composeSubstanceDefinitionSubstanceDefinitionStructureRepresentationComponentInner(element);
56026      close();
56027    }
56028  }
56029
56030  protected void composeSubstanceDefinitionSubstanceDefinitionStructureRepresentationComponentInner(SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent element) throws IOException {
56031      composeBackbone(element);
56032      if (element.hasType()) {
56033        composeCodeableConcept("type", element.getType());
56034      }
56035      if (element.hasRepresentationElement()) {
56036        composeStringCore("representation", element.getRepresentationElement(), false);
56037        composeStringExtras("representation", element.getRepresentationElement(), false);
56038      }
56039      if (element.hasAttachment()) {
56040        composeAttachment("attachment", element.getAttachment());
56041      }
56042  }
56043
56044  protected void composeSubstanceDefinitionSubstanceDefinitionCodeComponent(String name, SubstanceDefinition.SubstanceDefinitionCodeComponent element) throws IOException {
56045    if (element != null) {
56046      open(name);
56047      composeSubstanceDefinitionSubstanceDefinitionCodeComponentInner(element);
56048      close();
56049    }
56050  }
56051
56052  protected void composeSubstanceDefinitionSubstanceDefinitionCodeComponentInner(SubstanceDefinition.SubstanceDefinitionCodeComponent element) throws IOException {
56053      composeBackbone(element);
56054      if (element.hasCode()) {
56055        composeCodeableConcept("code", element.getCode());
56056      }
56057      if (element.hasStatus()) {
56058        composeCodeableConcept("status", element.getStatus());
56059      }
56060      if (element.hasStatusDateElement()) {
56061        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
56062        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
56063      }
56064      if (element.hasNote()) {
56065        openArray("note");
56066        for (Annotation e : element.getNote()) 
56067          composeAnnotation(null, e);
56068        closeArray();
56069      };
56070      if (element.hasSource()) {
56071        openArray("source");
56072        for (Reference e : element.getSource()) 
56073          composeReference(null, e);
56074        closeArray();
56075      };
56076  }
56077
56078  protected void composeSubstanceDefinitionSubstanceDefinitionNameComponent(String name, SubstanceDefinition.SubstanceDefinitionNameComponent element) throws IOException {
56079    if (element != null) {
56080      open(name);
56081      composeSubstanceDefinitionSubstanceDefinitionNameComponentInner(element);
56082      close();
56083    }
56084  }
56085
56086  protected void composeSubstanceDefinitionSubstanceDefinitionNameComponentInner(SubstanceDefinition.SubstanceDefinitionNameComponent element) throws IOException {
56087      composeBackbone(element);
56088      if (element.hasNameElement()) {
56089        composeStringCore("name", element.getNameElement(), false);
56090        composeStringExtras("name", element.getNameElement(), false);
56091      }
56092      if (element.hasType()) {
56093        composeCodeableConcept("type", element.getType());
56094      }
56095      if (element.hasStatus()) {
56096        composeCodeableConcept("status", element.getStatus());
56097      }
56098      if (element.hasPreferredElement()) {
56099        composeBooleanCore("preferred", element.getPreferredElement(), false);
56100        composeBooleanExtras("preferred", element.getPreferredElement(), false);
56101      }
56102      if (element.hasLanguage()) {
56103        openArray("language");
56104        for (CodeableConcept e : element.getLanguage()) 
56105          composeCodeableConcept(null, e);
56106        closeArray();
56107      };
56108      if (element.hasDomain()) {
56109        openArray("domain");
56110        for (CodeableConcept e : element.getDomain()) 
56111          composeCodeableConcept(null, e);
56112        closeArray();
56113      };
56114      if (element.hasJurisdiction()) {
56115        openArray("jurisdiction");
56116        for (CodeableConcept e : element.getJurisdiction()) 
56117          composeCodeableConcept(null, e);
56118          closeArray();
56119      };
56120      if (element.hasSynonym()) {
56121        openArray("synonym");
56122        for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getSynonym()) 
56123          composeSubstanceDefinitionSubstanceDefinitionNameComponent(null, e);
56124        closeArray();
56125      };
56126      if (element.hasTranslation()) {
56127        openArray("translation");
56128        for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getTranslation()) 
56129          composeSubstanceDefinitionSubstanceDefinitionNameComponent(null, e);
56130        closeArray();
56131      };
56132      if (element.hasOfficial()) {
56133        openArray("official");
56134        for (SubstanceDefinition.SubstanceDefinitionNameOfficialComponent e : element.getOfficial()) 
56135          composeSubstanceDefinitionSubstanceDefinitionNameOfficialComponent(null, e);
56136        closeArray();
56137      };
56138      if (element.hasSource()) {
56139        openArray("source");
56140        for (Reference e : element.getSource()) 
56141          composeReference(null, e);
56142        closeArray();
56143      };
56144  }
56145
56146  protected void composeSubstanceDefinitionSubstanceDefinitionNameOfficialComponent(String name, SubstanceDefinition.SubstanceDefinitionNameOfficialComponent element) throws IOException {
56147    if (element != null) {
56148      open(name);
56149      composeSubstanceDefinitionSubstanceDefinitionNameOfficialComponentInner(element);
56150      close();
56151    }
56152  }
56153
56154  protected void composeSubstanceDefinitionSubstanceDefinitionNameOfficialComponentInner(SubstanceDefinition.SubstanceDefinitionNameOfficialComponent element) throws IOException {
56155      composeBackbone(element);
56156      if (element.hasAuthority()) {
56157        composeCodeableConcept("authority", element.getAuthority());
56158      }
56159      if (element.hasStatus()) {
56160        composeCodeableConcept("status", element.getStatus());
56161      }
56162      if (element.hasDateElement()) {
56163        composeDateTimeCore("date", element.getDateElement(), false);
56164        composeDateTimeExtras("date", element.getDateElement(), false);
56165      }
56166  }
56167
56168  protected void composeSubstanceDefinitionSubstanceDefinitionRelationshipComponent(String name, SubstanceDefinition.SubstanceDefinitionRelationshipComponent element) throws IOException {
56169    if (element != null) {
56170      open(name);
56171      composeSubstanceDefinitionSubstanceDefinitionRelationshipComponentInner(element);
56172      close();
56173    }
56174  }
56175
56176  protected void composeSubstanceDefinitionSubstanceDefinitionRelationshipComponentInner(SubstanceDefinition.SubstanceDefinitionRelationshipComponent element) throws IOException {
56177      composeBackbone(element);
56178      if (element.hasSubstanceDefinition()) {
56179        composeType("substanceDefinition", element.getSubstanceDefinition());
56180      }
56181      if (element.hasRelationship()) {
56182        composeCodeableConcept("relationship", element.getRelationship());
56183      }
56184      if (element.hasIsDefiningElement()) {
56185        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
56186        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
56187      }
56188      if (element.hasAmount()) {
56189        composeType("amount", element.getAmount());
56190      }
56191      if (element.hasAmountRatioLowLimit()) {
56192        composeRatio("amountRatioLowLimit", element.getAmountRatioLowLimit());
56193      }
56194      if (element.hasAmountType()) {
56195        composeCodeableConcept("amountType", element.getAmountType());
56196      }
56197      if (element.hasSource()) {
56198        openArray("source");
56199        for (Reference e : element.getSource()) 
56200          composeReference(null, e);
56201        closeArray();
56202      };
56203  }
56204
56205  protected void composeSubstanceNucleicAcid(String name, SubstanceNucleicAcid element) throws IOException {
56206    if (element != null) {
56207      prop("resourceType", name);
56208      composeSubstanceNucleicAcidInner(element);
56209    }
56210  }
56211
56212  protected void composeSubstanceNucleicAcidInner(SubstanceNucleicAcid element) throws IOException {
56213      composeDomainResourceElements(element);
56214      if (element.hasSequenceType()) {
56215        composeCodeableConcept("sequenceType", element.getSequenceType());
56216      }
56217      if (element.hasNumberOfSubunitsElement()) {
56218        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
56219        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
56220      }
56221      if (element.hasAreaOfHybridisationElement()) {
56222        composeStringCore("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
56223        composeStringExtras("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
56224      }
56225      if (element.hasOligoNucleotideType()) {
56226        composeCodeableConcept("oligoNucleotideType", element.getOligoNucleotideType());
56227      }
56228      if (element.hasSubunit()) {
56229        openArray("subunit");
56230        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent e : element.getSubunit()) 
56231          composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(null, e);
56232        closeArray();
56233      };
56234  }
56235
56236  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
56237    if (element != null) {
56238      open(name);
56239      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentInner(element);
56240      close();
56241    }
56242  }
56243
56244  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentInner(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
56245      composeBackbone(element);
56246      if (element.hasSubunitElement()) {
56247        composeIntegerCore("subunit", element.getSubunitElement(), false);
56248        composeIntegerExtras("subunit", element.getSubunitElement(), false);
56249      }
56250      if (element.hasSequenceElement()) {
56251        composeStringCore("sequence", element.getSequenceElement(), false);
56252        composeStringExtras("sequence", element.getSequenceElement(), false);
56253      }
56254      if (element.hasLengthElement()) {
56255        composeIntegerCore("length", element.getLengthElement(), false);
56256        composeIntegerExtras("length", element.getLengthElement(), false);
56257      }
56258      if (element.hasSequenceAttachment()) {
56259        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
56260      }
56261      if (element.hasFivePrime()) {
56262        composeCodeableConcept("fivePrime", element.getFivePrime());
56263      }
56264      if (element.hasThreePrime()) {
56265        composeCodeableConcept("threePrime", element.getThreePrime());
56266      }
56267      if (element.hasLinkage()) {
56268        openArray("linkage");
56269        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent e : element.getLinkage()) 
56270          composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(null, e);
56271        closeArray();
56272      };
56273      if (element.hasSugar()) {
56274        openArray("sugar");
56275        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent e : element.getSugar()) 
56276          composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(null, e);
56277        closeArray();
56278      };
56279  }
56280
56281  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
56282    if (element != null) {
56283      open(name);
56284      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentInner(element);
56285      close();
56286    }
56287  }
56288
56289  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentInner(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
56290      composeBackbone(element);
56291      if (element.hasConnectivityElement()) {
56292        composeStringCore("connectivity", element.getConnectivityElement(), false);
56293        composeStringExtras("connectivity", element.getConnectivityElement(), false);
56294      }
56295      if (element.hasIdentifier()) {
56296        composeIdentifier("identifier", element.getIdentifier());
56297      }
56298      if (element.hasNameElement()) {
56299        composeStringCore("name", element.getNameElement(), false);
56300        composeStringExtras("name", element.getNameElement(), false);
56301      }
56302      if (element.hasResidueSiteElement()) {
56303        composeStringCore("residueSite", element.getResidueSiteElement(), false);
56304        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
56305      }
56306  }
56307
56308  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
56309    if (element != null) {
56310      open(name);
56311      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentInner(element);
56312      close();
56313    }
56314  }
56315
56316  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentInner(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
56317      composeBackbone(element);
56318      if (element.hasIdentifier()) {
56319        composeIdentifier("identifier", element.getIdentifier());
56320      }
56321      if (element.hasNameElement()) {
56322        composeStringCore("name", element.getNameElement(), false);
56323        composeStringExtras("name", element.getNameElement(), false);
56324      }
56325      if (element.hasResidueSiteElement()) {
56326        composeStringCore("residueSite", element.getResidueSiteElement(), false);
56327        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
56328      }
56329  }
56330
56331  protected void composeSubstancePolymer(String name, SubstancePolymer element) throws IOException {
56332    if (element != null) {
56333      prop("resourceType", name);
56334      composeSubstancePolymerInner(element);
56335    }
56336  }
56337
56338  protected void composeSubstancePolymerInner(SubstancePolymer element) throws IOException {
56339      composeDomainResourceElements(element);
56340      if (element.hasClass_()) {
56341        composeCodeableConcept("class", element.getClass_());
56342      }
56343      if (element.hasGeometry()) {
56344        composeCodeableConcept("geometry", element.getGeometry());
56345      }
56346      if (element.hasCopolymerConnectivity()) {
56347        openArray("copolymerConnectivity");
56348        for (CodeableConcept e : element.getCopolymerConnectivity()) 
56349          composeCodeableConcept(null, e);
56350        closeArray();
56351      };
56352      if (element.hasModification()) {
56353        openArray("modification");
56354        for (StringType e : element.getModification()) 
56355          composeStringCore(null, e, true);
56356        closeArray();
56357        if (anyHasExtras(element.getModification())) {
56358          openArray("_modification");
56359          for (StringType e : element.getModification()) 
56360            composeStringExtras(null, e, true);
56361          closeArray();
56362        }
56363      };
56364      if (element.hasMonomerSet()) {
56365        openArray("monomerSet");
56366        for (SubstancePolymer.SubstancePolymerMonomerSetComponent e : element.getMonomerSet()) 
56367          composeSubstancePolymerSubstancePolymerMonomerSetComponent(null, e);
56368        closeArray();
56369      };
56370      if (element.hasRepeat()) {
56371        openArray("repeat");
56372        for (SubstancePolymer.SubstancePolymerRepeatComponent e : element.getRepeat()) 
56373          composeSubstancePolymerSubstancePolymerRepeatComponent(null, e);
56374        closeArray();
56375      };
56376  }
56377
56378  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
56379    if (element != null) {
56380      open(name);
56381      composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(element);
56382      close();
56383    }
56384  }
56385
56386  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
56387      composeBackbone(element);
56388      if (element.hasRatioType()) {
56389        composeCodeableConcept("ratioType", element.getRatioType());
56390      }
56391      if (element.hasStartingMaterial()) {
56392        openArray("startingMaterial");
56393        for (SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent e : element.getStartingMaterial()) 
56394          composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(null, e);
56395        closeArray();
56396      };
56397  }
56398
56399  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
56400    if (element != null) {
56401      open(name);
56402      composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(element);
56403      close();
56404    }
56405  }
56406
56407  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
56408      composeBackbone(element);
56409      if (element.hasMaterial()) {
56410        composeCodeableConcept("material", element.getMaterial());
56411      }
56412      if (element.hasType()) {
56413        composeCodeableConcept("type", element.getType());
56414      }
56415      if (element.hasIsDefiningElement()) {
56416        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
56417        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
56418      }
56419      if (element.hasAmount()) {
56420        composeSubstanceAmount("amount", element.getAmount());
56421      }
56422  }
56423
56424  protected void composeSubstancePolymerSubstancePolymerRepeatComponent(String name, SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
56425    if (element != null) {
56426      open(name);
56427      composeSubstancePolymerSubstancePolymerRepeatComponentInner(element);
56428      close();
56429    }
56430  }
56431
56432  protected void composeSubstancePolymerSubstancePolymerRepeatComponentInner(SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
56433      composeBackbone(element);
56434      if (element.hasNumberOfUnitsElement()) {
56435        composeIntegerCore("numberOfUnits", element.getNumberOfUnitsElement(), false);
56436        composeIntegerExtras("numberOfUnits", element.getNumberOfUnitsElement(), false);
56437      }
56438      if (element.hasAverageMolecularFormulaElement()) {
56439        composeStringCore("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
56440        composeStringExtras("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
56441      }
56442      if (element.hasRepeatUnitAmountType()) {
56443        composeCodeableConcept("repeatUnitAmountType", element.getRepeatUnitAmountType());
56444      }
56445      if (element.hasRepeatUnit()) {
56446        openArray("repeatUnit");
56447        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent e : element.getRepeatUnit()) 
56448          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(null, e);
56449        closeArray();
56450      };
56451  }
56452
56453  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
56454    if (element != null) {
56455      open(name);
56456      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(element);
56457      close();
56458    }
56459  }
56460
56461  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
56462      composeBackbone(element);
56463      if (element.hasOrientationOfPolymerisation()) {
56464        composeCodeableConcept("orientationOfPolymerisation", element.getOrientationOfPolymerisation());
56465      }
56466      if (element.hasRepeatUnitElement()) {
56467        composeStringCore("repeatUnit", element.getRepeatUnitElement(), false);
56468        composeStringExtras("repeatUnit", element.getRepeatUnitElement(), false);
56469      }
56470      if (element.hasAmount()) {
56471        composeSubstanceAmount("amount", element.getAmount());
56472      }
56473      if (element.hasDegreeOfPolymerisation()) {
56474        openArray("degreeOfPolymerisation");
56475        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent e : element.getDegreeOfPolymerisation()) 
56476          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(null, e);
56477        closeArray();
56478      };
56479      if (element.hasStructuralRepresentation()) {
56480        openArray("structuralRepresentation");
56481        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent e : element.getStructuralRepresentation()) 
56482          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(null, e);
56483        closeArray();
56484      };
56485  }
56486
56487  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
56488    if (element != null) {
56489      open(name);
56490      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(element);
56491      close();
56492    }
56493  }
56494
56495  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
56496      composeBackbone(element);
56497      if (element.hasDegree()) {
56498        composeCodeableConcept("degree", element.getDegree());
56499      }
56500      if (element.hasAmount()) {
56501        composeSubstanceAmount("amount", element.getAmount());
56502      }
56503  }
56504
56505  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
56506    if (element != null) {
56507      open(name);
56508      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(element);
56509      close();
56510    }
56511  }
56512
56513  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
56514      composeBackbone(element);
56515      if (element.hasType()) {
56516        composeCodeableConcept("type", element.getType());
56517      }
56518      if (element.hasRepresentationElement()) {
56519        composeStringCore("representation", element.getRepresentationElement(), false);
56520        composeStringExtras("representation", element.getRepresentationElement(), false);
56521      }
56522      if (element.hasAttachment()) {
56523        composeAttachment("attachment", element.getAttachment());
56524      }
56525  }
56526
56527  protected void composeSubstanceProtein(String name, SubstanceProtein element) throws IOException {
56528    if (element != null) {
56529      prop("resourceType", name);
56530      composeSubstanceProteinInner(element);
56531    }
56532  }
56533
56534  protected void composeSubstanceProteinInner(SubstanceProtein element) throws IOException {
56535      composeDomainResourceElements(element);
56536      if (element.hasSequenceType()) {
56537        composeCodeableConcept("sequenceType", element.getSequenceType());
56538      }
56539      if (element.hasNumberOfSubunitsElement()) {
56540        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
56541        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
56542      }
56543      if (element.hasDisulfideLinkage()) {
56544        openArray("disulfideLinkage");
56545        for (StringType e : element.getDisulfideLinkage()) 
56546          composeStringCore(null, e, true);
56547        closeArray();
56548        if (anyHasExtras(element.getDisulfideLinkage())) {
56549          openArray("_disulfideLinkage");
56550          for (StringType e : element.getDisulfideLinkage()) 
56551            composeStringExtras(null, e, true);
56552          closeArray();
56553        }
56554      };
56555      if (element.hasSubunit()) {
56556        openArray("subunit");
56557        for (SubstanceProtein.SubstanceProteinSubunitComponent e : element.getSubunit()) 
56558          composeSubstanceProteinSubstanceProteinSubunitComponent(null, e);
56559        closeArray();
56560      };
56561  }
56562
56563  protected void composeSubstanceProteinSubstanceProteinSubunitComponent(String name, SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
56564    if (element != null) {
56565      open(name);
56566      composeSubstanceProteinSubstanceProteinSubunitComponentInner(element);
56567      close();
56568    }
56569  }
56570
56571  protected void composeSubstanceProteinSubstanceProteinSubunitComponentInner(SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
56572      composeBackbone(element);
56573      if (element.hasSubunitElement()) {
56574        composeIntegerCore("subunit", element.getSubunitElement(), false);
56575        composeIntegerExtras("subunit", element.getSubunitElement(), false);
56576      }
56577      if (element.hasSequenceElement()) {
56578        composeStringCore("sequence", element.getSequenceElement(), false);
56579        composeStringExtras("sequence", element.getSequenceElement(), false);
56580      }
56581      if (element.hasLengthElement()) {
56582        composeIntegerCore("length", element.getLengthElement(), false);
56583        composeIntegerExtras("length", element.getLengthElement(), false);
56584      }
56585      if (element.hasSequenceAttachment()) {
56586        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
56587      }
56588      if (element.hasNTerminalModificationId()) {
56589        composeIdentifier("nTerminalModificationId", element.getNTerminalModificationId());
56590      }
56591      if (element.hasNTerminalModificationElement()) {
56592        composeStringCore("nTerminalModification", element.getNTerminalModificationElement(), false);
56593        composeStringExtras("nTerminalModification", element.getNTerminalModificationElement(), false);
56594      }
56595      if (element.hasCTerminalModificationId()) {
56596        composeIdentifier("cTerminalModificationId", element.getCTerminalModificationId());
56597      }
56598      if (element.hasCTerminalModificationElement()) {
56599        composeStringCore("cTerminalModification", element.getCTerminalModificationElement(), false);
56600        composeStringExtras("cTerminalModification", element.getCTerminalModificationElement(), false);
56601      }
56602  }
56603
56604  protected void composeSubstanceReferenceInformation(String name, SubstanceReferenceInformation element) throws IOException {
56605    if (element != null) {
56606      prop("resourceType", name);
56607      composeSubstanceReferenceInformationInner(element);
56608    }
56609  }
56610
56611  protected void composeSubstanceReferenceInformationInner(SubstanceReferenceInformation element) throws IOException {
56612      composeDomainResourceElements(element);
56613      if (element.hasCommentElement()) {
56614        composeStringCore("comment", element.getCommentElement(), false);
56615        composeStringExtras("comment", element.getCommentElement(), false);
56616      }
56617      if (element.hasGene()) {
56618        openArray("gene");
56619        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent e : element.getGene()) 
56620          composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(null, e);
56621        closeArray();
56622      };
56623      if (element.hasGeneElement()) {
56624        openArray("geneElement");
56625        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent e : element.getGeneElement()) 
56626          composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(null, e);
56627        closeArray();
56628      };
56629      if (element.hasClassification()) {
56630        openArray("classification");
56631        for (SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent e : element.getClassification()) 
56632          composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(null, e);
56633        closeArray();
56634      };
56635      if (element.hasTarget()) {
56636        openArray("target");
56637        for (SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent e : element.getTarget()) 
56638          composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(null, e);
56639        closeArray();
56640      };
56641  }
56642
56643  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
56644    if (element != null) {
56645      open(name);
56646      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(element);
56647      close();
56648    }
56649  }
56650
56651  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
56652      composeBackbone(element);
56653      if (element.hasGeneSequenceOrigin()) {
56654        composeCodeableConcept("geneSequenceOrigin", element.getGeneSequenceOrigin());
56655      }
56656      if (element.hasGene()) {
56657        composeCodeableConcept("gene", element.getGene());
56658      }
56659      if (element.hasSource()) {
56660        openArray("source");
56661        for (Reference e : element.getSource()) 
56662          composeReference(null, e);
56663        closeArray();
56664      };
56665  }
56666
56667  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
56668    if (element != null) {
56669      open(name);
56670      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(element);
56671      close();
56672    }
56673  }
56674
56675  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
56676      composeBackbone(element);
56677      if (element.hasType()) {
56678        composeCodeableConcept("type", element.getType());
56679      }
56680      if (element.hasElement()) {
56681        composeIdentifier("element", element.getElement());
56682      }
56683      if (element.hasSource()) {
56684        openArray("source");
56685        for (Reference e : element.getSource()) 
56686          composeReference(null, e);
56687        closeArray();
56688      };
56689  }
56690
56691  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
56692    if (element != null) {
56693      open(name);
56694      composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(element);
56695      close();
56696    }
56697  }
56698
56699  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
56700      composeBackbone(element);
56701      if (element.hasDomain()) {
56702        composeCodeableConcept("domain", element.getDomain());
56703      }
56704      if (element.hasClassification()) {
56705        composeCodeableConcept("classification", element.getClassification());
56706      }
56707      if (element.hasSubtype()) {
56708        openArray("subtype");
56709        for (CodeableConcept e : element.getSubtype()) 
56710          composeCodeableConcept(null, e);
56711        closeArray();
56712      };
56713      if (element.hasSource()) {
56714        openArray("source");
56715        for (Reference e : element.getSource()) 
56716          composeReference(null, e);
56717        closeArray();
56718      };
56719  }
56720
56721  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
56722    if (element != null) {
56723      open(name);
56724      composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(element);
56725      close();
56726    }
56727  }
56728
56729  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
56730      composeBackbone(element);
56731      if (element.hasTarget()) {
56732        composeIdentifier("target", element.getTarget());
56733      }
56734      if (element.hasType()) {
56735        composeCodeableConcept("type", element.getType());
56736      }
56737      if (element.hasInteraction()) {
56738        composeCodeableConcept("interaction", element.getInteraction());
56739      }
56740      if (element.hasOrganism()) {
56741        composeCodeableConcept("organism", element.getOrganism());
56742      }
56743      if (element.hasOrganismType()) {
56744        composeCodeableConcept("organismType", element.getOrganismType());
56745      }
56746      if (element.hasAmount()) {
56747        composeType("amount", element.getAmount());
56748      }
56749      if (element.hasAmountType()) {
56750        composeCodeableConcept("amountType", element.getAmountType());
56751      }
56752      if (element.hasSource()) {
56753        openArray("source");
56754        for (Reference e : element.getSource()) 
56755          composeReference(null, e);
56756        closeArray();
56757      };
56758  }
56759
56760  protected void composeSubstanceSourceMaterial(String name, SubstanceSourceMaterial element) throws IOException {
56761    if (element != null) {
56762      prop("resourceType", name);
56763      composeSubstanceSourceMaterialInner(element);
56764    }
56765  }
56766
56767  protected void composeSubstanceSourceMaterialInner(SubstanceSourceMaterial element) throws IOException {
56768      composeDomainResourceElements(element);
56769      if (element.hasSourceMaterialClass()) {
56770        composeCodeableConcept("sourceMaterialClass", element.getSourceMaterialClass());
56771      }
56772      if (element.hasSourceMaterialType()) {
56773        composeCodeableConcept("sourceMaterialType", element.getSourceMaterialType());
56774      }
56775      if (element.hasSourceMaterialState()) {
56776        composeCodeableConcept("sourceMaterialState", element.getSourceMaterialState());
56777      }
56778      if (element.hasOrganismId()) {
56779        composeIdentifier("organismId", element.getOrganismId());
56780      }
56781      if (element.hasOrganismNameElement()) {
56782        composeStringCore("organismName", element.getOrganismNameElement(), false);
56783        composeStringExtras("organismName", element.getOrganismNameElement(), false);
56784      }
56785      if (element.hasParentSubstanceId()) {
56786        openArray("parentSubstanceId");
56787        for (Identifier e : element.getParentSubstanceId()) 
56788          composeIdentifier(null, e);
56789        closeArray();
56790      };
56791      if (element.hasParentSubstanceName()) {
56792        openArray("parentSubstanceName");
56793        for (StringType e : element.getParentSubstanceName()) 
56794          composeStringCore(null, e, true);
56795        closeArray();
56796        if (anyHasExtras(element.getParentSubstanceName())) {
56797          openArray("_parentSubstanceName");
56798          for (StringType e : element.getParentSubstanceName()) 
56799            composeStringExtras(null, e, true);
56800          closeArray();
56801      }
56802      };
56803      if (element.hasCountryOfOrigin()) {
56804        openArray("countryOfOrigin");
56805        for (CodeableConcept e : element.getCountryOfOrigin()) 
56806          composeCodeableConcept(null, e);
56807        closeArray();
56808      };
56809      if (element.hasGeographicalLocation()) {
56810        openArray("geographicalLocation");
56811        for (StringType e : element.getGeographicalLocation()) 
56812          composeStringCore(null, e, true);
56813        closeArray();
56814        if (anyHasExtras(element.getGeographicalLocation())) {
56815          openArray("_geographicalLocation");
56816          for (StringType e : element.getGeographicalLocation()) 
56817            composeStringExtras(null, e, true);
56818        closeArray();
56819        }
56820      };
56821      if (element.hasDevelopmentStage()) {
56822        composeCodeableConcept("developmentStage", element.getDevelopmentStage());
56823      }
56824      if (element.hasFractionDescription()) {
56825        openArray("fractionDescription");
56826        for (SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent e : element.getFractionDescription()) 
56827          composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(null, e);
56828        closeArray();
56829      };
56830      if (element.hasOrganism()) {
56831        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent("organism", element.getOrganism());
56832      }
56833      if (element.hasPartDescription()) {
56834        openArray("partDescription");
56835        for (SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent e : element.getPartDescription()) 
56836          composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(null, e);
56837        closeArray();
56838      };
56839  }
56840
56841  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
56842    if (element != null) {
56843      open(name);
56844      composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentInner(element);
56845      close();
56846    }
56847  }
56848
56849  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
56850      composeBackbone(element);
56851      if (element.hasFractionElement()) {
56852        composeStringCore("fraction", element.getFractionElement(), false);
56853        composeStringExtras("fraction", element.getFractionElement(), false);
56854      }
56855      if (element.hasMaterialType()) {
56856        composeCodeableConcept("materialType", element.getMaterialType());
56857      }
56858  }
56859
56860  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
56861    if (element != null) {
56862      open(name);
56863      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentInner(element);
56864      close();
56865    }
56866  }
56867
56868  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
56869      composeBackbone(element);
56870      if (element.hasFamily()) {
56871        composeCodeableConcept("family", element.getFamily());
56872      }
56873      if (element.hasGenus()) {
56874        composeCodeableConcept("genus", element.getGenus());
56875      }
56876      if (element.hasSpecies()) {
56877        composeCodeableConcept("species", element.getSpecies());
56878      }
56879      if (element.hasIntraspecificType()) {
56880        composeCodeableConcept("intraspecificType", element.getIntraspecificType());
56881  }
56882      if (element.hasIntraspecificDescriptionElement()) {
56883        composeStringCore("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
56884        composeStringExtras("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
56885    }
56886      if (element.hasAuthor()) {
56887        openArray("author");
56888        for (SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent e : element.getAuthor()) 
56889          composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(null, e);
56890        closeArray();
56891      };
56892      if (element.hasHybrid()) {
56893        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent("hybrid", element.getHybrid());
56894  }
56895      if (element.hasOrganismGeneral()) {
56896        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent("organismGeneral", element.getOrganismGeneral());
56897      }
56898  }
56899
56900  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
56901    if (element != null) {
56902      open(name);
56903      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentInner(element);
56904      close();
56905    }
56906  }
56907
56908  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
56909      composeBackbone(element);
56910      if (element.hasAuthorType()) {
56911        composeCodeableConcept("authorType", element.getAuthorType());
56912      }
56913      if (element.hasAuthorDescriptionElement()) {
56914        composeStringCore("authorDescription", element.getAuthorDescriptionElement(), false);
56915        composeStringExtras("authorDescription", element.getAuthorDescriptionElement(), false);
56916      }
56917  }
56918
56919  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
56920    if (element != null) {
56921      open(name);
56922      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentInner(element);
56923      close();
56924    }
56925  }
56926
56927  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
56928      composeBackbone(element);
56929      if (element.hasMaternalOrganismIdElement()) {
56930        composeStringCore("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
56931        composeStringExtras("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
56932      }
56933      if (element.hasMaternalOrganismNameElement()) {
56934        composeStringCore("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
56935        composeStringExtras("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
56936      }
56937      if (element.hasPaternalOrganismIdElement()) {
56938        composeStringCore("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
56939        composeStringExtras("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
56940      }
56941      if (element.hasPaternalOrganismNameElement()) {
56942        composeStringCore("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
56943        composeStringExtras("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
56944      }
56945      if (element.hasHybridType()) {
56946        composeCodeableConcept("hybridType", element.getHybridType());
56947      }
56948  }
56949
56950  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
56951    if (element != null) {
56952      open(name);
56953      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentInner(element);
56954      close();
56955    }
56956  }
56957
56958  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
56959      composeBackbone(element);
56960      if (element.hasKingdom()) {
56961        composeCodeableConcept("kingdom", element.getKingdom());
56962      }
56963      if (element.hasPhylum()) {
56964        composeCodeableConcept("phylum", element.getPhylum());
56965      }
56966      if (element.hasClass_()) {
56967        composeCodeableConcept("class", element.getClass_());
56968      }
56969      if (element.hasOrder()) {
56970        composeCodeableConcept("order", element.getOrder());
56971      }
56972  }
56973
56974  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
56975    if (element != null) {
56976      open(name);
56977      composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentInner(element);
56978      close();
56979    }
56980  }
56981
56982  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
56983      composeBackbone(element);
56984      if (element.hasPart()) {
56985        composeCodeableConcept("part", element.getPart());
56986      }
56987      if (element.hasPartLocation()) {
56988        composeCodeableConcept("partLocation", element.getPartLocation());
56989      }
56990  }
56991
56992  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
56993    if (element != null) {
56994      prop("resourceType", name);
56995      composeSupplyDeliveryInner(element);
56996    }
56997  }
56998
56999  protected void composeSupplyDeliveryInner(SupplyDelivery element) throws IOException {
57000      composeDomainResourceElements(element);
57001      if (element.hasIdentifier()) {
57002        openArray("identifier");
57003        for (Identifier e : element.getIdentifier()) 
57004          composeIdentifier(null, e);
57005        closeArray();
57006      };
57007      if (element.hasBasedOn()) {
57008        openArray("basedOn");
57009        for (Reference e : element.getBasedOn()) 
57010          composeReference(null, e);
57011        closeArray();
57012      };
57013      if (element.hasPartOf()) {
57014        openArray("partOf");
57015        for (Reference e : element.getPartOf()) 
57016          composeReference(null, e);
57017        closeArray();
57018      };
57019      if (element.hasStatusElement()) {
57020        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
57021        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
57022      }
57023      if (element.hasPatient()) {
57024        composeReference("patient", element.getPatient());
57025      }
57026      if (element.hasType()) {
57027        composeCodeableConcept("type", element.getType());
57028      }
57029      if (element.hasSuppliedItem()) {
57030        composeSupplyDeliverySupplyDeliverySuppliedItemComponent("suppliedItem", element.getSuppliedItem());
57031      }
57032      if (element.hasOccurrence()) {
57033        composeType("occurrence", element.getOccurrence());
57034      }
57035      if (element.hasSupplier()) {
57036        composeReference("supplier", element.getSupplier());
57037      }
57038      if (element.hasDestination()) {
57039        composeReference("destination", element.getDestination());
57040      }
57041      if (element.hasReceiver()) {
57042        openArray("receiver");
57043        for (Reference e : element.getReceiver()) 
57044          composeReference(null, e);
57045        closeArray();
57046      };
57047  }
57048
57049  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
57050    if (element != null) {
57051      open(name);
57052      composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(element);
57053      close();
57054    }
57055  }
57056
57057  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
57058      composeBackbone(element);
57059      if (element.hasQuantity()) {
57060        composeQuantity("quantity", element.getQuantity());
57061      }
57062      if (element.hasItem()) {
57063        composeType("item", element.getItem());
57064      }
57065  }
57066
57067  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
57068    if (element != null) {
57069      prop("resourceType", name);
57070      composeSupplyRequestInner(element);
57071    }
57072  }
57073
57074  protected void composeSupplyRequestInner(SupplyRequest element) throws IOException {
57075      composeDomainResourceElements(element);
57076      if (element.hasIdentifier()) {
57077        openArray("identifier");
57078        for (Identifier e : element.getIdentifier()) 
57079          composeIdentifier(null, e);
57080        closeArray();
57081      };
57082      if (element.hasStatusElement()) {
57083        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
57084        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
57085      }
57086      if (element.hasCategory()) {
57087        composeCodeableConcept("category", element.getCategory());
57088      }
57089      if (element.hasPriorityElement()) {
57090        composeEnumerationCore("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
57091        composeEnumerationExtras("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
57092      }
57093      if (element.hasItem()) {
57094        composeType("item", element.getItem());
57095      }
57096      if (element.hasQuantity()) {
57097        composeQuantity("quantity", element.getQuantity());
57098      }
57099      if (element.hasParameter()) {
57100        openArray("parameter");
57101        for (SupplyRequest.SupplyRequestParameterComponent e : element.getParameter()) 
57102          composeSupplyRequestSupplyRequestParameterComponent(null, e);
57103        closeArray();
57104      };
57105      if (element.hasOccurrence()) {
57106        composeType("occurrence", element.getOccurrence());
57107      }
57108      if (element.hasAuthoredOnElement()) {
57109        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
57110        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
57111      }
57112      if (element.hasRequester()) {
57113        composeReference("requester", element.getRequester());
57114      }
57115      if (element.hasSupplier()) {
57116        openArray("supplier");
57117        for (Reference e : element.getSupplier()) 
57118          composeReference(null, e);
57119        closeArray();
57120      };
57121      if (element.hasReasonCode()) {
57122        openArray("reasonCode");
57123        for (CodeableConcept e : element.getReasonCode()) 
57124          composeCodeableConcept(null, e);
57125        closeArray();
57126      };
57127      if (element.hasReasonReference()) {
57128        openArray("reasonReference");
57129        for (Reference e : element.getReasonReference()) 
57130          composeReference(null, e);
57131        closeArray();
57132      };
57133      if (element.hasDeliverFrom()) {
57134        composeReference("deliverFrom", element.getDeliverFrom());
57135      }
57136      if (element.hasDeliverTo()) {
57137        composeReference("deliverTo", element.getDeliverTo());
57138      }
57139  }
57140
57141  protected void composeSupplyRequestSupplyRequestParameterComponent(String name, SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
57142    if (element != null) {
57143      open(name);
57144      composeSupplyRequestSupplyRequestParameterComponentInner(element);
57145      close();
57146    }
57147  }
57148
57149  protected void composeSupplyRequestSupplyRequestParameterComponentInner(SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
57150      composeBackbone(element);
57151      if (element.hasCode()) {
57152        composeCodeableConcept("code", element.getCode());
57153      }
57154      if (element.hasValue()) {
57155        composeType("value", element.getValue());
57156      }
57157  }
57158
57159  protected void composeTask(String name, Task element) throws IOException {
57160    if (element != null) {
57161      prop("resourceType", name);
57162      composeTaskInner(element);
57163    }
57164  }
57165
57166  protected void composeTaskInner(Task element) throws IOException {
57167      composeDomainResourceElements(element);
57168      if (element.hasIdentifier()) {
57169        openArray("identifier");
57170        for (Identifier e : element.getIdentifier()) 
57171          composeIdentifier(null, e);
57172        closeArray();
57173      };
57174      if (element.hasInstantiatesCanonicalElement()) {
57175        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
57176        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
57177      }
57178      if (element.hasInstantiatesUriElement()) {
57179        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
57180        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
57181      }
57182      if (element.hasBasedOn()) {
57183        openArray("basedOn");
57184        for (Reference e : element.getBasedOn()) 
57185          composeReference(null, e);
57186        closeArray();
57187      };
57188      if (element.hasGroupIdentifier()) {
57189        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
57190      }
57191      if (element.hasPartOf()) {
57192        openArray("partOf");
57193        for (Reference e : element.getPartOf()) 
57194          composeReference(null, e);
57195        closeArray();
57196      };
57197      if (element.hasStatusElement()) {
57198        composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
57199        composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
57200      }
57201      if (element.hasStatusReason()) {
57202        composeCodeableConcept("statusReason", element.getStatusReason());
57203      }
57204      if (element.hasBusinessStatus()) {
57205        composeCodeableConcept("businessStatus", element.getBusinessStatus());
57206      }
57207      if (element.hasIntentElement()) {
57208        composeEnumerationCore("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
57209        composeEnumerationExtras("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
57210      }
57211      if (element.hasPriorityElement()) {
57212        composeEnumerationCore("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
57213        composeEnumerationExtras("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
57214      }
57215      if (element.hasCode()) {
57216        composeCodeableConcept("code", element.getCode());
57217      }
57218      if (element.hasDescriptionElement()) {
57219        composeStringCore("description", element.getDescriptionElement(), false);
57220        composeStringExtras("description", element.getDescriptionElement(), false);
57221      }
57222      if (element.hasFocus()) {
57223        composeReference("focus", element.getFocus());
57224      }
57225      if (element.hasFor()) {
57226        composeReference("for", element.getFor());
57227      }
57228      if (element.hasEncounter()) {
57229        composeReference("encounter", element.getEncounter());
57230      }
57231      if (element.hasExecutionPeriod()) {
57232        composePeriod("executionPeriod", element.getExecutionPeriod());
57233      }
57234      if (element.hasAuthoredOnElement()) {
57235        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
57236        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
57237      }
57238      if (element.hasLastModifiedElement()) {
57239        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
57240        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
57241      }
57242      if (element.hasRequester()) {
57243        composeReference("requester", element.getRequester());
57244      }
57245      if (element.hasPerformerType()) {
57246        openArray("performerType");
57247        for (CodeableConcept e : element.getPerformerType()) 
57248          composeCodeableConcept(null, e);
57249        closeArray();
57250      };
57251      if (element.hasOwner()) {
57252        composeReference("owner", element.getOwner());
57253      }
57254      if (element.hasLocation()) {
57255        composeReference("location", element.getLocation());
57256      }
57257      if (element.hasReasonCode()) {
57258        composeCodeableConcept("reasonCode", element.getReasonCode());
57259      }
57260      if (element.hasReasonReference()) {
57261        composeReference("reasonReference", element.getReasonReference());
57262      }
57263      if (element.hasInsurance()) {
57264        openArray("insurance");
57265        for (Reference e : element.getInsurance()) 
57266          composeReference(null, e);
57267        closeArray();
57268      };
57269      if (element.hasNote()) {
57270        openArray("note");
57271        for (Annotation e : element.getNote()) 
57272          composeAnnotation(null, e);
57273        closeArray();
57274      };
57275      if (element.hasRelevantHistory()) {
57276        openArray("relevantHistory");
57277        for (Reference e : element.getRelevantHistory()) 
57278          composeReference(null, e);
57279        closeArray();
57280      };
57281      if (element.hasRestriction()) {
57282        composeTaskTaskRestrictionComponent("restriction", element.getRestriction());
57283      }
57284      if (element.hasInput()) {
57285        openArray("input");
57286        for (Task.ParameterComponent e : element.getInput()) 
57287          composeTaskParameterComponent(null, e);
57288        closeArray();
57289      };
57290      if (element.hasOutput()) {
57291        openArray("output");
57292        for (Task.TaskOutputComponent e : element.getOutput()) 
57293          composeTaskTaskOutputComponent(null, e);
57294        closeArray();
57295      };
57296  }
57297
57298  protected void composeTaskTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
57299    if (element != null) {
57300      open(name);
57301      composeTaskTaskRestrictionComponentInner(element);
57302      close();
57303    }
57304  }
57305
57306  protected void composeTaskTaskRestrictionComponentInner(Task.TaskRestrictionComponent element) throws IOException {
57307      composeBackbone(element);
57308      if (element.hasRepetitionsElement()) {
57309        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
57310        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
57311      }
57312      if (element.hasPeriod()) {
57313        composePeriod("period", element.getPeriod());
57314      }
57315      if (element.hasRecipient()) {
57316        openArray("recipient");
57317        for (Reference e : element.getRecipient()) 
57318          composeReference(null, e);
57319        closeArray();
57320      };
57321  }
57322
57323  protected void composeTaskParameterComponent(String name, Task.ParameterComponent element) throws IOException {
57324    if (element != null) {
57325      open(name);
57326      composeTaskParameterComponentInner(element);
57327      close();
57328    }
57329  }
57330
57331  protected void composeTaskParameterComponentInner(Task.ParameterComponent element) throws IOException {
57332      composeBackbone(element);
57333      if (element.hasType()) {
57334        composeCodeableConcept("type", element.getType());
57335      }
57336      if (element.hasValue()) {
57337        composeType("value", element.getValue());
57338      }
57339  }
57340
57341  protected void composeTaskTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
57342    if (element != null) {
57343      open(name);
57344      composeTaskTaskOutputComponentInner(element);
57345      close();
57346    }
57347  }
57348
57349  protected void composeTaskTaskOutputComponentInner(Task.TaskOutputComponent element) throws IOException {
57350      composeBackbone(element);
57351      if (element.hasType()) {
57352        composeCodeableConcept("type", element.getType());
57353      }
57354      if (element.hasValue()) {
57355        composeType("value", element.getValue());
57356      }
57357  }
57358
57359  protected void composeTerminologyCapabilities(String name, TerminologyCapabilities element) throws IOException {
57360    if (element != null) {
57361      prop("resourceType", name);
57362      composeTerminologyCapabilitiesInner(element);
57363    }
57364  }
57365
57366  protected void composeTerminologyCapabilitiesInner(TerminologyCapabilities element) throws IOException {
57367      composeDomainResourceElements(element);
57368      if (element.hasUrlElement()) {
57369        composeUriCore("url", element.getUrlElement(), false);
57370        composeUriExtras("url", element.getUrlElement(), false);
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.hasPurposeElement()) {
57423        composeMarkdownCore("purpose", element.getPurposeElement(), false);
57424        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
57425      }
57426      if (element.hasCopyrightElement()) {
57427        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
57428        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
57429      }
57430      if (element.hasKindElement()) {
57431        composeEnumerationCore("kind", element.getKindElement(), new TerminologyCapabilities.CapabilityStatementKindEnumFactory(), false);
57432        composeEnumerationExtras("kind", element.getKindElement(), new TerminologyCapabilities.CapabilityStatementKindEnumFactory(), false);
57433      }
57434      if (element.hasSoftware()) {
57435        composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent("software", element.getSoftware());
57436      }
57437      if (element.hasImplementation()) {
57438        composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent("implementation", element.getImplementation());
57439      }
57440      if (element.hasLockedDateElement()) {
57441        composeBooleanCore("lockedDate", element.getLockedDateElement(), false);
57442        composeBooleanExtras("lockedDate", element.getLockedDateElement(), false);
57443      }
57444      if (element.hasCodeSystem()) {
57445        openArray("codeSystem");
57446        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent e : element.getCodeSystem()) 
57447          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(null, e);
57448        closeArray();
57449      };
57450      if (element.hasExpansion()) {
57451        composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent("expansion", element.getExpansion());
57452      }
57453      if (element.hasCodeSearchElement()) {
57454        composeEnumerationCore("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
57455        composeEnumerationExtras("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
57456      }
57457      if (element.hasValidateCode()) {
57458        composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent("validateCode", element.getValidateCode());
57459      }
57460      if (element.hasTranslation()) {
57461        composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent("translation", element.getTranslation());
57462      }
57463      if (element.hasClosure()) {
57464        composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent("closure", element.getClosure());
57465      }
57466  }
57467
57468  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
57469    if (element != null) {
57470      open(name);
57471      composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentInner(element);
57472      close();
57473    }
57474  }
57475
57476  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentInner(TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
57477      composeBackbone(element);
57478      if (element.hasNameElement()) {
57479        composeStringCore("name", element.getNameElement(), false);
57480        composeStringExtras("name", element.getNameElement(), false);
57481      }
57482      if (element.hasVersionElement()) {
57483        composeStringCore("version", element.getVersionElement(), false);
57484        composeStringExtras("version", element.getVersionElement(), false);
57485      }
57486  }
57487
57488  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
57489    if (element != null) {
57490      open(name);
57491      composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentInner(element);
57492      close();
57493    }
57494  }
57495
57496  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentInner(TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
57497      composeBackbone(element);
57498      if (element.hasDescriptionElement()) {
57499        composeStringCore("description", element.getDescriptionElement(), false);
57500        composeStringExtras("description", element.getDescriptionElement(), false);
57501      }
57502      if (element.hasUrlElement()) {
57503        composeUrlCore("url", element.getUrlElement(), false);
57504        composeUrlExtras("url", element.getUrlElement(), false);
57505      }
57506  }
57507
57508  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
57509    if (element != null) {
57510      open(name);
57511      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(element);
57512      close();
57513    }
57514  }
57515
57516  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
57517      composeBackbone(element);
57518      if (element.hasUriElement()) {
57519        composeCanonicalCore("uri", element.getUriElement(), false);
57520        composeCanonicalExtras("uri", element.getUriElement(), false);
57521      }
57522      if (element.hasVersion()) {
57523        openArray("version");
57524        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent e : element.getVersion()) 
57525          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(null, e);
57526        closeArray();
57527      };
57528      if (element.hasSubsumptionElement()) {
57529        composeBooleanCore("subsumption", element.getSubsumptionElement(), false);
57530        composeBooleanExtras("subsumption", element.getSubsumptionElement(), false);
57531      }
57532  }
57533
57534  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
57535    if (element != null) {
57536      open(name);
57537      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(element);
57538      close();
57539    }
57540  }
57541
57542  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
57543      composeBackbone(element);
57544      if (element.hasCodeElement()) {
57545        composeStringCore("code", element.getCodeElement(), false);
57546        composeStringExtras("code", element.getCodeElement(), false);
57547      }
57548      if (element.hasIsDefaultElement()) {
57549        composeBooleanCore("isDefault", element.getIsDefaultElement(), false);
57550        composeBooleanExtras("isDefault", element.getIsDefaultElement(), false);
57551      }
57552      if (element.hasCompositionalElement()) {
57553        composeBooleanCore("compositional", element.getCompositionalElement(), false);
57554        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
57555      }
57556      if (element.hasLanguage()) {
57557        openArray("language");
57558        for (CodeType e : element.getLanguage()) 
57559          composeCodeCore(null, e, true);
57560        closeArray();
57561        if (anyHasExtras(element.getLanguage())) {
57562          openArray("_language");
57563          for (CodeType e : element.getLanguage()) 
57564            composeCodeExtras(null, e, true);
57565          closeArray();
57566        }
57567      };
57568      if (element.hasFilter()) {
57569        openArray("filter");
57570        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent e : element.getFilter()) 
57571          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(null, e);
57572        closeArray();
57573      };
57574      if (element.hasProperty()) {
57575        openArray("property");
57576        for (CodeType e : element.getProperty()) 
57577          composeCodeCore(null, e, true);
57578        closeArray();
57579        if (anyHasExtras(element.getProperty())) {
57580          openArray("_property");
57581          for (CodeType e : element.getProperty()) 
57582            composeCodeExtras(null, e, true);
57583          closeArray();
57584        }
57585      };
57586  }
57587
57588  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
57589    if (element != null) {
57590      open(name);
57591      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(element);
57592      close();
57593    }
57594  }
57595
57596  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
57597      composeBackbone(element);
57598      if (element.hasCodeElement()) {
57599        composeCodeCore("code", element.getCodeElement(), false);
57600        composeCodeExtras("code", element.getCodeElement(), false);
57601      }
57602      if (element.hasOp()) {
57603        openArray("op");
57604        for (CodeType e : element.getOp()) 
57605          composeCodeCore(null, e, true);
57606        closeArray();
57607        if (anyHasExtras(element.getOp())) {
57608          openArray("_op");
57609          for (CodeType e : element.getOp()) 
57610            composeCodeExtras(null, e, true);
57611          closeArray();
57612        }
57613      };
57614  }
57615
57616  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
57617    if (element != null) {
57618      open(name);
57619      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(element);
57620      close();
57621    }
57622  }
57623
57624  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
57625      composeBackbone(element);
57626      if (element.hasHierarchicalElement()) {
57627        composeBooleanCore("hierarchical", element.getHierarchicalElement(), false);
57628        composeBooleanExtras("hierarchical", element.getHierarchicalElement(), false);
57629      }
57630      if (element.hasPagingElement()) {
57631        composeBooleanCore("paging", element.getPagingElement(), false);
57632        composeBooleanExtras("paging", element.getPagingElement(), false);
57633      }
57634      if (element.hasIncompleteElement()) {
57635        composeBooleanCore("incomplete", element.getIncompleteElement(), false);
57636        composeBooleanExtras("incomplete", element.getIncompleteElement(), false);
57637      }
57638      if (element.hasParameter()) {
57639        openArray("parameter");
57640        for (TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent e : element.getParameter()) 
57641          composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(null, e);
57642        closeArray();
57643      };
57644      if (element.hasTextFilterElement()) {
57645        composeMarkdownCore("textFilter", element.getTextFilterElement(), false);
57646        composeMarkdownExtras("textFilter", element.getTextFilterElement(), false);
57647      }
57648  }
57649
57650  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
57651    if (element != null) {
57652      open(name);
57653      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentInner(element);
57654      close();
57655    }
57656  }
57657
57658  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentInner(TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
57659      composeBackbone(element);
57660      if (element.hasNameElement()) {
57661        composeCodeCore("name", element.getNameElement(), false);
57662        composeCodeExtras("name", element.getNameElement(), false);
57663      }
57664      if (element.hasDocumentationElement()) {
57665        composeStringCore("documentation", element.getDocumentationElement(), false);
57666        composeStringExtras("documentation", element.getDocumentationElement(), false);
57667      }
57668  }
57669
57670  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
57671    if (element != null) {
57672      open(name);
57673      composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(element);
57674      close();
57675    }
57676  }
57677
57678  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
57679      composeBackbone(element);
57680      if (element.hasTranslationsElement()) {
57681        composeBooleanCore("translations", element.getTranslationsElement(), false);
57682        composeBooleanExtras("translations", element.getTranslationsElement(), false);
57683      }
57684  }
57685
57686  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
57687    if (element != null) {
57688      open(name);
57689      composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(element);
57690      close();
57691    }
57692  }
57693
57694  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
57695      composeBackbone(element);
57696      if (element.hasNeedsMapElement()) {
57697        composeBooleanCore("needsMap", element.getNeedsMapElement(), false);
57698        composeBooleanExtras("needsMap", element.getNeedsMapElement(), false);
57699      }
57700  }
57701
57702  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
57703    if (element != null) {
57704      open(name);
57705      composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(element);
57706      close();
57707    }
57708  }
57709
57710  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
57711      composeBackbone(element);
57712      if (element.hasTranslationElement()) {
57713        composeBooleanCore("translation", element.getTranslationElement(), false);
57714        composeBooleanExtras("translation", element.getTranslationElement(), false);
57715      }
57716  }
57717
57718  protected void composeTestReport(String name, TestReport element) throws IOException {
57719    if (element != null) {
57720      prop("resourceType", name);
57721      composeTestReportInner(element);
57722    }
57723  }
57724
57725  protected void composeTestReportInner(TestReport element) throws IOException {
57726      composeDomainResourceElements(element);
57727      if (element.hasIdentifier()) {
57728        composeIdentifier("identifier", element.getIdentifier());
57729      }
57730      if (element.hasNameElement()) {
57731        composeStringCore("name", element.getNameElement(), false);
57732        composeStringExtras("name", element.getNameElement(), false);
57733      }
57734      if (element.hasStatusElement()) {
57735        composeEnumerationCore("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
57736        composeEnumerationExtras("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
57737      }
57738      if (element.hasTestScript()) {
57739        composeReference("testScript", element.getTestScript());
57740      }
57741      if (element.hasResultElement()) {
57742        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
57743        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
57744      }
57745      if (element.hasScoreElement()) {
57746        composeDecimalCore("score", element.getScoreElement(), false);
57747        composeDecimalExtras("score", element.getScoreElement(), false);
57748      }
57749      if (element.hasTesterElement()) {
57750        composeStringCore("tester", element.getTesterElement(), false);
57751        composeStringExtras("tester", element.getTesterElement(), false);
57752      }
57753      if (element.hasIssuedElement()) {
57754        composeDateTimeCore("issued", element.getIssuedElement(), false);
57755        composeDateTimeExtras("issued", element.getIssuedElement(), false);
57756      }
57757      if (element.hasParticipant()) {
57758        openArray("participant");
57759        for (TestReport.TestReportParticipantComponent e : element.getParticipant()) 
57760          composeTestReportTestReportParticipantComponent(null, e);
57761        closeArray();
57762      };
57763      if (element.hasSetup()) {
57764        composeTestReportTestReportSetupComponent("setup", element.getSetup());
57765      }
57766      if (element.hasTest()) {
57767        openArray("test");
57768        for (TestReport.TestReportTestComponent e : element.getTest()) 
57769          composeTestReportTestReportTestComponent(null, e);
57770        closeArray();
57771      };
57772      if (element.hasTeardown()) {
57773        composeTestReportTestReportTeardownComponent("teardown", element.getTeardown());
57774      }
57775  }
57776
57777  protected void composeTestReportTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
57778    if (element != null) {
57779      open(name);
57780      composeTestReportTestReportParticipantComponentInner(element);
57781      close();
57782    }
57783  }
57784
57785  protected void composeTestReportTestReportParticipantComponentInner(TestReport.TestReportParticipantComponent element) throws IOException {
57786      composeBackbone(element);
57787      if (element.hasTypeElement()) {
57788        composeEnumerationCore("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
57789        composeEnumerationExtras("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
57790      }
57791      if (element.hasUriElement()) {
57792        composeUriCore("uri", element.getUriElement(), false);
57793        composeUriExtras("uri", element.getUriElement(), false);
57794      }
57795      if (element.hasDisplayElement()) {
57796        composeStringCore("display", element.getDisplayElement(), false);
57797        composeStringExtras("display", element.getDisplayElement(), false);
57798      }
57799  }
57800
57801  protected void composeTestReportTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
57802    if (element != null) {
57803      open(name);
57804      composeTestReportTestReportSetupComponentInner(element);
57805      close();
57806    }
57807  }
57808
57809  protected void composeTestReportTestReportSetupComponentInner(TestReport.TestReportSetupComponent element) throws IOException {
57810      composeBackbone(element);
57811      if (element.hasAction()) {
57812        openArray("action");
57813        for (TestReport.SetupActionComponent e : element.getAction()) 
57814          composeTestReportSetupActionComponent(null, e);
57815        closeArray();
57816      };
57817  }
57818
57819  protected void composeTestReportSetupActionComponent(String name, TestReport.SetupActionComponent element) throws IOException {
57820    if (element != null) {
57821      open(name);
57822      composeTestReportSetupActionComponentInner(element);
57823      close();
57824    }
57825  }
57826
57827  protected void composeTestReportSetupActionComponentInner(TestReport.SetupActionComponent element) throws IOException {
57828      composeBackbone(element);
57829      if (element.hasOperation()) {
57830        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
57831      }
57832      if (element.hasAssert()) {
57833        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
57834      }
57835  }
57836
57837  protected void composeTestReportSetupActionOperationComponent(String name, TestReport.SetupActionOperationComponent element) throws IOException {
57838    if (element != null) {
57839      open(name);
57840      composeTestReportSetupActionOperationComponentInner(element);
57841      close();
57842    }
57843  }
57844
57845  protected void composeTestReportSetupActionOperationComponentInner(TestReport.SetupActionOperationComponent element) throws IOException {
57846      composeBackbone(element);
57847      if (element.hasResultElement()) {
57848        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
57849        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
57850      }
57851      if (element.hasMessageElement()) {
57852        composeMarkdownCore("message", element.getMessageElement(), false);
57853        composeMarkdownExtras("message", element.getMessageElement(), false);
57854      }
57855      if (element.hasDetailElement()) {
57856        composeUriCore("detail", element.getDetailElement(), false);
57857        composeUriExtras("detail", element.getDetailElement(), false);
57858      }
57859  }
57860
57861  protected void composeTestReportSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element) throws IOException {
57862    if (element != null) {
57863      open(name);
57864      composeTestReportSetupActionAssertComponentInner(element);
57865      close();
57866    }
57867  }
57868
57869  protected void composeTestReportSetupActionAssertComponentInner(TestReport.SetupActionAssertComponent element) throws IOException {
57870      composeBackbone(element);
57871      if (element.hasResultElement()) {
57872        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
57873        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
57874      }
57875      if (element.hasMessageElement()) {
57876        composeMarkdownCore("message", element.getMessageElement(), false);
57877        composeMarkdownExtras("message", element.getMessageElement(), false);
57878      }
57879      if (element.hasDetailElement()) {
57880        composeStringCore("detail", element.getDetailElement(), false);
57881        composeStringExtras("detail", element.getDetailElement(), false);
57882      }
57883  }
57884
57885  protected void composeTestReportTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
57886    if (element != null) {
57887      open(name);
57888      composeTestReportTestReportTestComponentInner(element);
57889      close();
57890    }
57891  }
57892
57893  protected void composeTestReportTestReportTestComponentInner(TestReport.TestReportTestComponent element) throws IOException {
57894      composeBackbone(element);
57895      if (element.hasNameElement()) {
57896        composeStringCore("name", element.getNameElement(), false);
57897        composeStringExtras("name", element.getNameElement(), false);
57898      }
57899      if (element.hasDescriptionElement()) {
57900        composeStringCore("description", element.getDescriptionElement(), false);
57901        composeStringExtras("description", element.getDescriptionElement(), false);
57902      }
57903      if (element.hasAction()) {
57904        openArray("action");
57905        for (TestReport.TestActionComponent e : element.getAction()) 
57906          composeTestReportTestActionComponent(null, e);
57907        closeArray();
57908      };
57909  }
57910
57911  protected void composeTestReportTestActionComponent(String name, TestReport.TestActionComponent element) throws IOException {
57912    if (element != null) {
57913      open(name);
57914      composeTestReportTestActionComponentInner(element);
57915      close();
57916    }
57917  }
57918
57919  protected void composeTestReportTestActionComponentInner(TestReport.TestActionComponent element) throws IOException {
57920      composeBackbone(element);
57921      if (element.hasOperation()) {
57922        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
57923      }
57924      if (element.hasAssert()) {
57925        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
57926      }
57927  }
57928
57929  protected void composeTestReportTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
57930    if (element != null) {
57931      open(name);
57932      composeTestReportTestReportTeardownComponentInner(element);
57933      close();
57934    }
57935  }
57936
57937  protected void composeTestReportTestReportTeardownComponentInner(TestReport.TestReportTeardownComponent element) throws IOException {
57938      composeBackbone(element);
57939      if (element.hasAction()) {
57940        openArray("action");
57941        for (TestReport.TeardownActionComponent e : element.getAction()) 
57942          composeTestReportTeardownActionComponent(null, e);
57943        closeArray();
57944      };
57945  }
57946
57947  protected void composeTestReportTeardownActionComponent(String name, TestReport.TeardownActionComponent element) throws IOException {
57948    if (element != null) {
57949      open(name);
57950      composeTestReportTeardownActionComponentInner(element);
57951      close();
57952    }
57953  }
57954
57955  protected void composeTestReportTeardownActionComponentInner(TestReport.TeardownActionComponent element) throws IOException {
57956      composeBackbone(element);
57957      if (element.hasOperation()) {
57958        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
57959      }
57960  }
57961
57962  protected void composeTestScript(String name, TestScript element) throws IOException {
57963    if (element != null) {
57964      prop("resourceType", name);
57965      composeTestScriptInner(element);
57966    }
57967  }
57968
57969  protected void composeTestScriptInner(TestScript element) throws IOException {
57970      composeDomainResourceElements(element);
57971      if (element.hasUrlElement()) {
57972        composeUriCore("url", element.getUrlElement(), false);
57973        composeUriExtras("url", element.getUrlElement(), false);
57974      }
57975      if (element.hasIdentifier()) {
57976        composeIdentifier("identifier", element.getIdentifier());
57977      }
57978      if (element.hasVersionElement()) {
57979        composeStringCore("version", element.getVersionElement(), false);
57980        composeStringExtras("version", element.getVersionElement(), false);
57981      }
57982      if (element.hasNameElement()) {
57983        composeStringCore("name", element.getNameElement(), false);
57984        composeStringExtras("name", element.getNameElement(), false);
57985      }
57986      if (element.hasTitleElement()) {
57987        composeStringCore("title", element.getTitleElement(), false);
57988        composeStringExtras("title", element.getTitleElement(), false);
57989      }
57990      if (element.hasStatusElement()) {
57991        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57992        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57993      }
57994      if (element.hasExperimentalElement()) {
57995        composeBooleanCore("experimental", element.getExperimentalElement(), false);
57996        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
57997      }
57998      if (element.hasDateElement()) {
57999        composeDateTimeCore("date", element.getDateElement(), false);
58000        composeDateTimeExtras("date", element.getDateElement(), false);
58001      }
58002      if (element.hasPublisherElement()) {
58003        composeStringCore("publisher", element.getPublisherElement(), false);
58004        composeStringExtras("publisher", element.getPublisherElement(), false);
58005      }
58006      if (element.hasContact()) {
58007        openArray("contact");
58008        for (ContactDetail e : element.getContact()) 
58009          composeContactDetail(null, e);
58010        closeArray();
58011      };
58012      if (element.hasDescriptionElement()) {
58013        composeMarkdownCore("description", element.getDescriptionElement(), false);
58014        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58015      }
58016      if (element.hasUseContext()) {
58017        openArray("useContext");
58018        for (UsageContext e : element.getUseContext()) 
58019          composeUsageContext(null, e);
58020        closeArray();
58021      };
58022      if (element.hasJurisdiction()) {
58023        openArray("jurisdiction");
58024        for (CodeableConcept e : element.getJurisdiction()) 
58025          composeCodeableConcept(null, e);
58026        closeArray();
58027      };
58028      if (element.hasPurposeElement()) {
58029        composeMarkdownCore("purpose", element.getPurposeElement(), false);
58030        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
58031      }
58032      if (element.hasCopyrightElement()) {
58033        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
58034        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
58035      }
58036      if (element.hasOrigin()) {
58037        openArray("origin");
58038        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
58039          composeTestScriptTestScriptOriginComponent(null, e);
58040        closeArray();
58041      };
58042      if (element.hasDestination()) {
58043        openArray("destination");
58044        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
58045          composeTestScriptTestScriptDestinationComponent(null, e);
58046        closeArray();
58047      };
58048      if (element.hasMetadata()) {
58049        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
58050      }
58051      if (element.hasFixture()) {
58052        openArray("fixture");
58053        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
58054          composeTestScriptTestScriptFixtureComponent(null, e);
58055        closeArray();
58056      };
58057      if (element.hasProfile()) {
58058        openArray("profile");
58059        for (Reference e : element.getProfile()) 
58060          composeReference(null, e);
58061        closeArray();
58062      };
58063      if (element.hasVariable()) {
58064        openArray("variable");
58065        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
58066          composeTestScriptTestScriptVariableComponent(null, e);
58067        closeArray();
58068      };
58069      if (element.hasSetup()) {
58070        composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
58071      }
58072      if (element.hasTest()) {
58073        openArray("test");
58074        for (TestScript.TestScriptTestComponent e : element.getTest()) 
58075          composeTestScriptTestScriptTestComponent(null, e);
58076        closeArray();
58077      };
58078      if (element.hasTeardown()) {
58079        composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
58080      }
58081  }
58082
58083  protected void composeTestScriptTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
58084    if (element != null) {
58085      open(name);
58086      composeTestScriptTestScriptOriginComponentInner(element);
58087      close();
58088    }
58089  }
58090
58091  protected void composeTestScriptTestScriptOriginComponentInner(TestScript.TestScriptOriginComponent element) throws IOException {
58092      composeBackbone(element);
58093      if (element.hasIndexElement()) {
58094        composeIntegerCore("index", element.getIndexElement(), false);
58095        composeIntegerExtras("index", element.getIndexElement(), false);
58096      }
58097      if (element.hasProfile()) {
58098        composeCoding("profile", element.getProfile());
58099      }
58100  }
58101
58102  protected void composeTestScriptTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
58103    if (element != null) {
58104      open(name);
58105      composeTestScriptTestScriptDestinationComponentInner(element);
58106      close();
58107    }
58108  }
58109
58110  protected void composeTestScriptTestScriptDestinationComponentInner(TestScript.TestScriptDestinationComponent element) throws IOException {
58111      composeBackbone(element);
58112      if (element.hasIndexElement()) {
58113        composeIntegerCore("index", element.getIndexElement(), false);
58114        composeIntegerExtras("index", element.getIndexElement(), false);
58115      }
58116      if (element.hasProfile()) {
58117        composeCoding("profile", element.getProfile());
58118      }
58119  }
58120
58121  protected void composeTestScriptTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
58122    if (element != null) {
58123      open(name);
58124      composeTestScriptTestScriptMetadataComponentInner(element);
58125      close();
58126    }
58127  }
58128
58129  protected void composeTestScriptTestScriptMetadataComponentInner(TestScript.TestScriptMetadataComponent element) throws IOException {
58130      composeBackbone(element);
58131      if (element.hasLink()) {
58132        openArray("link");
58133        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
58134          composeTestScriptTestScriptMetadataLinkComponent(null, e);
58135        closeArray();
58136      };
58137      if (element.hasCapability()) {
58138        openArray("capability");
58139        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
58140          composeTestScriptTestScriptMetadataCapabilityComponent(null, e);
58141        closeArray();
58142      };
58143  }
58144
58145  protected void composeTestScriptTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
58146    if (element != null) {
58147      open(name);
58148      composeTestScriptTestScriptMetadataLinkComponentInner(element);
58149      close();
58150    }
58151  }
58152
58153  protected void composeTestScriptTestScriptMetadataLinkComponentInner(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
58154      composeBackbone(element);
58155      if (element.hasUrlElement()) {
58156        composeUriCore("url", element.getUrlElement(), false);
58157        composeUriExtras("url", element.getUrlElement(), false);
58158      }
58159      if (element.hasDescriptionElement()) {
58160        composeStringCore("description", element.getDescriptionElement(), false);
58161        composeStringExtras("description", element.getDescriptionElement(), false);
58162      }
58163  }
58164
58165  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
58166    if (element != null) {
58167      open(name);
58168      composeTestScriptTestScriptMetadataCapabilityComponentInner(element);
58169      close();
58170    }
58171  }
58172
58173  protected void composeTestScriptTestScriptMetadataCapabilityComponentInner(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
58174      composeBackbone(element);
58175      if (element.hasRequiredElement()) {
58176        composeBooleanCore("required", element.getRequiredElement(), false);
58177        composeBooleanExtras("required", element.getRequiredElement(), false);
58178      }
58179      if (element.hasValidatedElement()) {
58180        composeBooleanCore("validated", element.getValidatedElement(), false);
58181        composeBooleanExtras("validated", element.getValidatedElement(), false);
58182      }
58183      if (element.hasDescriptionElement()) {
58184        composeStringCore("description", element.getDescriptionElement(), false);
58185        composeStringExtras("description", element.getDescriptionElement(), false);
58186      }
58187      if (element.hasOrigin()) {
58188        openArray("origin");
58189        for (IntegerType e : element.getOrigin()) 
58190          composeIntegerCore(null, e, true);
58191        closeArray();
58192        if (anyHasExtras(element.getOrigin())) {
58193          openArray("_origin");
58194          for (IntegerType e : element.getOrigin()) 
58195            composeIntegerExtras(null, e, true);
58196          closeArray();
58197        }
58198      };
58199      if (element.hasDestinationElement()) {
58200        composeIntegerCore("destination", element.getDestinationElement(), false);
58201        composeIntegerExtras("destination", element.getDestinationElement(), false);
58202      }
58203      if (element.hasLink()) {
58204        openArray("link");
58205        for (UriType e : element.getLink()) 
58206          composeUriCore(null, e, true);
58207        closeArray();
58208        if (anyHasExtras(element.getLink())) {
58209          openArray("_link");
58210          for (UriType e : element.getLink()) 
58211            composeUriExtras(null, e, true);
58212          closeArray();
58213        }
58214      };
58215      if (element.hasCapabilitiesElement()) {
58216        composeCanonicalCore("capabilities", element.getCapabilitiesElement(), false);
58217        composeCanonicalExtras("capabilities", element.getCapabilitiesElement(), false);
58218      }
58219  }
58220
58221  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
58222    if (element != null) {
58223      open(name);
58224      composeTestScriptTestScriptFixtureComponentInner(element);
58225      close();
58226    }
58227  }
58228
58229  protected void composeTestScriptTestScriptFixtureComponentInner(TestScript.TestScriptFixtureComponent element) throws IOException {
58230      composeBackbone(element);
58231      if (element.hasAutocreateElement()) {
58232        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
58233        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
58234      }
58235      if (element.hasAutodeleteElement()) {
58236        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
58237        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
58238      }
58239      if (element.hasResource()) {
58240        composeReference("resource", element.getResource());
58241      }
58242  }
58243
58244  protected void composeTestScriptTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
58245    if (element != null) {
58246      open(name);
58247      composeTestScriptTestScriptVariableComponentInner(element);
58248      close();
58249    }
58250  }
58251
58252  protected void composeTestScriptTestScriptVariableComponentInner(TestScript.TestScriptVariableComponent element) throws IOException {
58253      composeBackbone(element);
58254      if (element.hasNameElement()) {
58255        composeStringCore("name", element.getNameElement(), false);
58256        composeStringExtras("name", element.getNameElement(), false);
58257      }
58258      if (element.hasDefaultValueElement()) {
58259        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
58260        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
58261      }
58262      if (element.hasDescriptionElement()) {
58263        composeStringCore("description", element.getDescriptionElement(), false);
58264        composeStringExtras("description", element.getDescriptionElement(), false);
58265      }
58266      if (element.hasExpressionElement()) {
58267        composeStringCore("expression", element.getExpressionElement(), false);
58268        composeStringExtras("expression", element.getExpressionElement(), false);
58269      }
58270      if (element.hasHeaderFieldElement()) {
58271        composeStringCore("headerField", element.getHeaderFieldElement(), false);
58272        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
58273      }
58274      if (element.hasHintElement()) {
58275        composeStringCore("hint", element.getHintElement(), false);
58276        composeStringExtras("hint", element.getHintElement(), false);
58277      }
58278      if (element.hasPathElement()) {
58279        composeStringCore("path", element.getPathElement(), false);
58280        composeStringExtras("path", element.getPathElement(), false);
58281      }
58282      if (element.hasSourceIdElement()) {
58283        composeIdCore("sourceId", element.getSourceIdElement(), false);
58284        composeIdExtras("sourceId", element.getSourceIdElement(), false);
58285      }
58286  }
58287
58288  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
58289    if (element != null) {
58290      open(name);
58291      composeTestScriptTestScriptSetupComponentInner(element);
58292      close();
58293    }
58294  }
58295
58296  protected void composeTestScriptTestScriptSetupComponentInner(TestScript.TestScriptSetupComponent element) throws IOException {
58297      composeBackbone(element);
58298      if (element.hasAction()) {
58299        openArray("action");
58300        for (TestScript.SetupActionComponent e : element.getAction()) 
58301          composeTestScriptSetupActionComponent(null, e);
58302        closeArray();
58303      };
58304  }
58305
58306  protected void composeTestScriptSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
58307    if (element != null) {
58308      open(name);
58309      composeTestScriptSetupActionComponentInner(element);
58310      close();
58311    }
58312  }
58313
58314  protected void composeTestScriptSetupActionComponentInner(TestScript.SetupActionComponent element) throws IOException {
58315      composeBackbone(element);
58316      if (element.hasOperation()) {
58317        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
58318      }
58319      if (element.hasAssert()) {
58320        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
58321      }
58322  }
58323
58324  protected void composeTestScriptSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
58325    if (element != null) {
58326      open(name);
58327      composeTestScriptSetupActionOperationComponentInner(element);
58328      close();
58329    }
58330  }
58331
58332  protected void composeTestScriptSetupActionOperationComponentInner(TestScript.SetupActionOperationComponent element) throws IOException {
58333      composeBackbone(element);
58334      if (element.hasType()) {
58335        composeCoding("type", element.getType());
58336      }
58337      if (element.hasResourceElement()) {
58338        composeCodeCore("resource", element.getResourceElement(), false);
58339        composeCodeExtras("resource", element.getResourceElement(), false);
58340      }
58341      if (element.hasLabelElement()) {
58342        composeStringCore("label", element.getLabelElement(), false);
58343        composeStringExtras("label", element.getLabelElement(), false);
58344      }
58345      if (element.hasDescriptionElement()) {
58346        composeStringCore("description", element.getDescriptionElement(), false);
58347        composeStringExtras("description", element.getDescriptionElement(), false);
58348      }
58349      if (element.hasAcceptElement()) {
58350        composeCodeCore("accept", element.getAcceptElement(), false);
58351        composeCodeExtras("accept", element.getAcceptElement(), false);
58352      }
58353      if (element.hasContentTypeElement()) {
58354        composeCodeCore("contentType", element.getContentTypeElement(), false);
58355        composeCodeExtras("contentType", element.getContentTypeElement(), false);
58356      }
58357      if (element.hasDestinationElement()) {
58358        composeIntegerCore("destination", element.getDestinationElement(), false);
58359        composeIntegerExtras("destination", element.getDestinationElement(), false);
58360      }
58361      if (element.hasEncodeRequestUrlElement()) {
58362        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
58363        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
58364      }
58365      if (element.hasMethodElement()) {
58366        composeEnumerationCore("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
58367        composeEnumerationExtras("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
58368      }
58369      if (element.hasOriginElement()) {
58370        composeIntegerCore("origin", element.getOriginElement(), false);
58371        composeIntegerExtras("origin", element.getOriginElement(), false);
58372      }
58373      if (element.hasParamsElement()) {
58374        composeStringCore("params", element.getParamsElement(), false);
58375        composeStringExtras("params", element.getParamsElement(), false);
58376      }
58377      if (element.hasRequestHeader()) {
58378        openArray("requestHeader");
58379        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
58380          composeTestScriptSetupActionOperationRequestHeaderComponent(null, e);
58381        closeArray();
58382      };
58383      if (element.hasRequestIdElement()) {
58384        composeIdCore("requestId", element.getRequestIdElement(), false);
58385        composeIdExtras("requestId", element.getRequestIdElement(), false);
58386      }
58387      if (element.hasResponseIdElement()) {
58388        composeIdCore("responseId", element.getResponseIdElement(), false);
58389        composeIdExtras("responseId", element.getResponseIdElement(), false);
58390      }
58391      if (element.hasSourceIdElement()) {
58392        composeIdCore("sourceId", element.getSourceIdElement(), false);
58393        composeIdExtras("sourceId", element.getSourceIdElement(), false);
58394      }
58395      if (element.hasTargetIdElement()) {
58396        composeIdCore("targetId", element.getTargetIdElement(), false);
58397        composeIdExtras("targetId", element.getTargetIdElement(), false);
58398      }
58399      if (element.hasUrlElement()) {
58400        composeStringCore("url", element.getUrlElement(), false);
58401        composeStringExtras("url", element.getUrlElement(), false);
58402      }
58403  }
58404
58405  protected void composeTestScriptSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
58406    if (element != null) {
58407      open(name);
58408      composeTestScriptSetupActionOperationRequestHeaderComponentInner(element);
58409      close();
58410    }
58411  }
58412
58413  protected void composeTestScriptSetupActionOperationRequestHeaderComponentInner(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
58414      composeBackbone(element);
58415      if (element.hasFieldElement()) {
58416        composeStringCore("field", element.getFieldElement(), false);
58417        composeStringExtras("field", element.getFieldElement(), false);
58418      }
58419      if (element.hasValueElement()) {
58420        composeStringCore("value", element.getValueElement(), false);
58421        composeStringExtras("value", element.getValueElement(), false);
58422      }
58423  }
58424
58425  protected void composeTestScriptSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
58426    if (element != null) {
58427      open(name);
58428      composeTestScriptSetupActionAssertComponentInner(element);
58429      close();
58430    }
58431  }
58432
58433  protected void composeTestScriptSetupActionAssertComponentInner(TestScript.SetupActionAssertComponent element) throws IOException {
58434      composeBackbone(element);
58435      if (element.hasLabelElement()) {
58436        composeStringCore("label", element.getLabelElement(), false);
58437        composeStringExtras("label", element.getLabelElement(), false);
58438      }
58439      if (element.hasDescriptionElement()) {
58440        composeStringCore("description", element.getDescriptionElement(), false);
58441        composeStringExtras("description", element.getDescriptionElement(), false);
58442      }
58443      if (element.hasDirectionElement()) {
58444        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
58445        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
58446      }
58447      if (element.hasCompareToSourceIdElement()) {
58448        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
58449        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
58450      }
58451      if (element.hasCompareToSourceExpressionElement()) {
58452        composeStringCore("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
58453        composeStringExtras("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
58454      }
58455      if (element.hasCompareToSourcePathElement()) {
58456        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
58457        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
58458      }
58459      if (element.hasContentTypeElement()) {
58460        composeCodeCore("contentType", element.getContentTypeElement(), false);
58461        composeCodeExtras("contentType", element.getContentTypeElement(), false);
58462      }
58463      if (element.hasExpressionElement()) {
58464        composeStringCore("expression", element.getExpressionElement(), false);
58465        composeStringExtras("expression", element.getExpressionElement(), false);
58466      }
58467      if (element.hasHeaderFieldElement()) {
58468        composeStringCore("headerField", element.getHeaderFieldElement(), false);
58469        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
58470      }
58471      if (element.hasMinimumIdElement()) {
58472        composeStringCore("minimumId", element.getMinimumIdElement(), false);
58473        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
58474      }
58475      if (element.hasNavigationLinksElement()) {
58476        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
58477        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
58478      }
58479      if (element.hasOperatorElement()) {
58480        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
58481        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
58482      }
58483      if (element.hasPathElement()) {
58484        composeStringCore("path", element.getPathElement(), false);
58485        composeStringExtras("path", element.getPathElement(), false);
58486      }
58487      if (element.hasRequestMethodElement()) {
58488        composeEnumerationCore("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
58489        composeEnumerationExtras("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
58490      }
58491      if (element.hasRequestURLElement()) {
58492        composeStringCore("requestURL", element.getRequestURLElement(), false);
58493        composeStringExtras("requestURL", element.getRequestURLElement(), false);
58494      }
58495      if (element.hasResourceElement()) {
58496        composeCodeCore("resource", element.getResourceElement(), false);
58497        composeCodeExtras("resource", element.getResourceElement(), false);
58498      }
58499      if (element.hasResponseElement()) {
58500        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
58501        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
58502      }
58503      if (element.hasResponseCodeElement()) {
58504        composeStringCore("responseCode", element.getResponseCodeElement(), false);
58505        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
58506      }
58507      if (element.hasSourceIdElement()) {
58508        composeIdCore("sourceId", element.getSourceIdElement(), false);
58509        composeIdExtras("sourceId", element.getSourceIdElement(), false);
58510      }
58511      if (element.hasValidateProfileIdElement()) {
58512        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
58513        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
58514      }
58515      if (element.hasValueElement()) {
58516        composeStringCore("value", element.getValueElement(), false);
58517        composeStringExtras("value", element.getValueElement(), false);
58518      }
58519      if (element.hasWarningOnlyElement()) {
58520        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
58521        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
58522      }
58523  }
58524
58525  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
58526    if (element != null) {
58527      open(name);
58528      composeTestScriptTestScriptTestComponentInner(element);
58529      close();
58530    }
58531  }
58532
58533  protected void composeTestScriptTestScriptTestComponentInner(TestScript.TestScriptTestComponent element) throws IOException {
58534      composeBackbone(element);
58535      if (element.hasNameElement()) {
58536        composeStringCore("name", element.getNameElement(), false);
58537        composeStringExtras("name", element.getNameElement(), false);
58538      }
58539      if (element.hasDescriptionElement()) {
58540        composeStringCore("description", element.getDescriptionElement(), false);
58541        composeStringExtras("description", element.getDescriptionElement(), false);
58542      }
58543      if (element.hasAction()) {
58544        openArray("action");
58545        for (TestScript.TestActionComponent e : element.getAction()) 
58546          composeTestScriptTestActionComponent(null, e);
58547        closeArray();
58548      };
58549  }
58550
58551  protected void composeTestScriptTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
58552    if (element != null) {
58553      open(name);
58554      composeTestScriptTestActionComponentInner(element);
58555      close();
58556    }
58557  }
58558
58559  protected void composeTestScriptTestActionComponentInner(TestScript.TestActionComponent element) throws IOException {
58560      composeBackbone(element);
58561      if (element.hasOperation()) {
58562        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
58563      }
58564      if (element.hasAssert()) {
58565        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
58566      }
58567  }
58568
58569  protected void composeTestScriptTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
58570    if (element != null) {
58571      open(name);
58572      composeTestScriptTestScriptTeardownComponentInner(element);
58573      close();
58574    }
58575  }
58576
58577  protected void composeTestScriptTestScriptTeardownComponentInner(TestScript.TestScriptTeardownComponent element) throws IOException {
58578      composeBackbone(element);
58579      if (element.hasAction()) {
58580        openArray("action");
58581        for (TestScript.TeardownActionComponent e : element.getAction()) 
58582          composeTestScriptTeardownActionComponent(null, e);
58583        closeArray();
58584      };
58585  }
58586
58587  protected void composeTestScriptTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
58588    if (element != null) {
58589      open(name);
58590      composeTestScriptTeardownActionComponentInner(element);
58591      close();
58592    }
58593  }
58594
58595  protected void composeTestScriptTeardownActionComponentInner(TestScript.TeardownActionComponent element) throws IOException {
58596      composeBackbone(element);
58597      if (element.hasOperation()) {
58598        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
58599      }
58600  }
58601
58602  protected void composeTopic(String name, Topic element) throws IOException {
58603    if (element != null) {
58604      prop("resourceType", name);
58605      composeTopicInner(element);
58606    }
58607  }
58608
58609  protected void composeTopicInner(Topic element) throws IOException {
58610      composeDomainResourceElements(element);
58611      if (element.hasUrlElement()) {
58612        composeUriCore("url", element.getUrlElement(), false);
58613        composeUriExtras("url", element.getUrlElement(), false);
58614      }
58615      if (element.hasIdentifier()) {
58616        openArray("identifier");
58617        for (Identifier e : element.getIdentifier()) 
58618          composeIdentifier(null, e);
58619        closeArray();
58620      };
58621      if (element.hasVersionElement()) {
58622        composeStringCore("version", element.getVersionElement(), false);
58623        composeStringExtras("version", element.getVersionElement(), false);
58624      }
58625      if (element.hasTitleElement()) {
58626        composeStringCore("title", element.getTitleElement(), false);
58627        composeStringExtras("title", element.getTitleElement(), false);
58628      }
58629      if (element.hasDerivedFromCanonical()) {
58630        openArray("derivedFromCanonical");
58631        for (CanonicalType e : element.getDerivedFromCanonical()) 
58632          composeCanonicalCore(null, e, true);
58633        closeArray();
58634        if (anyHasExtras(element.getDerivedFromCanonical())) {
58635          openArray("_derivedFromCanonical");
58636          for (CanonicalType e : element.getDerivedFromCanonical()) 
58637            composeCanonicalExtras(null, e, true);
58638          closeArray();
58639        }
58640      };
58641      if (element.hasDerivedFromUri()) {
58642        openArray("derivedFromUri");
58643        for (UriType e : element.getDerivedFromUri()) 
58644          composeUriCore(null, e, true);
58645        closeArray();
58646        if (anyHasExtras(element.getDerivedFromUri())) {
58647          openArray("_derivedFromUri");
58648          for (UriType e : element.getDerivedFromUri()) 
58649            composeUriExtras(null, e, true);
58650          closeArray();
58651        }
58652      };
58653      if (element.hasStatusElement()) {
58654        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58655        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58656      }
58657      if (element.hasExperimentalElement()) {
58658        composeBooleanCore("experimental", element.getExperimentalElement(), false);
58659        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
58660      }
58661      if (element.hasDateElement()) {
58662        composeDateTimeCore("date", element.getDateElement(), false);
58663        composeDateTimeExtras("date", element.getDateElement(), false);
58664      }
58665      if (element.hasPublisher()) {
58666        composeReference("publisher", element.getPublisher());
58667      }
58668      if (element.hasContact()) {
58669        openArray("contact");
58670        for (ContactDetail e : element.getContact()) 
58671          composeContactDetail(null, e);
58672        closeArray();
58673      };
58674      if (element.hasDescriptionElement()) {
58675        composeMarkdownCore("description", element.getDescriptionElement(), false);
58676        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58677      }
58678      if (element.hasUseContext()) {
58679        openArray("useContext");
58680        for (UsageContext e : element.getUseContext()) 
58681          composeUsageContext(null, e);
58682        closeArray();
58683      };
58684      if (element.hasJurisdiction()) {
58685        openArray("jurisdiction");
58686        for (CodeableConcept e : element.getJurisdiction()) 
58687          composeCodeableConcept(null, e);
58688        closeArray();
58689      };
58690      if (element.hasPurposeElement()) {
58691        composeMarkdownCore("purpose", element.getPurposeElement(), false);
58692        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
58693      }
58694      if (element.hasCopyrightElement()) {
58695        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
58696        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
58697      }
58698      if (element.hasApprovalDateElement()) {
58699        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
58700        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
58701      }
58702      if (element.hasLastReviewDateElement()) {
58703        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
58704        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
58705      }
58706      if (element.hasEffectivePeriod()) {
58707        composePeriod("effectivePeriod", element.getEffectivePeriod());
58708      }
58709      if (element.hasResourceTrigger()) {
58710        composeTopicTopicResourceTriggerComponent("resourceTrigger", element.getResourceTrigger());
58711      }
58712      if (element.hasCanFilterBy()) {
58713        openArray("canFilterBy");
58714        for (Topic.TopicCanFilterByComponent e : element.getCanFilterBy()) 
58715          composeTopicTopicCanFilterByComponent(null, e);
58716        closeArray();
58717      };
58718  }
58719
58720  protected void composeTopicTopicResourceTriggerComponent(String name, Topic.TopicResourceTriggerComponent element) throws IOException {
58721    if (element != null) {
58722      open(name);
58723      composeTopicTopicResourceTriggerComponentInner(element);
58724      close();
58725    }
58726  }
58727
58728  protected void composeTopicTopicResourceTriggerComponentInner(Topic.TopicResourceTriggerComponent element) throws IOException {
58729      composeBackbone(element);
58730      if (element.hasDescriptionElement()) {
58731        composeStringCore("description", element.getDescriptionElement(), false);
58732        composeStringExtras("description", element.getDescriptionElement(), false);
58733      }
58734      if (element.hasResourceType()) {
58735        openArray("resourceType");
58736        for (Enumeration<Topic.FHIRType> e : element.getResourceType()) 
58737          composeEnumerationCore(null, e, new Topic.FHIRTypeEnumFactory(), true);
58738        closeArray();
58739        if (anyHasExtras(element.getResourceType())) {
58740          openArray("_resourceType");
58741          for (Enumeration<Topic.FHIRType> e : element.getResourceType()) 
58742            composeEnumerationExtras(null, e, new Topic.FHIRTypeEnumFactory(), true);
58743          closeArray();
58744        }
58745      };
58746      if (element.hasMethodCriteria()) {
58747        openArray("methodCriteria");
58748        for (Enumeration<Topic.MethodCode> e : element.getMethodCriteria()) 
58749          composeEnumerationCore(null, e, new Topic.MethodCodeEnumFactory(), true);
58750        closeArray();
58751        if (anyHasExtras(element.getMethodCriteria())) {
58752          openArray("_methodCriteria");
58753          for (Enumeration<Topic.MethodCode> e : element.getMethodCriteria()) 
58754            composeEnumerationExtras(null, e, new Topic.MethodCodeEnumFactory(), true);
58755          closeArray();
58756        }
58757      };
58758      if (element.hasQueryCriteria()) {
58759        composeTopicTopicResourceTriggerQueryCriteriaComponent("queryCriteria", element.getQueryCriteria());
58760      }
58761      if (element.hasFhirPathCriteriaElement()) {
58762        composeStringCore("fhirPathCriteria", element.getFhirPathCriteriaElement(), false);
58763        composeStringExtras("fhirPathCriteria", element.getFhirPathCriteriaElement(), false);
58764      }
58765  }
58766
58767  protected void composeTopicTopicResourceTriggerQueryCriteriaComponent(String name, Topic.TopicResourceTriggerQueryCriteriaComponent element) throws IOException {
58768    if (element != null) {
58769      open(name);
58770      composeTopicTopicResourceTriggerQueryCriteriaComponentInner(element);
58771      close();
58772    }
58773  }
58774
58775  protected void composeTopicTopicResourceTriggerQueryCriteriaComponentInner(Topic.TopicResourceTriggerQueryCriteriaComponent element) throws IOException {
58776      composeBackbone(element);
58777      if (element.hasPreviousElement()) {
58778        composeStringCore("previous", element.getPreviousElement(), false);
58779        composeStringExtras("previous", element.getPreviousElement(), false);
58780      }
58781      if (element.hasCurrentElement()) {
58782        composeStringCore("current", element.getCurrentElement(), false);
58783        composeStringExtras("current", element.getCurrentElement(), false);
58784      }
58785      if (element.hasRequireBothElement()) {
58786        composeBooleanCore("requireBoth", element.getRequireBothElement(), false);
58787        composeBooleanExtras("requireBoth", element.getRequireBothElement(), false);
58788      }
58789  }
58790
58791  protected void composeTopicTopicCanFilterByComponent(String name, Topic.TopicCanFilterByComponent element) throws IOException {
58792    if (element != null) {
58793      open(name);
58794      composeTopicTopicCanFilterByComponentInner(element);
58795      close();
58796    }
58797  }
58798
58799  protected void composeTopicTopicCanFilterByComponentInner(Topic.TopicCanFilterByComponent element) throws IOException {
58800      composeBackbone(element);
58801      if (element.hasNameElement()) {
58802        composeStringCore("name", element.getNameElement(), false);
58803        composeStringExtras("name", element.getNameElement(), false);
58804      }
58805      if (element.hasMatchType()) {
58806        openArray("matchType");
58807        for (Enumeration<Topic.TopicFilterByMatchType> e : element.getMatchType()) 
58808          composeEnumerationCore(null, e, new Topic.TopicFilterByMatchTypeEnumFactory(), true);
58809        closeArray();
58810        if (anyHasExtras(element.getMatchType())) {
58811          openArray("_matchType");
58812          for (Enumeration<Topic.TopicFilterByMatchType> e : element.getMatchType()) 
58813            composeEnumerationExtras(null, e, new Topic.TopicFilterByMatchTypeEnumFactory(), true);
58814          closeArray();
58815        }
58816      };
58817      if (element.hasDocumentationElement()) {
58818        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
58819        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
58820      }
58821  }
58822
58823  protected void composeValueSet(String name, ValueSet element) throws IOException {
58824    if (element != null) {
58825      prop("resourceType", name);
58826      composeValueSetInner(element);
58827    }
58828  }
58829
58830  protected void composeValueSetInner(ValueSet element) throws IOException {
58831      composeDomainResourceElements(element);
58832      if (element.hasUrlElement()) {
58833        composeUriCore("url", element.getUrlElement(), false);
58834        composeUriExtras("url", element.getUrlElement(), false);
58835      }
58836      if (element.hasIdentifier()) {
58837        openArray("identifier");
58838        for (Identifier e : element.getIdentifier()) 
58839          composeIdentifier(null, e);
58840        closeArray();
58841      };
58842      if (element.hasVersionElement()) {
58843        composeStringCore("version", element.getVersionElement(), false);
58844        composeStringExtras("version", element.getVersionElement(), false);
58845      }
58846      if (element.hasNameElement()) {
58847        composeStringCore("name", element.getNameElement(), false);
58848        composeStringExtras("name", element.getNameElement(), false);
58849      }
58850      if (element.hasTitleElement()) {
58851        composeStringCore("title", element.getTitleElement(), false);
58852        composeStringExtras("title", element.getTitleElement(), false);
58853      }
58854      if (element.hasStatusElement()) {
58855        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58856        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58857      }
58858      if (element.hasExperimentalElement()) {
58859        composeBooleanCore("experimental", element.getExperimentalElement(), false);
58860        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
58861      }
58862      if (element.hasDateElement()) {
58863        composeDateTimeCore("date", element.getDateElement(), false);
58864        composeDateTimeExtras("date", element.getDateElement(), false);
58865      }
58866      if (element.hasPublisherElement()) {
58867        composeStringCore("publisher", element.getPublisherElement(), false);
58868        composeStringExtras("publisher", element.getPublisherElement(), false);
58869      }
58870      if (element.hasContact()) {
58871        openArray("contact");
58872        for (ContactDetail e : element.getContact()) 
58873          composeContactDetail(null, e);
58874        closeArray();
58875      };
58876      if (element.hasDescriptionElement()) {
58877        composeMarkdownCore("description", element.getDescriptionElement(), false);
58878        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58879      }
58880      if (element.hasUseContext()) {
58881        openArray("useContext");
58882        for (UsageContext e : element.getUseContext()) 
58883          composeUsageContext(null, e);
58884        closeArray();
58885      };
58886      if (element.hasJurisdiction()) {
58887        openArray("jurisdiction");
58888        for (CodeableConcept e : element.getJurisdiction()) 
58889          composeCodeableConcept(null, e);
58890        closeArray();
58891      };
58892      if (element.hasImmutableElement()) {
58893        composeBooleanCore("immutable", element.getImmutableElement(), false);
58894        composeBooleanExtras("immutable", element.getImmutableElement(), false);
58895      }
58896      if (element.hasPurposeElement()) {
58897        composeMarkdownCore("purpose", element.getPurposeElement(), false);
58898        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
58899      }
58900      if (element.hasCopyrightElement()) {
58901        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
58902        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
58903      }
58904      if (element.hasCompose()) {
58905        composeValueSetValueSetComposeComponent("compose", element.getCompose());
58906      }
58907      if (element.hasExpansion()) {
58908        composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
58909      }
58910  }
58911
58912  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
58913    if (element != null) {
58914      open(name);
58915      composeValueSetValueSetComposeComponentInner(element);
58916      close();
58917    }
58918  }
58919
58920  protected void composeValueSetValueSetComposeComponentInner(ValueSet.ValueSetComposeComponent element) throws IOException {
58921      composeBackbone(element);
58922      if (element.hasLockedDateElement()) {
58923        composeDateCore("lockedDate", element.getLockedDateElement(), false);
58924        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
58925      }
58926      if (element.hasInactiveElement()) {
58927        composeBooleanCore("inactive", element.getInactiveElement(), false);
58928        composeBooleanExtras("inactive", element.getInactiveElement(), false);
58929      }
58930      if (element.hasInclude()) {
58931        openArray("include");
58932        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
58933          composeValueSetConceptSetComponent(null, e);
58934        closeArray();
58935      };
58936      if (element.hasExclude()) {
58937        openArray("exclude");
58938        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
58939          composeValueSetConceptSetComponent(null, e);
58940        closeArray();
58941      };
58942      if (element.hasProperty()) {
58943        openArray("property");
58944        for (StringType e : element.getProperty()) 
58945          composeStringCore(null, e, true);
58946        closeArray();
58947        if (anyHasExtras(element.getProperty())) {
58948          openArray("_property");
58949          for (StringType e : element.getProperty()) 
58950            composeStringExtras(null, e, true);
58951          closeArray();
58952        }
58953      };
58954  }
58955
58956  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
58957    if (element != null) {
58958      open(name);
58959      composeValueSetConceptSetComponentInner(element);
58960      close();
58961    }
58962  }
58963
58964  protected void composeValueSetConceptSetComponentInner(ValueSet.ConceptSetComponent element) throws IOException {
58965      composeBackbone(element);
58966      if (element.hasSystemElement()) {
58967        composeUriCore("system", element.getSystemElement(), false);
58968        composeUriExtras("system", element.getSystemElement(), false);
58969      }
58970      if (element.hasVersionElement()) {
58971        composeStringCore("version", element.getVersionElement(), false);
58972        composeStringExtras("version", element.getVersionElement(), false);
58973      }
58974      if (element.hasConcept()) {
58975        openArray("concept");
58976        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
58977          composeValueSetConceptReferenceComponent(null, e);
58978        closeArray();
58979      };
58980      if (element.hasFilter()) {
58981        openArray("filter");
58982        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
58983          composeValueSetConceptSetFilterComponent(null, e);
58984        closeArray();
58985      };
58986      if (element.hasValueSet()) {
58987        openArray("valueSet");
58988        for (CanonicalType e : element.getValueSet()) 
58989          composeCanonicalCore(null, e, true);
58990        closeArray();
58991        if (anyHasExtras(element.getValueSet())) {
58992          openArray("_valueSet");
58993          for (CanonicalType e : element.getValueSet()) 
58994            composeCanonicalExtras(null, e, true);
58995          closeArray();
58996        }
58997      };
58998  }
58999
59000  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
59001    if (element != null) {
59002      open(name);
59003      composeValueSetConceptReferenceComponentInner(element);
59004      close();
59005    }
59006  }
59007
59008  protected void composeValueSetConceptReferenceComponentInner(ValueSet.ConceptReferenceComponent element) throws IOException {
59009      composeBackbone(element);
59010      if (element.hasCodeElement()) {
59011        composeCodeCore("code", element.getCodeElement(), false);
59012        composeCodeExtras("code", element.getCodeElement(), false);
59013      }
59014      if (element.hasDisplayElement()) {
59015        composeStringCore("display", element.getDisplayElement(), false);
59016        composeStringExtras("display", element.getDisplayElement(), false);
59017      }
59018      if (element.hasDesignation()) {
59019        openArray("designation");
59020        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
59021          composeValueSetConceptReferenceDesignationComponent(null, e);
59022        closeArray();
59023      };
59024  }
59025
59026  protected void composeValueSetConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
59027    if (element != null) {
59028      open(name);
59029      composeValueSetConceptReferenceDesignationComponentInner(element);
59030      close();
59031    }
59032  }
59033
59034  protected void composeValueSetConceptReferenceDesignationComponentInner(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
59035      composeBackbone(element);
59036      if (element.hasLanguageElement()) {
59037        composeCodeCore("language", element.getLanguageElement(), false);
59038        composeCodeExtras("language", element.getLanguageElement(), false);
59039      }
59040      if (element.hasUse()) {
59041        composeCoding("use", element.getUse());
59042      }
59043      if (element.hasValueElement()) {
59044        composeStringCore("value", element.getValueElement(), false);
59045        composeStringExtras("value", element.getValueElement(), false);
59046      }
59047  }
59048
59049  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
59050    if (element != null) {
59051      open(name);
59052      composeValueSetConceptSetFilterComponentInner(element);
59053      close();
59054    }
59055  }
59056
59057  protected void composeValueSetConceptSetFilterComponentInner(ValueSet.ConceptSetFilterComponent element) throws IOException {
59058      composeBackbone(element);
59059      if (element.hasPropertyElement()) {
59060        composeCodeCore("property", element.getPropertyElement(), false);
59061        composeCodeExtras("property", element.getPropertyElement(), false);
59062      }
59063      if (element.hasOpElement()) {
59064        composeEnumerationCore("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
59065        composeEnumerationExtras("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
59066      }
59067      if (element.hasValueElement()) {
59068        composeStringCore("value", element.getValueElement(), false);
59069        composeStringExtras("value", element.getValueElement(), false);
59070      }
59071  }
59072
59073  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
59074    if (element != null) {
59075      open(name);
59076      composeValueSetValueSetExpansionComponentInner(element);
59077      close();
59078    }
59079  }
59080
59081  protected void composeValueSetValueSetExpansionComponentInner(ValueSet.ValueSetExpansionComponent element) throws IOException {
59082      composeBackbone(element);
59083      if (element.hasIdentifierElement()) {
59084        composeUriCore("identifier", element.getIdentifierElement(), false);
59085        composeUriExtras("identifier", element.getIdentifierElement(), false);
59086      }
59087      if (element.hasTimestampElement()) {
59088        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
59089        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
59090      }
59091      if (element.hasTotalElement()) {
59092        composeIntegerCore("total", element.getTotalElement(), false);
59093        composeIntegerExtras("total", element.getTotalElement(), false);
59094      }
59095      if (element.hasOffsetElement()) {
59096        composeIntegerCore("offset", element.getOffsetElement(), false);
59097        composeIntegerExtras("offset", element.getOffsetElement(), false);
59098      }
59099      if (element.hasParameter()) {
59100        openArray("parameter");
59101        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
59102          composeValueSetValueSetExpansionParameterComponent(null, e);
59103        closeArray();
59104      };
59105      if (element.hasProperty()) {
59106        openArray("property");
59107        for (ValueSet.ValueSetExpansionPropertyComponent e : element.getProperty()) 
59108          composeValueSetValueSetExpansionPropertyComponent(null, e);
59109        closeArray();
59110      };
59111      if (element.hasContains()) {
59112        openArray("contains");
59113        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
59114          composeValueSetValueSetExpansionContainsComponent(null, e);
59115        closeArray();
59116      };
59117  }
59118
59119  protected void composeValueSetValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
59120    if (element != null) {
59121      open(name);
59122      composeValueSetValueSetExpansionParameterComponentInner(element);
59123      close();
59124    }
59125  }
59126
59127  protected void composeValueSetValueSetExpansionParameterComponentInner(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
59128      composeBackbone(element);
59129      if (element.hasNameElement()) {
59130        composeStringCore("name", element.getNameElement(), false);
59131        composeStringExtras("name", element.getNameElement(), false);
59132      }
59133      if (element.hasValue()) {
59134        composeType("value", element.getValue());
59135      }
59136  }
59137
59138  protected void composeValueSetValueSetExpansionPropertyComponent(String name, ValueSet.ValueSetExpansionPropertyComponent element) throws IOException {
59139    if (element != null) {
59140      open(name);
59141      composeValueSetValueSetExpansionPropertyComponentInner(element);
59142      close();
59143    }
59144  }
59145
59146  protected void composeValueSetValueSetExpansionPropertyComponentInner(ValueSet.ValueSetExpansionPropertyComponent element) throws IOException {
59147      composeBackbone(element);
59148      if (element.hasCodeElement()) {
59149        composeCodeCore("code", element.getCodeElement(), false);
59150        composeCodeExtras("code", element.getCodeElement(), false);
59151      }
59152      if (element.hasUriElement()) {
59153        composeUriCore("uri", element.getUriElement(), false);
59154        composeUriExtras("uri", element.getUriElement(), false);
59155      }
59156  }
59157
59158  protected void composeValueSetValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
59159    if (element != null) {
59160      open(name);
59161      composeValueSetValueSetExpansionContainsComponentInner(element);
59162      close();
59163    }
59164  }
59165
59166  protected void composeValueSetValueSetExpansionContainsComponentInner(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
59167      composeBackbone(element);
59168      if (element.hasSystemElement()) {
59169        composeUriCore("system", element.getSystemElement(), false);
59170        composeUriExtras("system", element.getSystemElement(), false);
59171      }
59172      if (element.hasAbstractElement()) {
59173        composeBooleanCore("abstract", element.getAbstractElement(), false);
59174        composeBooleanExtras("abstract", element.getAbstractElement(), false);
59175      }
59176      if (element.hasInactiveElement()) {
59177        composeBooleanCore("inactive", element.getInactiveElement(), false);
59178        composeBooleanExtras("inactive", element.getInactiveElement(), false);
59179      }
59180      if (element.hasVersionElement()) {
59181        composeStringCore("version", element.getVersionElement(), false);
59182        composeStringExtras("version", element.getVersionElement(), false);
59183      }
59184      if (element.hasCodeElement()) {
59185        composeCodeCore("code", element.getCodeElement(), false);
59186        composeCodeExtras("code", element.getCodeElement(), false);
59187      }
59188      if (element.hasDisplayElement()) {
59189        composeStringCore("display", element.getDisplayElement(), false);
59190        composeStringExtras("display", element.getDisplayElement(), false);
59191      }
59192      if (element.hasDesignation()) {
59193        openArray("designation");
59194        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
59195          composeValueSetConceptReferenceDesignationComponent(null, e);
59196        closeArray();
59197      };
59198      if (element.hasProperty()) {
59199        openArray("property");
59200        for (ValueSet.ConceptPropertyComponent e : element.getProperty()) 
59201          composeValueSetConceptPropertyComponent(null, e);
59202        closeArray();
59203      };
59204      if (element.hasContains()) {
59205        openArray("contains");
59206        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
59207          composeValueSetValueSetExpansionContainsComponent(null, e);
59208        closeArray();
59209      };
59210  }
59211
59212  protected void composeValueSetConceptPropertyComponent(String name, ValueSet.ConceptPropertyComponent element) throws IOException {
59213    if (element != null) {
59214      open(name);
59215      composeValueSetConceptPropertyComponentInner(element);
59216      close();
59217    }
59218  }
59219
59220  protected void composeValueSetConceptPropertyComponentInner(ValueSet.ConceptPropertyComponent element) throws IOException {
59221      composeBackbone(element);
59222      if (element.hasCodeElement()) {
59223        composeCodeCore("code", element.getCodeElement(), false);
59224        composeCodeExtras("code", element.getCodeElement(), false);
59225      }
59226      if (element.hasValue()) {
59227        composeType("value", element.getValue());
59228      }
59229  }
59230
59231  protected void composeVerificationResult(String name, VerificationResult element) throws IOException {
59232    if (element != null) {
59233      prop("resourceType", name);
59234      composeVerificationResultInner(element);
59235    }
59236  }
59237
59238  protected void composeVerificationResultInner(VerificationResult element) throws IOException {
59239      composeDomainResourceElements(element);
59240      if (element.hasTarget()) {
59241        openArray("target");
59242        for (Reference e : element.getTarget()) 
59243          composeReference(null, e);
59244        closeArray();
59245      };
59246      if (element.hasTargetLocation()) {
59247        openArray("targetLocation");
59248        for (StringType e : element.getTargetLocation()) 
59249          composeStringCore(null, e, true);
59250        closeArray();
59251        if (anyHasExtras(element.getTargetLocation())) {
59252          openArray("_targetLocation");
59253          for (StringType e : element.getTargetLocation()) 
59254            composeStringExtras(null, e, true);
59255          closeArray();
59256        }
59257      };
59258      if (element.hasNeed()) {
59259        composeCodeableConcept("need", element.getNeed());
59260      }
59261      if (element.hasStatusElement()) {
59262        composeEnumerationCore("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
59263        composeEnumerationExtras("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
59264      }
59265      if (element.hasStatusDateElement()) {
59266        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
59267        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
59268      }
59269      if (element.hasValidationType()) {
59270        composeCodeableConcept("validationType", element.getValidationType());
59271      }
59272      if (element.hasValidationProcess()) {
59273        openArray("validationProcess");
59274        for (CodeableConcept e : element.getValidationProcess()) 
59275          composeCodeableConcept(null, e);
59276        closeArray();
59277      };
59278      if (element.hasFrequency()) {
59279        composeTiming("frequency", element.getFrequency());
59280      }
59281      if (element.hasLastPerformedElement()) {
59282        composeDateTimeCore("lastPerformed", element.getLastPerformedElement(), false);
59283        composeDateTimeExtras("lastPerformed", element.getLastPerformedElement(), false);
59284      }
59285      if (element.hasNextScheduledElement()) {
59286        composeDateCore("nextScheduled", element.getNextScheduledElement(), false);
59287        composeDateExtras("nextScheduled", element.getNextScheduledElement(), false);
59288      }
59289      if (element.hasFailureAction()) {
59290        composeCodeableConcept("failureAction", element.getFailureAction());
59291      }
59292      if (element.hasPrimarySource()) {
59293        openArray("primarySource");
59294        for (VerificationResult.VerificationResultPrimarySourceComponent e : element.getPrimarySource()) 
59295          composeVerificationResultVerificationResultPrimarySourceComponent(null, e);
59296        closeArray();
59297      };
59298      if (element.hasAttestation()) {
59299        composeVerificationResultVerificationResultAttestationComponent("attestation", element.getAttestation());
59300      }
59301      if (element.hasValidator()) {
59302        openArray("validator");
59303        for (VerificationResult.VerificationResultValidatorComponent e : element.getValidator()) 
59304          composeVerificationResultVerificationResultValidatorComponent(null, e);
59305        closeArray();
59306      };
59307  }
59308
59309  protected void composeVerificationResultVerificationResultPrimarySourceComponent(String name, VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
59310    if (element != null) {
59311      open(name);
59312      composeVerificationResultVerificationResultPrimarySourceComponentInner(element);
59313      close();
59314    }
59315  }
59316
59317  protected void composeVerificationResultVerificationResultPrimarySourceComponentInner(VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
59318      composeBackbone(element);
59319      if (element.hasWho()) {
59320        composeReference("who", element.getWho());
59321      }
59322      if (element.hasType()) {
59323        openArray("type");
59324        for (CodeableConcept e : element.getType()) 
59325          composeCodeableConcept(null, e);
59326        closeArray();
59327      };
59328      if (element.hasCommunicationMethod()) {
59329        openArray("communicationMethod");
59330        for (CodeableConcept e : element.getCommunicationMethod()) 
59331          composeCodeableConcept(null, e);
59332        closeArray();
59333      };
59334      if (element.hasValidationStatus()) {
59335        composeCodeableConcept("validationStatus", element.getValidationStatus());
59336      }
59337      if (element.hasValidationDateElement()) {
59338        composeDateTimeCore("validationDate", element.getValidationDateElement(), false);
59339        composeDateTimeExtras("validationDate", element.getValidationDateElement(), false);
59340      }
59341      if (element.hasCanPushUpdates()) {
59342        composeCodeableConcept("canPushUpdates", element.getCanPushUpdates());
59343      }
59344      if (element.hasPushTypeAvailable()) {
59345        openArray("pushTypeAvailable");
59346        for (CodeableConcept e : element.getPushTypeAvailable()) 
59347          composeCodeableConcept(null, e);
59348        closeArray();
59349      };
59350  }
59351
59352  protected void composeVerificationResultVerificationResultAttestationComponent(String name, VerificationResult.VerificationResultAttestationComponent element) throws IOException {
59353    if (element != null) {
59354      open(name);
59355      composeVerificationResultVerificationResultAttestationComponentInner(element);
59356      close();
59357    }
59358  }
59359
59360  protected void composeVerificationResultVerificationResultAttestationComponentInner(VerificationResult.VerificationResultAttestationComponent element) throws IOException {
59361      composeBackbone(element);
59362      if (element.hasWho()) {
59363        composeReference("who", element.getWho());
59364      }
59365      if (element.hasOnBehalfOf()) {
59366        composeReference("onBehalfOf", element.getOnBehalfOf());
59367      }
59368      if (element.hasCommunicationMethod()) {
59369        composeCodeableConcept("communicationMethod", element.getCommunicationMethod());
59370      }
59371      if (element.hasDateElement()) {
59372        composeDateCore("date", element.getDateElement(), false);
59373        composeDateExtras("date", element.getDateElement(), false);
59374      }
59375      if (element.hasSourceIdentityCertificateElement()) {
59376        composeStringCore("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
59377        composeStringExtras("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
59378      }
59379      if (element.hasProxyIdentityCertificateElement()) {
59380        composeStringCore("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
59381        composeStringExtras("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
59382      }
59383      if (element.hasProxySignature()) {
59384        composeSignature("proxySignature", element.getProxySignature());
59385      }
59386      if (element.hasSourceSignature()) {
59387        composeSignature("sourceSignature", element.getSourceSignature());
59388      }
59389  }
59390
59391  protected void composeVerificationResultVerificationResultValidatorComponent(String name, VerificationResult.VerificationResultValidatorComponent element) throws IOException {
59392    if (element != null) {
59393      open(name);
59394      composeVerificationResultVerificationResultValidatorComponentInner(element);
59395      close();
59396    }
59397  }
59398
59399  protected void composeVerificationResultVerificationResultValidatorComponentInner(VerificationResult.VerificationResultValidatorComponent element) throws IOException {
59400      composeBackbone(element);
59401      if (element.hasOrganization()) {
59402        composeReference("organization", element.getOrganization());
59403      }
59404      if (element.hasIdentityCertificateElement()) {
59405        composeStringCore("identityCertificate", element.getIdentityCertificateElement(), false);
59406        composeStringExtras("identityCertificate", element.getIdentityCertificateElement(), false);
59407      }
59408      if (element.hasAttestationSignature()) {
59409        composeSignature("attestationSignature", element.getAttestationSignature());
59410      }
59411  }
59412
59413  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
59414    if (element != null) {
59415      prop("resourceType", name);
59416      composeVisionPrescriptionInner(element);
59417    }
59418  }
59419
59420  protected void composeVisionPrescriptionInner(VisionPrescription element) throws IOException {
59421      composeDomainResourceElements(element);
59422      if (element.hasIdentifier()) {
59423        openArray("identifier");
59424        for (Identifier e : element.getIdentifier()) 
59425          composeIdentifier(null, e);
59426        closeArray();
59427      };
59428      if (element.hasStatusElement()) {
59429        composeEnumerationCore("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
59430        composeEnumerationExtras("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
59431      }
59432      if (element.hasCreatedElement()) {
59433        composeDateTimeCore("created", element.getCreatedElement(), false);
59434        composeDateTimeExtras("created", element.getCreatedElement(), false);
59435      }
59436      if (element.hasPatient()) {
59437        composeReference("patient", element.getPatient());
59438      }
59439      if (element.hasEncounter()) {
59440        composeReference("encounter", element.getEncounter());
59441      }
59442      if (element.hasDateWrittenElement()) {
59443        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
59444        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
59445      }
59446      if (element.hasPrescriber()) {
59447        composeReference("prescriber", element.getPrescriber());
59448      }
59449      if (element.hasLensSpecification()) {
59450        openArray("lensSpecification");
59451        for (VisionPrescription.VisionPrescriptionLensSpecificationComponent e : element.getLensSpecification()) 
59452          composeVisionPrescriptionVisionPrescriptionLensSpecificationComponent(null, e);
59453        closeArray();
59454      };
59455  }
59456
59457  protected void composeVisionPrescriptionVisionPrescriptionLensSpecificationComponent(String name, VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
59458    if (element != null) {
59459      open(name);
59460      composeVisionPrescriptionVisionPrescriptionLensSpecificationComponentInner(element);
59461      close();
59462    }
59463  }
59464
59465  protected void composeVisionPrescriptionVisionPrescriptionLensSpecificationComponentInner(VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
59466      composeBackbone(element);
59467      if (element.hasProduct()) {
59468        composeCodeableConcept("product", element.getProduct());
59469      }
59470      if (element.hasEyeElement()) {
59471        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
59472        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
59473      }
59474      if (element.hasSphereElement()) {
59475        composeDecimalCore("sphere", element.getSphereElement(), false);
59476        composeDecimalExtras("sphere", element.getSphereElement(), false);
59477      }
59478      if (element.hasCylinderElement()) {
59479        composeDecimalCore("cylinder", element.getCylinderElement(), false);
59480        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
59481      }
59482      if (element.hasAxisElement()) {
59483        composeIntegerCore("axis", element.getAxisElement(), false);
59484        composeIntegerExtras("axis", element.getAxisElement(), false);
59485      }
59486      if (element.hasPrism()) {
59487        openArray("prism");
59488        for (VisionPrescription.PrismComponent e : element.getPrism()) 
59489          composeVisionPrescriptionPrismComponent(null, e);
59490        closeArray();
59491      };
59492      if (element.hasAddElement()) {
59493        composeDecimalCore("add", element.getAddElement(), false);
59494        composeDecimalExtras("add", element.getAddElement(), false);
59495      }
59496      if (element.hasPowerElement()) {
59497        composeDecimalCore("power", element.getPowerElement(), false);
59498        composeDecimalExtras("power", element.getPowerElement(), false);
59499      }
59500      if (element.hasBackCurveElement()) {
59501        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
59502        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
59503      }
59504      if (element.hasDiameterElement()) {
59505        composeDecimalCore("diameter", element.getDiameterElement(), false);
59506        composeDecimalExtras("diameter", element.getDiameterElement(), false);
59507      }
59508      if (element.hasDuration()) {
59509        composeQuantity("duration", element.getDuration());
59510      }
59511      if (element.hasColorElement()) {
59512        composeStringCore("color", element.getColorElement(), false);
59513        composeStringExtras("color", element.getColorElement(), false);
59514      }
59515      if (element.hasBrandElement()) {
59516        composeStringCore("brand", element.getBrandElement(), false);
59517        composeStringExtras("brand", element.getBrandElement(), false);
59518      }
59519      if (element.hasNote()) {
59520        openArray("note");
59521        for (Annotation e : element.getNote()) 
59522          composeAnnotation(null, e);
59523        closeArray();
59524      };
59525  }
59526
59527  protected void composeVisionPrescriptionPrismComponent(String name, VisionPrescription.PrismComponent element) throws IOException {
59528    if (element != null) {
59529      open(name);
59530      composeVisionPrescriptionPrismComponentInner(element);
59531      close();
59532    }
59533  }
59534
59535  protected void composeVisionPrescriptionPrismComponentInner(VisionPrescription.PrismComponent element) throws IOException {
59536      composeBackbone(element);
59537      if (element.hasAmountElement()) {
59538        composeDecimalCore("amount", element.getAmountElement(), false);
59539        composeDecimalExtras("amount", element.getAmountElement(), false);
59540      }
59541      if (element.hasBaseElement()) {
59542        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
59543        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
59544      }
59545  }
59546
59547  @Override
59548  protected void composeResource(Resource resource) throws IOException {
59549    if (resource instanceof Parameters)
59550      composeParameters("Parameters", (Parameters)resource);
59551    else if (resource instanceof Account)
59552      composeAccount("Account", (Account)resource);
59553    else if (resource instanceof ActivityDefinition)
59554      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
59555    else if (resource instanceof AdministrableProductDefinition)
59556      composeAdministrableProductDefinition("AdministrableProductDefinition", (AdministrableProductDefinition)resource);
59557    else if (resource instanceof AdverseEvent)
59558      composeAdverseEvent("AdverseEvent", (AdverseEvent)resource);
59559    else if (resource instanceof AllergyIntolerance)
59560      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
59561    else if (resource instanceof Appointment)
59562      composeAppointment("Appointment", (Appointment)resource);
59563    else if (resource instanceof AppointmentResponse)
59564      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
59565    else if (resource instanceof AuditEvent)
59566      composeAuditEvent("AuditEvent", (AuditEvent)resource);
59567    else if (resource instanceof Basic)
59568      composeBasic("Basic", (Basic)resource);
59569    else if (resource instanceof Binary)
59570      composeBinary("Binary", (Binary)resource);
59571    else if (resource instanceof BiologicallyDerivedProduct)
59572      composeBiologicallyDerivedProduct("BiologicallyDerivedProduct", (BiologicallyDerivedProduct)resource);
59573    else if (resource instanceof BodyStructure)
59574      composeBodyStructure("BodyStructure", (BodyStructure)resource);
59575    else if (resource instanceof Bundle)
59576      composeBundle("Bundle", (Bundle)resource);
59577    else if (resource instanceof CapabilityStatement)
59578      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement)resource);
59579    else if (resource instanceof CapabilityStatement2)
59580      composeCapabilityStatement2("CapabilityStatement2", (CapabilityStatement2)resource);
59581    else if (resource instanceof CarePlan)
59582      composeCarePlan("CarePlan", (CarePlan)resource);
59583    else if (resource instanceof CareTeam)
59584      composeCareTeam("CareTeam", (CareTeam)resource);
59585    else if (resource instanceof CatalogEntry)
59586      composeCatalogEntry("CatalogEntry", (CatalogEntry)resource);
59587    else if (resource instanceof ChargeItem)
59588      composeChargeItem("ChargeItem", (ChargeItem)resource);
59589    else if (resource instanceof ChargeItemDefinition)
59590      composeChargeItemDefinition("ChargeItemDefinition", (ChargeItemDefinition)resource);
59591    else if (resource instanceof Claim)
59592      composeClaim("Claim", (Claim)resource);
59593    else if (resource instanceof ClaimResponse)
59594      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
59595    else if (resource instanceof ClinicalImpression)
59596      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
59597    else if (resource instanceof ClinicalUseIssue)
59598      composeClinicalUseIssue("ClinicalUseIssue", (ClinicalUseIssue)resource);
59599    else if (resource instanceof CodeSystem)
59600      composeCodeSystem("CodeSystem", (CodeSystem)resource);
59601    else if (resource instanceof Communication)
59602      composeCommunication("Communication", (Communication)resource);
59603    else if (resource instanceof CommunicationRequest)
59604      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
59605    else if (resource instanceof CompartmentDefinition)
59606      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
59607    else if (resource instanceof Composition)
59608      composeComposition("Composition", (Composition)resource);
59609    else if (resource instanceof ConceptMap)
59610      composeConceptMap("ConceptMap", (ConceptMap)resource);
59611    else if (resource instanceof Condition)
59612      composeCondition("Condition", (Condition)resource);
59613    else if (resource instanceof ConditionDefinition)
59614      composeConditionDefinition("ConditionDefinition", (ConditionDefinition)resource);
59615    else if (resource instanceof Consent)
59616      composeConsent("Consent", (Consent)resource);
59617    else if (resource instanceof Contract)
59618      composeContract("Contract", (Contract)resource);
59619    else if (resource instanceof Coverage)
59620      composeCoverage("Coverage", (Coverage)resource);
59621    else if (resource instanceof CoverageEligibilityRequest)
59622      composeCoverageEligibilityRequest("CoverageEligibilityRequest", (CoverageEligibilityRequest)resource);
59623    else if (resource instanceof CoverageEligibilityResponse)
59624      composeCoverageEligibilityResponse("CoverageEligibilityResponse", (CoverageEligibilityResponse)resource);
59625    else if (resource instanceof DetectedIssue)
59626      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
59627    else if (resource instanceof Device)
59628      composeDevice("Device", (Device)resource);
59629    else if (resource instanceof DeviceDefinition)
59630      composeDeviceDefinition("DeviceDefinition", (DeviceDefinition)resource);
59631    else if (resource instanceof DeviceMetric)
59632      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
59633    else if (resource instanceof DeviceRequest)
59634      composeDeviceRequest("DeviceRequest", (DeviceRequest)resource);
59635    else if (resource instanceof DeviceUseStatement)
59636      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
59637    else if (resource instanceof DiagnosticReport)
59638      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
59639    else if (resource instanceof DocumentManifest)
59640      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
59641    else if (resource instanceof DocumentReference)
59642      composeDocumentReference("DocumentReference", (DocumentReference)resource);
59643    else if (resource instanceof Encounter)
59644      composeEncounter("Encounter", (Encounter)resource);
59645    else if (resource instanceof Endpoint)
59646      composeEndpoint("Endpoint", (Endpoint)resource);
59647    else if (resource instanceof EnrollmentRequest)
59648      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
59649    else if (resource instanceof EnrollmentResponse)
59650      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
59651    else if (resource instanceof EpisodeOfCare)
59652      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
59653    else if (resource instanceof EventDefinition)
59654      composeEventDefinition("EventDefinition", (EventDefinition)resource);
59655    else if (resource instanceof Evidence)
59656      composeEvidence("Evidence", (Evidence)resource);
59657    else if (resource instanceof EvidenceVariable)
59658      composeEvidenceVariable("EvidenceVariable", (EvidenceVariable)resource);
59659    else if (resource instanceof ExampleScenario)
59660      composeExampleScenario("ExampleScenario", (ExampleScenario)resource);
59661    else if (resource instanceof ExplanationOfBenefit)
59662      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
59663    else if (resource instanceof FamilyMemberHistory)
59664      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
59665    else if (resource instanceof Flag)
59666      composeFlag("Flag", (Flag)resource);
59667    else if (resource instanceof Goal)
59668      composeGoal("Goal", (Goal)resource);
59669    else if (resource instanceof GraphDefinition)
59670      composeGraphDefinition("GraphDefinition", (GraphDefinition)resource);
59671    else if (resource instanceof Group)
59672      composeGroup("Group", (Group)resource);
59673    else if (resource instanceof GuidanceResponse)
59674      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
59675    else if (resource instanceof HealthcareService)
59676      composeHealthcareService("HealthcareService", (HealthcareService)resource);
59677    else if (resource instanceof ImagingStudy)
59678      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
59679    else if (resource instanceof Immunization)
59680      composeImmunization("Immunization", (Immunization)resource);
59681    else if (resource instanceof ImmunizationEvaluation)
59682      composeImmunizationEvaluation("ImmunizationEvaluation", (ImmunizationEvaluation)resource);
59683    else if (resource instanceof ImmunizationRecommendation)
59684      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
59685    else if (resource instanceof ImplementationGuide)
59686      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
59687    else if (resource instanceof Ingredient)
59688      composeIngredient("Ingredient", (Ingredient)resource);
59689    else if (resource instanceof InsurancePlan)
59690      composeInsurancePlan("InsurancePlan", (InsurancePlan)resource);
59691    else if (resource instanceof Invoice)
59692      composeInvoice("Invoice", (Invoice)resource);
59693    else if (resource instanceof Library)
59694      composeLibrary("Library", (Library)resource);
59695    else if (resource instanceof Linkage)
59696      composeLinkage("Linkage", (Linkage)resource);
59697    else if (resource instanceof ListResource)
59698      composeListResource("List", (ListResource)resource);
59699    else if (resource instanceof Location)
59700      composeLocation("Location", (Location)resource);
59701    else if (resource instanceof ManufacturedItemDefinition)
59702      composeManufacturedItemDefinition("ManufacturedItemDefinition", (ManufacturedItemDefinition)resource);
59703    else if (resource instanceof Measure)
59704      composeMeasure("Measure", (Measure)resource);
59705    else if (resource instanceof MeasureReport)
59706      composeMeasureReport("MeasureReport", (MeasureReport)resource);
59707    else if (resource instanceof Medication)
59708      composeMedication("Medication", (Medication)resource);
59709    else if (resource instanceof MedicationAdministration)
59710      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
59711    else if (resource instanceof MedicationDispense)
59712      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
59713    else if (resource instanceof MedicationKnowledge)
59714      composeMedicationKnowledge("MedicationKnowledge", (MedicationKnowledge)resource);
59715    else if (resource instanceof MedicationRequest)
59716      composeMedicationRequest("MedicationRequest", (MedicationRequest)resource);
59717    else if (resource instanceof MedicationUsage)
59718      composeMedicationUsage("MedicationUsage", (MedicationUsage)resource);
59719    else if (resource instanceof MedicinalProductDefinition)
59720      composeMedicinalProductDefinition("MedicinalProductDefinition", (MedicinalProductDefinition)resource);
59721    else if (resource instanceof MessageDefinition)
59722      composeMessageDefinition("MessageDefinition", (MessageDefinition)resource);
59723    else if (resource instanceof MessageHeader)
59724      composeMessageHeader("MessageHeader", (MessageHeader)resource);
59725    else if (resource instanceof MolecularSequence)
59726      composeMolecularSequence("MolecularSequence", (MolecularSequence)resource);
59727    else if (resource instanceof NamingSystem)
59728      composeNamingSystem("NamingSystem", (NamingSystem)resource);
59729    else if (resource instanceof NutritionIntake)
59730      composeNutritionIntake("NutritionIntake", (NutritionIntake)resource);
59731    else if (resource instanceof NutritionOrder)
59732      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
59733    else if (resource instanceof Observation)
59734      composeObservation("Observation", (Observation)resource);
59735    else if (resource instanceof ObservationDefinition)
59736      composeObservationDefinition("ObservationDefinition", (ObservationDefinition)resource);
59737    else if (resource instanceof OperationDefinition)
59738      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
59739    else if (resource instanceof OperationOutcome)
59740      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
59741    else if (resource instanceof Organization)
59742      composeOrganization("Organization", (Organization)resource);
59743    else if (resource instanceof OrganizationAffiliation)
59744      composeOrganizationAffiliation("OrganizationAffiliation", (OrganizationAffiliation)resource);
59745    else if (resource instanceof PackagedProductDefinition)
59746      composePackagedProductDefinition("PackagedProductDefinition", (PackagedProductDefinition)resource);
59747    else if (resource instanceof Patient)
59748      composePatient("Patient", (Patient)resource);
59749    else if (resource instanceof PaymentNotice)
59750      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
59751    else if (resource instanceof PaymentReconciliation)
59752      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
59753    else if (resource instanceof Person)
59754      composePerson("Person", (Person)resource);
59755    else if (resource instanceof PlanDefinition)
59756      composePlanDefinition("PlanDefinition", (PlanDefinition)resource);
59757    else if (resource instanceof Practitioner)
59758      composePractitioner("Practitioner", (Practitioner)resource);
59759    else if (resource instanceof PractitionerRole)
59760      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
59761    else if (resource instanceof Procedure)
59762      composeProcedure("Procedure", (Procedure)resource);
59763    else if (resource instanceof Provenance)
59764      composeProvenance("Provenance", (Provenance)resource);
59765    else if (resource instanceof Questionnaire)
59766      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
59767    else if (resource instanceof QuestionnaireResponse)
59768      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
59769    else if (resource instanceof RegulatedAuthorization)
59770      composeRegulatedAuthorization("RegulatedAuthorization", (RegulatedAuthorization)resource);
59771    else if (resource instanceof RelatedPerson)
59772      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
59773    else if (resource instanceof RequestGroup)
59774      composeRequestGroup("RequestGroup", (RequestGroup)resource);
59775    else if (resource instanceof ResearchStudy)
59776      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
59777    else if (resource instanceof ResearchSubject)
59778      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
59779    else if (resource instanceof RiskAssessment)
59780      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
59781    else if (resource instanceof Schedule)
59782      composeSchedule("Schedule", (Schedule)resource);
59783    else if (resource instanceof SearchParameter)
59784      composeSearchParameter("SearchParameter", (SearchParameter)resource);
59785    else if (resource instanceof ServiceRequest)
59786      composeServiceRequest("ServiceRequest", (ServiceRequest)resource);
59787    else if (resource instanceof Slot)
59788      composeSlot("Slot", (Slot)resource);
59789    else if (resource instanceof Specimen)
59790      composeSpecimen("Specimen", (Specimen)resource);
59791    else if (resource instanceof SpecimenDefinition)
59792      composeSpecimenDefinition("SpecimenDefinition", (SpecimenDefinition)resource);
59793    else if (resource instanceof StructureDefinition)
59794      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
59795    else if (resource instanceof StructureMap)
59796      composeStructureMap("StructureMap", (StructureMap)resource);
59797    else if (resource instanceof Subscription)
59798      composeSubscription("Subscription", (Subscription)resource);
59799    else if (resource instanceof Substance)
59800      composeSubstance("Substance", (Substance)resource);
59801    else if (resource instanceof SubstanceDefinition)
59802      composeSubstanceDefinition("SubstanceDefinition", (SubstanceDefinition)resource);
59803    else if (resource instanceof SubstanceNucleicAcid)
59804      composeSubstanceNucleicAcid("SubstanceNucleicAcid", (SubstanceNucleicAcid)resource);
59805    else if (resource instanceof SubstancePolymer)
59806      composeSubstancePolymer("SubstancePolymer", (SubstancePolymer)resource);
59807    else if (resource instanceof SubstanceProtein)
59808      composeSubstanceProtein("SubstanceProtein", (SubstanceProtein)resource);
59809    else if (resource instanceof SubstanceReferenceInformation)
59810      composeSubstanceReferenceInformation("SubstanceReferenceInformation", (SubstanceReferenceInformation)resource);
59811    else if (resource instanceof SubstanceSourceMaterial)
59812      composeSubstanceSourceMaterial("SubstanceSourceMaterial", (SubstanceSourceMaterial)resource);
59813    else if (resource instanceof SupplyDelivery)
59814      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
59815    else if (resource instanceof SupplyRequest)
59816      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
59817    else if (resource instanceof Task)
59818      composeTask("Task", (Task)resource);
59819    else if (resource instanceof TerminologyCapabilities)
59820      composeTerminologyCapabilities("TerminologyCapabilities", (TerminologyCapabilities)resource);
59821    else if (resource instanceof TestReport)
59822      composeTestReport("TestReport", (TestReport)resource);
59823    else if (resource instanceof TestScript)
59824      composeTestScript("TestScript", (TestScript)resource);
59825    else if (resource instanceof Topic)
59826      composeTopic("Topic", (Topic)resource);
59827    else if (resource instanceof ValueSet)
59828      composeValueSet("ValueSet", (ValueSet)resource);
59829    else if (resource instanceof VerificationResult)
59830      composeVerificationResult("VerificationResult", (VerificationResult)resource);
59831    else if (resource instanceof VisionPrescription)
59832      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
59833    else if (resource instanceof Binary)
59834      composeBinary("Binary", (Binary)resource);
59835    else
59836      throw new Error("Unhandled resource type "+resource.getClass().getName());
59837  }
59838
59839  protected void composeNamedReference(String name, Resource resource) throws IOException {
59840    if (resource instanceof Parameters)
59841      composeParameters(name, (Parameters)resource);
59842    else if (resource instanceof Account)
59843      composeAccount(name, (Account)resource);
59844    else if (resource instanceof ActivityDefinition)
59845      composeActivityDefinition(name, (ActivityDefinition)resource);
59846    else if (resource instanceof AdministrableProductDefinition)
59847      composeAdministrableProductDefinition(name, (AdministrableProductDefinition)resource);
59848    else if (resource instanceof AdverseEvent)
59849      composeAdverseEvent(name, (AdverseEvent)resource);
59850    else if (resource instanceof AllergyIntolerance)
59851      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
59852    else if (resource instanceof Appointment)
59853      composeAppointment(name, (Appointment)resource);
59854    else if (resource instanceof AppointmentResponse)
59855      composeAppointmentResponse(name, (AppointmentResponse)resource);
59856    else if (resource instanceof AuditEvent)
59857      composeAuditEvent(name, (AuditEvent)resource);
59858    else if (resource instanceof Basic)
59859      composeBasic(name, (Basic)resource);
59860    else if (resource instanceof Binary)
59861      composeBinary(name, (Binary)resource);
59862    else if (resource instanceof BiologicallyDerivedProduct)
59863      composeBiologicallyDerivedProduct(name, (BiologicallyDerivedProduct)resource);
59864    else if (resource instanceof BodyStructure)
59865      composeBodyStructure(name, (BodyStructure)resource);
59866    else if (resource instanceof Bundle)
59867      composeBundle(name, (Bundle)resource);
59868    else if (resource instanceof CapabilityStatement)
59869      composeCapabilityStatement(name, (CapabilityStatement)resource);
59870    else if (resource instanceof CapabilityStatement2)
59871      composeCapabilityStatement2(name, (CapabilityStatement2)resource);
59872    else if (resource instanceof CarePlan)
59873      composeCarePlan(name, (CarePlan)resource);
59874    else if (resource instanceof CareTeam)
59875      composeCareTeam(name, (CareTeam)resource);
59876    else if (resource instanceof CatalogEntry)
59877      composeCatalogEntry(name, (CatalogEntry)resource);
59878    else if (resource instanceof ChargeItem)
59879      composeChargeItem(name, (ChargeItem)resource);
59880    else if (resource instanceof ChargeItemDefinition)
59881      composeChargeItemDefinition(name, (ChargeItemDefinition)resource);
59882    else if (resource instanceof Claim)
59883      composeClaim(name, (Claim)resource);
59884    else if (resource instanceof ClaimResponse)
59885      composeClaimResponse(name, (ClaimResponse)resource);
59886    else if (resource instanceof ClinicalImpression)
59887      composeClinicalImpression(name, (ClinicalImpression)resource);
59888    else if (resource instanceof ClinicalUseIssue)
59889      composeClinicalUseIssue(name, (ClinicalUseIssue)resource);
59890    else if (resource instanceof CodeSystem)
59891      composeCodeSystem(name, (CodeSystem)resource);
59892    else if (resource instanceof Communication)
59893      composeCommunication(name, (Communication)resource);
59894    else if (resource instanceof CommunicationRequest)
59895      composeCommunicationRequest(name, (CommunicationRequest)resource);
59896    else if (resource instanceof CompartmentDefinition)
59897      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
59898    else if (resource instanceof Composition)
59899      composeComposition(name, (Composition)resource);
59900    else if (resource instanceof ConceptMap)
59901      composeConceptMap(name, (ConceptMap)resource);
59902    else if (resource instanceof Condition)
59903      composeCondition(name, (Condition)resource);
59904    else if (resource instanceof ConditionDefinition)
59905      composeConditionDefinition(name, (ConditionDefinition)resource);
59906    else if (resource instanceof Consent)
59907      composeConsent(name, (Consent)resource);
59908    else if (resource instanceof Contract)
59909      composeContract(name, (Contract)resource);
59910    else if (resource instanceof Coverage)
59911      composeCoverage(name, (Coverage)resource);
59912    else if (resource instanceof CoverageEligibilityRequest)
59913      composeCoverageEligibilityRequest(name, (CoverageEligibilityRequest)resource);
59914    else if (resource instanceof CoverageEligibilityResponse)
59915      composeCoverageEligibilityResponse(name, (CoverageEligibilityResponse)resource);
59916    else if (resource instanceof DetectedIssue)
59917      composeDetectedIssue(name, (DetectedIssue)resource);
59918    else if (resource instanceof Device)
59919      composeDevice(name, (Device)resource);
59920    else if (resource instanceof DeviceDefinition)
59921      composeDeviceDefinition(name, (DeviceDefinition)resource);
59922    else if (resource instanceof DeviceMetric)
59923      composeDeviceMetric(name, (DeviceMetric)resource);
59924    else if (resource instanceof DeviceRequest)
59925      composeDeviceRequest(name, (DeviceRequest)resource);
59926    else if (resource instanceof DeviceUseStatement)
59927      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
59928    else if (resource instanceof DiagnosticReport)
59929      composeDiagnosticReport(name, (DiagnosticReport)resource);
59930    else if (resource instanceof DocumentManifest)
59931      composeDocumentManifest(name, (DocumentManifest)resource);
59932    else if (resource instanceof DocumentReference)
59933      composeDocumentReference(name, (DocumentReference)resource);
59934    else if (resource instanceof Encounter)
59935      composeEncounter(name, (Encounter)resource);
59936    else if (resource instanceof Endpoint)
59937      composeEndpoint(name, (Endpoint)resource);
59938    else if (resource instanceof EnrollmentRequest)
59939      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
59940    else if (resource instanceof EnrollmentResponse)
59941      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
59942    else if (resource instanceof EpisodeOfCare)
59943      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
59944    else if (resource instanceof EventDefinition)
59945      composeEventDefinition(name, (EventDefinition)resource);
59946    else if (resource instanceof Evidence)
59947      composeEvidence(name, (Evidence)resource);
59948    else if (resource instanceof EvidenceVariable)
59949      composeEvidenceVariable(name, (EvidenceVariable)resource);
59950    else if (resource instanceof ExampleScenario)
59951      composeExampleScenario(name, (ExampleScenario)resource);
59952    else if (resource instanceof ExplanationOfBenefit)
59953      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
59954    else if (resource instanceof FamilyMemberHistory)
59955      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
59956    else if (resource instanceof Flag)
59957      composeFlag(name, (Flag)resource);
59958    else if (resource instanceof Goal)
59959      composeGoal(name, (Goal)resource);
59960    else if (resource instanceof GraphDefinition)
59961      composeGraphDefinition(name, (GraphDefinition)resource);
59962    else if (resource instanceof Group)
59963      composeGroup(name, (Group)resource);
59964    else if (resource instanceof GuidanceResponse)
59965      composeGuidanceResponse(name, (GuidanceResponse)resource);
59966    else if (resource instanceof HealthcareService)
59967      composeHealthcareService(name, (HealthcareService)resource);
59968    else if (resource instanceof ImagingStudy)
59969      composeImagingStudy(name, (ImagingStudy)resource);
59970    else if (resource instanceof Immunization)
59971      composeImmunization(name, (Immunization)resource);
59972    else if (resource instanceof ImmunizationEvaluation)
59973      composeImmunizationEvaluation(name, (ImmunizationEvaluation)resource);
59974    else if (resource instanceof ImmunizationRecommendation)
59975      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
59976    else if (resource instanceof ImplementationGuide)
59977      composeImplementationGuide(name, (ImplementationGuide)resource);
59978    else if (resource instanceof Ingredient)
59979      composeIngredient(name, (Ingredient)resource);
59980    else if (resource instanceof InsurancePlan)
59981      composeInsurancePlan(name, (InsurancePlan)resource);
59982    else if (resource instanceof Invoice)
59983      composeInvoice(name, (Invoice)resource);
59984    else if (resource instanceof Library)
59985      composeLibrary(name, (Library)resource);
59986    else if (resource instanceof Linkage)
59987      composeLinkage(name, (Linkage)resource);
59988    else if (resource instanceof ListResource)
59989      composeListResource(name, (ListResource)resource);
59990    else if (resource instanceof Location)
59991      composeLocation(name, (Location)resource);
59992    else if (resource instanceof ManufacturedItemDefinition)
59993      composeManufacturedItemDefinition(name, (ManufacturedItemDefinition)resource);
59994    else if (resource instanceof Measure)
59995      composeMeasure(name, (Measure)resource);
59996    else if (resource instanceof MeasureReport)
59997      composeMeasureReport(name, (MeasureReport)resource);
59998    else if (resource instanceof Medication)
59999      composeMedication(name, (Medication)resource);
60000    else if (resource instanceof MedicationAdministration)
60001      composeMedicationAdministration(name, (MedicationAdministration)resource);
60002    else if (resource instanceof MedicationDispense)
60003      composeMedicationDispense(name, (MedicationDispense)resource);
60004    else if (resource instanceof MedicationKnowledge)
60005      composeMedicationKnowledge(name, (MedicationKnowledge)resource);
60006    else if (resource instanceof MedicationRequest)
60007      composeMedicationRequest(name, (MedicationRequest)resource);
60008    else if (resource instanceof MedicationUsage)
60009      composeMedicationUsage(name, (MedicationUsage)resource);
60010    else if (resource instanceof MedicinalProductDefinition)
60011      composeMedicinalProductDefinition(name, (MedicinalProductDefinition)resource);
60012    else if (resource instanceof MessageDefinition)
60013      composeMessageDefinition(name, (MessageDefinition)resource);
60014    else if (resource instanceof MessageHeader)
60015      composeMessageHeader(name, (MessageHeader)resource);
60016    else if (resource instanceof MolecularSequence)
60017      composeMolecularSequence(name, (MolecularSequence)resource);
60018    else if (resource instanceof NamingSystem)
60019      composeNamingSystem(name, (NamingSystem)resource);
60020    else if (resource instanceof NutritionIntake)
60021      composeNutritionIntake(name, (NutritionIntake)resource);
60022    else if (resource instanceof NutritionOrder)
60023      composeNutritionOrder(name, (NutritionOrder)resource);
60024    else if (resource instanceof Observation)
60025      composeObservation(name, (Observation)resource);
60026    else if (resource instanceof ObservationDefinition)
60027      composeObservationDefinition(name, (ObservationDefinition)resource);
60028    else if (resource instanceof OperationDefinition)
60029      composeOperationDefinition(name, (OperationDefinition)resource);
60030    else if (resource instanceof OperationOutcome)
60031      composeOperationOutcome(name, (OperationOutcome)resource);
60032    else if (resource instanceof Organization)
60033      composeOrganization(name, (Organization)resource);
60034    else if (resource instanceof OrganizationAffiliation)
60035      composeOrganizationAffiliation(name, (OrganizationAffiliation)resource);
60036    else if (resource instanceof PackagedProductDefinition)
60037      composePackagedProductDefinition(name, (PackagedProductDefinition)resource);
60038    else if (resource instanceof Patient)
60039      composePatient(name, (Patient)resource);
60040    else if (resource instanceof PaymentNotice)
60041      composePaymentNotice(name, (PaymentNotice)resource);
60042    else if (resource instanceof PaymentReconciliation)
60043      composePaymentReconciliation(name, (PaymentReconciliation)resource);
60044    else if (resource instanceof Person)
60045      composePerson(name, (Person)resource);
60046    else if (resource instanceof PlanDefinition)
60047      composePlanDefinition(name, (PlanDefinition)resource);
60048    else if (resource instanceof Practitioner)
60049      composePractitioner(name, (Practitioner)resource);
60050    else if (resource instanceof PractitionerRole)
60051      composePractitionerRole(name, (PractitionerRole)resource);
60052    else if (resource instanceof Procedure)
60053      composeProcedure(name, (Procedure)resource);
60054    else if (resource instanceof Provenance)
60055      composeProvenance(name, (Provenance)resource);
60056    else if (resource instanceof Questionnaire)
60057      composeQuestionnaire(name, (Questionnaire)resource);
60058    else if (resource instanceof QuestionnaireResponse)
60059      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
60060    else if (resource instanceof RegulatedAuthorization)
60061      composeRegulatedAuthorization(name, (RegulatedAuthorization)resource);
60062    else if (resource instanceof RelatedPerson)
60063      composeRelatedPerson(name, (RelatedPerson)resource);
60064    else if (resource instanceof RequestGroup)
60065      composeRequestGroup(name, (RequestGroup)resource);
60066    else if (resource instanceof ResearchStudy)
60067      composeResearchStudy(name, (ResearchStudy)resource);
60068    else if (resource instanceof ResearchSubject)
60069      composeResearchSubject(name, (ResearchSubject)resource);
60070    else if (resource instanceof RiskAssessment)
60071      composeRiskAssessment(name, (RiskAssessment)resource);
60072    else if (resource instanceof Schedule)
60073      composeSchedule(name, (Schedule)resource);
60074    else if (resource instanceof SearchParameter)
60075      composeSearchParameter(name, (SearchParameter)resource);
60076    else if (resource instanceof ServiceRequest)
60077      composeServiceRequest(name, (ServiceRequest)resource);
60078    else if (resource instanceof Slot)
60079      composeSlot(name, (Slot)resource);
60080    else if (resource instanceof Specimen)
60081      composeSpecimen(name, (Specimen)resource);
60082    else if (resource instanceof SpecimenDefinition)
60083      composeSpecimenDefinition(name, (SpecimenDefinition)resource);
60084    else if (resource instanceof StructureDefinition)
60085      composeStructureDefinition(name, (StructureDefinition)resource);
60086    else if (resource instanceof StructureMap)
60087      composeStructureMap(name, (StructureMap)resource);
60088    else if (resource instanceof Subscription)
60089      composeSubscription(name, (Subscription)resource);
60090    else if (resource instanceof Substance)
60091      composeSubstance(name, (Substance)resource);
60092    else if (resource instanceof SubstanceDefinition)
60093      composeSubstanceDefinition(name, (SubstanceDefinition)resource);
60094    else if (resource instanceof SubstanceNucleicAcid)
60095      composeSubstanceNucleicAcid(name, (SubstanceNucleicAcid)resource);
60096    else if (resource instanceof SubstancePolymer)
60097      composeSubstancePolymer(name, (SubstancePolymer)resource);
60098    else if (resource instanceof SubstanceProtein)
60099      composeSubstanceProtein(name, (SubstanceProtein)resource);
60100    else if (resource instanceof SubstanceReferenceInformation)
60101      composeSubstanceReferenceInformation(name, (SubstanceReferenceInformation)resource);
60102    else if (resource instanceof SubstanceSourceMaterial)
60103      composeSubstanceSourceMaterial(name, (SubstanceSourceMaterial)resource);
60104    else if (resource instanceof SupplyDelivery)
60105      composeSupplyDelivery(name, (SupplyDelivery)resource);
60106    else if (resource instanceof SupplyRequest)
60107      composeSupplyRequest(name, (SupplyRequest)resource);
60108    else if (resource instanceof Task)
60109      composeTask(name, (Task)resource);
60110    else if (resource instanceof TerminologyCapabilities)
60111      composeTerminologyCapabilities(name, (TerminologyCapabilities)resource);
60112    else if (resource instanceof TestReport)
60113      composeTestReport(name, (TestReport)resource);
60114    else if (resource instanceof TestScript)
60115      composeTestScript(name, (TestScript)resource);
60116    else if (resource instanceof Topic)
60117      composeTopic(name, (Topic)resource);
60118    else if (resource instanceof ValueSet)
60119      composeValueSet(name, (ValueSet)resource);
60120    else if (resource instanceof VerificationResult)
60121      composeVerificationResult(name, (VerificationResult)resource);
60122    else if (resource instanceof VisionPrescription)
60123      composeVisionPrescription(name, (VisionPrescription)resource);
60124    else if (resource instanceof Binary)
60125      composeBinary(name, (Binary)resource);
60126    else
60127      throw new Error("Unhandled resource type "+resource.getClass().getName());
60128  }
60129
60130  protected void composeType(String prefix, Type type) throws IOException {
60131    if (type == null)
60132      ;
60133    else if (type instanceof Extension)
60134       composeExtension(prefix+"Extension", (Extension) type);
60135    else if (type instanceof Narrative)
60136       composeNarrative(prefix+"Narrative", (Narrative) type);
60137    else if (type instanceof Count)
60138       composeCount(prefix+"Count", (Count) type);
60139    else if (type instanceof Dosage)
60140       composeDosage(prefix+"Dosage", (Dosage) type);
60141    else if (type instanceof MarketingStatus)
60142       composeMarketingStatus(prefix+"MarketingStatus", (MarketingStatus) type);
60143    else if (type instanceof SubstanceAmount)
60144       composeSubstanceAmount(prefix+"SubstanceAmount", (SubstanceAmount) type);
60145    else if (type instanceof Statistic)
60146       composeStatistic(prefix+"Statistic", (Statistic) type);
60147    else if (type instanceof Population)
60148       composePopulation(prefix+"Population", (Population) type);
60149    else if (type instanceof OrderedDistribution)
60150       composeOrderedDistribution(prefix+"OrderedDistribution", (OrderedDistribution) type);
60151    else if (type instanceof Distance)
60152       composeDistance(prefix+"Distance", (Distance) type);
60153    else if (type instanceof Age)
60154       composeAge(prefix+"Age", (Age) type);
60155    else if (type instanceof Duration)
60156       composeDuration(prefix+"Duration", (Duration) type);
60157    else if (type instanceof ProductShelfLife)
60158       composeProductShelfLife(prefix+"ProductShelfLife", (ProductShelfLife) type);
60159    else if (type instanceof Timing)
60160       composeTiming(prefix+"Timing", (Timing) type);
60161    else if (type instanceof ProdCharacteristic)
60162       composeProdCharacteristic(prefix+"ProdCharacteristic", (ProdCharacteristic) type);
60163    else if (type instanceof Meta)
60164       composeMeta(prefix+"Meta", (Meta) type);
60165    else if (type instanceof Address)
60166       composeAddress(prefix+"Address", (Address) type);
60167    else if (type instanceof Contributor)
60168       composeContributor(prefix+"Contributor", (Contributor) type);
60169    else if (type instanceof Attachment)
60170       composeAttachment(prefix+"Attachment", (Attachment) type);
60171    else if (type instanceof DataRequirement)
60172       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
60173    else if (type instanceof Money)
60174       composeMoney(prefix+"Money", (Money) type);
60175    else if (type instanceof HumanName)
60176       composeHumanName(prefix+"HumanName", (HumanName) type);
60177    else if (type instanceof ContactPoint)
60178       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
60179    else if (type instanceof Identifier)
60180       composeIdentifier(prefix+"Identifier", (Identifier) type);
60181    else if (type instanceof Coding)
60182       composeCoding(prefix+"Coding", (Coding) type);
60183    else if (type instanceof SampledData)
60184       composeSampledData(prefix+"SampledData", (SampledData) type);
60185    else if (type instanceof Ratio)
60186       composeRatio(prefix+"Ratio", (Ratio) type);
60187    else if (type instanceof Reference)
60188       composeReference(prefix+"Reference", (Reference) type);
60189    else if (type instanceof TriggerDefinition)
60190       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
60191    else if (type instanceof Quantity)
60192       composeQuantity(prefix+"Quantity", (Quantity) type);
60193    else if (type instanceof Period)
60194       composePeriod(prefix+"Period", (Period) type);
60195    else if (type instanceof Range)
60196       composeRange(prefix+"Range", (Range) type);
60197    else if (type instanceof RelatedArtifact)
60198       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
60199    else if (type instanceof Annotation)
60200       composeAnnotation(prefix+"Annotation", (Annotation) type);
60201    else if (type instanceof ContactDetail)
60202       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
60203    else if (type instanceof UsageContext)
60204       composeUsageContext(prefix+"UsageContext", (UsageContext) type);
60205    else if (type instanceof Expression)
60206       composeExpression(prefix+"Expression", (Expression) type);
60207    else if (type instanceof Signature)
60208       composeSignature(prefix+"Signature", (Signature) type);
60209    else if (type instanceof CodeableConcept)
60210       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
60211    else if (type instanceof ParameterDefinition)
60212       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
60213    else if (type instanceof CodeType) {
60214      composeCodeCore(prefix+"Code", (CodeType) type, false);
60215      composeCodeExtras(prefix+"Code", (CodeType) type, false);
60216    }
60217    else if (type instanceof OidType) {
60218      composeOidCore(prefix+"Oid", (OidType) type, false);
60219      composeOidExtras(prefix+"Oid", (OidType) type, false);
60220    }
60221    else if (type instanceof CanonicalType) {
60222      composeCanonicalCore(prefix+"Canonical", (CanonicalType) type, false);
60223      composeCanonicalExtras(prefix+"Canonical", (CanonicalType) type, false);
60224    }
60225    else if (type instanceof UuidType) {
60226      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
60227      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
60228    }
60229    else if (type instanceof UrlType) {
60230      composeUrlCore(prefix+"Url", (UrlType) type, false);
60231      composeUrlExtras(prefix+"Url", (UrlType) type, false);
60232    }
60233    else if (type instanceof UnsignedIntType) {
60234      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
60235      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
60236    }
60237    else if (type instanceof MarkdownType) {
60238      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
60239      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
60240    }
60241    else if (type instanceof IdType) {
60242      composeIdCore(prefix+"Id", (IdType) type, false);
60243      composeIdExtras(prefix+"Id", (IdType) type, false);
60244    }
60245    else if (type instanceof PositiveIntType) {
60246      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
60247      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
60248    }
60249    else if (type instanceof DateType) {
60250      composeDateCore(prefix+"Date", (DateType) type, false);
60251      composeDateExtras(prefix+"Date", (DateType) type, false);
60252    }
60253    else if (type instanceof DateTimeType) {
60254      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
60255      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
60256    }
60257    else if (type instanceof StringType) {
60258      composeStringCore(prefix+"String", (StringType) type, false);
60259      composeStringExtras(prefix+"String", (StringType) type, false);
60260    }
60261    else if (type instanceof IntegerType) {
60262      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
60263      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
60264    }
60265    else if (type instanceof UriType) {
60266      composeUriCore(prefix+"Uri", (UriType) type, false);
60267      composeUriExtras(prefix+"Uri", (UriType) type, false);
60268    }
60269    else if (type instanceof InstantType) {
60270      composeInstantCore(prefix+"Instant", (InstantType) type, false);
60271      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
60272    }
60273    else if (type instanceof BooleanType) {
60274      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
60275      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
60276    }
60277    else if (type instanceof Base64BinaryType) {
60278      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
60279      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
60280    }
60281    else if (type instanceof TimeType) {
60282      composeTimeCore(prefix+"Time", (TimeType) type, false);
60283      composeTimeExtras(prefix+"Time", (TimeType) type, false);
60284    }
60285    else if (type instanceof DecimalType) {
60286      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
60287      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
60288    }
60289    else
60290      throw new Error("Unhandled type");
60291  }
60292
60293  protected void composeTypeInner(Type type) throws IOException {
60294    if (type == null)
60295      ;
60296    else if (type instanceof Extension)
60297       composeExtensionInner((Extension) type);
60298    else if (type instanceof Narrative)
60299       composeNarrativeInner((Narrative) type);
60300    else if (type instanceof Count)
60301       composeCountInner((Count) type);
60302    else if (type instanceof Dosage)
60303       composeDosageInner((Dosage) type);
60304    else if (type instanceof MarketingStatus)
60305       composeMarketingStatusInner((MarketingStatus) type);
60306    else if (type instanceof SubstanceAmount)
60307       composeSubstanceAmountInner((SubstanceAmount) type);
60308    else if (type instanceof Statistic)
60309       composeStatisticInner((Statistic) type);
60310    else if (type instanceof Population)
60311       composePopulationInner((Population) type);
60312    else if (type instanceof OrderedDistribution)
60313       composeOrderedDistributionInner((OrderedDistribution) type);
60314    else if (type instanceof Distance)
60315       composeDistanceInner((Distance) type);
60316    else if (type instanceof Age)
60317       composeAgeInner((Age) type);
60318    else if (type instanceof Duration)
60319       composeDurationInner((Duration) type);
60320    else if (type instanceof ProductShelfLife)
60321       composeProductShelfLifeInner((ProductShelfLife) type);
60322    else if (type instanceof Timing)
60323       composeTimingInner((Timing) type);
60324    else if (type instanceof ProdCharacteristic)
60325       composeProdCharacteristicInner((ProdCharacteristic) type);
60326    else if (type instanceof Meta)
60327       composeMetaInner((Meta) type);
60328    else if (type instanceof Address)
60329       composeAddressInner((Address) type);
60330    else if (type instanceof Contributor)
60331       composeContributorInner((Contributor) type);
60332    else if (type instanceof Attachment)
60333       composeAttachmentInner((Attachment) type);
60334    else if (type instanceof DataRequirement)
60335       composeDataRequirementInner((DataRequirement) type);
60336    else if (type instanceof Money)
60337       composeMoneyInner((Money) type);
60338    else if (type instanceof HumanName)
60339       composeHumanNameInner((HumanName) type);
60340    else if (type instanceof ContactPoint)
60341       composeContactPointInner((ContactPoint) type);
60342    else if (type instanceof Identifier)
60343       composeIdentifierInner((Identifier) type);
60344    else if (type instanceof Coding)
60345       composeCodingInner((Coding) type);
60346    else if (type instanceof SampledData)
60347       composeSampledDataInner((SampledData) type);
60348    else if (type instanceof Ratio)
60349       composeRatioInner((Ratio) type);
60350    else if (type instanceof Reference)
60351       composeReferenceInner((Reference) type);
60352    else if (type instanceof TriggerDefinition)
60353       composeTriggerDefinitionInner((TriggerDefinition) type);
60354    else if (type instanceof Quantity)
60355       composeQuantityInner((Quantity) type);
60356    else if (type instanceof Period)
60357       composePeriodInner((Period) type);
60358    else if (type instanceof Range)
60359       composeRangeInner((Range) type);
60360    else if (type instanceof RelatedArtifact)
60361       composeRelatedArtifactInner((RelatedArtifact) type);
60362    else if (type instanceof Annotation)
60363       composeAnnotationInner((Annotation) type);
60364    else if (type instanceof ContactDetail)
60365       composeContactDetailInner((ContactDetail) type);
60366    else if (type instanceof UsageContext)
60367       composeUsageContextInner((UsageContext) type);
60368    else if (type instanceof Expression)
60369       composeExpressionInner((Expression) type);
60370    else if (type instanceof Signature)
60371       composeSignatureInner((Signature) type);
60372    else if (type instanceof CodeableConcept)
60373       composeCodeableConceptInner((CodeableConcept) type);
60374    else if (type instanceof ParameterDefinition)
60375       composeParameterDefinitionInner((ParameterDefinition) type);
60376    else
60377      throw new Error("Unhandled type: "+type.fhirType());
60378  }
60379
60380}
60381