001package org.hl7.fhir.r5.formats;
002
003// generated
004
005/*
006 * #%L
007 * org.hl7.fhir.r5
008 * %%
009 * Copyright (C) 2014 - 2019 Health Level 7
010 * %%
011 * Licensed under the Apache License, Version 2.0 (the \"License\");
012 * you may not use this file except in compliance with the License.
013 * You may obtain a copy of the License at
014 * 
015 *      http://www.apache.org/licenses/LICENSE-2.0
016 * 
017 * Unless required by applicable law or agreed to in writing, software
018 * distributed under the License is distributed on an \"AS IS\" BASIS,
019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
020 * See the License for the specific language governing permissions and
021 * limitations under the License.
022 * #L%
023 */
024
025/*
026  Copyright (c) 2011+, HL7, Inc.
027  All rights reserved.
028  
029  Redistribution and use in source and binary forms, with or without modification, \
030  are permitted provided that the following conditions are met:
031  
032   * Redistributions of source code must retain the above copyright notice, this \
033     list of conditions and the following disclaimer.
034   * Redistributions in binary form must reproduce the above copyright notice, \
035     this list of conditions and the following disclaimer in the documentation \
036     and/or other materials provided with the distribution.
037   * Neither the name of HL7 nor the names of its contributors may be used to 
038     endorse or promote products derived from this software without specific 
039     prior written permission.
040  
041  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
042  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
043  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
044  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
045  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
046  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
047  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
048  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
049  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
050  POSSIBILITY OF SUCH DAMAGE.
051  */
052
053// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent
054
055
056
057import org.hl7.fhir.r5.model.*;
058import org.hl7.fhir.utilities.Utilities;
059import org.hl7.fhir.utilities.xhtml.XhtmlNode;
060import org.hl7.fhir.exceptions.FHIRFormatError;
061import org.hl7.fhir.exceptions.FHIRException;
062import org.hl7.fhir.utilities.json.JsonTrackingParser.PresentedBigDecimal;
063import com.google.gson.JsonObject;
064import com.google.gson.JsonArray;
065import com.google.gson.JsonElement;
066import java.io.IOException;
067
068public class JsonParser extends JsonParserBase {
069
070  public JsonParser() {
071    super();
072  }
073
074  public JsonParser(boolean allowUnknownContent) {
075    super();
076    setAllowUnknownContent(allowUnknownContent);
077  }
078
079  protected void parseBaseProperties(JsonObject json, Base res) throws IOException, FHIRFormatError {
080    // nothing
081  }
082
083  @SuppressWarnings("unchecked")
084  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(String s, E item, EnumFactory e) throws IOException, FHIRFormatError {
085    Enumeration<E> res = new Enumeration<E>(e);
086    if (s != null)
087      res.setValue((E) e.fromCode(s));
088    return res;
089  }
090
091  protected DateType parseDate(String v) throws IOException, FHIRFormatError {
092    DateType res = new DateType(v);
093    return res;
094  }
095
096  protected DateTimeType parseDateTime(String v) throws IOException, FHIRFormatError {
097    DateTimeType res = new DateTimeType(v);
098    return res;
099  }
100
101  protected CodeType parseCode(String v) throws IOException, FHIRFormatError {
102    CodeType res = new CodeType(v);
103    return res;
104  }
105
106  protected StringType parseString(String v) throws IOException, FHIRFormatError {
107    StringType res = new StringType(v);
108    return res;
109  }
110
111  protected IntegerType parseInteger(java.lang.Long v) throws IOException, FHIRFormatError {
112    IntegerType res = new IntegerType(v);
113    return res;
114  }
115
116  protected Integer64Type parseInteger64(java.lang.Long v) throws IOException, FHIRFormatError {
117    Integer64Type res = new Integer64Type(v);
118    return res;
119  }
120
121  protected OidType parseOid(String v) throws IOException, FHIRFormatError {
122    OidType res = new OidType(v);
123    return res;
124  }
125
126  protected CanonicalType parseCanonical(String v) throws IOException, FHIRFormatError {
127    CanonicalType res = new CanonicalType(v);
128    return res;
129  }
130
131  protected UriType parseUri(String v) throws IOException, FHIRFormatError {
132    UriType res = new UriType(v);
133    return res;
134  }
135
136  protected UuidType parseUuid(String v) throws IOException, FHIRFormatError {
137    UuidType res = new UuidType(v);
138    return res;
139  }
140
141  protected UrlType parseUrl(String v) throws IOException, FHIRFormatError {
142    UrlType res = new UrlType(v);
143    return res;
144  }
145
146  protected InstantType parseInstant(String v) throws IOException, FHIRFormatError {
147    InstantType res = new InstantType(v);
148    return res;
149  }
150
151  protected BooleanType parseBoolean(java.lang.Boolean v) throws IOException, FHIRFormatError {
152    BooleanType res = new BooleanType(v);
153    return res;
154  }
155
156  protected Base64BinaryType parseBase64Binary(String v) throws IOException, FHIRFormatError {
157    Base64BinaryType res = new Base64BinaryType(v);
158    return res;
159  }
160
161  protected UnsignedIntType parseUnsignedInt(String v) throws IOException, FHIRFormatError {
162    UnsignedIntType res = new UnsignedIntType(v);
163    return res;
164  }
165
166  protected MarkdownType parseMarkdown(String v) throws IOException, FHIRFormatError {
167    MarkdownType res = new MarkdownType(v);
168    return res;
169  }
170
171  protected TimeType parseTime(String v) throws IOException, FHIRFormatError {
172    TimeType res = new TimeType(v);
173    return res;
174  }
175
176  protected IdType parseId(String v) throws IOException, FHIRFormatError {
177    IdType res = new IdType(v);
178    return res;
179  }
180
181  protected PositiveIntType parsePositiveInt(String v) throws IOException, FHIRFormatError {
182    PositiveIntType res = new PositiveIntType(v);
183    return res;
184  }
185
186  protected DecimalType parseDecimal(java.math.BigDecimal v) throws IOException, FHIRFormatError {
187    DecimalType res = new DecimalType(v);
188    if (v instanceof PresentedBigDecimal)
189      res.setRepresentation(((PresentedBigDecimal) v).getPresentation());
190    return res;
191  }
192
193
194
195  protected void parseBackboneElementProperties(JsonObject json, BackboneElement res) throws IOException, FHIRFormatError {
196    parseElementProperties(json, res);
197    if (json.has("modifierExtension")) {
198      JsonArray array = json.getAsJsonArray("modifierExtension");
199      for (int i = 0; i < array.size(); i++) {
200        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
201      }
202    };
203  }
204
205  protected void parseBackboneTypeProperties(JsonObject json, BackboneType res) throws IOException, FHIRFormatError {
206    parseDataTypeProperties(json, res);
207    if (json.has("modifierExtension")) {
208      JsonArray array = json.getAsJsonArray("modifierExtension");
209      for (int i = 0; i < array.size(); i++) {
210        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
211      }
212    };
213  }
214
215  protected void parseDataTypeProperties(JsonObject json, DataType res) throws IOException, FHIRFormatError {
216    parseElementProperties(json, res);
217  }
218
219  protected void parseElementProperties(JsonObject json, Element res) throws IOException, FHIRFormatError {
220    parseBaseProperties(json, res);
221    if (json.has("id"))
222      res.setIdElement(parseString(json.get("id").getAsString()));
223    if (json.has("_id"))
224      parseElementProperties(json.getAsJsonObject("_id"), res.getIdElement());
225    if (json.has("extension")) {
226      JsonArray array = json.getAsJsonArray("extension");
227      for (int i = 0; i < array.size(); i++) {
228        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
229      }
230    };
231  }
232
233  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
234    Address res = new Address();
235    parseAddressProperties(json, res);
236    return res;
237  }
238
239  protected void parseAddressProperties(JsonObject json, Address res) throws IOException, FHIRFormatError {
240    parseDataTypeProperties(json, res);
241    if (json.has("use"))
242      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
243    if (json.has("_use"))
244      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
245    if (json.has("type"))
246      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
247    if (json.has("_type"))
248      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
249    if (json.has("text"))
250      res.setTextElement(parseString(json.get("text").getAsString()));
251    if (json.has("_text"))
252      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
253    if (json.has("line")) {
254      JsonArray array = json.getAsJsonArray("line");
255      for (int i = 0; i < array.size(); i++) {
256        if (array.get(i).isJsonNull()) {
257          res.getLine().add(new StringType());
258        } else {;
259          res.getLine().add(parseString(array.get(i).getAsString()));
260        }
261      }
262    };
263    if (json.has("_line")) {
264      JsonArray array = json.getAsJsonArray("_line");
265      for (int i = 0; i < array.size(); i++) {
266        if (i == res.getLine().size())
267          res.getLine().add(parseString(null));
268        if (array.get(i) instanceof JsonObject) 
269          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
270      }
271    };
272    if (json.has("city"))
273      res.setCityElement(parseString(json.get("city").getAsString()));
274    if (json.has("_city"))
275      parseElementProperties(json.getAsJsonObject("_city"), res.getCityElement());
276    if (json.has("district"))
277      res.setDistrictElement(parseString(json.get("district").getAsString()));
278    if (json.has("_district"))
279      parseElementProperties(json.getAsJsonObject("_district"), res.getDistrictElement());
280    if (json.has("state"))
281      res.setStateElement(parseString(json.get("state").getAsString()));
282    if (json.has("_state"))
283      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
284    if (json.has("postalCode"))
285      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
286    if (json.has("_postalCode"))
287      parseElementProperties(json.getAsJsonObject("_postalCode"), res.getPostalCodeElement());
288    if (json.has("country"))
289      res.setCountryElement(parseString(json.get("country").getAsString()));
290    if (json.has("_country"))
291      parseElementProperties(json.getAsJsonObject("_country"), res.getCountryElement());
292    if (json.has("period"))
293      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
294  }
295
296  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
297    Age res = new Age();
298    parseAgeProperties(json, res);
299    return res;
300  }
301
302  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
303    parseQuantityProperties(json, res);
304  }
305
306  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
307    Annotation res = new Annotation();
308    parseAnnotationProperties(json, res);
309    return res;
310  }
311
312  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
313    parseDataTypeProperties(json, res);
314    DataType author = parseType("author", json);
315    if (author != null)
316      res.setAuthor(author);
317    if (json.has("time"))
318      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
319    if (json.has("_time"))
320      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
321    if (json.has("text"))
322      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
323    if (json.has("_text"))
324      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
325  }
326
327  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
328    Attachment res = new Attachment();
329    parseAttachmentProperties(json, res);
330    return res;
331  }
332
333  protected void parseAttachmentProperties(JsonObject json, Attachment res) throws IOException, FHIRFormatError {
334    parseDataTypeProperties(json, res);
335    if (json.has("contentType"))
336      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
337    if (json.has("_contentType"))
338      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
339    if (json.has("language"))
340      res.setLanguageElement(parseCode(json.get("language").getAsString()));
341    if (json.has("_language"))
342      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
343    if (json.has("data"))
344      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
345    if (json.has("_data"))
346      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
347    if (json.has("url"))
348      res.setUrlElement(parseUrl(json.get("url").getAsString()));
349    if (json.has("_url"))
350      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
351    if (json.has("size"))
352      res.setSizeElement(parseInteger64(json.get("size").getAsLong()));
353    if (json.has("_size"))
354      parseElementProperties(json.getAsJsonObject("_size"), res.getSizeElement());
355    if (json.has("hash"))
356      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
357    if (json.has("_hash"))
358      parseElementProperties(json.getAsJsonObject("_hash"), res.getHashElement());
359    if (json.has("title"))
360      res.setTitleElement(parseString(json.get("title").getAsString()));
361    if (json.has("_title"))
362      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
363    if (json.has("creation"))
364      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
365    if (json.has("_creation"))
366      parseElementProperties(json.getAsJsonObject("_creation"), res.getCreationElement());
367    if (json.has("height"))
368      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
369    if (json.has("_height"))
370      parseElementProperties(json.getAsJsonObject("_height"), res.getHeightElement());
371    if (json.has("width"))
372      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
373    if (json.has("_width"))
374      parseElementProperties(json.getAsJsonObject("_width"), res.getWidthElement());
375    if (json.has("frames"))
376      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
377    if (json.has("_frames"))
378      parseElementProperties(json.getAsJsonObject("_frames"), res.getFramesElement());
379    if (json.has("duration"))
380      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
381    if (json.has("_duration"))
382      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
383    if (json.has("pages"))
384      res.setPagesElement(parsePositiveInt(json.get("pages").getAsString()));
385    if (json.has("_pages"))
386      parseElementProperties(json.getAsJsonObject("_pages"), res.getPagesElement());
387  }
388
389  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
390    CodeableConcept res = new CodeableConcept();
391    parseCodeableConceptProperties(json, res);
392    return res;
393  }
394
395  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
396    parseDataTypeProperties(json, res);
397    if (json.has("coding")) {
398      JsonArray array = json.getAsJsonArray("coding");
399      for (int i = 0; i < array.size(); i++) {
400        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
401      }
402    };
403    if (json.has("text"))
404      res.setTextElement(parseString(json.get("text").getAsString()));
405    if (json.has("_text"))
406      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
407  }
408
409  protected CodeableReference parseCodeableReference(JsonObject json) throws IOException, FHIRFormatError {
410    CodeableReference res = new CodeableReference();
411    parseCodeableReferenceProperties(json, res);
412    return res;
413  }
414
415  protected void parseCodeableReferenceProperties(JsonObject json, CodeableReference res) throws IOException, FHIRFormatError {
416    parseDataTypeProperties(json, res);
417    if (json.has("concept"))
418      res.setConcept(parseCodeableConcept(json.getAsJsonObject("concept")));
419    if (json.has("reference"))
420      res.setReference(parseReference(json.getAsJsonObject("reference")));
421  }
422
423  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
424    Coding res = new Coding();
425    parseCodingProperties(json, res);
426    return res;
427  }
428
429  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
430    parseDataTypeProperties(json, res);
431    if (json.has("system"))
432      res.setSystemElement(parseUri(json.get("system").getAsString()));
433    if (json.has("_system"))
434      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
435    if (json.has("version"))
436      res.setVersionElement(parseString(json.get("version").getAsString()));
437    if (json.has("_version"))
438      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
439    if (json.has("code"))
440      res.setCodeElement(parseCode(json.get("code").getAsString()));
441    if (json.has("_code"))
442      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
443    if (json.has("display"))
444      res.setDisplayElement(parseString(json.get("display").getAsString()));
445    if (json.has("_display"))
446      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
447    if (json.has("userSelected"))
448      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
449    if (json.has("_userSelected"))
450      parseElementProperties(json.getAsJsonObject("_userSelected"), res.getUserSelectedElement());
451  }
452
453  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
454    ContactDetail res = new ContactDetail();
455    parseContactDetailProperties(json, res);
456    return res;
457  }
458
459  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
460    parseDataTypeProperties(json, res);
461    if (json.has("name"))
462      res.setNameElement(parseString(json.get("name").getAsString()));
463    if (json.has("_name"))
464      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
465    if (json.has("telecom")) {
466      JsonArray array = json.getAsJsonArray("telecom");
467      for (int i = 0; i < array.size(); i++) {
468        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
469      }
470    };
471  }
472
473  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
474    ContactPoint res = new ContactPoint();
475    parseContactPointProperties(json, res);
476    return res;
477  }
478
479  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
480    parseDataTypeProperties(json, res);
481    if (json.has("system"))
482      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
483    if (json.has("_system"))
484      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
485    if (json.has("value"))
486      res.setValueElement(parseString(json.get("value").getAsString()));
487    if (json.has("_value"))
488      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
489    if (json.has("use"))
490      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
491    if (json.has("_use"))
492      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
493    if (json.has("rank"))
494      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
495    if (json.has("_rank"))
496      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
497    if (json.has("period"))
498      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
499  }
500
501  protected Contributor parseContributor(JsonObject json) throws IOException, FHIRFormatError {
502    Contributor res = new Contributor();
503    parseContributorProperties(json, res);
504    return res;
505  }
506
507  protected void parseContributorProperties(JsonObject json, Contributor res) throws IOException, FHIRFormatError {
508    parseDataTypeProperties(json, res);
509    if (json.has("type"))
510      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
511    if (json.has("_type"))
512      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
513    if (json.has("name"))
514      res.setNameElement(parseString(json.get("name").getAsString()));
515    if (json.has("_name"))
516      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
517    if (json.has("contact")) {
518      JsonArray array = json.getAsJsonArray("contact");
519      for (int i = 0; i < array.size(); i++) {
520        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
521      }
522    };
523  }
524
525  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
526    Count res = new Count();
527    parseCountProperties(json, res);
528    return res;
529  }
530
531  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
532    parseQuantityProperties(json, res);
533  }
534
535  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
536    DataRequirement res = new DataRequirement();
537    parseDataRequirementProperties(json, res);
538    return res;
539  }
540
541  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res) throws IOException, FHIRFormatError {
542    parseDataTypeProperties(json, res);
543    if (json.has("type"))
544      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.FHIRAllTypes.NULL, new Enumerations.FHIRAllTypesEnumFactory()));
545    if (json.has("_type"))
546      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
547    if (json.has("profile")) {
548      JsonArray array = json.getAsJsonArray("profile");
549      for (int i = 0; i < array.size(); i++) {
550        if (array.get(i).isJsonNull()) {
551          res.getProfile().add(new CanonicalType());
552        } else {;
553          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
554        }
555      }
556    };
557    if (json.has("_profile")) {
558      JsonArray array = json.getAsJsonArray("_profile");
559      for (int i = 0; i < array.size(); i++) {
560        if (i == res.getProfile().size())
561          res.getProfile().add(parseCanonical(null));
562        if (array.get(i) instanceof JsonObject) 
563          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
564      }
565    };
566    DataType subject = parseType("subject", json);
567    if (subject != null)
568      res.setSubject(subject);
569    if (json.has("mustSupport")) {
570      JsonArray array = json.getAsJsonArray("mustSupport");
571      for (int i = 0; i < array.size(); i++) {
572        if (array.get(i).isJsonNull()) {
573          res.getMustSupport().add(new StringType());
574        } else {;
575          res.getMustSupport().add(parseString(array.get(i).getAsString()));
576        }
577      }
578    };
579    if (json.has("_mustSupport")) {
580      JsonArray array = json.getAsJsonArray("_mustSupport");
581      for (int i = 0; i < array.size(); i++) {
582        if (i == res.getMustSupport().size())
583          res.getMustSupport().add(parseString(null));
584        if (array.get(i) instanceof JsonObject) 
585          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
586      }
587    };
588    if (json.has("codeFilter")) {
589      JsonArray array = json.getAsJsonArray("codeFilter");
590      for (int i = 0; i < array.size(); i++) {
591        res.getCodeFilter().add(parseDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject()));
592      }
593    };
594    if (json.has("dateFilter")) {
595      JsonArray array = json.getAsJsonArray("dateFilter");
596      for (int i = 0; i < array.size(); i++) {
597        res.getDateFilter().add(parseDataRequirementDateFilterComponent(array.get(i).getAsJsonObject()));
598      }
599    };
600    if (json.has("limit"))
601      res.setLimitElement(parsePositiveInt(json.get("limit").getAsString()));
602    if (json.has("_limit"))
603      parseElementProperties(json.getAsJsonObject("_limit"), res.getLimitElement());
604    if (json.has("sort")) {
605      JsonArray array = json.getAsJsonArray("sort");
606      for (int i = 0; i < array.size(); i++) {
607        res.getSort().add(parseDataRequirementSortComponent(array.get(i).getAsJsonObject()));
608      }
609    };
610  }
611
612  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementCodeFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
613    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
614    parseDataRequirementCodeFilterComponentProperties(json, res);
615    return res;
616  }
617
618  protected void parseDataRequirementCodeFilterComponentProperties(JsonObject json, DataRequirement.DataRequirementCodeFilterComponent res) throws IOException, FHIRFormatError {
619    parseElementProperties(json, res);
620    if (json.has("path"))
621      res.setPathElement(parseString(json.get("path").getAsString()));
622    if (json.has("_path"))
623      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
624    if (json.has("searchParam"))
625      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
626    if (json.has("_searchParam"))
627      parseElementProperties(json.getAsJsonObject("_searchParam"), res.getSearchParamElement());
628    if (json.has("valueSet"))
629      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
630    if (json.has("_valueSet"))
631      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
632    if (json.has("code")) {
633      JsonArray array = json.getAsJsonArray("code");
634      for (int i = 0; i < array.size(); i++) {
635        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
636      }
637    };
638  }
639
640  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDateFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
641    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
642    parseDataRequirementDateFilterComponentProperties(json, res);
643    return res;
644  }
645
646  protected void parseDataRequirementDateFilterComponentProperties(JsonObject json, DataRequirement.DataRequirementDateFilterComponent res) throws IOException, FHIRFormatError {
647    parseElementProperties(json, res);
648    if (json.has("path"))
649      res.setPathElement(parseString(json.get("path").getAsString()));
650    if (json.has("_path"))
651      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
652    if (json.has("searchParam"))
653      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
654    if (json.has("_searchParam"))
655      parseElementProperties(json.getAsJsonObject("_searchParam"), res.getSearchParamElement());
656    DataType value = parseType("value", json);
657    if (value != null)
658      res.setValue(value);
659  }
660
661  protected DataRequirement.DataRequirementSortComponent parseDataRequirementSortComponent(JsonObject json) throws IOException, FHIRFormatError {
662    DataRequirement.DataRequirementSortComponent res = new DataRequirement.DataRequirementSortComponent();
663    parseDataRequirementSortComponentProperties(json, res);
664    return res;
665  }
666
667  protected void parseDataRequirementSortComponentProperties(JsonObject json, DataRequirement.DataRequirementSortComponent res) throws IOException, FHIRFormatError {
668    parseElementProperties(json, res);
669    if (json.has("path"))
670      res.setPathElement(parseString(json.get("path").getAsString()));
671    if (json.has("_path"))
672      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
673    if (json.has("direction"))
674      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), DataRequirement.SortDirection.NULL, new DataRequirement.SortDirectionEnumFactory()));
675    if (json.has("_direction"))
676      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
677  }
678
679  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
680    Distance res = new Distance();
681    parseDistanceProperties(json, res);
682    return res;
683  }
684
685  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
686    parseQuantityProperties(json, res);
687  }
688
689  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
690    Dosage res = new Dosage();
691    parseDosageProperties(json, res);
692    return res;
693  }
694
695  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
696    parseBackboneTypeProperties(json, res);
697    if (json.has("sequence"))
698      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
699    if (json.has("_sequence"))
700      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
701    if (json.has("text"))
702      res.setTextElement(parseString(json.get("text").getAsString()));
703    if (json.has("_text"))
704      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
705    if (json.has("additionalInstruction")) {
706      JsonArray array = json.getAsJsonArray("additionalInstruction");
707      for (int i = 0; i < array.size(); i++) {
708        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
709      }
710    };
711    if (json.has("patientInstruction"))
712      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
713    if (json.has("_patientInstruction"))
714      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
715    if (json.has("timing"))
716      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
717    DataType asNeeded = parseType("asNeeded", json);
718    if (asNeeded != null)
719      res.setAsNeeded(asNeeded);
720    if (json.has("site"))
721      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
722    if (json.has("route"))
723      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
724    if (json.has("method"))
725      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
726    if (json.has("doseAndRate")) {
727      JsonArray array = json.getAsJsonArray("doseAndRate");
728      for (int i = 0; i < array.size(); i++) {
729        res.getDoseAndRate().add(parseDosageDoseAndRateComponent(array.get(i).getAsJsonObject()));
730      }
731    };
732    if (json.has("maxDosePerPeriod"))
733      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
734    if (json.has("maxDosePerAdministration"))
735      res.setMaxDosePerAdministration(parseQuantity(json.getAsJsonObject("maxDosePerAdministration")));
736    if (json.has("maxDosePerLifetime"))
737      res.setMaxDosePerLifetime(parseQuantity(json.getAsJsonObject("maxDosePerLifetime")));
738  }
739
740  protected Dosage.DosageDoseAndRateComponent parseDosageDoseAndRateComponent(JsonObject json) throws IOException, FHIRFormatError {
741    Dosage.DosageDoseAndRateComponent res = new Dosage.DosageDoseAndRateComponent();
742    parseDosageDoseAndRateComponentProperties(json, res);
743    return res;
744  }
745
746  protected void parseDosageDoseAndRateComponentProperties(JsonObject json, Dosage.DosageDoseAndRateComponent res) throws IOException, FHIRFormatError {
747    parseElementProperties(json, res);
748    if (json.has("type"))
749      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
750    DataType dose = parseType("dose", json);
751    if (dose != null)
752      res.setDose(dose);
753    DataType rate = parseType("rate", json);
754    if (rate != null)
755      res.setRate(rate);
756  }
757
758  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
759    Duration res = new Duration();
760    parseDurationProperties(json, res);
761    return res;
762  }
763
764  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
765    parseQuantityProperties(json, res);
766  }
767
768  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
769    ElementDefinition res = new ElementDefinition();
770    parseElementDefinitionProperties(json, res);
771    return res;
772  }
773
774  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
775    parseBackboneTypeProperties(json, res);
776    if (json.has("path"))
777      res.setPathElement(parseString(json.get("path").getAsString()));
778    if (json.has("_path"))
779      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
780    if (json.has("representation")) {
781      JsonArray array = json.getAsJsonArray("representation");
782      for (int i = 0; i < array.size(); i++) {
783        if (array.get(i).isJsonNull()) {
784          res.getRepresentation().add(new Enumeration<ElementDefinition.PropertyRepresentation>(new ElementDefinition.PropertyRepresentationEnumFactory(), ElementDefinition.PropertyRepresentation.NULL));
785        } else {;
786          res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
787        }
788      }
789    };
790    if (json.has("_representation")) {
791      JsonArray array = json.getAsJsonArray("_representation");
792      for (int i = 0; i < array.size(); i++) {
793        if (i == res.getRepresentation().size())
794          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
795        if (array.get(i) instanceof JsonObject) 
796          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
797      }
798    };
799    if (json.has("sliceName"))
800      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
801    if (json.has("_sliceName"))
802      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
803    if (json.has("sliceIsConstraining"))
804      res.setSliceIsConstrainingElement(parseBoolean(json.get("sliceIsConstraining").getAsBoolean()));
805    if (json.has("_sliceIsConstraining"))
806      parseElementProperties(json.getAsJsonObject("_sliceIsConstraining"), res.getSliceIsConstrainingElement());
807    if (json.has("label"))
808      res.setLabelElement(parseString(json.get("label").getAsString()));
809    if (json.has("_label"))
810      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
811    if (json.has("code")) {
812      JsonArray array = json.getAsJsonArray("code");
813      for (int i = 0; i < array.size(); i++) {
814        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
815      }
816    };
817    if (json.has("slicing"))
818      res.setSlicing(parseElementDefinitionSlicingComponent(json.getAsJsonObject("slicing")));
819    if (json.has("short"))
820      res.setShortElement(parseString(json.get("short").getAsString()));
821    if (json.has("_short"))
822      parseElementProperties(json.getAsJsonObject("_short"), res.getShortElement());
823    if (json.has("definition"))
824      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
825    if (json.has("_definition"))
826      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
827    if (json.has("comment"))
828      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
829    if (json.has("_comment"))
830      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
831    if (json.has("requirements"))
832      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
833    if (json.has("_requirements"))
834      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
835    if (json.has("alias")) {
836      JsonArray array = json.getAsJsonArray("alias");
837      for (int i = 0; i < array.size(); i++) {
838        if (array.get(i).isJsonNull()) {
839          res.getAlias().add(new StringType());
840        } else {;
841          res.getAlias().add(parseString(array.get(i).getAsString()));
842        }
843      }
844    };
845    if (json.has("_alias")) {
846      JsonArray array = json.getAsJsonArray("_alias");
847      for (int i = 0; i < array.size(); i++) {
848        if (i == res.getAlias().size())
849          res.getAlias().add(parseString(null));
850        if (array.get(i) instanceof JsonObject) 
851          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
852      }
853    };
854    if (json.has("min"))
855      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
856    if (json.has("_min"))
857      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
858    if (json.has("max"))
859      res.setMaxElement(parseString(json.get("max").getAsString()));
860    if (json.has("_max"))
861      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
862    if (json.has("base"))
863      res.setBase(parseElementDefinitionBaseComponent(json.getAsJsonObject("base")));
864    if (json.has("contentReference"))
865      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
866    if (json.has("_contentReference"))
867      parseElementProperties(json.getAsJsonObject("_contentReference"), res.getContentReferenceElement());
868    if (json.has("type")) {
869      JsonArray array = json.getAsJsonArray("type");
870      for (int i = 0; i < array.size(); i++) {
871        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject()));
872      }
873    };
874    DataType defaultValue = parseType("defaultValue", json);
875    if (defaultValue != null)
876      res.setDefaultValue(defaultValue);
877    if (json.has("meaningWhenMissing"))
878      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
879    if (json.has("_meaningWhenMissing"))
880      parseElementProperties(json.getAsJsonObject("_meaningWhenMissing"), res.getMeaningWhenMissingElement());
881    if (json.has("orderMeaning"))
882      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
883    if (json.has("_orderMeaning"))
884      parseElementProperties(json.getAsJsonObject("_orderMeaning"), res.getOrderMeaningElement());
885    DataType fixed = parseType("fixed", json);
886    if (fixed != null)
887      res.setFixed(fixed);
888    DataType pattern = parseType("pattern", json);
889    if (pattern != null)
890      res.setPattern(pattern);
891    if (json.has("example")) {
892      JsonArray array = json.getAsJsonArray("example");
893      for (int i = 0; i < array.size(); i++) {
894        res.getExample().add(parseElementDefinitionExampleComponent(array.get(i).getAsJsonObject()));
895      }
896    };
897    DataType minValue = parseType("minValue", json);
898    if (minValue != null)
899      res.setMinValue(minValue);
900    DataType maxValue = parseType("maxValue", json);
901    if (maxValue != null)
902      res.setMaxValue(maxValue);
903    if (json.has("maxLength"))
904      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
905    if (json.has("_maxLength"))
906      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
907    if (json.has("condition")) {
908      JsonArray array = json.getAsJsonArray("condition");
909      for (int i = 0; i < array.size(); i++) {
910        if (array.get(i).isJsonNull()) {
911          res.getCondition().add(new IdType());
912        } else {;
913          res.getCondition().add(parseId(array.get(i).getAsString()));
914        }
915      }
916    };
917    if (json.has("_condition")) {
918      JsonArray array = json.getAsJsonArray("_condition");
919      for (int i = 0; i < array.size(); i++) {
920        if (i == res.getCondition().size())
921          res.getCondition().add(parseId(null));
922        if (array.get(i) instanceof JsonObject) 
923          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
924      }
925    };
926    if (json.has("constraint")) {
927      JsonArray array = json.getAsJsonArray("constraint");
928      for (int i = 0; i < array.size(); i++) {
929        res.getConstraint().add(parseElementDefinitionConstraintComponent(array.get(i).getAsJsonObject()));
930      }
931    };
932    if (json.has("mustSupport"))
933      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
934    if (json.has("_mustSupport"))
935      parseElementProperties(json.getAsJsonObject("_mustSupport"), res.getMustSupportElement());
936    if (json.has("isModifier"))
937      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
938    if (json.has("_isModifier"))
939      parseElementProperties(json.getAsJsonObject("_isModifier"), res.getIsModifierElement());
940    if (json.has("isModifierReason"))
941      res.setIsModifierReasonElement(parseString(json.get("isModifierReason").getAsString()));
942    if (json.has("_isModifierReason"))
943      parseElementProperties(json.getAsJsonObject("_isModifierReason"), res.getIsModifierReasonElement());
944    if (json.has("isSummary"))
945      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
946    if (json.has("_isSummary"))
947      parseElementProperties(json.getAsJsonObject("_isSummary"), res.getIsSummaryElement());
948    if (json.has("binding"))
949      res.setBinding(parseElementDefinitionBindingComponent(json.getAsJsonObject("binding")));
950    if (json.has("mapping")) {
951      JsonArray array = json.getAsJsonArray("mapping");
952      for (int i = 0; i < array.size(); i++) {
953        res.getMapping().add(parseElementDefinitionMappingComponent(array.get(i).getAsJsonObject()));
954      }
955    };
956  }
957
958  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionSlicingComponent(JsonObject json) throws IOException, FHIRFormatError {
959    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
960    parseElementDefinitionSlicingComponentProperties(json, res);
961    return res;
962  }
963
964  protected void parseElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
965    parseElementProperties(json, res);
966    if (json.has("discriminator")) {
967      JsonArray array = json.getAsJsonArray("discriminator");
968      for (int i = 0; i < array.size(); i++) {
969        res.getDiscriminator().add(parseElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject()));
970      }
971    };
972    if (json.has("description"))
973      res.setDescriptionElement(parseString(json.get("description").getAsString()));
974    if (json.has("_description"))
975      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
976    if (json.has("ordered"))
977      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
978    if (json.has("_ordered"))
979      parseElementProperties(json.getAsJsonObject("_ordered"), res.getOrderedElement());
980    if (json.has("rules"))
981      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
982    if (json.has("_rules"))
983      parseElementProperties(json.getAsJsonObject("_rules"), res.getRulesElement());
984  }
985
986  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionSlicingDiscriminatorComponent(JsonObject json) throws IOException, FHIRFormatError {
987    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
988    parseElementDefinitionSlicingDiscriminatorComponentProperties(json, res);
989    return res;
990  }
991
992  protected void parseElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
993    parseElementProperties(json, res);
994    if (json.has("type"))
995      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
996    if (json.has("_type"))
997      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
998    if (json.has("path"))
999      res.setPathElement(parseString(json.get("path").getAsString()));
1000    if (json.has("_path"))
1001      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1002  }
1003
1004  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionBaseComponent(JsonObject json) throws IOException, FHIRFormatError {
1005    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1006    parseElementDefinitionBaseComponentProperties(json, res);
1007    return res;
1008  }
1009
1010  protected void parseElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
1011    parseElementProperties(json, res);
1012    if (json.has("path"))
1013      res.setPathElement(parseString(json.get("path").getAsString()));
1014    if (json.has("_path"))
1015      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1016    if (json.has("min"))
1017      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1018    if (json.has("_min"))
1019      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1020    if (json.has("max"))
1021      res.setMaxElement(parseString(json.get("max").getAsString()));
1022    if (json.has("_max"))
1023      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1024  }
1025
1026  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json) throws IOException, FHIRFormatError {
1027    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1028    parseElementDefinitionTypeRefComponentProperties(json, res);
1029    return res;
1030  }
1031
1032  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1033    parseElementProperties(json, res);
1034    if (json.has("code"))
1035      res.setCodeElement(parseUri(json.get("code").getAsString()));
1036    if (json.has("_code"))
1037      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1038    if (json.has("profile")) {
1039      JsonArray array = json.getAsJsonArray("profile");
1040      for (int i = 0; i < array.size(); i++) {
1041        if (array.get(i).isJsonNull()) {
1042          res.getProfile().add(new CanonicalType());
1043        } else {;
1044          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1045        }
1046      }
1047    };
1048    if (json.has("_profile")) {
1049      JsonArray array = json.getAsJsonArray("_profile");
1050      for (int i = 0; i < array.size(); i++) {
1051        if (i == res.getProfile().size())
1052          res.getProfile().add(parseCanonical(null));
1053        if (array.get(i) instanceof JsonObject) 
1054          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1055      }
1056    };
1057    if (json.has("targetProfile")) {
1058      JsonArray array = json.getAsJsonArray("targetProfile");
1059      for (int i = 0; i < array.size(); i++) {
1060        if (array.get(i).isJsonNull()) {
1061          res.getTargetProfile().add(new CanonicalType());
1062        } else {;
1063          res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
1064        }
1065      }
1066    };
1067    if (json.has("_targetProfile")) {
1068      JsonArray array = json.getAsJsonArray("_targetProfile");
1069      for (int i = 0; i < array.size(); i++) {
1070        if (i == res.getTargetProfile().size())
1071          res.getTargetProfile().add(parseCanonical(null));
1072        if (array.get(i) instanceof JsonObject) 
1073          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
1074      }
1075    };
1076    if (json.has("aggregation")) {
1077      JsonArray array = json.getAsJsonArray("aggregation");
1078      for (int i = 0; i < array.size(); i++) {
1079        if (array.get(i).isJsonNull()) {
1080          res.getAggregation().add(new Enumeration<ElementDefinition.AggregationMode>(new ElementDefinition.AggregationModeEnumFactory(), ElementDefinition.AggregationMode.NULL));
1081        } else {;
1082          res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1083        }
1084      }
1085    };
1086    if (json.has("_aggregation")) {
1087      JsonArray array = json.getAsJsonArray("_aggregation");
1088      for (int i = 0; i < array.size(); i++) {
1089        if (i == res.getAggregation().size())
1090          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1091        if (array.get(i) instanceof JsonObject) 
1092          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1093      }
1094    };
1095    if (json.has("versioning"))
1096      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1097    if (json.has("_versioning"))
1098      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
1099  }
1100
1101  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionExampleComponent(JsonObject json) throws IOException, FHIRFormatError {
1102    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1103    parseElementDefinitionExampleComponentProperties(json, res);
1104    return res;
1105  }
1106
1107  protected void parseElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
1108    parseElementProperties(json, res);
1109    if (json.has("label"))
1110      res.setLabelElement(parseString(json.get("label").getAsString()));
1111    if (json.has("_label"))
1112      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1113    DataType value = parseType("value", json);
1114    if (value != null)
1115      res.setValue(value);
1116  }
1117
1118  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionConstraintComponent(JsonObject json) throws IOException, FHIRFormatError {
1119    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1120    parseElementDefinitionConstraintComponentProperties(json, res);
1121    return res;
1122  }
1123
1124  protected void parseElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
1125    parseElementProperties(json, res);
1126    if (json.has("key"))
1127      res.setKeyElement(parseId(json.get("key").getAsString()));
1128    if (json.has("_key"))
1129      parseElementProperties(json.getAsJsonObject("_key"), res.getKeyElement());
1130    if (json.has("requirements"))
1131      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
1132    if (json.has("_requirements"))
1133      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1134    if (json.has("severity"))
1135      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1136    if (json.has("_severity"))
1137      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
1138    if (json.has("human"))
1139      res.setHumanElement(parseString(json.get("human").getAsString()));
1140    if (json.has("_human"))
1141      parseElementProperties(json.getAsJsonObject("_human"), res.getHumanElement());
1142    if (json.has("expression"))
1143      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1144    if (json.has("_expression"))
1145      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
1146    if (json.has("xpath"))
1147      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1148    if (json.has("_xpath"))
1149      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
1150    if (json.has("source"))
1151      res.setSourceElement(parseCanonical(json.get("source").getAsString()));
1152    if (json.has("_source"))
1153      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
1154  }
1155
1156  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionBindingComponent(JsonObject json) throws IOException, FHIRFormatError {
1157    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1158    parseElementDefinitionBindingComponentProperties(json, res);
1159    return res;
1160  }
1161
1162  protected void parseElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
1163    parseElementProperties(json, res);
1164    if (json.has("strength"))
1165      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1166    if (json.has("_strength"))
1167      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
1168    if (json.has("description"))
1169      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1170    if (json.has("_description"))
1171      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1172    if (json.has("valueSet"))
1173      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
1174    if (json.has("_valueSet"))
1175      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
1176  }
1177
1178  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionMappingComponent(JsonObject json) throws IOException, FHIRFormatError {
1179    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1180    parseElementDefinitionMappingComponentProperties(json, res);
1181    return res;
1182  }
1183
1184  protected void parseElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
1185    parseElementProperties(json, res);
1186    if (json.has("identity"))
1187      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1188    if (json.has("_identity"))
1189      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
1190    if (json.has("language"))
1191      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1192    if (json.has("_language"))
1193      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1194    if (json.has("map"))
1195      res.setMapElement(parseString(json.get("map").getAsString()));
1196    if (json.has("_map"))
1197      parseElementProperties(json.getAsJsonObject("_map"), res.getMapElement());
1198    if (json.has("comment"))
1199      res.setCommentElement(parseString(json.get("comment").getAsString()));
1200    if (json.has("_comment"))
1201      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1202  }
1203
1204  protected Expression parseExpression(JsonObject json) throws IOException, FHIRFormatError {
1205    Expression res = new Expression();
1206    parseExpressionProperties(json, res);
1207    return res;
1208  }
1209
1210  protected void parseExpressionProperties(JsonObject json, Expression res) throws IOException, FHIRFormatError {
1211    parseDataTypeProperties(json, res);
1212    if (json.has("description"))
1213      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1214    if (json.has("_description"))
1215      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1216    if (json.has("name"))
1217      res.setNameElement(parseId(json.get("name").getAsString()));
1218    if (json.has("_name"))
1219      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1220    if (json.has("language"))
1221      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1222    if (json.has("_language"))
1223      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1224    if (json.has("expression"))
1225      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1226    if (json.has("_expression"))
1227      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
1228    if (json.has("reference"))
1229      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
1230    if (json.has("_reference"))
1231      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
1232  }
1233
1234  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
1235    Extension res = new Extension();
1236    parseExtensionProperties(json, res);
1237    return res;
1238  }
1239
1240  protected void parseExtensionProperties(JsonObject json, Extension res) throws IOException, FHIRFormatError {
1241    parseDataTypeProperties(json, res);
1242    if (json.has("url"))
1243      res.setUrlElement(parseUri(json.get("url").getAsString()));
1244    if (json.has("_url"))
1245      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
1246    DataType value = parseType("value", json);
1247    if (value != null)
1248      res.setValue(value);
1249  }
1250
1251  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
1252    HumanName res = new HumanName();
1253    parseHumanNameProperties(json, res);
1254    return res;
1255  }
1256
1257  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
1258    parseDataTypeProperties(json, res);
1259    if (json.has("use"))
1260      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
1261    if (json.has("_use"))
1262      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1263    if (json.has("text"))
1264      res.setTextElement(parseString(json.get("text").getAsString()));
1265    if (json.has("_text"))
1266      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
1267    if (json.has("family"))
1268      res.setFamilyElement(parseString(json.get("family").getAsString()));
1269    if (json.has("_family"))
1270      parseElementProperties(json.getAsJsonObject("_family"), res.getFamilyElement());
1271    if (json.has("given")) {
1272      JsonArray array = json.getAsJsonArray("given");
1273      for (int i = 0; i < array.size(); i++) {
1274        if (array.get(i).isJsonNull()) {
1275          res.getGiven().add(new StringType());
1276        } else {;
1277          res.getGiven().add(parseString(array.get(i).getAsString()));
1278        }
1279      }
1280    };
1281    if (json.has("_given")) {
1282      JsonArray array = json.getAsJsonArray("_given");
1283      for (int i = 0; i < array.size(); i++) {
1284        if (i == res.getGiven().size())
1285          res.getGiven().add(parseString(null));
1286        if (array.get(i) instanceof JsonObject) 
1287          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
1288      }
1289    };
1290    if (json.has("prefix")) {
1291      JsonArray array = json.getAsJsonArray("prefix");
1292      for (int i = 0; i < array.size(); i++) {
1293        if (array.get(i).isJsonNull()) {
1294          res.getPrefix().add(new StringType());
1295        } else {;
1296          res.getPrefix().add(parseString(array.get(i).getAsString()));
1297        }
1298      }
1299    };
1300    if (json.has("_prefix")) {
1301      JsonArray array = json.getAsJsonArray("_prefix");
1302      for (int i = 0; i < array.size(); i++) {
1303        if (i == res.getPrefix().size())
1304          res.getPrefix().add(parseString(null));
1305        if (array.get(i) instanceof JsonObject) 
1306          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
1307      }
1308    };
1309    if (json.has("suffix")) {
1310      JsonArray array = json.getAsJsonArray("suffix");
1311      for (int i = 0; i < array.size(); i++) {
1312        if (array.get(i).isJsonNull()) {
1313          res.getSuffix().add(new StringType());
1314        } else {;
1315          res.getSuffix().add(parseString(array.get(i).getAsString()));
1316        }
1317      }
1318    };
1319    if (json.has("_suffix")) {
1320      JsonArray array = json.getAsJsonArray("_suffix");
1321      for (int i = 0; i < array.size(); i++) {
1322        if (i == res.getSuffix().size())
1323          res.getSuffix().add(parseString(null));
1324        if (array.get(i) instanceof JsonObject) 
1325          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
1326      }
1327    };
1328    if (json.has("period"))
1329      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
1330  }
1331
1332  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
1333    Identifier res = new Identifier();
1334    parseIdentifierProperties(json, res);
1335    return res;
1336  }
1337
1338  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
1339    parseDataTypeProperties(json, res);
1340    if (json.has("use"))
1341      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
1342    if (json.has("_use"))
1343      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1344    if (json.has("type"))
1345      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
1346    if (json.has("system"))
1347      res.setSystemElement(parseUri(json.get("system").getAsString()));
1348    if (json.has("_system"))
1349      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
1350    if (json.has("value"))
1351      res.setValueElement(parseString(json.get("value").getAsString()));
1352    if (json.has("_value"))
1353      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
1354    if (json.has("period"))
1355      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
1356    if (json.has("assigner"))
1357      res.setAssigner(parseReference(json.getAsJsonObject("assigner")));
1358  }
1359
1360  protected MarketingStatus parseMarketingStatus(JsonObject json) throws IOException, FHIRFormatError {
1361    MarketingStatus res = new MarketingStatus();
1362    parseMarketingStatusProperties(json, res);
1363    return res;
1364  }
1365
1366  protected void parseMarketingStatusProperties(JsonObject json, MarketingStatus res) throws IOException, FHIRFormatError {
1367    parseBackboneTypeProperties(json, res);
1368    if (json.has("country"))
1369      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
1370    if (json.has("jurisdiction"))
1371      res.setJurisdiction(parseCodeableConcept(json.getAsJsonObject("jurisdiction")));
1372    if (json.has("status"))
1373      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
1374    if (json.has("dateRange"))
1375      res.setDateRange(parsePeriod(json.getAsJsonObject("dateRange")));
1376    if (json.has("restoreDate"))
1377      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
1378    if (json.has("_restoreDate"))
1379      parseElementProperties(json.getAsJsonObject("_restoreDate"), res.getRestoreDateElement());
1380  }
1381
1382  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
1383    Meta res = new Meta();
1384    parseMetaProperties(json, res);
1385    return res;
1386  }
1387
1388  protected void parseMetaProperties(JsonObject json, Meta res) throws IOException, FHIRFormatError {
1389    parseElementProperties(json, res);
1390    if (json.has("versionId"))
1391      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
1392    if (json.has("_versionId"))
1393      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
1394    if (json.has("lastUpdated"))
1395      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
1396    if (json.has("_lastUpdated"))
1397      parseElementProperties(json.getAsJsonObject("_lastUpdated"), res.getLastUpdatedElement());
1398    if (json.has("source"))
1399      res.setSourceElement(parseUri(json.get("source").getAsString()));
1400    if (json.has("_source"))
1401      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
1402    if (json.has("profile")) {
1403      JsonArray array = json.getAsJsonArray("profile");
1404      for (int i = 0; i < array.size(); i++) {
1405        if (array.get(i).isJsonNull()) {
1406          res.getProfile().add(new CanonicalType());
1407        } else {;
1408          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1409        }
1410      }
1411    };
1412    if (json.has("_profile")) {
1413      JsonArray array = json.getAsJsonArray("_profile");
1414      for (int i = 0; i < array.size(); i++) {
1415        if (i == res.getProfile().size())
1416          res.getProfile().add(parseCanonical(null));
1417        if (array.get(i) instanceof JsonObject) 
1418          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1419      }
1420    };
1421    if (json.has("security")) {
1422      JsonArray array = json.getAsJsonArray("security");
1423      for (int i = 0; i < array.size(); i++) {
1424        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
1425      }
1426    };
1427    if (json.has("tag")) {
1428      JsonArray array = json.getAsJsonArray("tag");
1429      for (int i = 0; i < array.size(); i++) {
1430        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
1431      }
1432    };
1433  }
1434
1435  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
1436    Money res = new Money();
1437    parseMoneyProperties(json, res);
1438    return res;
1439  }
1440
1441  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
1442    parseDataTypeProperties(json, res);
1443    if (json.has("value"))
1444      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1445    if (json.has("_value"))
1446      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
1447    if (json.has("currency"))
1448      res.setCurrencyElement(parseCode(json.get("currency").getAsString()));
1449    if (json.has("_currency"))
1450      parseElementProperties(json.getAsJsonObject("_currency"), res.getCurrencyElement());
1451  }
1452
1453  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
1454    Narrative res = new Narrative();
1455    parseNarrativeProperties(json, res);
1456    return res;
1457  }
1458
1459  protected void parseNarrativeProperties(JsonObject json, Narrative res) throws IOException, FHIRFormatError {
1460    parseDataTypeProperties(json, res);
1461    if (json.has("status"))
1462      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
1463    if (json.has("_status"))
1464      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1465    if (json.has("div"))
1466      res.setDiv(parseXhtml(json.get("div").getAsString()));
1467  }
1468
1469  protected OrderedDistribution parseOrderedDistribution(JsonObject json) throws IOException, FHIRFormatError {
1470    OrderedDistribution res = new OrderedDistribution();
1471    parseOrderedDistributionProperties(json, res);
1472    return res;
1473  }
1474
1475  protected void parseOrderedDistributionProperties(JsonObject json, OrderedDistribution res) throws IOException, FHIRFormatError {
1476    parseBackboneTypeProperties(json, res);
1477    if (json.has("description"))
1478      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1479    if (json.has("_description"))
1480      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1481    if (json.has("note")) {
1482      JsonArray array = json.getAsJsonArray("note");
1483      for (int i = 0; i < array.size(); i++) {
1484        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
1485      }
1486    };
1487    if (json.has("numberOfIntervals"))
1488      res.setNumberOfIntervalsElement(parseInteger(json.get("numberOfIntervals").getAsLong()));
1489    if (json.has("_numberOfIntervals"))
1490      parseElementProperties(json.getAsJsonObject("_numberOfIntervals"), res.getNumberOfIntervalsElement());
1491    if (json.has("bottomOfFirstInterval"))
1492      res.setBottomOfFirstInterval(parseQuantity(json.getAsJsonObject("bottomOfFirstInterval")));
1493    if (json.has("interval")) {
1494      JsonArray array = json.getAsJsonArray("interval");
1495      for (int i = 0; i < array.size(); i++) {
1496        res.getInterval().add(parseOrderedDistributionIntervalComponent(array.get(i).getAsJsonObject()));
1497      }
1498    };
1499    if (json.has("topOfInterval"))
1500      res.setTopOfInterval(parseQuantity(json.getAsJsonObject("topOfInterval")));
1501  }
1502
1503  protected OrderedDistribution.OrderedDistributionIntervalComponent parseOrderedDistributionIntervalComponent(JsonObject json) throws IOException, FHIRFormatError {
1504    OrderedDistribution.OrderedDistributionIntervalComponent res = new OrderedDistribution.OrderedDistributionIntervalComponent();
1505    parseOrderedDistributionIntervalComponentProperties(json, res);
1506    return res;
1507  }
1508
1509  protected void parseOrderedDistributionIntervalComponentProperties(JsonObject json, OrderedDistribution.OrderedDistributionIntervalComponent res) throws IOException, FHIRFormatError {
1510    parseElementProperties(json, res);
1511    if (json.has("rankOrder"))
1512      res.setRankOrderElement(parseInteger(json.get("rankOrder").getAsLong()));
1513    if (json.has("_rankOrder"))
1514      parseElementProperties(json.getAsJsonObject("_rankOrder"), res.getRankOrderElement());
1515    if (json.has("intervalStatistic")) {
1516      JsonArray array = json.getAsJsonArray("intervalStatistic");
1517      for (int i = 0; i < array.size(); i++) {
1518        res.getIntervalStatistic().add(parseStatistic(array.get(i).getAsJsonObject()));
1519      }
1520    };
1521  }
1522
1523  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1524    ParameterDefinition res = new ParameterDefinition();
1525    parseParameterDefinitionProperties(json, res);
1526    return res;
1527  }
1528
1529  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1530    parseDataTypeProperties(json, res);
1531    if (json.has("name"))
1532      res.setNameElement(parseCode(json.get("name").getAsString()));
1533    if (json.has("_name"))
1534      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1535    if (json.has("use"))
1536      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.OperationParameterUse.NULL, new Enumerations.OperationParameterUseEnumFactory()));
1537    if (json.has("_use"))
1538      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1539    if (json.has("min"))
1540      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1541    if (json.has("_min"))
1542      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1543    if (json.has("max"))
1544      res.setMaxElement(parseString(json.get("max").getAsString()));
1545    if (json.has("_max"))
1546      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1547    if (json.has("documentation"))
1548      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1549    if (json.has("_documentation"))
1550      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
1551    if (json.has("type"))
1552      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.FHIRAllTypes.NULL, new Enumerations.FHIRAllTypesEnumFactory()));
1553    if (json.has("_type"))
1554      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1555    if (json.has("profile"))
1556      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
1557    if (json.has("_profile"))
1558      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
1559  }
1560
1561  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
1562    Period res = new Period();
1563    parsePeriodProperties(json, res);
1564    return res;
1565  }
1566
1567  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
1568    parseDataTypeProperties(json, res);
1569    if (json.has("start"))
1570      res.setStartElement(parseDateTime(json.get("start").getAsString()));
1571    if (json.has("_start"))
1572      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
1573    if (json.has("end"))
1574      res.setEndElement(parseDateTime(json.get("end").getAsString()));
1575    if (json.has("_end"))
1576      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
1577  }
1578
1579  protected Population parsePopulation(JsonObject json) throws IOException, FHIRFormatError {
1580    Population res = new Population();
1581    parsePopulationProperties(json, res);
1582    return res;
1583  }
1584
1585  protected void parsePopulationProperties(JsonObject json, Population res) throws IOException, FHIRFormatError {
1586    parseBackboneTypeProperties(json, res);
1587    DataType age = parseType("age", json);
1588    if (age != null)
1589      res.setAge(age);
1590    if (json.has("gender"))
1591      res.setGender(parseCodeableConcept(json.getAsJsonObject("gender")));
1592    if (json.has("race"))
1593      res.setRace(parseCodeableConcept(json.getAsJsonObject("race")));
1594    if (json.has("physiologicalCondition"))
1595      res.setPhysiologicalCondition(parseCodeableConcept(json.getAsJsonObject("physiologicalCondition")));
1596  }
1597
1598  protected ProdCharacteristic parseProdCharacteristic(JsonObject json) throws IOException, FHIRFormatError {
1599    ProdCharacteristic res = new ProdCharacteristic();
1600    parseProdCharacteristicProperties(json, res);
1601    return res;
1602  }
1603
1604  protected void parseProdCharacteristicProperties(JsonObject json, ProdCharacteristic res) throws IOException, FHIRFormatError {
1605    parseBackboneTypeProperties(json, res);
1606    if (json.has("height"))
1607      res.setHeight(parseQuantity(json.getAsJsonObject("height")));
1608    if (json.has("width"))
1609      res.setWidth(parseQuantity(json.getAsJsonObject("width")));
1610    if (json.has("depth"))
1611      res.setDepth(parseQuantity(json.getAsJsonObject("depth")));
1612    if (json.has("weight"))
1613      res.setWeight(parseQuantity(json.getAsJsonObject("weight")));
1614    if (json.has("nominalVolume"))
1615      res.setNominalVolume(parseQuantity(json.getAsJsonObject("nominalVolume")));
1616    if (json.has("externalDiameter"))
1617      res.setExternalDiameter(parseQuantity(json.getAsJsonObject("externalDiameter")));
1618    if (json.has("shape"))
1619      res.setShapeElement(parseString(json.get("shape").getAsString()));
1620    if (json.has("_shape"))
1621      parseElementProperties(json.getAsJsonObject("_shape"), res.getShapeElement());
1622    if (json.has("color")) {
1623      JsonArray array = json.getAsJsonArray("color");
1624      for (int i = 0; i < array.size(); i++) {
1625        if (array.get(i).isJsonNull()) {
1626          res.getColor().add(new StringType());
1627        } else {;
1628          res.getColor().add(parseString(array.get(i).getAsString()));
1629        }
1630      }
1631    };
1632    if (json.has("_color")) {
1633      JsonArray array = json.getAsJsonArray("_color");
1634      for (int i = 0; i < array.size(); i++) {
1635        if (i == res.getColor().size())
1636          res.getColor().add(parseString(null));
1637        if (array.get(i) instanceof JsonObject) 
1638          parseElementProperties(array.get(i).getAsJsonObject(), res.getColor().get(i));
1639      }
1640    };
1641    if (json.has("imprint")) {
1642      JsonArray array = json.getAsJsonArray("imprint");
1643      for (int i = 0; i < array.size(); i++) {
1644        if (array.get(i).isJsonNull()) {
1645          res.getImprint().add(new StringType());
1646        } else {;
1647          res.getImprint().add(parseString(array.get(i).getAsString()));
1648        }
1649      }
1650    };
1651    if (json.has("_imprint")) {
1652      JsonArray array = json.getAsJsonArray("_imprint");
1653      for (int i = 0; i < array.size(); i++) {
1654        if (i == res.getImprint().size())
1655          res.getImprint().add(parseString(null));
1656        if (array.get(i) instanceof JsonObject) 
1657          parseElementProperties(array.get(i).getAsJsonObject(), res.getImprint().get(i));
1658      }
1659    };
1660    if (json.has("image")) {
1661      JsonArray array = json.getAsJsonArray("image");
1662      for (int i = 0; i < array.size(); i++) {
1663        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
1664      }
1665    };
1666    if (json.has("scoring"))
1667      res.setScoring(parseCodeableConcept(json.getAsJsonObject("scoring")));
1668  }
1669
1670  protected ProductShelfLife parseProductShelfLife(JsonObject json) throws IOException, FHIRFormatError {
1671    ProductShelfLife res = new ProductShelfLife();
1672    parseProductShelfLifeProperties(json, res);
1673    return res;
1674  }
1675
1676  protected void parseProductShelfLifeProperties(JsonObject json, ProductShelfLife res) throws IOException, FHIRFormatError {
1677    parseBackboneTypeProperties(json, res);
1678    if (json.has("identifier"))
1679      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
1680    if (json.has("type"))
1681      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
1682    if (json.has("period"))
1683      res.setPeriod(parseQuantity(json.getAsJsonObject("period")));
1684    if (json.has("specialPrecautionsForStorage")) {
1685      JsonArray array = json.getAsJsonArray("specialPrecautionsForStorage");
1686      for (int i = 0; i < array.size(); i++) {
1687        res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1688      }
1689    };
1690  }
1691
1692  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
1693    Quantity res = new Quantity();
1694    parseQuantityProperties(json, res);
1695    return res;
1696  }
1697
1698  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
1699    parseDataTypeProperties(json, res);
1700    if (json.has("value"))
1701      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1702    if (json.has("_value"))
1703      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
1704    if (json.has("comparator"))
1705      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Enumerations.QuantityComparator.NULL, new Enumerations.QuantityComparatorEnumFactory()));
1706    if (json.has("_comparator"))
1707      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
1708    if (json.has("unit"))
1709      res.setUnitElement(parseString(json.get("unit").getAsString()));
1710    if (json.has("_unit"))
1711      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
1712    if (json.has("system"))
1713      res.setSystemElement(parseUri(json.get("system").getAsString()));
1714    if (json.has("_system"))
1715      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
1716    if (json.has("code"))
1717      res.setCodeElement(parseCode(json.get("code").getAsString()));
1718    if (json.has("_code"))
1719      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1720  }
1721
1722  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
1723    Range res = new Range();
1724    parseRangeProperties(json, res);
1725    return res;
1726  }
1727
1728  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
1729    parseDataTypeProperties(json, res);
1730    if (json.has("low"))
1731      res.setLow(parseQuantity(json.getAsJsonObject("low")));
1732    if (json.has("high"))
1733      res.setHigh(parseQuantity(json.getAsJsonObject("high")));
1734  }
1735
1736  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
1737    Ratio res = new Ratio();
1738    parseRatioProperties(json, res);
1739    return res;
1740  }
1741
1742  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
1743    parseDataTypeProperties(json, res);
1744    if (json.has("numerator"))
1745      res.setNumerator(parseQuantity(json.getAsJsonObject("numerator")));
1746    if (json.has("denominator"))
1747      res.setDenominator(parseQuantity(json.getAsJsonObject("denominator")));
1748  }
1749
1750  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
1751    Reference res = new Reference();
1752    parseReferenceProperties(json, res);
1753    return res;
1754  }
1755
1756  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
1757    parseDataTypeProperties(json, res);
1758    if (json.has("reference"))
1759      res.setReferenceElement(parseString(json.get("reference").getAsString()));
1760    if (json.has("_reference"))
1761      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
1762    if (json.has("type"))
1763      res.setTypeElement(parseUri(json.get("type").getAsString()));
1764    if (json.has("_type"))
1765      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1766    if (json.has("identifier"))
1767      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
1768    if (json.has("display"))
1769      res.setDisplayElement(parseString(json.get("display").getAsString()));
1770    if (json.has("_display"))
1771      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
1772  }
1773
1774  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
1775    RelatedArtifact res = new RelatedArtifact();
1776    parseRelatedArtifactProperties(json, res);
1777    return res;
1778  }
1779
1780  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
1781    parseDataTypeProperties(json, res);
1782    if (json.has("type"))
1783      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
1784    if (json.has("_type"))
1785      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1786    if (json.has("label"))
1787      res.setLabelElement(parseString(json.get("label").getAsString()));
1788    if (json.has("_label"))
1789      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1790    if (json.has("display"))
1791      res.setDisplayElement(parseString(json.get("display").getAsString()));
1792    if (json.has("_display"))
1793      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
1794    if (json.has("citation"))
1795      res.setCitationElement(parseMarkdown(json.get("citation").getAsString()));
1796    if (json.has("_citation"))
1797      parseElementProperties(json.getAsJsonObject("_citation"), res.getCitationElement());
1798    if (json.has("url"))
1799      res.setUrlElement(parseUrl(json.get("url").getAsString()));
1800    if (json.has("_url"))
1801      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
1802    if (json.has("document"))
1803      res.setDocument(parseAttachment(json.getAsJsonObject("document")));
1804    if (json.has("resource"))
1805      res.setResourceElement(parseCanonical(json.get("resource").getAsString()));
1806    if (json.has("_resource"))
1807      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
1808  }
1809
1810  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
1811    SampledData res = new SampledData();
1812    parseSampledDataProperties(json, res);
1813    return res;
1814  }
1815
1816  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
1817    parseDataTypeProperties(json, res);
1818    if (json.has("origin"))
1819      res.setOrigin(parseQuantity(json.getAsJsonObject("origin")));
1820    if (json.has("period"))
1821      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1822    if (json.has("_period"))
1823      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
1824    if (json.has("factor"))
1825      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
1826    if (json.has("_factor"))
1827      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
1828    if (json.has("lowerLimit"))
1829      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
1830    if (json.has("_lowerLimit"))
1831      parseElementProperties(json.getAsJsonObject("_lowerLimit"), res.getLowerLimitElement());
1832    if (json.has("upperLimit"))
1833      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
1834    if (json.has("_upperLimit"))
1835      parseElementProperties(json.getAsJsonObject("_upperLimit"), res.getUpperLimitElement());
1836    if (json.has("dimensions"))
1837      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
1838    if (json.has("_dimensions"))
1839      parseElementProperties(json.getAsJsonObject("_dimensions"), res.getDimensionsElement());
1840    if (json.has("data"))
1841      res.setDataElement(parseString(json.get("data").getAsString()));
1842    if (json.has("_data"))
1843      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
1844  }
1845
1846  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
1847    Signature res = new Signature();
1848    parseSignatureProperties(json, res);
1849    return res;
1850  }
1851
1852  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
1853    parseDataTypeProperties(json, res);
1854    if (json.has("type")) {
1855      JsonArray array = json.getAsJsonArray("type");
1856      for (int i = 0; i < array.size(); i++) {
1857        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
1858      }
1859    };
1860    if (json.has("when"))
1861      res.setWhenElement(parseInstant(json.get("when").getAsString()));
1862    if (json.has("_when"))
1863      parseElementProperties(json.getAsJsonObject("_when"), res.getWhenElement());
1864    if (json.has("who"))
1865      res.setWho(parseReference(json.getAsJsonObject("who")));
1866    if (json.has("onBehalfOf"))
1867      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
1868    if (json.has("targetFormat"))
1869      res.setTargetFormatElement(parseCode(json.get("targetFormat").getAsString()));
1870    if (json.has("_targetFormat"))
1871      parseElementProperties(json.getAsJsonObject("_targetFormat"), res.getTargetFormatElement());
1872    if (json.has("sigFormat"))
1873      res.setSigFormatElement(parseCode(json.get("sigFormat").getAsString()));
1874    if (json.has("_sigFormat"))
1875      parseElementProperties(json.getAsJsonObject("_sigFormat"), res.getSigFormatElement());
1876    if (json.has("data"))
1877      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
1878    if (json.has("_data"))
1879      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
1880  }
1881
1882  protected Statistic parseStatistic(JsonObject json) throws IOException, FHIRFormatError {
1883    Statistic res = new Statistic();
1884    parseStatisticProperties(json, res);
1885    return res;
1886  }
1887
1888  protected void parseStatisticProperties(JsonObject json, Statistic res) throws IOException, FHIRFormatError {
1889    parseBackboneTypeProperties(json, res);
1890    if (json.has("description"))
1891      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1892    if (json.has("_description"))
1893      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1894    if (json.has("note")) {
1895      JsonArray array = json.getAsJsonArray("note");
1896      for (int i = 0; i < array.size(); i++) {
1897        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
1898      }
1899    };
1900    if (json.has("statisticType"))
1901      res.setStatisticType(parseCodeableConcept(json.getAsJsonObject("statisticType")));
1902    if (json.has("quantity"))
1903      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
1904    if (json.has("sampleSize"))
1905      res.setSampleSize(parseStatisticSampleSizeComponent(json.getAsJsonObject("sampleSize")));
1906    if (json.has("attributeEstimate")) {
1907      JsonArray array = json.getAsJsonArray("attributeEstimate");
1908      for (int i = 0; i < array.size(); i++) {
1909        res.getAttributeEstimate().add(parseStatisticAttributeEstimateComponent(array.get(i).getAsJsonObject()));
1910      }
1911    };
1912  }
1913
1914  protected Statistic.StatisticSampleSizeComponent parseStatisticSampleSizeComponent(JsonObject json) throws IOException, FHIRFormatError {
1915    Statistic.StatisticSampleSizeComponent res = new Statistic.StatisticSampleSizeComponent();
1916    parseStatisticSampleSizeComponentProperties(json, res);
1917    return res;
1918  }
1919
1920  protected void parseStatisticSampleSizeComponentProperties(JsonObject json, Statistic.StatisticSampleSizeComponent res) throws IOException, FHIRFormatError {
1921    parseElementProperties(json, res);
1922    if (json.has("description"))
1923      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1924    if (json.has("_description"))
1925      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1926    if (json.has("note")) {
1927      JsonArray array = json.getAsJsonArray("note");
1928      for (int i = 0; i < array.size(); i++) {
1929        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
1930      }
1931    };
1932    if (json.has("numberOfStudies"))
1933      res.setNumberOfStudiesElement(parseInteger(json.get("numberOfStudies").getAsLong()));
1934    if (json.has("_numberOfStudies"))
1935      parseElementProperties(json.getAsJsonObject("_numberOfStudies"), res.getNumberOfStudiesElement());
1936    if (json.has("numberOfParticipants"))
1937      res.setNumberOfParticipantsElement(parseInteger(json.get("numberOfParticipants").getAsLong()));
1938    if (json.has("_numberOfParticipants"))
1939      parseElementProperties(json.getAsJsonObject("_numberOfParticipants"), res.getNumberOfParticipantsElement());
1940    if (json.has("knownDataCount"))
1941      res.setKnownDataCountElement(parseInteger(json.get("knownDataCount").getAsLong()));
1942    if (json.has("_knownDataCount"))
1943      parseElementProperties(json.getAsJsonObject("_knownDataCount"), res.getKnownDataCountElement());
1944    if (json.has("numeratorCount"))
1945      res.setNumeratorCountElement(parseInteger(json.get("numeratorCount").getAsLong()));
1946    if (json.has("_numeratorCount"))
1947      parseElementProperties(json.getAsJsonObject("_numeratorCount"), res.getNumeratorCountElement());
1948  }
1949
1950  protected Statistic.StatisticAttributeEstimateComponent parseStatisticAttributeEstimateComponent(JsonObject json) throws IOException, FHIRFormatError {
1951    Statistic.StatisticAttributeEstimateComponent res = new Statistic.StatisticAttributeEstimateComponent();
1952    parseStatisticAttributeEstimateComponentProperties(json, res);
1953    return res;
1954  }
1955
1956  protected void parseStatisticAttributeEstimateComponentProperties(JsonObject json, Statistic.StatisticAttributeEstimateComponent res) throws IOException, FHIRFormatError {
1957    parseElementProperties(json, res);
1958    if (json.has("description"))
1959      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1960    if (json.has("_description"))
1961      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1962    if (json.has("note")) {
1963      JsonArray array = json.getAsJsonArray("note");
1964      for (int i = 0; i < array.size(); i++) {
1965        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
1966      }
1967    };
1968    if (json.has("type"))
1969      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
1970    if (json.has("quantity"))
1971      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
1972    if (json.has("level"))
1973      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
1974    if (json.has("_level"))
1975      parseElementProperties(json.getAsJsonObject("_level"), res.getLevelElement());
1976    if (json.has("range"))
1977      res.setRange(parseRange(json.getAsJsonObject("range")));
1978    if (json.has("estimateQualifier")) {
1979      JsonArray array = json.getAsJsonArray("estimateQualifier");
1980      for (int i = 0; i < array.size(); i++) {
1981        res.getEstimateQualifier().add(parseStatisticAttributeEstimateEstimateQualifierComponent(array.get(i).getAsJsonObject()));
1982      }
1983    };
1984  }
1985
1986  protected Statistic.StatisticAttributeEstimateEstimateQualifierComponent parseStatisticAttributeEstimateEstimateQualifierComponent(JsonObject json) throws IOException, FHIRFormatError {
1987    Statistic.StatisticAttributeEstimateEstimateQualifierComponent res = new Statistic.StatisticAttributeEstimateEstimateQualifierComponent();
1988    parseStatisticAttributeEstimateEstimateQualifierComponentProperties(json, res);
1989    return res;
1990  }
1991
1992  protected void parseStatisticAttributeEstimateEstimateQualifierComponentProperties(JsonObject json, Statistic.StatisticAttributeEstimateEstimateQualifierComponent res) throws IOException, FHIRFormatError {
1993    parseElementProperties(json, res);
1994    if (json.has("description"))
1995      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1996    if (json.has("_description"))
1997      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1998    if (json.has("note")) {
1999      JsonArray array = json.getAsJsonArray("note");
2000      for (int i = 0; i < array.size(); i++) {
2001        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2002      }
2003    };
2004    if (json.has("type"))
2005      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
2006    if (json.has("quantity"))
2007      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
2008    if (json.has("level"))
2009      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
2010    if (json.has("_level"))
2011      parseElementProperties(json.getAsJsonObject("_level"), res.getLevelElement());
2012    if (json.has("range"))
2013      res.setRange(parseRange(json.getAsJsonObject("range")));
2014  }
2015
2016  protected SubstanceAmount parseSubstanceAmount(JsonObject json) throws IOException, FHIRFormatError {
2017    SubstanceAmount res = new SubstanceAmount();
2018    parseSubstanceAmountProperties(json, res);
2019    return res;
2020  }
2021
2022  protected void parseSubstanceAmountProperties(JsonObject json, SubstanceAmount res) throws IOException, FHIRFormatError {
2023    parseBackboneTypeProperties(json, res);
2024    DataType amount = parseType("amount", json);
2025    if (amount != null)
2026      res.setAmount(amount);
2027    if (json.has("amountType"))
2028      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
2029    if (json.has("amountText"))
2030      res.setAmountTextElement(parseString(json.get("amountText").getAsString()));
2031    if (json.has("_amountText"))
2032      parseElementProperties(json.getAsJsonObject("_amountText"), res.getAmountTextElement());
2033    if (json.has("referenceRange"))
2034      res.setReferenceRange(parseSubstanceAmountReferenceRangeComponent(json.getAsJsonObject("referenceRange")));
2035  }
2036
2037  protected SubstanceAmount.SubstanceAmountReferenceRangeComponent parseSubstanceAmountReferenceRangeComponent(JsonObject json) throws IOException, FHIRFormatError {
2038    SubstanceAmount.SubstanceAmountReferenceRangeComponent res = new SubstanceAmount.SubstanceAmountReferenceRangeComponent();
2039    parseSubstanceAmountReferenceRangeComponentProperties(json, res);
2040    return res;
2041  }
2042
2043  protected void parseSubstanceAmountReferenceRangeComponentProperties(JsonObject json, SubstanceAmount.SubstanceAmountReferenceRangeComponent res) throws IOException, FHIRFormatError {
2044    parseElementProperties(json, res);
2045    if (json.has("lowLimit"))
2046      res.setLowLimit(parseQuantity(json.getAsJsonObject("lowLimit")));
2047    if (json.has("highLimit"))
2048      res.setHighLimit(parseQuantity(json.getAsJsonObject("highLimit")));
2049  }
2050
2051  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
2052    Timing res = new Timing();
2053    parseTimingProperties(json, res);
2054    return res;
2055  }
2056
2057  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
2058    parseBackboneTypeProperties(json, res);
2059    if (json.has("event")) {
2060      JsonArray array = json.getAsJsonArray("event");
2061      for (int i = 0; i < array.size(); i++) {
2062        if (array.get(i).isJsonNull()) {
2063          res.getEvent().add(new DateTimeType());
2064        } else {;
2065          res.getEvent().add(parseDateTime(array.get(i).getAsString()));
2066        }
2067      }
2068    };
2069    if (json.has("_event")) {
2070      JsonArray array = json.getAsJsonArray("_event");
2071      for (int i = 0; i < array.size(); i++) {
2072        if (i == res.getEvent().size())
2073          res.getEvent().add(parseDateTime(null));
2074        if (array.get(i) instanceof JsonObject) 
2075          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
2076      }
2077    };
2078    if (json.has("repeat"))
2079      res.setRepeat(parseTimingRepeatComponent(json.getAsJsonObject("repeat")));
2080    if (json.has("code"))
2081      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2082  }
2083
2084  protected Timing.TimingRepeatComponent parseTimingRepeatComponent(JsonObject json) throws IOException, FHIRFormatError {
2085    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
2086    parseTimingRepeatComponentProperties(json, res);
2087    return res;
2088  }
2089
2090  protected void parseTimingRepeatComponentProperties(JsonObject json, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
2091    parseElementProperties(json, res);
2092    DataType bounds = parseType("bounds", json);
2093    if (bounds != null)
2094      res.setBounds(bounds);
2095    if (json.has("count"))
2096      res.setCountElement(parsePositiveInt(json.get("count").getAsString()));
2097    if (json.has("_count"))
2098      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
2099    if (json.has("countMax"))
2100      res.setCountMaxElement(parsePositiveInt(json.get("countMax").getAsString()));
2101    if (json.has("_countMax"))
2102      parseElementProperties(json.getAsJsonObject("_countMax"), res.getCountMaxElement());
2103    if (json.has("duration"))
2104      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
2105    if (json.has("_duration"))
2106      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
2107    if (json.has("durationMax"))
2108      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
2109    if (json.has("_durationMax"))
2110      parseElementProperties(json.getAsJsonObject("_durationMax"), res.getDurationMaxElement());
2111    if (json.has("durationUnit"))
2112      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
2113    if (json.has("_durationUnit"))
2114      parseElementProperties(json.getAsJsonObject("_durationUnit"), res.getDurationUnitElement());
2115    if (json.has("frequency"))
2116      res.setFrequencyElement(parsePositiveInt(json.get("frequency").getAsString()));
2117    if (json.has("_frequency"))
2118      parseElementProperties(json.getAsJsonObject("_frequency"), res.getFrequencyElement());
2119    if (json.has("frequencyMax"))
2120      res.setFrequencyMaxElement(parsePositiveInt(json.get("frequencyMax").getAsString()));
2121    if (json.has("_frequencyMax"))
2122      parseElementProperties(json.getAsJsonObject("_frequencyMax"), res.getFrequencyMaxElement());
2123    if (json.has("period"))
2124      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
2125    if (json.has("_period"))
2126      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
2127    if (json.has("periodMax"))
2128      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
2129    if (json.has("_periodMax"))
2130      parseElementProperties(json.getAsJsonObject("_periodMax"), res.getPeriodMaxElement());
2131    if (json.has("periodUnit"))
2132      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
2133    if (json.has("_periodUnit"))
2134      parseElementProperties(json.getAsJsonObject("_periodUnit"), res.getPeriodUnitElement());
2135    if (json.has("dayOfWeek")) {
2136      JsonArray array = json.getAsJsonArray("dayOfWeek");
2137      for (int i = 0; i < array.size(); i++) {
2138        if (array.get(i).isJsonNull()) {
2139          res.getDayOfWeek().add(new Enumeration<Enumerations.DaysOfWeek>(new Enumerations.DaysOfWeekEnumFactory(), Enumerations.DaysOfWeek.NULL));
2140        } else {;
2141          res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
2142        }
2143      }
2144    };
2145    if (json.has("_dayOfWeek")) {
2146      JsonArray array = json.getAsJsonArray("_dayOfWeek");
2147      for (int i = 0; i < array.size(); i++) {
2148        if (i == res.getDayOfWeek().size())
2149          res.getDayOfWeek().add(parseEnumeration(null, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
2150        if (array.get(i) instanceof JsonObject) 
2151          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
2152      }
2153    };
2154    if (json.has("timeOfDay")) {
2155      JsonArray array = json.getAsJsonArray("timeOfDay");
2156      for (int i = 0; i < array.size(); i++) {
2157        if (array.get(i).isJsonNull()) {
2158          res.getTimeOfDay().add(new TimeType());
2159        } else {;
2160          res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
2161        }
2162      }
2163    };
2164    if (json.has("_timeOfDay")) {
2165      JsonArray array = json.getAsJsonArray("_timeOfDay");
2166      for (int i = 0; i < array.size(); i++) {
2167        if (i == res.getTimeOfDay().size())
2168          res.getTimeOfDay().add(parseTime(null));
2169        if (array.get(i) instanceof JsonObject) 
2170          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
2171      }
2172    };
2173    if (json.has("when")) {
2174      JsonArray array = json.getAsJsonArray("when");
2175      for (int i = 0; i < array.size(); i++) {
2176        if (array.get(i).isJsonNull()) {
2177          res.getWhen().add(new Enumeration<Timing.EventTiming>(new Timing.EventTimingEnumFactory(), Timing.EventTiming.NULL));
2178        } else {;
2179          res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
2180        }
2181      }
2182    };
2183    if (json.has("_when")) {
2184      JsonArray array = json.getAsJsonArray("_when");
2185      for (int i = 0; i < array.size(); i++) {
2186        if (i == res.getWhen().size())
2187          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
2188        if (array.get(i) instanceof JsonObject) 
2189          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
2190      }
2191    };
2192    if (json.has("offset"))
2193      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
2194    if (json.has("_offset"))
2195      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
2196  }
2197
2198  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
2199    TriggerDefinition res = new TriggerDefinition();
2200    parseTriggerDefinitionProperties(json, res);
2201    return res;
2202  }
2203
2204  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
2205    parseDataTypeProperties(json, res);
2206    if (json.has("type"))
2207      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
2208    if (json.has("_type"))
2209      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2210    if (json.has("name"))
2211      res.setNameElement(parseString(json.get("name").getAsString()));
2212    if (json.has("_name"))
2213      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2214    DataType timing = parseType("timing", json);
2215    if (timing != null)
2216      res.setTiming(timing);
2217    if (json.has("data")) {
2218      JsonArray array = json.getAsJsonArray("data");
2219      for (int i = 0; i < array.size(); i++) {
2220        res.getData().add(parseDataRequirement(array.get(i).getAsJsonObject()));
2221      }
2222    };
2223    if (json.has("condition"))
2224      res.setCondition(parseExpression(json.getAsJsonObject("condition")));
2225  }
2226
2227  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
2228    UsageContext res = new UsageContext();
2229    parseUsageContextProperties(json, res);
2230    return res;
2231  }
2232
2233  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
2234    parseDataTypeProperties(json, res);
2235    if (json.has("code"))
2236      res.setCode(parseCoding(json.getAsJsonObject("code")));
2237    DataType value = parseType("value", json);
2238    if (value != null)
2239      res.setValue(value);
2240  }
2241
2242  protected void parseCanonicalResourceProperties(JsonObject json, CanonicalResource res) throws IOException, FHIRFormatError {
2243    parseDomainResourceProperties(json, res);
2244  }
2245
2246  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
2247    parseResourceProperties(json, res);
2248    if (json.has("text"))
2249      res.setText(parseNarrative(json.getAsJsonObject("text")));
2250    if (json.has("contained")) {
2251      JsonArray array = json.getAsJsonArray("contained");
2252      for (int i = 0; i < array.size(); i++) {
2253        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
2254      }
2255    };
2256    if (json.has("extension")) {
2257      JsonArray array = json.getAsJsonArray("extension");
2258      for (int i = 0; i < array.size(); i++) {
2259        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2260      }
2261    };
2262    if (json.has("modifierExtension")) {
2263      JsonArray array = json.getAsJsonArray("modifierExtension");
2264      for (int i = 0; i < array.size(); i++) {
2265        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2266      }
2267    };
2268  }
2269
2270  protected void parseMetadataResourceProperties(JsonObject json, MetadataResource res) throws IOException, FHIRFormatError {
2271    parseCanonicalResourceProperties(json, res);
2272  }
2273
2274  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
2275    parseBaseProperties(json, res);
2276    if (json.has("id"))
2277      res.setIdElement(parseId(json.get("id").getAsString()));
2278    if (json.has("_id"))
2279      parseElementProperties(json.getAsJsonObject("_id"), res.getIdElement());
2280    if (json.has("meta"))
2281      res.setMeta(parseMeta(json.getAsJsonObject("meta")));
2282    if (json.has("implicitRules"))
2283      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
2284    if (json.has("_implicitRules"))
2285      parseElementProperties(json.getAsJsonObject("_implicitRules"), res.getImplicitRulesElement());
2286    if (json.has("language"))
2287      res.setLanguageElement(parseCode(json.get("language").getAsString()));
2288    if (json.has("_language"))
2289      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
2290  }
2291
2292  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
2293    Account res = new Account();
2294    parseAccountProperties(json, res);
2295    return res;
2296  }
2297
2298  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
2299    parseDomainResourceProperties(json, res);
2300    if (json.has("identifier")) {
2301      JsonArray array = json.getAsJsonArray("identifier");
2302      for (int i = 0; i < array.size(); i++) {
2303        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2304      }
2305    };
2306    if (json.has("status"))
2307      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
2308    if (json.has("_status"))
2309      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2310    if (json.has("type"))
2311      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
2312    if (json.has("name"))
2313      res.setNameElement(parseString(json.get("name").getAsString()));
2314    if (json.has("_name"))
2315      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2316    if (json.has("subject")) {
2317      JsonArray array = json.getAsJsonArray("subject");
2318      for (int i = 0; i < array.size(); i++) {
2319        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
2320      }
2321    };
2322    if (json.has("servicePeriod"))
2323      res.setServicePeriod(parsePeriod(json.getAsJsonObject("servicePeriod")));
2324    if (json.has("coverage")) {
2325      JsonArray array = json.getAsJsonArray("coverage");
2326      for (int i = 0; i < array.size(); i++) {
2327        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject()));
2328      }
2329    };
2330    if (json.has("owner"))
2331      res.setOwner(parseReference(json.getAsJsonObject("owner")));
2332    if (json.has("description"))
2333      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2334    if (json.has("_description"))
2335      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2336    if (json.has("guarantor")) {
2337      JsonArray array = json.getAsJsonArray("guarantor");
2338      for (int i = 0; i < array.size(); i++) {
2339        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject()));
2340      }
2341    };
2342    if (json.has("partOf"))
2343      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
2344  }
2345
2346  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json) throws IOException, FHIRFormatError {
2347    Account.CoverageComponent res = new Account.CoverageComponent();
2348    parseAccountCoverageComponentProperties(json, res);
2349    return res;
2350  }
2351
2352  protected void parseAccountCoverageComponentProperties(JsonObject json, Account.CoverageComponent res) throws IOException, FHIRFormatError {
2353    parseBackboneElementProperties(json, res);
2354    if (json.has("coverage"))
2355      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
2356    if (json.has("priority"))
2357      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
2358    if (json.has("_priority"))
2359      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2360  }
2361
2362  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json) throws IOException, FHIRFormatError {
2363    Account.GuarantorComponent res = new Account.GuarantorComponent();
2364    parseAccountGuarantorComponentProperties(json, res);
2365    return res;
2366  }
2367
2368  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
2369    parseBackboneElementProperties(json, res);
2370    if (json.has("party"))
2371      res.setParty(parseReference(json.getAsJsonObject("party")));
2372    if (json.has("onHold"))
2373      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
2374    if (json.has("_onHold"))
2375      parseElementProperties(json.getAsJsonObject("_onHold"), res.getOnHoldElement());
2376    if (json.has("period"))
2377      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2378  }
2379
2380  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
2381    ActivityDefinition res = new ActivityDefinition();
2382    parseActivityDefinitionProperties(json, res);
2383    return res;
2384  }
2385
2386  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
2387    parseMetadataResourceProperties(json, res);
2388    if (json.has("url"))
2389      res.setUrlElement(parseUri(json.get("url").getAsString()));
2390    if (json.has("_url"))
2391      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
2392    if (json.has("identifier")) {
2393      JsonArray array = json.getAsJsonArray("identifier");
2394      for (int i = 0; i < array.size(); i++) {
2395        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2396      }
2397    };
2398    if (json.has("version"))
2399      res.setVersionElement(parseString(json.get("version").getAsString()));
2400    if (json.has("_version"))
2401      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
2402    if (json.has("name"))
2403      res.setNameElement(parseString(json.get("name").getAsString()));
2404    if (json.has("_name"))
2405      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2406    if (json.has("title"))
2407      res.setTitleElement(parseString(json.get("title").getAsString()));
2408    if (json.has("_title"))
2409      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
2410    if (json.has("subtitle"))
2411      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
2412    if (json.has("_subtitle"))
2413      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
2414    if (json.has("status"))
2415      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2416    if (json.has("_status"))
2417      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2418    if (json.has("experimental"))
2419      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2420    if (json.has("_experimental"))
2421      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
2422    DataType subject = parseType("subject", json);
2423    if (subject != null)
2424      res.setSubject(subject);
2425    if (json.has("date"))
2426      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2427    if (json.has("_date"))
2428      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2429    if (json.has("publisher"))
2430      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2431    if (json.has("_publisher"))
2432      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
2433    if (json.has("contact")) {
2434      JsonArray array = json.getAsJsonArray("contact");
2435      for (int i = 0; i < array.size(); i++) {
2436        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2437      }
2438    };
2439    if (json.has("description"))
2440      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2441    if (json.has("_description"))
2442      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2443    if (json.has("useContext")) {
2444      JsonArray array = json.getAsJsonArray("useContext");
2445      for (int i = 0; i < array.size(); i++) {
2446        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2447      }
2448    };
2449    if (json.has("jurisdiction")) {
2450      JsonArray array = json.getAsJsonArray("jurisdiction");
2451      for (int i = 0; i < array.size(); i++) {
2452        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2453      }
2454    };
2455    if (json.has("purpose"))
2456      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2457    if (json.has("_purpose"))
2458      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
2459    if (json.has("usage"))
2460      res.setUsageElement(parseString(json.get("usage").getAsString()));
2461    if (json.has("_usage"))
2462      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
2463    if (json.has("copyright"))
2464      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2465    if (json.has("_copyright"))
2466      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
2467    if (json.has("approvalDate"))
2468      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
2469    if (json.has("_approvalDate"))
2470      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
2471    if (json.has("lastReviewDate"))
2472      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
2473    if (json.has("_lastReviewDate"))
2474      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
2475    if (json.has("effectivePeriod"))
2476      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
2477    if (json.has("topic")) {
2478      JsonArray array = json.getAsJsonArray("topic");
2479      for (int i = 0; i < array.size(); i++) {
2480        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2481      }
2482    };
2483    if (json.has("author")) {
2484      JsonArray array = json.getAsJsonArray("author");
2485      for (int i = 0; i < array.size(); i++) {
2486        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2487      }
2488    };
2489    if (json.has("editor")) {
2490      JsonArray array = json.getAsJsonArray("editor");
2491      for (int i = 0; i < array.size(); i++) {
2492        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2493      }
2494    };
2495    if (json.has("reviewer")) {
2496      JsonArray array = json.getAsJsonArray("reviewer");
2497      for (int i = 0; i < array.size(); i++) {
2498        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
2499      }
2500    };
2501    if (json.has("endorser")) {
2502      JsonArray array = json.getAsJsonArray("endorser");
2503      for (int i = 0; i < array.size(); i++) {
2504        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
2505      }
2506    };
2507    if (json.has("relatedArtifact")) {
2508      JsonArray array = json.getAsJsonArray("relatedArtifact");
2509      for (int i = 0; i < array.size(); i++) {
2510        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
2511      }
2512    };
2513    if (json.has("library")) {
2514      JsonArray array = json.getAsJsonArray("library");
2515      for (int i = 0; i < array.size(); i++) {
2516        if (array.get(i).isJsonNull()) {
2517          res.getLibrary().add(new CanonicalType());
2518        } else {;
2519          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
2520        }
2521      }
2522    };
2523    if (json.has("_library")) {
2524      JsonArray array = json.getAsJsonArray("_library");
2525      for (int i = 0; i < array.size(); i++) {
2526        if (i == res.getLibrary().size())
2527          res.getLibrary().add(parseCanonical(null));
2528        if (array.get(i) instanceof JsonObject) 
2529          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
2530      }
2531    };
2532    if (json.has("kind"))
2533      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.RequestResourceType.NULL, new ActivityDefinition.RequestResourceTypeEnumFactory()));
2534    if (json.has("_kind"))
2535      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
2536    if (json.has("profile"))
2537      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
2538    if (json.has("_profile"))
2539      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
2540    if (json.has("code"))
2541      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2542    if (json.has("intent"))
2543      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
2544    if (json.has("_intent"))
2545      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
2546    if (json.has("priority"))
2547      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
2548    if (json.has("_priority"))
2549      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2550    if (json.has("doNotPerform"))
2551      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
2552    if (json.has("_doNotPerform"))
2553      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
2554    DataType timing = parseType("timing", json);
2555    if (timing != null)
2556      res.setTiming(timing);
2557    if (json.has("location"))
2558      res.setLocation(parseReference(json.getAsJsonObject("location")));
2559    if (json.has("participant")) {
2560      JsonArray array = json.getAsJsonArray("participant");
2561      for (int i = 0; i < array.size(); i++) {
2562        res.getParticipant().add(parseActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject()));
2563      }
2564    };
2565    DataType product = parseType("product", json);
2566    if (product != null)
2567      res.setProduct(product);
2568    if (json.has("quantity"))
2569      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
2570    if (json.has("dosage")) {
2571      JsonArray array = json.getAsJsonArray("dosage");
2572      for (int i = 0; i < array.size(); i++) {
2573        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
2574      }
2575    };
2576    if (json.has("bodySite")) {
2577      JsonArray array = json.getAsJsonArray("bodySite");
2578      for (int i = 0; i < array.size(); i++) {
2579        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2580      }
2581    };
2582    if (json.has("specimenRequirement")) {
2583      JsonArray array = json.getAsJsonArray("specimenRequirement");
2584      for (int i = 0; i < array.size(); i++) {
2585        res.getSpecimenRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2586      }
2587    };
2588    if (json.has("observationRequirement")) {
2589      JsonArray array = json.getAsJsonArray("observationRequirement");
2590      for (int i = 0; i < array.size(); i++) {
2591        res.getObservationRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2592      }
2593    };
2594    if (json.has("observationResultRequirement")) {
2595      JsonArray array = json.getAsJsonArray("observationResultRequirement");
2596      for (int i = 0; i < array.size(); i++) {
2597        res.getObservationResultRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2598      }
2599    };
2600    if (json.has("transform"))
2601      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
2602    if (json.has("_transform"))
2603      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
2604    if (json.has("dynamicValue")) {
2605      JsonArray array = json.getAsJsonArray("dynamicValue");
2606      for (int i = 0; i < array.size(); i++) {
2607        res.getDynamicValue().add(parseActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject()));
2608      }
2609    };
2610  }
2611
2612  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
2613    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2614    parseActivityDefinitionParticipantComponentProperties(json, res);
2615    return res;
2616  }
2617
2618  protected void parseActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
2619    parseBackboneElementProperties(json, res);
2620    if (json.has("type"))
2621      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ActionParticipantType.NULL, new Enumerations.ActionParticipantTypeEnumFactory()));
2622    if (json.has("_type"))
2623      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2624    if (json.has("role"))
2625      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
2626  }
2627
2628  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionDynamicValueComponent(JsonObject json) throws IOException, FHIRFormatError {
2629    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2630    parseActivityDefinitionDynamicValueComponentProperties(json, res);
2631    return res;
2632  }
2633
2634  protected void parseActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
2635    parseBackboneElementProperties(json, res);
2636    if (json.has("path"))
2637      res.setPathElement(parseString(json.get("path").getAsString()));
2638    if (json.has("_path"))
2639      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
2640    if (json.has("expression"))
2641      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
2642  }
2643
2644  protected AdministrableProductDefinition parseAdministrableProductDefinition(JsonObject json) throws IOException, FHIRFormatError {
2645    AdministrableProductDefinition res = new AdministrableProductDefinition();
2646    parseAdministrableProductDefinitionProperties(json, res);
2647    return res;
2648  }
2649
2650  protected void parseAdministrableProductDefinitionProperties(JsonObject json, AdministrableProductDefinition res) throws IOException, FHIRFormatError {
2651    parseDomainResourceProperties(json, res);
2652    if (json.has("identifier")) {
2653      JsonArray array = json.getAsJsonArray("identifier");
2654      for (int i = 0; i < array.size(); i++) {
2655        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2656      }
2657    };
2658    if (json.has("subject")) {
2659      JsonArray array = json.getAsJsonArray("subject");
2660      for (int i = 0; i < array.size(); i++) {
2661        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
2662      }
2663    };
2664    if (json.has("administrableDoseForm"))
2665      res.setAdministrableDoseForm(parseCodeableConcept(json.getAsJsonObject("administrableDoseForm")));
2666    if (json.has("unitOfPresentation"))
2667      res.setUnitOfPresentation(parseCodeableConcept(json.getAsJsonObject("unitOfPresentation")));
2668    if (json.has("producedFrom")) {
2669      JsonArray array = json.getAsJsonArray("producedFrom");
2670      for (int i = 0; i < array.size(); i++) {
2671        res.getProducedFrom().add(parseReference(array.get(i).getAsJsonObject()));
2672      }
2673    };
2674    if (json.has("ingredient")) {
2675      JsonArray array = json.getAsJsonArray("ingredient");
2676      for (int i = 0; i < array.size(); i++) {
2677        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
2678      }
2679    };
2680    if (json.has("device")) {
2681      JsonArray array = json.getAsJsonArray("device");
2682      for (int i = 0; i < array.size(); i++) {
2683        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
2684      }
2685    };
2686    if (json.has("characteristic")) {
2687      JsonArray array = json.getAsJsonArray("characteristic");
2688      for (int i = 0; i < array.size(); i++) {
2689        res.getCharacteristic().add(parseAdministrableProductDefinitionCharacteristicComponent(array.get(i).getAsJsonObject()));
2690      }
2691    };
2692    if (json.has("routeOfAdministration")) {
2693      JsonArray array = json.getAsJsonArray("routeOfAdministration");
2694      for (int i = 0; i < array.size(); i++) {
2695        res.getRouteOfAdministration().add(parseAdministrableProductDefinitionRouteOfAdministrationComponent(array.get(i).getAsJsonObject()));
2696      }
2697    };
2698  }
2699
2700  protected AdministrableProductDefinition.AdministrableProductDefinitionCharacteristicComponent parseAdministrableProductDefinitionCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
2701    AdministrableProductDefinition.AdministrableProductDefinitionCharacteristicComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionCharacteristicComponent();
2702    parseAdministrableProductDefinitionCharacteristicComponentProperties(json, res);
2703    return res;
2704  }
2705
2706  protected void parseAdministrableProductDefinitionCharacteristicComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionCharacteristicComponent res) throws IOException, FHIRFormatError {
2707    parseBackboneElementProperties(json, res);
2708    if (json.has("code"))
2709      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2710    DataType value = parseType("value", json);
2711    if (value != null)
2712      res.setValue(value);
2713    if (json.has("status"))
2714      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
2715  }
2716
2717  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent parseAdministrableProductDefinitionRouteOfAdministrationComponent(JsonObject json) throws IOException, FHIRFormatError {
2718    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent();
2719    parseAdministrableProductDefinitionRouteOfAdministrationComponentProperties(json, res);
2720    return res;
2721  }
2722
2723  protected void parseAdministrableProductDefinitionRouteOfAdministrationComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent res) throws IOException, FHIRFormatError {
2724    parseBackboneElementProperties(json, res);
2725    if (json.has("code"))
2726      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2727    if (json.has("firstDose"))
2728      res.setFirstDose(parseQuantity(json.getAsJsonObject("firstDose")));
2729    if (json.has("maxSingleDose"))
2730      res.setMaxSingleDose(parseQuantity(json.getAsJsonObject("maxSingleDose")));
2731    if (json.has("maxDosePerDay"))
2732      res.setMaxDosePerDay(parseQuantity(json.getAsJsonObject("maxDosePerDay")));
2733    if (json.has("maxDosePerTreatmentPeriod"))
2734      res.setMaxDosePerTreatmentPeriod(parseRatio(json.getAsJsonObject("maxDosePerTreatmentPeriod")));
2735    if (json.has("maxTreatmentPeriod"))
2736      res.setMaxTreatmentPeriod(parseDuration(json.getAsJsonObject("maxTreatmentPeriod")));
2737    if (json.has("targetSpecies")) {
2738      JsonArray array = json.getAsJsonArray("targetSpecies");
2739      for (int i = 0; i < array.size(); i++) {
2740        res.getTargetSpecies().add(parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(array.get(i).getAsJsonObject()));
2741      }
2742    };
2743  }
2744
2745  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(JsonObject json) throws IOException, FHIRFormatError {
2746    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent();
2747    parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(json, res);
2748    return res;
2749  }
2750
2751  protected void parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent res) throws IOException, FHIRFormatError {
2752    parseBackboneElementProperties(json, res);
2753    if (json.has("code"))
2754      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2755    if (json.has("withdrawalPeriod")) {
2756      JsonArray array = json.getAsJsonArray("withdrawalPeriod");
2757      for (int i = 0; i < array.size(); i++) {
2758        res.getWithdrawalPeriod().add(parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(array.get(i).getAsJsonObject()));
2759      }
2760    };
2761  }
2762
2763  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(JsonObject json) throws IOException, FHIRFormatError {
2764    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
2765    parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(json, res);
2766    return res;
2767  }
2768
2769  protected void parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(JsonObject json, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res) throws IOException, FHIRFormatError {
2770    parseBackboneElementProperties(json, res);
2771    if (json.has("tissue"))
2772      res.setTissue(parseCodeableConcept(json.getAsJsonObject("tissue")));
2773    if (json.has("value"))
2774      res.setValue(parseQuantity(json.getAsJsonObject("value")));
2775    if (json.has("supportingInformation"))
2776      res.setSupportingInformationElement(parseString(json.get("supportingInformation").getAsString()));
2777    if (json.has("_supportingInformation"))
2778      parseElementProperties(json.getAsJsonObject("_supportingInformation"), res.getSupportingInformationElement());
2779  }
2780
2781  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
2782    AdverseEvent res = new AdverseEvent();
2783    parseAdverseEventProperties(json, res);
2784    return res;
2785  }
2786
2787  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2788    parseDomainResourceProperties(json, res);
2789    if (json.has("identifier")) {
2790      JsonArray array = json.getAsJsonArray("identifier");
2791      for (int i = 0; i < array.size(); i++) {
2792        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2793      }
2794    };
2795    if (json.has("status"))
2796      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), AdverseEvent.AdverseEventStatus.NULL, new AdverseEvent.AdverseEventStatusEnumFactory()));
2797    if (json.has("_status"))
2798      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2799    if (json.has("actuality"))
2800      res.setActualityElement(parseEnumeration(json.get("actuality").getAsString(), AdverseEvent.AdverseEventActuality.NULL, new AdverseEvent.AdverseEventActualityEnumFactory()));
2801    if (json.has("_actuality"))
2802      parseElementProperties(json.getAsJsonObject("_actuality"), res.getActualityElement());
2803    if (json.has("category")) {
2804      JsonArray array = json.getAsJsonArray("category");
2805      for (int i = 0; i < array.size(); i++) {
2806        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2807      }
2808    };
2809    if (json.has("code"))
2810      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2811    if (json.has("subject"))
2812      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2813    if (json.has("encounter"))
2814      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
2815    DataType occurrence = parseType("occurrence", json);
2816    if (occurrence != null)
2817      res.setOccurrence(occurrence);
2818    if (json.has("detected"))
2819      res.setDetectedElement(parseDateTime(json.get("detected").getAsString()));
2820    if (json.has("_detected"))
2821      parseElementProperties(json.getAsJsonObject("_detected"), res.getDetectedElement());
2822    if (json.has("recordedDate"))
2823      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2824    if (json.has("_recordedDate"))
2825      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
2826    if (json.has("resultingCondition")) {
2827      JsonArray array = json.getAsJsonArray("resultingCondition");
2828      for (int i = 0; i < array.size(); i++) {
2829        res.getResultingCondition().add(parseReference(array.get(i).getAsJsonObject()));
2830      }
2831    };
2832    if (json.has("location"))
2833      res.setLocation(parseReference(json.getAsJsonObject("location")));
2834    if (json.has("seriousness"))
2835      res.setSeriousness(parseCodeableConcept(json.getAsJsonObject("seriousness")));
2836    if (json.has("outcome"))
2837      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
2838    if (json.has("recorder"))
2839      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
2840    if (json.has("participant")) {
2841      JsonArray array = json.getAsJsonArray("participant");
2842      for (int i = 0; i < array.size(); i++) {
2843        res.getParticipant().add(parseAdverseEventParticipantComponent(array.get(i).getAsJsonObject()));
2844      }
2845    };
2846    if (json.has("suspectEntity")) {
2847      JsonArray array = json.getAsJsonArray("suspectEntity");
2848      for (int i = 0; i < array.size(); i++) {
2849        res.getSuspectEntity().add(parseAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject()));
2850      }
2851    };
2852    if (json.has("contributingFactor")) {
2853      JsonArray array = json.getAsJsonArray("contributingFactor");
2854      for (int i = 0; i < array.size(); i++) {
2855        res.getContributingFactor().add(parseAdverseEventContributingFactorComponent(array.get(i).getAsJsonObject()));
2856      }
2857    };
2858    if (json.has("preventiveAction")) {
2859      JsonArray array = json.getAsJsonArray("preventiveAction");
2860      for (int i = 0; i < array.size(); i++) {
2861        res.getPreventiveAction().add(parseAdverseEventPreventiveActionComponent(array.get(i).getAsJsonObject()));
2862      }
2863    };
2864    if (json.has("mitigatingAction")) {
2865      JsonArray array = json.getAsJsonArray("mitigatingAction");
2866      for (int i = 0; i < array.size(); i++) {
2867        res.getMitigatingAction().add(parseAdverseEventMitigatingActionComponent(array.get(i).getAsJsonObject()));
2868      }
2869    };
2870    if (json.has("supportingInfo")) {
2871      JsonArray array = json.getAsJsonArray("supportingInfo");
2872      for (int i = 0; i < array.size(); i++) {
2873        res.getSupportingInfo().add(parseAdverseEventSupportingInfoComponent(array.get(i).getAsJsonObject()));
2874      }
2875    };
2876    if (json.has("study")) {
2877      JsonArray array = json.getAsJsonArray("study");
2878      for (int i = 0; i < array.size(); i++) {
2879        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
2880      }
2881    };
2882  }
2883
2884  protected AdverseEvent.AdverseEventParticipantComponent parseAdverseEventParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
2885    AdverseEvent.AdverseEventParticipantComponent res = new AdverseEvent.AdverseEventParticipantComponent();
2886    parseAdverseEventParticipantComponentProperties(json, res);
2887    return res;
2888  }
2889
2890  protected void parseAdverseEventParticipantComponentProperties(JsonObject json, AdverseEvent.AdverseEventParticipantComponent res) throws IOException, FHIRFormatError {
2891    parseBackboneElementProperties(json, res);
2892    if (json.has("function"))
2893      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
2894    if (json.has("actor"))
2895      res.setActor(parseReference(json.getAsJsonObject("actor")));
2896  }
2897
2898  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventSuspectEntityComponent(JsonObject json) throws IOException, FHIRFormatError {
2899    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2900    parseAdverseEventSuspectEntityComponentProperties(json, res);
2901    return res;
2902  }
2903
2904  protected void parseAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
2905    parseBackboneElementProperties(json, res);
2906    DataType instance = parseType("instance", json);
2907    if (instance != null)
2908      res.setInstance(instance);
2909    if (json.has("causality"))
2910      res.setCausality(parseAdverseEventSuspectEntityCausalityComponent(json.getAsJsonObject("causality")));
2911  }
2912
2913  protected AdverseEvent.AdverseEventSuspectEntityCausalityComponent parseAdverseEventSuspectEntityCausalityComponent(JsonObject json) throws IOException, FHIRFormatError {
2914    AdverseEvent.AdverseEventSuspectEntityCausalityComponent res = new AdverseEvent.AdverseEventSuspectEntityCausalityComponent();
2915    parseAdverseEventSuspectEntityCausalityComponentProperties(json, res);
2916    return res;
2917  }
2918
2919  protected void parseAdverseEventSuspectEntityCausalityComponentProperties(JsonObject json, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res) throws IOException, FHIRFormatError {
2920    parseBackboneElementProperties(json, res);
2921    if (json.has("assessmentMethod"))
2922      res.setAssessmentMethod(parseCodeableConcept(json.getAsJsonObject("assessmentMethod")));
2923    if (json.has("entityRelatedness"))
2924      res.setEntityRelatedness(parseCodeableConcept(json.getAsJsonObject("entityRelatedness")));
2925    if (json.has("author"))
2926      res.setAuthor(parseReference(json.getAsJsonObject("author")));
2927  }
2928
2929  protected AdverseEvent.AdverseEventContributingFactorComponent parseAdverseEventContributingFactorComponent(JsonObject json) throws IOException, FHIRFormatError {
2930    AdverseEvent.AdverseEventContributingFactorComponent res = new AdverseEvent.AdverseEventContributingFactorComponent();
2931    parseAdverseEventContributingFactorComponentProperties(json, res);
2932    return res;
2933  }
2934
2935  protected void parseAdverseEventContributingFactorComponentProperties(JsonObject json, AdverseEvent.AdverseEventContributingFactorComponent res) throws IOException, FHIRFormatError {
2936    parseBackboneElementProperties(json, res);
2937    DataType item = parseType("item", json);
2938    if (item != null)
2939      res.setItem(item);
2940  }
2941
2942  protected AdverseEvent.AdverseEventPreventiveActionComponent parseAdverseEventPreventiveActionComponent(JsonObject json) throws IOException, FHIRFormatError {
2943    AdverseEvent.AdverseEventPreventiveActionComponent res = new AdverseEvent.AdverseEventPreventiveActionComponent();
2944    parseAdverseEventPreventiveActionComponentProperties(json, res);
2945    return res;
2946  }
2947
2948  protected void parseAdverseEventPreventiveActionComponentProperties(JsonObject json, AdverseEvent.AdverseEventPreventiveActionComponent res) throws IOException, FHIRFormatError {
2949    parseBackboneElementProperties(json, res);
2950    DataType item = parseType("item", json);
2951    if (item != null)
2952      res.setItem(item);
2953  }
2954
2955  protected AdverseEvent.AdverseEventMitigatingActionComponent parseAdverseEventMitigatingActionComponent(JsonObject json) throws IOException, FHIRFormatError {
2956    AdverseEvent.AdverseEventMitigatingActionComponent res = new AdverseEvent.AdverseEventMitigatingActionComponent();
2957    parseAdverseEventMitigatingActionComponentProperties(json, res);
2958    return res;
2959  }
2960
2961  protected void parseAdverseEventMitigatingActionComponentProperties(JsonObject json, AdverseEvent.AdverseEventMitigatingActionComponent res) throws IOException, FHIRFormatError {
2962    parseBackboneElementProperties(json, res);
2963    DataType item = parseType("item", json);
2964    if (item != null)
2965      res.setItem(item);
2966  }
2967
2968  protected AdverseEvent.AdverseEventSupportingInfoComponent parseAdverseEventSupportingInfoComponent(JsonObject json) throws IOException, FHIRFormatError {
2969    AdverseEvent.AdverseEventSupportingInfoComponent res = new AdverseEvent.AdverseEventSupportingInfoComponent();
2970    parseAdverseEventSupportingInfoComponentProperties(json, res);
2971    return res;
2972  }
2973
2974  protected void parseAdverseEventSupportingInfoComponentProperties(JsonObject json, AdverseEvent.AdverseEventSupportingInfoComponent res) throws IOException, FHIRFormatError {
2975    parseBackboneElementProperties(json, res);
2976    DataType item = parseType("item", json);
2977    if (item != null)
2978      res.setItem(item);
2979  }
2980
2981  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
2982    AllergyIntolerance res = new AllergyIntolerance();
2983    parseAllergyIntoleranceProperties(json, res);
2984    return res;
2985  }
2986
2987  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
2988    parseDomainResourceProperties(json, res);
2989    if (json.has("identifier")) {
2990      JsonArray array = json.getAsJsonArray("identifier");
2991      for (int i = 0; i < array.size(); i++) {
2992        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2993      }
2994    };
2995    if (json.has("clinicalStatus"))
2996      res.setClinicalStatus(parseCodeableConcept(json.getAsJsonObject("clinicalStatus")));
2997    if (json.has("verificationStatus"))
2998      res.setVerificationStatus(parseCodeableConcept(json.getAsJsonObject("verificationStatus")));
2999    if (json.has("type"))
3000      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
3001    if (json.has("_type"))
3002      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3003    if (json.has("category")) {
3004      JsonArray array = json.getAsJsonArray("category");
3005      for (int i = 0; i < array.size(); i++) {
3006        if (array.get(i).isJsonNull()) {
3007          res.getCategory().add(new Enumeration<AllergyIntolerance.AllergyIntoleranceCategory>(new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), AllergyIntolerance.AllergyIntoleranceCategory.NULL));
3008        } else {;
3009          res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
3010        }
3011      }
3012    };
3013    if (json.has("_category")) {
3014      JsonArray array = json.getAsJsonArray("_category");
3015      for (int i = 0; i < array.size(); i++) {
3016        if (i == res.getCategory().size())
3017          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
3018        if (array.get(i) instanceof JsonObject) 
3019          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
3020      }
3021    };
3022    if (json.has("criticality"))
3023      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
3024    if (json.has("_criticality"))
3025      parseElementProperties(json.getAsJsonObject("_criticality"), res.getCriticalityElement());
3026    if (json.has("code"))
3027      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3028    if (json.has("patient"))
3029      res.setPatient(parseReference(json.getAsJsonObject("patient")));
3030    if (json.has("encounter"))
3031      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
3032    DataType onset = parseType("onset", json);
3033    if (onset != null)
3034      res.setOnset(onset);
3035    if (json.has("recordedDate"))
3036      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
3037    if (json.has("_recordedDate"))
3038      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
3039    if (json.has("recorder"))
3040      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
3041    if (json.has("asserter"))
3042      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
3043    if (json.has("lastOccurrence"))
3044      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
3045    if (json.has("_lastOccurrence"))
3046      parseElementProperties(json.getAsJsonObject("_lastOccurrence"), res.getLastOccurrenceElement());
3047    if (json.has("note")) {
3048      JsonArray array = json.getAsJsonArray("note");
3049      for (int i = 0; i < array.size(); i++) {
3050        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3051      }
3052    };
3053    if (json.has("reaction")) {
3054      JsonArray array = json.getAsJsonArray("reaction");
3055      for (int i = 0; i < array.size(); i++) {
3056        res.getReaction().add(parseAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject()));
3057      }
3058    };
3059  }
3060
3061  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceReactionComponent(JsonObject json) throws IOException, FHIRFormatError {
3062    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
3063    parseAllergyIntoleranceReactionComponentProperties(json, res);
3064    return res;
3065  }
3066
3067  protected void parseAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
3068    parseBackboneElementProperties(json, res);
3069    if (json.has("substance"))
3070      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
3071    if (json.has("manifestation")) {
3072      JsonArray array = json.getAsJsonArray("manifestation");
3073      for (int i = 0; i < array.size(); i++) {
3074        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3075      }
3076    };
3077    if (json.has("description"))
3078      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3079    if (json.has("_description"))
3080      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3081    if (json.has("onset"))
3082      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
3083    if (json.has("_onset"))
3084      parseElementProperties(json.getAsJsonObject("_onset"), res.getOnsetElement());
3085    if (json.has("severity"))
3086      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
3087    if (json.has("_severity"))
3088      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
3089    if (json.has("exposureRoute"))
3090      res.setExposureRoute(parseCodeableConcept(json.getAsJsonObject("exposureRoute")));
3091    if (json.has("note")) {
3092      JsonArray array = json.getAsJsonArray("note");
3093      for (int i = 0; i < array.size(); i++) {
3094        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3095      }
3096    };
3097  }
3098
3099  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
3100    Appointment res = new Appointment();
3101    parseAppointmentProperties(json, res);
3102    return res;
3103  }
3104
3105  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
3106    parseDomainResourceProperties(json, res);
3107    if (json.has("identifier")) {
3108      JsonArray array = json.getAsJsonArray("identifier");
3109      for (int i = 0; i < array.size(); i++) {
3110        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3111      }
3112    };
3113    if (json.has("status"))
3114      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
3115    if (json.has("_status"))
3116      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3117    if (json.has("cancelationReason"))
3118      res.setCancelationReason(parseCodeableConcept(json.getAsJsonObject("cancelationReason")));
3119    if (json.has("serviceCategory")) {
3120      JsonArray array = json.getAsJsonArray("serviceCategory");
3121      for (int i = 0; i < array.size(); i++) {
3122        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3123      }
3124    };
3125    if (json.has("serviceType")) {
3126      JsonArray array = json.getAsJsonArray("serviceType");
3127      for (int i = 0; i < array.size(); i++) {
3128        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3129      }
3130    };
3131    if (json.has("specialty")) {
3132      JsonArray array = json.getAsJsonArray("specialty");
3133      for (int i = 0; i < array.size(); i++) {
3134        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3135      }
3136    };
3137    if (json.has("appointmentType"))
3138      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
3139    if (json.has("reason")) {
3140      JsonArray array = json.getAsJsonArray("reason");
3141      for (int i = 0; i < array.size(); i++) {
3142        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
3143      }
3144    };
3145    if (json.has("priority"))
3146      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
3147    if (json.has("_priority"))
3148      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
3149    if (json.has("description"))
3150      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3151    if (json.has("_description"))
3152      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3153    if (json.has("supportingInformation")) {
3154      JsonArray array = json.getAsJsonArray("supportingInformation");
3155      for (int i = 0; i < array.size(); i++) {
3156        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
3157      }
3158    };
3159    if (json.has("start"))
3160      res.setStartElement(parseInstant(json.get("start").getAsString()));
3161    if (json.has("_start"))
3162      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
3163    if (json.has("end"))
3164      res.setEndElement(parseInstant(json.get("end").getAsString()));
3165    if (json.has("_end"))
3166      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
3167    if (json.has("minutesDuration"))
3168      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
3169    if (json.has("_minutesDuration"))
3170      parseElementProperties(json.getAsJsonObject("_minutesDuration"), res.getMinutesDurationElement());
3171    if (json.has("slot")) {
3172      JsonArray array = json.getAsJsonArray("slot");
3173      for (int i = 0; i < array.size(); i++) {
3174        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
3175      }
3176    };
3177    if (json.has("created"))
3178      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
3179    if (json.has("_created"))
3180      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
3181    if (json.has("comment"))
3182      res.setCommentElement(parseString(json.get("comment").getAsString()));
3183    if (json.has("_comment"))
3184      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
3185    if (json.has("patientInstruction"))
3186      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
3187    if (json.has("_patientInstruction"))
3188      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
3189    if (json.has("basedOn")) {
3190      JsonArray array = json.getAsJsonArray("basedOn");
3191      for (int i = 0; i < array.size(); i++) {
3192        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
3193      }
3194    };
3195    if (json.has("participant")) {
3196      JsonArray array = json.getAsJsonArray("participant");
3197      for (int i = 0; i < array.size(); i++) {
3198        res.getParticipant().add(parseAppointmentParticipantComponent(array.get(i).getAsJsonObject()));
3199      }
3200    };
3201    if (json.has("requestedPeriod")) {
3202      JsonArray array = json.getAsJsonArray("requestedPeriod");
3203      for (int i = 0; i < array.size(); i++) {
3204        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
3205      }
3206    };
3207  }
3208
3209  protected Appointment.AppointmentParticipantComponent parseAppointmentParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
3210    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
3211    parseAppointmentParticipantComponentProperties(json, res);
3212    return res;
3213  }
3214
3215  protected void parseAppointmentParticipantComponentProperties(JsonObject json, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
3216    parseBackboneElementProperties(json, res);
3217    if (json.has("type")) {
3218      JsonArray array = json.getAsJsonArray("type");
3219      for (int i = 0; i < array.size(); i++) {
3220        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3221      }
3222    };
3223    if (json.has("actor"))
3224      res.setActor(parseReference(json.getAsJsonObject("actor")));
3225    if (json.has("required"))
3226      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
3227    if (json.has("_required"))
3228      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
3229    if (json.has("status"))
3230      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ParticipationStatus.NULL, new Enumerations.ParticipationStatusEnumFactory()));
3231    if (json.has("_status"))
3232      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3233    if (json.has("period"))
3234      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
3235  }
3236
3237  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
3238    AppointmentResponse res = new AppointmentResponse();
3239    parseAppointmentResponseProperties(json, res);
3240    return res;
3241  }
3242
3243  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
3244    parseDomainResourceProperties(json, res);
3245    if (json.has("identifier")) {
3246      JsonArray array = json.getAsJsonArray("identifier");
3247      for (int i = 0; i < array.size(); i++) {
3248        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3249      }
3250    };
3251    if (json.has("appointment"))
3252      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
3253    if (json.has("start"))
3254      res.setStartElement(parseInstant(json.get("start").getAsString()));
3255    if (json.has("_start"))
3256      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
3257    if (json.has("end"))
3258      res.setEndElement(parseInstant(json.get("end").getAsString()));
3259    if (json.has("_end"))
3260      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
3261    if (json.has("participantType")) {
3262      JsonArray array = json.getAsJsonArray("participantType");
3263      for (int i = 0; i < array.size(); i++) {
3264        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3265      }
3266    };
3267    if (json.has("actor"))
3268      res.setActor(parseReference(json.getAsJsonObject("actor")));
3269    if (json.has("participantStatus"))
3270      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), Enumerations.ParticipationStatus.NULL, new Enumerations.ParticipationStatusEnumFactory()));
3271    if (json.has("_participantStatus"))
3272      parseElementProperties(json.getAsJsonObject("_participantStatus"), res.getParticipantStatusElement());
3273    if (json.has("comment"))
3274      res.setCommentElement(parseString(json.get("comment").getAsString()));
3275    if (json.has("_comment"))
3276      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
3277  }
3278
3279  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
3280    AuditEvent res = new AuditEvent();
3281    parseAuditEventProperties(json, res);
3282    return res;
3283  }
3284
3285  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
3286    parseDomainResourceProperties(json, res);
3287    if (json.has("type"))
3288      res.setType(parseCoding(json.getAsJsonObject("type")));
3289    if (json.has("subtype")) {
3290      JsonArray array = json.getAsJsonArray("subtype");
3291      for (int i = 0; i < array.size(); i++) {
3292        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
3293      }
3294    };
3295    if (json.has("action"))
3296      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
3297    if (json.has("_action"))
3298      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
3299    if (json.has("severity"))
3300      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AuditEvent.AuditEventSeverity.NULL, new AuditEvent.AuditEventSeverityEnumFactory()));
3301    if (json.has("_severity"))
3302      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
3303    if (json.has("period"))
3304      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
3305    if (json.has("recorded"))
3306      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
3307    if (json.has("_recorded"))
3308      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
3309    if (json.has("outcome"))
3310      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
3311    if (json.has("_outcome"))
3312      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
3313    if (json.has("outcomeDesc"))
3314      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
3315    if (json.has("_outcomeDesc"))
3316      parseElementProperties(json.getAsJsonObject("_outcomeDesc"), res.getOutcomeDescElement());
3317    if (json.has("purposeOfEvent")) {
3318      JsonArray array = json.getAsJsonArray("purposeOfEvent");
3319      for (int i = 0; i < array.size(); i++) {
3320        res.getPurposeOfEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3321      }
3322    };
3323    if (json.has("agent")) {
3324      JsonArray array = json.getAsJsonArray("agent");
3325      for (int i = 0; i < array.size(); i++) {
3326        res.getAgent().add(parseAuditEventAgentComponent(array.get(i).getAsJsonObject()));
3327      }
3328    };
3329    if (json.has("source"))
3330      res.setSource(parseAuditEventSourceComponent(json.getAsJsonObject("source")));
3331    if (json.has("entity")) {
3332      JsonArray array = json.getAsJsonArray("entity");
3333      for (int i = 0; i < array.size(); i++) {
3334        res.getEntity().add(parseAuditEventEntityComponent(array.get(i).getAsJsonObject()));
3335      }
3336    };
3337  }
3338
3339  protected AuditEvent.AuditEventAgentComponent parseAuditEventAgentComponent(JsonObject json) throws IOException, FHIRFormatError {
3340    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
3341    parseAuditEventAgentComponentProperties(json, res);
3342    return res;
3343  }
3344
3345  protected void parseAuditEventAgentComponentProperties(JsonObject json, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
3346    parseBackboneElementProperties(json, res);
3347    if (json.has("type"))
3348      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
3349    if (json.has("role")) {
3350      JsonArray array = json.getAsJsonArray("role");
3351      for (int i = 0; i < array.size(); i++) {
3352        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3353      }
3354    };
3355    if (json.has("who"))
3356      res.setWho(parseReference(json.getAsJsonObject("who")));
3357    if (json.has("altId"))
3358      res.setAltIdElement(parseString(json.get("altId").getAsString()));
3359    if (json.has("_altId"))
3360      parseElementProperties(json.getAsJsonObject("_altId"), res.getAltIdElement());
3361    if (json.has("name"))
3362      res.setNameElement(parseString(json.get("name").getAsString()));
3363    if (json.has("_name"))
3364      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3365    if (json.has("requestor"))
3366      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
3367    if (json.has("_requestor"))
3368      parseElementProperties(json.getAsJsonObject("_requestor"), res.getRequestorElement());
3369    if (json.has("location"))
3370      res.setLocation(parseReference(json.getAsJsonObject("location")));
3371    if (json.has("policy")) {
3372      JsonArray array = json.getAsJsonArray("policy");
3373      for (int i = 0; i < array.size(); i++) {
3374        if (array.get(i).isJsonNull()) {
3375          res.getPolicy().add(new UriType());
3376        } else {;
3377          res.getPolicy().add(parseUri(array.get(i).getAsString()));
3378        }
3379      }
3380    };
3381    if (json.has("_policy")) {
3382      JsonArray array = json.getAsJsonArray("_policy");
3383      for (int i = 0; i < array.size(); i++) {
3384        if (i == res.getPolicy().size())
3385          res.getPolicy().add(parseUri(null));
3386        if (array.get(i) instanceof JsonObject) 
3387          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
3388      }
3389    };
3390    if (json.has("media"))
3391      res.setMedia(parseCoding(json.getAsJsonObject("media")));
3392    if (json.has("network"))
3393      res.setNetwork(parseAuditEventAgentNetworkComponent(json.getAsJsonObject("network")));
3394    if (json.has("purposeOfUse")) {
3395      JsonArray array = json.getAsJsonArray("purposeOfUse");
3396      for (int i = 0; i < array.size(); i++) {
3397        res.getPurposeOfUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3398      }
3399    };
3400  }
3401
3402  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAgentNetworkComponent(JsonObject json) throws IOException, FHIRFormatError {
3403    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
3404    parseAuditEventAgentNetworkComponentProperties(json, res);
3405    return res;
3406  }
3407
3408  protected void parseAuditEventAgentNetworkComponentProperties(JsonObject json, AuditEvent.AuditEventAgentNetworkComponent res) throws IOException, FHIRFormatError {
3409    parseBackboneElementProperties(json, res);
3410    if (json.has("address"))
3411      res.setAddressElement(parseString(json.get("address").getAsString()));
3412    if (json.has("_address"))
3413      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
3414    if (json.has("type"))
3415      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventAgentNetworkType.NULL, new AuditEvent.AuditEventAgentNetworkTypeEnumFactory()));
3416    if (json.has("_type"))
3417      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3418  }
3419
3420  protected AuditEvent.AuditEventSourceComponent parseAuditEventSourceComponent(JsonObject json) throws IOException, FHIRFormatError {
3421    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
3422    parseAuditEventSourceComponentProperties(json, res);
3423    return res;
3424  }
3425
3426  protected void parseAuditEventSourceComponentProperties(JsonObject json, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
3427    parseBackboneElementProperties(json, res);
3428    if (json.has("site"))
3429      res.setSiteElement(parseString(json.get("site").getAsString()));
3430    if (json.has("_site"))
3431      parseElementProperties(json.getAsJsonObject("_site"), res.getSiteElement());
3432    if (json.has("observer"))
3433      res.setObserver(parseReference(json.getAsJsonObject("observer")));
3434    if (json.has("type")) {
3435      JsonArray array = json.getAsJsonArray("type");
3436      for (int i = 0; i < array.size(); i++) {
3437        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
3438      }
3439    };
3440  }
3441
3442  protected AuditEvent.AuditEventEntityComponent parseAuditEventEntityComponent(JsonObject json) throws IOException, FHIRFormatError {
3443    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
3444    parseAuditEventEntityComponentProperties(json, res);
3445    return res;
3446  }
3447
3448  protected void parseAuditEventEntityComponentProperties(JsonObject json, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
3449    parseBackboneElementProperties(json, res);
3450    if (json.has("what"))
3451      res.setWhat(parseReference(json.getAsJsonObject("what")));
3452    if (json.has("type"))
3453      res.setType(parseCoding(json.getAsJsonObject("type")));
3454    if (json.has("role"))
3455      res.setRole(parseCoding(json.getAsJsonObject("role")));
3456    if (json.has("lifecycle"))
3457      res.setLifecycle(parseCoding(json.getAsJsonObject("lifecycle")));
3458    if (json.has("securityLabel")) {
3459      JsonArray array = json.getAsJsonArray("securityLabel");
3460      for (int i = 0; i < array.size(); i++) {
3461        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
3462      }
3463    };
3464    if (json.has("name"))
3465      res.setNameElement(parseString(json.get("name").getAsString()));
3466    if (json.has("_name"))
3467      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3468    if (json.has("query"))
3469      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
3470    if (json.has("_query"))
3471      parseElementProperties(json.getAsJsonObject("_query"), res.getQueryElement());
3472    if (json.has("detail")) {
3473      JsonArray array = json.getAsJsonArray("detail");
3474      for (int i = 0; i < array.size(); i++) {
3475        res.getDetail().add(parseAuditEventEntityDetailComponent(array.get(i).getAsJsonObject()));
3476      }
3477    };
3478  }
3479
3480  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventEntityDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
3481    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
3482    parseAuditEventEntityDetailComponentProperties(json, res);
3483    return res;
3484  }
3485
3486  protected void parseAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
3487    parseBackboneElementProperties(json, res);
3488    if (json.has("type"))
3489      res.setTypeElement(parseString(json.get("type").getAsString()));
3490    if (json.has("_type"))
3491      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3492    DataType value = parseType("value", json);
3493    if (value != null)
3494      res.setValue(value);
3495  }
3496
3497  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
3498    Basic res = new Basic();
3499    parseBasicProperties(json, res);
3500    return res;
3501  }
3502
3503  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
3504    parseDomainResourceProperties(json, res);
3505    if (json.has("identifier")) {
3506      JsonArray array = json.getAsJsonArray("identifier");
3507      for (int i = 0; i < array.size(); i++) {
3508        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3509      }
3510    };
3511    if (json.has("code"))
3512      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3513    if (json.has("subject"))
3514      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3515    if (json.has("created"))
3516      res.setCreatedElement(parseDate(json.get("created").getAsString()));
3517    if (json.has("_created"))
3518      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
3519    if (json.has("author"))
3520      res.setAuthor(parseReference(json.getAsJsonObject("author")));
3521  }
3522
3523  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
3524    Binary res = new Binary();
3525    parseBinaryProperties(json, res);
3526    return res;
3527  }
3528
3529  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
3530    parseResourceProperties(json, res);
3531    if (json.has("contentType"))
3532      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
3533    if (json.has("_contentType"))
3534      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
3535    if (json.has("securityContext"))
3536      res.setSecurityContext(parseReference(json.getAsJsonObject("securityContext")));
3537    if (json.has("data"))
3538      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
3539    if (json.has("_data"))
3540      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
3541  }
3542
3543  protected BiologicallyDerivedProduct parseBiologicallyDerivedProduct(JsonObject json) throws IOException, FHIRFormatError {
3544    BiologicallyDerivedProduct res = new BiologicallyDerivedProduct();
3545    parseBiologicallyDerivedProductProperties(json, res);
3546    return res;
3547  }
3548
3549  protected void parseBiologicallyDerivedProductProperties(JsonObject json, BiologicallyDerivedProduct res) throws IOException, FHIRFormatError {
3550    parseDomainResourceProperties(json, res);
3551    if (json.has("identifier")) {
3552      JsonArray array = json.getAsJsonArray("identifier");
3553      for (int i = 0; i < array.size(); i++) {
3554        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3555      }
3556    };
3557    if (json.has("productCategory"))
3558      res.setProductCategoryElement(parseEnumeration(json.get("productCategory").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory()));
3559    if (json.has("_productCategory"))
3560      parseElementProperties(json.getAsJsonObject("_productCategory"), res.getProductCategoryElement());
3561    if (json.has("productCode"))
3562      res.setProductCode(parseCodeableConcept(json.getAsJsonObject("productCode")));
3563    if (json.has("status"))
3564      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory()));
3565    if (json.has("_status"))
3566      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3567    if (json.has("request")) {
3568      JsonArray array = json.getAsJsonArray("request");
3569      for (int i = 0; i < array.size(); i++) {
3570        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
3571      }
3572    };
3573    if (json.has("quantity"))
3574      res.setQuantityElement(parseInteger(json.get("quantity").getAsLong()));
3575    if (json.has("_quantity"))
3576      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
3577    if (json.has("parent")) {
3578      JsonArray array = json.getAsJsonArray("parent");
3579      for (int i = 0; i < array.size(); i++) {
3580        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
3581      }
3582    };
3583    if (json.has("collection"))
3584      res.setCollection(parseBiologicallyDerivedProductCollectionComponent(json.getAsJsonObject("collection")));
3585    if (json.has("processing")) {
3586      JsonArray array = json.getAsJsonArray("processing");
3587      for (int i = 0; i < array.size(); i++) {
3588        res.getProcessing().add(parseBiologicallyDerivedProductProcessingComponent(array.get(i).getAsJsonObject()));
3589      }
3590    };
3591    if (json.has("manipulation"))
3592      res.setManipulation(parseBiologicallyDerivedProductManipulationComponent(json.getAsJsonObject("manipulation")));
3593    if (json.has("storage")) {
3594      JsonArray array = json.getAsJsonArray("storage");
3595      for (int i = 0; i < array.size(); i++) {
3596        res.getStorage().add(parseBiologicallyDerivedProductStorageComponent(array.get(i).getAsJsonObject()));
3597      }
3598    };
3599  }
3600
3601  protected BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent parseBiologicallyDerivedProductCollectionComponent(JsonObject json) throws IOException, FHIRFormatError {
3602    BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent();
3603    parseBiologicallyDerivedProductCollectionComponentProperties(json, res);
3604    return res;
3605  }
3606
3607  protected void parseBiologicallyDerivedProductCollectionComponentProperties(JsonObject json, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res) throws IOException, FHIRFormatError {
3608    parseBackboneElementProperties(json, res);
3609    if (json.has("collector"))
3610      res.setCollector(parseReference(json.getAsJsonObject("collector")));
3611    if (json.has("source"))
3612      res.setSource(parseReference(json.getAsJsonObject("source")));
3613    DataType collected = parseType("collected", json);
3614    if (collected != null)
3615      res.setCollected(collected);
3616  }
3617
3618  protected BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent parseBiologicallyDerivedProductProcessingComponent(JsonObject json) throws IOException, FHIRFormatError {
3619    BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent();
3620    parseBiologicallyDerivedProductProcessingComponentProperties(json, res);
3621    return res;
3622  }
3623
3624  protected void parseBiologicallyDerivedProductProcessingComponentProperties(JsonObject json, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res) throws IOException, FHIRFormatError {
3625    parseBackboneElementProperties(json, res);
3626    if (json.has("description"))
3627      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3628    if (json.has("_description"))
3629      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3630    if (json.has("procedure"))
3631      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
3632    if (json.has("additive"))
3633      res.setAdditive(parseReference(json.getAsJsonObject("additive")));
3634    DataType time = parseType("time", json);
3635    if (time != null)
3636      res.setTime(time);
3637  }
3638
3639  protected BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent parseBiologicallyDerivedProductManipulationComponent(JsonObject json) throws IOException, FHIRFormatError {
3640    BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent();
3641    parseBiologicallyDerivedProductManipulationComponentProperties(json, res);
3642    return res;
3643  }
3644
3645  protected void parseBiologicallyDerivedProductManipulationComponentProperties(JsonObject json, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res) throws IOException, FHIRFormatError {
3646    parseBackboneElementProperties(json, res);
3647    if (json.has("description"))
3648      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3649    if (json.has("_description"))
3650      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3651    DataType time = parseType("time", json);
3652    if (time != null)
3653      res.setTime(time);
3654  }
3655
3656  protected BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent parseBiologicallyDerivedProductStorageComponent(JsonObject json) throws IOException, FHIRFormatError {
3657    BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent();
3658    parseBiologicallyDerivedProductStorageComponentProperties(json, res);
3659    return res;
3660  }
3661
3662  protected void parseBiologicallyDerivedProductStorageComponentProperties(JsonObject json, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res) throws IOException, FHIRFormatError {
3663    parseBackboneElementProperties(json, res);
3664    if (json.has("description"))
3665      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3666    if (json.has("_description"))
3667      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3668    if (json.has("temperature"))
3669      res.setTemperatureElement(parseDecimal(json.get("temperature").getAsBigDecimal()));
3670    if (json.has("_temperature"))
3671      parseElementProperties(json.getAsJsonObject("_temperature"), res.getTemperatureElement());
3672    if (json.has("scale"))
3673      res.setScaleElement(parseEnumeration(json.get("scale").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory()));
3674    if (json.has("_scale"))
3675      parseElementProperties(json.getAsJsonObject("_scale"), res.getScaleElement());
3676    if (json.has("duration"))
3677      res.setDuration(parsePeriod(json.getAsJsonObject("duration")));
3678  }
3679
3680  protected BodyStructure parseBodyStructure(JsonObject json) throws IOException, FHIRFormatError {
3681    BodyStructure res = new BodyStructure();
3682    parseBodyStructureProperties(json, res);
3683    return res;
3684  }
3685
3686  protected void parseBodyStructureProperties(JsonObject json, BodyStructure res) throws IOException, FHIRFormatError {
3687    parseDomainResourceProperties(json, res);
3688    if (json.has("identifier")) {
3689      JsonArray array = json.getAsJsonArray("identifier");
3690      for (int i = 0; i < array.size(); i++) {
3691        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3692      }
3693    };
3694    if (json.has("active"))
3695      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
3696    if (json.has("_active"))
3697      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
3698    if (json.has("morphology"))
3699      res.setMorphology(parseCodeableConcept(json.getAsJsonObject("morphology")));
3700    if (json.has("location"))
3701      res.setLocation(parseCodeableConcept(json.getAsJsonObject("location")));
3702    if (json.has("locationQualifier")) {
3703      JsonArray array = json.getAsJsonArray("locationQualifier");
3704      for (int i = 0; i < array.size(); i++) {
3705        res.getLocationQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3706      }
3707    };
3708    if (json.has("description"))
3709      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3710    if (json.has("_description"))
3711      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3712    if (json.has("image")) {
3713      JsonArray array = json.getAsJsonArray("image");
3714      for (int i = 0; i < array.size(); i++) {
3715        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
3716      }
3717    };
3718    if (json.has("patient"))
3719      res.setPatient(parseReference(json.getAsJsonObject("patient")));
3720  }
3721
3722  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
3723    Bundle res = new Bundle();
3724    parseBundleProperties(json, res);
3725    return res;
3726  }
3727
3728  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
3729    parseResourceProperties(json, res);
3730    if (json.has("identifier"))
3731      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
3732    if (json.has("type"))
3733      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
3734    if (json.has("_type"))
3735      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3736    if (json.has("timestamp"))
3737      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
3738    if (json.has("_timestamp"))
3739      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
3740    if (json.has("total"))
3741      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
3742    if (json.has("_total"))
3743      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
3744    if (json.has("link")) {
3745      JsonArray array = json.getAsJsonArray("link");
3746      for (int i = 0; i < array.size(); i++) {
3747        res.getLink().add(parseBundleLinkComponent(array.get(i).getAsJsonObject()));
3748      }
3749    };
3750    if (json.has("entry")) {
3751      JsonArray array = json.getAsJsonArray("entry");
3752      for (int i = 0; i < array.size(); i++) {
3753        res.getEntry().add(parseBundleEntryComponent(array.get(i).getAsJsonObject()));
3754      }
3755    };
3756    if (json.has("signature"))
3757      res.setSignature(parseSignature(json.getAsJsonObject("signature")));
3758  }
3759
3760  protected Bundle.BundleLinkComponent parseBundleLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
3761    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
3762    parseBundleLinkComponentProperties(json, res);
3763    return res;
3764  }
3765
3766  protected void parseBundleLinkComponentProperties(JsonObject json, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
3767    parseBackboneElementProperties(json, res);
3768    if (json.has("relation"))
3769      res.setRelationElement(parseString(json.get("relation").getAsString()));
3770    if (json.has("_relation"))
3771      parseElementProperties(json.getAsJsonObject("_relation"), res.getRelationElement());
3772    if (json.has("url"))
3773      res.setUrlElement(parseUri(json.get("url").getAsString()));
3774    if (json.has("_url"))
3775      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3776  }
3777
3778  protected Bundle.BundleEntryComponent parseBundleEntryComponent(JsonObject json) throws IOException, FHIRFormatError {
3779    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
3780    parseBundleEntryComponentProperties(json, res);
3781    return res;
3782  }
3783
3784  protected void parseBundleEntryComponentProperties(JsonObject json, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
3785    parseBackboneElementProperties(json, res);
3786    if (json.has("link")) {
3787      JsonArray array = json.getAsJsonArray("link");
3788      for (int i = 0; i < array.size(); i++) {
3789        res.getLink().add(parseBundleLinkComponent(array.get(i).getAsJsonObject()));
3790      }
3791    };
3792    if (json.has("fullUrl"))
3793      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
3794    if (json.has("_fullUrl"))
3795      parseElementProperties(json.getAsJsonObject("_fullUrl"), res.getFullUrlElement());
3796    if (json.has("resource"))
3797      res.setResource(parseResource(json.getAsJsonObject("resource")));
3798    if (json.has("search"))
3799      res.setSearch(parseBundleEntrySearchComponent(json.getAsJsonObject("search")));
3800    if (json.has("request"))
3801      res.setRequest(parseBundleEntryRequestComponent(json.getAsJsonObject("request")));
3802    if (json.has("response"))
3803      res.setResponse(parseBundleEntryResponseComponent(json.getAsJsonObject("response")));
3804  }
3805
3806  protected Bundle.BundleEntrySearchComponent parseBundleEntrySearchComponent(JsonObject json) throws IOException, FHIRFormatError {
3807    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
3808    parseBundleEntrySearchComponentProperties(json, res);
3809    return res;
3810  }
3811
3812  protected void parseBundleEntrySearchComponentProperties(JsonObject json, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
3813    parseBackboneElementProperties(json, res);
3814    if (json.has("mode"))
3815      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
3816    if (json.has("_mode"))
3817      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3818    if (json.has("score"))
3819      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
3820    if (json.has("_score"))
3821      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
3822  }
3823
3824  protected Bundle.BundleEntryRequestComponent parseBundleEntryRequestComponent(JsonObject json) throws IOException, FHIRFormatError {
3825    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
3826    parseBundleEntryRequestComponentProperties(json, res);
3827    return res;
3828  }
3829
3830  protected void parseBundleEntryRequestComponentProperties(JsonObject json, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
3831    parseBackboneElementProperties(json, res);
3832    if (json.has("method"))
3833      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
3834    if (json.has("_method"))
3835      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
3836    if (json.has("url"))
3837      res.setUrlElement(parseUri(json.get("url").getAsString()));
3838    if (json.has("_url"))
3839      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3840    if (json.has("ifNoneMatch"))
3841      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
3842    if (json.has("_ifNoneMatch"))
3843      parseElementProperties(json.getAsJsonObject("_ifNoneMatch"), res.getIfNoneMatchElement());
3844    if (json.has("ifModifiedSince"))
3845      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
3846    if (json.has("_ifModifiedSince"))
3847      parseElementProperties(json.getAsJsonObject("_ifModifiedSince"), res.getIfModifiedSinceElement());
3848    if (json.has("ifMatch"))
3849      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
3850    if (json.has("_ifMatch"))
3851      parseElementProperties(json.getAsJsonObject("_ifMatch"), res.getIfMatchElement());
3852    if (json.has("ifNoneExist"))
3853      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
3854    if (json.has("_ifNoneExist"))
3855      parseElementProperties(json.getAsJsonObject("_ifNoneExist"), res.getIfNoneExistElement());
3856  }
3857
3858  protected Bundle.BundleEntryResponseComponent parseBundleEntryResponseComponent(JsonObject json) throws IOException, FHIRFormatError {
3859    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
3860    parseBundleEntryResponseComponentProperties(json, res);
3861    return res;
3862  }
3863
3864  protected void parseBundleEntryResponseComponentProperties(JsonObject json, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
3865    parseBackboneElementProperties(json, res);
3866    if (json.has("status"))
3867      res.setStatusElement(parseString(json.get("status").getAsString()));
3868    if (json.has("_status"))
3869      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3870    if (json.has("location"))
3871      res.setLocationElement(parseUri(json.get("location").getAsString()));
3872    if (json.has("_location"))
3873      parseElementProperties(json.getAsJsonObject("_location"), res.getLocationElement());
3874    if (json.has("etag"))
3875      res.setEtagElement(parseString(json.get("etag").getAsString()));
3876    if (json.has("_etag"))
3877      parseElementProperties(json.getAsJsonObject("_etag"), res.getEtagElement());
3878    if (json.has("lastModified"))
3879      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
3880    if (json.has("_lastModified"))
3881      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
3882    if (json.has("outcome"))
3883      res.setOutcome(parseResource(json.getAsJsonObject("outcome")));
3884  }
3885
3886  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
3887    CapabilityStatement res = new CapabilityStatement();
3888    parseCapabilityStatementProperties(json, res);
3889    return res;
3890  }
3891
3892  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
3893    parseCanonicalResourceProperties(json, res);
3894    if (json.has("url"))
3895      res.setUrlElement(parseUri(json.get("url").getAsString()));
3896    if (json.has("_url"))
3897      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3898    if (json.has("version"))
3899      res.setVersionElement(parseString(json.get("version").getAsString()));
3900    if (json.has("_version"))
3901      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3902    if (json.has("name"))
3903      res.setNameElement(parseString(json.get("name").getAsString()));
3904    if (json.has("_name"))
3905      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3906    if (json.has("title"))
3907      res.setTitleElement(parseString(json.get("title").getAsString()));
3908    if (json.has("_title"))
3909      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
3910    if (json.has("status"))
3911      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
3912    if (json.has("_status"))
3913      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3914    if (json.has("experimental"))
3915      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3916    if (json.has("_experimental"))
3917      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
3918    if (json.has("date"))
3919      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3920    if (json.has("_date"))
3921      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
3922    if (json.has("publisher"))
3923      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3924    if (json.has("_publisher"))
3925      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
3926    if (json.has("contact")) {
3927      JsonArray array = json.getAsJsonArray("contact");
3928      for (int i = 0; i < array.size(); i++) {
3929        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
3930      }
3931    };
3932    if (json.has("description"))
3933      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3934    if (json.has("_description"))
3935      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3936    if (json.has("useContext")) {
3937      JsonArray array = json.getAsJsonArray("useContext");
3938      for (int i = 0; i < array.size(); i++) {
3939        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
3940      }
3941    };
3942    if (json.has("jurisdiction")) {
3943      JsonArray array = json.getAsJsonArray("jurisdiction");
3944      for (int i = 0; i < array.size(); i++) {
3945        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3946      }
3947    };
3948    if (json.has("purpose"))
3949      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
3950    if (json.has("_purpose"))
3951      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
3952    if (json.has("copyright"))
3953      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
3954    if (json.has("_copyright"))
3955      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
3956    if (json.has("kind"))
3957      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.CapabilityStatementKind.NULL, new Enumerations.CapabilityStatementKindEnumFactory()));
3958    if (json.has("_kind"))
3959      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
3960    if (json.has("instantiates")) {
3961      JsonArray array = json.getAsJsonArray("instantiates");
3962      for (int i = 0; i < array.size(); i++) {
3963        if (array.get(i).isJsonNull()) {
3964          res.getInstantiates().add(new CanonicalType());
3965        } else {;
3966          res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
3967        }
3968      }
3969    };
3970    if (json.has("_instantiates")) {
3971      JsonArray array = json.getAsJsonArray("_instantiates");
3972      for (int i = 0; i < array.size(); i++) {
3973        if (i == res.getInstantiates().size())
3974          res.getInstantiates().add(parseCanonical(null));
3975        if (array.get(i) instanceof JsonObject) 
3976          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
3977      }
3978    };
3979    if (json.has("imports")) {
3980      JsonArray array = json.getAsJsonArray("imports");
3981      for (int i = 0; i < array.size(); i++) {
3982        if (array.get(i).isJsonNull()) {
3983          res.getImports().add(new CanonicalType());
3984        } else {;
3985          res.getImports().add(parseCanonical(array.get(i).getAsString()));
3986        }
3987      }
3988    };
3989    if (json.has("_imports")) {
3990      JsonArray array = json.getAsJsonArray("_imports");
3991      for (int i = 0; i < array.size(); i++) {
3992        if (i == res.getImports().size())
3993          res.getImports().add(parseCanonical(null));
3994        if (array.get(i) instanceof JsonObject) 
3995          parseElementProperties(array.get(i).getAsJsonObject(), res.getImports().get(i));
3996      }
3997    };
3998    if (json.has("software"))
3999      res.setSoftware(parseCapabilityStatementSoftwareComponent(json.getAsJsonObject("software")));
4000    if (json.has("implementation"))
4001      res.setImplementation(parseCapabilityStatementImplementationComponent(json.getAsJsonObject("implementation")));
4002    if (json.has("fhirVersion"))
4003      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
4004    if (json.has("_fhirVersion"))
4005      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
4006    if (json.has("format")) {
4007      JsonArray array = json.getAsJsonArray("format");
4008      for (int i = 0; i < array.size(); i++) {
4009        if (array.get(i).isJsonNull()) {
4010          res.getFormat().add(new CodeType());
4011        } else {;
4012          res.getFormat().add(parseCode(array.get(i).getAsString()));
4013        }
4014      }
4015    };
4016    if (json.has("_format")) {
4017      JsonArray array = json.getAsJsonArray("_format");
4018      for (int i = 0; i < array.size(); i++) {
4019        if (i == res.getFormat().size())
4020          res.getFormat().add(parseCode(null));
4021        if (array.get(i) instanceof JsonObject) 
4022          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
4023      }
4024    };
4025    if (json.has("patchFormat")) {
4026      JsonArray array = json.getAsJsonArray("patchFormat");
4027      for (int i = 0; i < array.size(); i++) {
4028        if (array.get(i).isJsonNull()) {
4029          res.getPatchFormat().add(new CodeType());
4030        } else {;
4031          res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
4032        }
4033      }
4034    };
4035    if (json.has("_patchFormat")) {
4036      JsonArray array = json.getAsJsonArray("_patchFormat");
4037      for (int i = 0; i < array.size(); i++) {
4038        if (i == res.getPatchFormat().size())
4039          res.getPatchFormat().add(parseCode(null));
4040        if (array.get(i) instanceof JsonObject) 
4041          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
4042      }
4043    };
4044    if (json.has("implementationGuide")) {
4045      JsonArray array = json.getAsJsonArray("implementationGuide");
4046      for (int i = 0; i < array.size(); i++) {
4047        if (array.get(i).isJsonNull()) {
4048          res.getImplementationGuide().add(new CanonicalType());
4049        } else {;
4050          res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
4051        }
4052      }
4053    };
4054    if (json.has("_implementationGuide")) {
4055      JsonArray array = json.getAsJsonArray("_implementationGuide");
4056      for (int i = 0; i < array.size(); i++) {
4057        if (i == res.getImplementationGuide().size())
4058          res.getImplementationGuide().add(parseCanonical(null));
4059        if (array.get(i) instanceof JsonObject) 
4060          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
4061      }
4062    };
4063    if (json.has("rest")) {
4064      JsonArray array = json.getAsJsonArray("rest");
4065      for (int i = 0; i < array.size(); i++) {
4066        res.getRest().add(parseCapabilityStatementRestComponent(array.get(i).getAsJsonObject()));
4067      }
4068    };
4069    if (json.has("messaging")) {
4070      JsonArray array = json.getAsJsonArray("messaging");
4071      for (int i = 0; i < array.size(); i++) {
4072        res.getMessaging().add(parseCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject()));
4073      }
4074    };
4075    if (json.has("document")) {
4076      JsonArray array = json.getAsJsonArray("document");
4077      for (int i = 0; i < array.size(); i++) {
4078        res.getDocument().add(parseCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject()));
4079      }
4080    };
4081  }
4082
4083  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementSoftwareComponent(JsonObject json) throws IOException, FHIRFormatError {
4084    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
4085    parseCapabilityStatementSoftwareComponentProperties(json, res);
4086    return res;
4087  }
4088
4089  protected void parseCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
4090    parseBackboneElementProperties(json, res);
4091    if (json.has("name"))
4092      res.setNameElement(parseString(json.get("name").getAsString()));
4093    if (json.has("_name"))
4094      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4095    if (json.has("version"))
4096      res.setVersionElement(parseString(json.get("version").getAsString()));
4097    if (json.has("_version"))
4098      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4099    if (json.has("releaseDate"))
4100      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
4101    if (json.has("_releaseDate"))
4102      parseElementProperties(json.getAsJsonObject("_releaseDate"), res.getReleaseDateElement());
4103  }
4104
4105  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementImplementationComponent(JsonObject json) throws IOException, FHIRFormatError {
4106    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
4107    parseCapabilityStatementImplementationComponentProperties(json, res);
4108    return res;
4109  }
4110
4111  protected void parseCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
4112    parseBackboneElementProperties(json, res);
4113    if (json.has("description"))
4114      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4115    if (json.has("_description"))
4116      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4117    if (json.has("url"))
4118      res.setUrlElement(parseUrl(json.get("url").getAsString()));
4119    if (json.has("_url"))
4120      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
4121    if (json.has("custodian"))
4122      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
4123  }
4124
4125  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementRestComponent(JsonObject json) throws IOException, FHIRFormatError {
4126    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
4127    parseCapabilityStatementRestComponentProperties(json, res);
4128    return res;
4129  }
4130
4131  protected void parseCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
4132    parseBackboneElementProperties(json, res);
4133    if (json.has("mode"))
4134      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Enumerations.RestfulCapabilityMode.NULL, new Enumerations.RestfulCapabilityModeEnumFactory()));
4135    if (json.has("_mode"))
4136      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
4137    if (json.has("documentation"))
4138      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4139    if (json.has("_documentation"))
4140      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4141    if (json.has("security"))
4142      res.setSecurity(parseCapabilityStatementRestSecurityComponent(json.getAsJsonObject("security")));
4143    if (json.has("resource")) {
4144      JsonArray array = json.getAsJsonArray("resource");
4145      for (int i = 0; i < array.size(); i++) {
4146        res.getResource().add(parseCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject()));
4147      }
4148    };
4149    if (json.has("interaction")) {
4150      JsonArray array = json.getAsJsonArray("interaction");
4151      for (int i = 0; i < array.size(); i++) {
4152        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject()));
4153      }
4154    };
4155    if (json.has("searchParam")) {
4156      JsonArray array = json.getAsJsonArray("searchParam");
4157      for (int i = 0; i < array.size(); i++) {
4158        res.getSearchParam().add(parseCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject()));
4159      }
4160    };
4161    if (json.has("operation")) {
4162      JsonArray array = json.getAsJsonArray("operation");
4163      for (int i = 0; i < array.size(); i++) {
4164        res.getOperation().add(parseCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject()));
4165      }
4166    };
4167    if (json.has("compartment")) {
4168      JsonArray array = json.getAsJsonArray("compartment");
4169      for (int i = 0; i < array.size(); i++) {
4170        if (array.get(i).isJsonNull()) {
4171          res.getCompartment().add(new CanonicalType());
4172        } else {;
4173          res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
4174        }
4175      }
4176    };
4177    if (json.has("_compartment")) {
4178      JsonArray array = json.getAsJsonArray("_compartment");
4179      for (int i = 0; i < array.size(); i++) {
4180        if (i == res.getCompartment().size())
4181          res.getCompartment().add(parseCanonical(null));
4182        if (array.get(i) instanceof JsonObject) 
4183          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
4184      }
4185    };
4186  }
4187
4188  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementRestSecurityComponent(JsonObject json) throws IOException, FHIRFormatError {
4189    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
4190    parseCapabilityStatementRestSecurityComponentProperties(json, res);
4191    return res;
4192  }
4193
4194  protected void parseCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
4195    parseBackboneElementProperties(json, res);
4196    if (json.has("cors"))
4197      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
4198    if (json.has("_cors"))
4199      parseElementProperties(json.getAsJsonObject("_cors"), res.getCorsElement());
4200    if (json.has("service")) {
4201      JsonArray array = json.getAsJsonArray("service");
4202      for (int i = 0; i < array.size(); i++) {
4203        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4204      }
4205    };
4206    if (json.has("description"))
4207      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4208    if (json.has("_description"))
4209      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4210  }
4211
4212  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementRestResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
4213    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
4214    parseCapabilityStatementRestResourceComponentProperties(json, res);
4215    return res;
4216  }
4217
4218  protected void parseCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
4219    parseBackboneElementProperties(json, res);
4220    if (json.has("type"))
4221      res.setTypeElement(parseCode(json.get("type").getAsString()));
4222    if (json.has("_type"))
4223      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4224    if (json.has("profile"))
4225      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
4226    if (json.has("_profile"))
4227      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
4228    if (json.has("supportedProfile")) {
4229      JsonArray array = json.getAsJsonArray("supportedProfile");
4230      for (int i = 0; i < array.size(); i++) {
4231        if (array.get(i).isJsonNull()) {
4232          res.getSupportedProfile().add(new CanonicalType());
4233        } else {;
4234          res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
4235        }
4236      }
4237    };
4238    if (json.has("_supportedProfile")) {
4239      JsonArray array = json.getAsJsonArray("_supportedProfile");
4240      for (int i = 0; i < array.size(); i++) {
4241        if (i == res.getSupportedProfile().size())
4242          res.getSupportedProfile().add(parseCanonical(null));
4243        if (array.get(i) instanceof JsonObject) 
4244          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
4245      }
4246    };
4247    if (json.has("documentation"))
4248      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4249    if (json.has("_documentation"))
4250      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4251    if (json.has("interaction")) {
4252      JsonArray array = json.getAsJsonArray("interaction");
4253      for (int i = 0; i < array.size(); i++) {
4254        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject()));
4255      }
4256    };
4257    if (json.has("versioning"))
4258      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
4259    if (json.has("_versioning"))
4260      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
4261    if (json.has("readHistory"))
4262      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
4263    if (json.has("_readHistory"))
4264      parseElementProperties(json.getAsJsonObject("_readHistory"), res.getReadHistoryElement());
4265    if (json.has("updateCreate"))
4266      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
4267    if (json.has("_updateCreate"))
4268      parseElementProperties(json.getAsJsonObject("_updateCreate"), res.getUpdateCreateElement());
4269    if (json.has("conditionalCreate"))
4270      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
4271    if (json.has("_conditionalCreate"))
4272      parseElementProperties(json.getAsJsonObject("_conditionalCreate"), res.getConditionalCreateElement());
4273    if (json.has("conditionalRead"))
4274      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
4275    if (json.has("_conditionalRead"))
4276      parseElementProperties(json.getAsJsonObject("_conditionalRead"), res.getConditionalReadElement());
4277    if (json.has("conditionalUpdate"))
4278      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
4279    if (json.has("_conditionalUpdate"))
4280      parseElementProperties(json.getAsJsonObject("_conditionalUpdate"), res.getConditionalUpdateElement());
4281    if (json.has("conditionalDelete"))
4282      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
4283    if (json.has("_conditionalDelete"))
4284      parseElementProperties(json.getAsJsonObject("_conditionalDelete"), res.getConditionalDeleteElement());
4285    if (json.has("referencePolicy")) {
4286      JsonArray array = json.getAsJsonArray("referencePolicy");
4287      for (int i = 0; i < array.size(); i++) {
4288        if (array.get(i).isJsonNull()) {
4289          res.getReferencePolicy().add(new Enumeration<CapabilityStatement.ReferenceHandlingPolicy>(new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), CapabilityStatement.ReferenceHandlingPolicy.NULL));
4290        } else {;
4291          res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
4292        }
4293      }
4294    };
4295    if (json.has("_referencePolicy")) {
4296      JsonArray array = json.getAsJsonArray("_referencePolicy");
4297      for (int i = 0; i < array.size(); i++) {
4298        if (i == res.getReferencePolicy().size())
4299          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
4300        if (array.get(i) instanceof JsonObject) 
4301          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
4302      }
4303    };
4304    if (json.has("searchInclude")) {
4305      JsonArray array = json.getAsJsonArray("searchInclude");
4306      for (int i = 0; i < array.size(); i++) {
4307        if (array.get(i).isJsonNull()) {
4308          res.getSearchInclude().add(new StringType());
4309        } else {;
4310          res.getSearchInclude().add(parseString(array.get(i).getAsString()));
4311        }
4312      }
4313    };
4314    if (json.has("_searchInclude")) {
4315      JsonArray array = json.getAsJsonArray("_searchInclude");
4316      for (int i = 0; i < array.size(); i++) {
4317        if (i == res.getSearchInclude().size())
4318          res.getSearchInclude().add(parseString(null));
4319        if (array.get(i) instanceof JsonObject) 
4320          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
4321      }
4322    };
4323    if (json.has("searchRevInclude")) {
4324      JsonArray array = json.getAsJsonArray("searchRevInclude");
4325      for (int i = 0; i < array.size(); i++) {
4326        if (array.get(i).isJsonNull()) {
4327          res.getSearchRevInclude().add(new StringType());
4328        } else {;
4329          res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
4330        }
4331      }
4332    };
4333    if (json.has("_searchRevInclude")) {
4334      JsonArray array = json.getAsJsonArray("_searchRevInclude");
4335      for (int i = 0; i < array.size(); i++) {
4336        if (i == res.getSearchRevInclude().size())
4337          res.getSearchRevInclude().add(parseString(null));
4338        if (array.get(i) instanceof JsonObject) 
4339          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
4340      }
4341    };
4342    if (json.has("searchParam")) {
4343      JsonArray array = json.getAsJsonArray("searchParam");
4344      for (int i = 0; i < array.size(); i++) {
4345        res.getSearchParam().add(parseCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject()));
4346      }
4347    };
4348    if (json.has("operation")) {
4349      JsonArray array = json.getAsJsonArray("operation");
4350      for (int i = 0; i < array.size(); i++) {
4351        res.getOperation().add(parseCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject()));
4352      }
4353    };
4354  }
4355
4356  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
4357    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
4358    parseCapabilityStatementResourceInteractionComponentProperties(json, res);
4359    return res;
4360  }
4361
4362  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
4363    parseBackboneElementProperties(json, res);
4364    if (json.has("code"))
4365      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
4366    if (json.has("_code"))
4367      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
4368    if (json.has("documentation"))
4369      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4370    if (json.has("_documentation"))
4371      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4372  }
4373
4374  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementRestResourceSearchParamComponent(JsonObject json) throws IOException, FHIRFormatError {
4375    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
4376    parseCapabilityStatementRestResourceSearchParamComponentProperties(json, res);
4377    return res;
4378  }
4379
4380  protected void parseCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
4381    parseBackboneElementProperties(json, res);
4382    if (json.has("name"))
4383      res.setNameElement(parseString(json.get("name").getAsString()));
4384    if (json.has("_name"))
4385      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4386    if (json.has("definition"))
4387      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4388    if (json.has("_definition"))
4389      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
4390    if (json.has("type"))
4391      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
4392    if (json.has("_type"))
4393      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4394    if (json.has("documentation"))
4395      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4396    if (json.has("_documentation"))
4397      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4398  }
4399
4400  protected CapabilityStatement.CapabilityStatementRestResourceOperationComponent parseCapabilityStatementRestResourceOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
4401    CapabilityStatement.CapabilityStatementRestResourceOperationComponent res = new CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
4402    parseCapabilityStatementRestResourceOperationComponentProperties(json, res);
4403    return res;
4404  }
4405
4406  protected void parseCapabilityStatementRestResourceOperationComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementRestResourceOperationComponent res) throws IOException, FHIRFormatError {
4407    parseBackboneElementProperties(json, res);
4408    if (json.has("name"))
4409      res.setNameElement(parseString(json.get("name").getAsString()));
4410    if (json.has("_name"))
4411      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4412    if (json.has("definition"))
4413      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4414    if (json.has("_definition"))
4415      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
4416    if (json.has("documentation"))
4417      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4418    if (json.has("_documentation"))
4419      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4420  }
4421
4422  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
4423    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
4424    parseCapabilityStatementSystemInteractionComponentProperties(json, res);
4425    return res;
4426  }
4427
4428  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
4429    parseBackboneElementProperties(json, res);
4430    if (json.has("code"))
4431      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
4432    if (json.has("_code"))
4433      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
4434    if (json.has("documentation"))
4435      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4436    if (json.has("_documentation"))
4437      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4438  }
4439
4440  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementMessagingComponent(JsonObject json) throws IOException, FHIRFormatError {
4441    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
4442    parseCapabilityStatementMessagingComponentProperties(json, res);
4443    return res;
4444  }
4445
4446  protected void parseCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
4447    parseBackboneElementProperties(json, res);
4448    if (json.has("endpoint")) {
4449      JsonArray array = json.getAsJsonArray("endpoint");
4450      for (int i = 0; i < array.size(); i++) {
4451        res.getEndpoint().add(parseCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject()));
4452      }
4453    };
4454    if (json.has("reliableCache"))
4455      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
4456    if (json.has("_reliableCache"))
4457      parseElementProperties(json.getAsJsonObject("_reliableCache"), res.getReliableCacheElement());
4458    if (json.has("documentation"))
4459      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4460    if (json.has("_documentation"))
4461      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4462    if (json.has("supportedMessage")) {
4463      JsonArray array = json.getAsJsonArray("supportedMessage");
4464      for (int i = 0; i < array.size(); i++) {
4465        res.getSupportedMessage().add(parseCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject()));
4466      }
4467    };
4468  }
4469
4470  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementMessagingEndpointComponent(JsonObject json) throws IOException, FHIRFormatError {
4471    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
4472    parseCapabilityStatementMessagingEndpointComponentProperties(json, res);
4473    return res;
4474  }
4475
4476  protected void parseCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
4477    parseBackboneElementProperties(json, res);
4478    if (json.has("protocol"))
4479      res.setProtocol(parseCoding(json.getAsJsonObject("protocol")));
4480    if (json.has("address"))
4481      res.setAddressElement(parseUrl(json.get("address").getAsString()));
4482    if (json.has("_address"))
4483      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
4484  }
4485
4486  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementMessagingSupportedMessageComponent(JsonObject json) throws IOException, FHIRFormatError {
4487    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
4488    parseCapabilityStatementMessagingSupportedMessageComponentProperties(json, res);
4489    return res;
4490  }
4491
4492  protected void parseCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
4493    parseBackboneElementProperties(json, res);
4494    if (json.has("mode"))
4495      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
4496    if (json.has("_mode"))
4497      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
4498    if (json.has("definition"))
4499      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4500    if (json.has("_definition"))
4501      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
4502  }
4503
4504  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementDocumentComponent(JsonObject json) throws IOException, FHIRFormatError {
4505    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
4506    parseCapabilityStatementDocumentComponentProperties(json, res);
4507    return res;
4508  }
4509
4510  protected void parseCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
4511    parseBackboneElementProperties(json, res);
4512    if (json.has("mode"))
4513      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
4514    if (json.has("_mode"))
4515      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
4516    if (json.has("documentation"))
4517      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4518    if (json.has("_documentation"))
4519      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4520    if (json.has("profile"))
4521      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
4522    if (json.has("_profile"))
4523      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
4524  }
4525
4526  protected CapabilityStatement2 parseCapabilityStatement2(JsonObject json) throws IOException, FHIRFormatError {
4527    CapabilityStatement2 res = new CapabilityStatement2();
4528    parseCapabilityStatement2Properties(json, res);
4529    return res;
4530  }
4531
4532  protected void parseCapabilityStatement2Properties(JsonObject json, CapabilityStatement2 res) throws IOException, FHIRFormatError {
4533    parseCanonicalResourceProperties(json, res);
4534    if (json.has("url"))
4535      res.setUrlElement(parseUri(json.get("url").getAsString()));
4536    if (json.has("_url"))
4537      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
4538    if (json.has("version"))
4539      res.setVersionElement(parseString(json.get("version").getAsString()));
4540    if (json.has("_version"))
4541      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4542    if (json.has("name"))
4543      res.setNameElement(parseString(json.get("name").getAsString()));
4544    if (json.has("_name"))
4545      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4546    if (json.has("title"))
4547      res.setTitleElement(parseString(json.get("title").getAsString()));
4548    if (json.has("_title"))
4549      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
4550    if (json.has("status"))
4551      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4552    if (json.has("_status"))
4553      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4554    if (json.has("experimental"))
4555      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
4556    if (json.has("_experimental"))
4557      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
4558    if (json.has("date"))
4559      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4560    if (json.has("_date"))
4561      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4562    if (json.has("publisher"))
4563      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
4564    if (json.has("_publisher"))
4565      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
4566    if (json.has("contact")) {
4567      JsonArray array = json.getAsJsonArray("contact");
4568      for (int i = 0; i < array.size(); i++) {
4569        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
4570      }
4571    };
4572    if (json.has("description"))
4573      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4574    if (json.has("_description"))
4575      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4576    if (json.has("useContext")) {
4577      JsonArray array = json.getAsJsonArray("useContext");
4578      for (int i = 0; i < array.size(); i++) {
4579        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
4580      }
4581    };
4582    if (json.has("jurisdiction")) {
4583      JsonArray array = json.getAsJsonArray("jurisdiction");
4584      for (int i = 0; i < array.size(); i++) {
4585        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4586      }
4587    };
4588    if (json.has("purpose"))
4589      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
4590    if (json.has("_purpose"))
4591      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
4592    if (json.has("copyright"))
4593      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
4594    if (json.has("_copyright"))
4595      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
4596    if (json.has("kind"))
4597      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.CapabilityStatementKind.NULL, new Enumerations.CapabilityStatementKindEnumFactory()));
4598    if (json.has("_kind"))
4599      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
4600    if (json.has("instantiates")) {
4601      JsonArray array = json.getAsJsonArray("instantiates");
4602      for (int i = 0; i < array.size(); i++) {
4603        if (array.get(i).isJsonNull()) {
4604          res.getInstantiates().add(new CanonicalType());
4605        } else {;
4606          res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
4607        }
4608      }
4609    };
4610    if (json.has("_instantiates")) {
4611      JsonArray array = json.getAsJsonArray("_instantiates");
4612      for (int i = 0; i < array.size(); i++) {
4613        if (i == res.getInstantiates().size())
4614          res.getInstantiates().add(parseCanonical(null));
4615        if (array.get(i) instanceof JsonObject) 
4616          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
4617      }
4618    };
4619    if (json.has("imports")) {
4620      JsonArray array = json.getAsJsonArray("imports");
4621      for (int i = 0; i < array.size(); i++) {
4622        if (array.get(i).isJsonNull()) {
4623          res.getImports().add(new CanonicalType());
4624        } else {;
4625          res.getImports().add(parseCanonical(array.get(i).getAsString()));
4626        }
4627      }
4628    };
4629    if (json.has("_imports")) {
4630      JsonArray array = json.getAsJsonArray("_imports");
4631      for (int i = 0; i < array.size(); i++) {
4632        if (i == res.getImports().size())
4633          res.getImports().add(parseCanonical(null));
4634        if (array.get(i) instanceof JsonObject) 
4635          parseElementProperties(array.get(i).getAsJsonObject(), res.getImports().get(i));
4636      }
4637    };
4638    if (json.has("software"))
4639      res.setSoftware(parseCapabilityStatement2SoftwareComponent(json.getAsJsonObject("software")));
4640    if (json.has("implementation"))
4641      res.setImplementation(parseCapabilityStatement2ImplementationComponent(json.getAsJsonObject("implementation")));
4642    if (json.has("fhirVersion"))
4643      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
4644    if (json.has("_fhirVersion"))
4645      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
4646    if (json.has("format")) {
4647      JsonArray array = json.getAsJsonArray("format");
4648      for (int i = 0; i < array.size(); i++) {
4649        if (array.get(i).isJsonNull()) {
4650          res.getFormat().add(new CodeType());
4651        } else {;
4652          res.getFormat().add(parseCode(array.get(i).getAsString()));
4653        }
4654      }
4655    };
4656    if (json.has("_format")) {
4657      JsonArray array = json.getAsJsonArray("_format");
4658      for (int i = 0; i < array.size(); i++) {
4659        if (i == res.getFormat().size())
4660          res.getFormat().add(parseCode(null));
4661        if (array.get(i) instanceof JsonObject) 
4662          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
4663      }
4664    };
4665    if (json.has("patchFormat")) {
4666      JsonArray array = json.getAsJsonArray("patchFormat");
4667      for (int i = 0; i < array.size(); i++) {
4668        if (array.get(i).isJsonNull()) {
4669          res.getPatchFormat().add(new CodeType());
4670        } else {;
4671          res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
4672        }
4673      }
4674    };
4675    if (json.has("_patchFormat")) {
4676      JsonArray array = json.getAsJsonArray("_patchFormat");
4677      for (int i = 0; i < array.size(); i++) {
4678        if (i == res.getPatchFormat().size())
4679          res.getPatchFormat().add(parseCode(null));
4680        if (array.get(i) instanceof JsonObject) 
4681          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
4682      }
4683    };
4684    if (json.has("implementationGuide")) {
4685      JsonArray array = json.getAsJsonArray("implementationGuide");
4686      for (int i = 0; i < array.size(); i++) {
4687        if (array.get(i).isJsonNull()) {
4688          res.getImplementationGuide().add(new CanonicalType());
4689        } else {;
4690          res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
4691        }
4692      }
4693    };
4694    if (json.has("_implementationGuide")) {
4695      JsonArray array = json.getAsJsonArray("_implementationGuide");
4696      for (int i = 0; i < array.size(); i++) {
4697        if (i == res.getImplementationGuide().size())
4698          res.getImplementationGuide().add(parseCanonical(null));
4699        if (array.get(i) instanceof JsonObject) 
4700          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
4701      }
4702    };
4703    if (json.has("rest")) {
4704      JsonArray array = json.getAsJsonArray("rest");
4705      for (int i = 0; i < array.size(); i++) {
4706        res.getRest().add(parseCapabilityStatement2RestComponent(array.get(i).getAsJsonObject()));
4707      }
4708    };
4709  }
4710
4711  protected CapabilityStatement2.CapabilityStatement2SoftwareComponent parseCapabilityStatement2SoftwareComponent(JsonObject json) throws IOException, FHIRFormatError {
4712    CapabilityStatement2.CapabilityStatement2SoftwareComponent res = new CapabilityStatement2.CapabilityStatement2SoftwareComponent();
4713    parseCapabilityStatement2SoftwareComponentProperties(json, res);
4714    return res;
4715  }
4716
4717  protected void parseCapabilityStatement2SoftwareComponentProperties(JsonObject json, CapabilityStatement2.CapabilityStatement2SoftwareComponent res) throws IOException, FHIRFormatError {
4718    parseBackboneElementProperties(json, res);
4719    if (json.has("name"))
4720      res.setNameElement(parseString(json.get("name").getAsString()));
4721    if (json.has("_name"))
4722      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4723    if (json.has("version"))
4724      res.setVersionElement(parseString(json.get("version").getAsString()));
4725    if (json.has("_version"))
4726      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4727    if (json.has("releaseDate"))
4728      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
4729    if (json.has("_releaseDate"))
4730      parseElementProperties(json.getAsJsonObject("_releaseDate"), res.getReleaseDateElement());
4731  }
4732
4733  protected CapabilityStatement2.CapabilityStatement2ImplementationComponent parseCapabilityStatement2ImplementationComponent(JsonObject json) throws IOException, FHIRFormatError {
4734    CapabilityStatement2.CapabilityStatement2ImplementationComponent res = new CapabilityStatement2.CapabilityStatement2ImplementationComponent();
4735    parseCapabilityStatement2ImplementationComponentProperties(json, res);
4736    return res;
4737  }
4738
4739  protected void parseCapabilityStatement2ImplementationComponentProperties(JsonObject json, CapabilityStatement2.CapabilityStatement2ImplementationComponent res) throws IOException, FHIRFormatError {
4740    parseBackboneElementProperties(json, res);
4741    if (json.has("description"))
4742      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4743    if (json.has("_description"))
4744      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4745    if (json.has("url"))
4746      res.setUrlElement(parseUrl(json.get("url").getAsString()));
4747    if (json.has("_url"))
4748      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
4749    if (json.has("custodian"))
4750      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
4751  }
4752
4753  protected CapabilityStatement2.CapabilityStatement2RestComponent parseCapabilityStatement2RestComponent(JsonObject json) throws IOException, FHIRFormatError {
4754    CapabilityStatement2.CapabilityStatement2RestComponent res = new CapabilityStatement2.CapabilityStatement2RestComponent();
4755    parseCapabilityStatement2RestComponentProperties(json, res);
4756    return res;
4757  }
4758
4759  protected void parseCapabilityStatement2RestComponentProperties(JsonObject json, CapabilityStatement2.CapabilityStatement2RestComponent res) throws IOException, FHIRFormatError {
4760    parseBackboneElementProperties(json, res);
4761    if (json.has("mode"))
4762      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Enumerations.RestfulCapabilityMode.NULL, new Enumerations.RestfulCapabilityModeEnumFactory()));
4763    if (json.has("_mode"))
4764      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
4765    if (json.has("documentation"))
4766      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4767    if (json.has("_documentation"))
4768      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4769    if (json.has("resource")) {
4770      JsonArray array = json.getAsJsonArray("resource");
4771      for (int i = 0; i < array.size(); i++) {
4772        res.getResource().add(parseCapabilityStatement2RestResourceComponent(array.get(i).getAsJsonObject()));
4773      }
4774    };
4775    if (json.has("interaction")) {
4776      JsonArray array = json.getAsJsonArray("interaction");
4777      for (int i = 0; i < array.size(); i++) {
4778        res.getInteraction().add(parseCapabilityStatement2SystemInteractionComponent(array.get(i).getAsJsonObject()));
4779      }
4780    };
4781    if (json.has("searchParam")) {
4782      JsonArray array = json.getAsJsonArray("searchParam");
4783      for (int i = 0; i < array.size(); i++) {
4784        res.getSearchParam().add(parseCapabilityStatement2RestResourceSearchParamComponent(array.get(i).getAsJsonObject()));
4785      }
4786    };
4787    if (json.has("operation")) {
4788      JsonArray array = json.getAsJsonArray("operation");
4789      for (int i = 0; i < array.size(); i++) {
4790        res.getOperation().add(parseCapabilityStatement2RestResourceOperationComponent(array.get(i).getAsJsonObject()));
4791      }
4792    };
4793    if (json.has("compartment")) {
4794      JsonArray array = json.getAsJsonArray("compartment");
4795      for (int i = 0; i < array.size(); i++) {
4796        if (array.get(i).isJsonNull()) {
4797          res.getCompartment().add(new CanonicalType());
4798        } else {;
4799          res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
4800        }
4801      }
4802    };
4803    if (json.has("_compartment")) {
4804      JsonArray array = json.getAsJsonArray("_compartment");
4805      for (int i = 0; i < array.size(); i++) {
4806        if (i == res.getCompartment().size())
4807          res.getCompartment().add(parseCanonical(null));
4808        if (array.get(i) instanceof JsonObject) 
4809          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
4810      }
4811    };
4812  }
4813
4814  protected CapabilityStatement2.CapabilityStatement2RestResourceComponent parseCapabilityStatement2RestResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
4815    CapabilityStatement2.CapabilityStatement2RestResourceComponent res = new CapabilityStatement2.CapabilityStatement2RestResourceComponent();
4816    parseCapabilityStatement2RestResourceComponentProperties(json, res);
4817    return res;
4818  }
4819
4820  protected void parseCapabilityStatement2RestResourceComponentProperties(JsonObject json, CapabilityStatement2.CapabilityStatement2RestResourceComponent res) throws IOException, FHIRFormatError {
4821    parseBackboneElementProperties(json, res);
4822    if (json.has("type"))
4823      res.setTypeElement(parseCode(json.get("type").getAsString()));
4824    if (json.has("_type"))
4825      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4826    if (json.has("profile"))
4827      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
4828    if (json.has("_profile"))
4829      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
4830    if (json.has("supportedProfile")) {
4831      JsonArray array = json.getAsJsonArray("supportedProfile");
4832      for (int i = 0; i < array.size(); i++) {
4833        if (array.get(i).isJsonNull()) {
4834          res.getSupportedProfile().add(new CanonicalType());
4835        } else {;
4836          res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
4837        }
4838      }
4839    };
4840    if (json.has("_supportedProfile")) {
4841      JsonArray array = json.getAsJsonArray("_supportedProfile");
4842      for (int i = 0; i < array.size(); i++) {
4843        if (i == res.getSupportedProfile().size())
4844          res.getSupportedProfile().add(parseCanonical(null));
4845        if (array.get(i) instanceof JsonObject) 
4846          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
4847      }
4848    };
4849    if (json.has("documentation"))
4850      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4851    if (json.has("_documentation"))
4852      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4853    if (json.has("interaction")) {
4854      JsonArray array = json.getAsJsonArray("interaction");
4855      for (int i = 0; i < array.size(); i++) {
4856        res.getInteraction().add(parseCapabilityStatement2ResourceInteractionComponent(array.get(i).getAsJsonObject()));
4857      }
4858    };
4859    if (json.has("searchParam")) {
4860      JsonArray array = json.getAsJsonArray("searchParam");
4861      for (int i = 0; i < array.size(); i++) {
4862        res.getSearchParam().add(parseCapabilityStatement2RestResourceSearchParamComponent(array.get(i).getAsJsonObject()));
4863      }
4864    };
4865    if (json.has("operation")) {
4866      JsonArray array = json.getAsJsonArray("operation");
4867      for (int i = 0; i < array.size(); i++) {
4868        res.getOperation().add(parseCapabilityStatement2RestResourceOperationComponent(array.get(i).getAsJsonObject()));
4869      }
4870    };
4871  }
4872
4873  protected CapabilityStatement2.ResourceInteractionComponent parseCapabilityStatement2ResourceInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
4874    CapabilityStatement2.ResourceInteractionComponent res = new CapabilityStatement2.ResourceInteractionComponent();
4875    parseCapabilityStatement2ResourceInteractionComponentProperties(json, res);
4876    return res;
4877  }
4878
4879  protected void parseCapabilityStatement2ResourceInteractionComponentProperties(JsonObject json, CapabilityStatement2.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
4880    parseBackboneElementProperties(json, res);
4881    if (json.has("code"))
4882      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement2.TypeRestfulInteraction.NULL, new CapabilityStatement2.TypeRestfulInteractionEnumFactory()));
4883    if (json.has("_code"))
4884      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
4885    if (json.has("documentation"))
4886      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4887    if (json.has("_documentation"))
4888      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4889  }
4890
4891  protected CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent parseCapabilityStatement2RestResourceSearchParamComponent(JsonObject json) throws IOException, FHIRFormatError {
4892    CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent res = new CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent();
4893    parseCapabilityStatement2RestResourceSearchParamComponentProperties(json, res);
4894    return res;
4895  }
4896
4897  protected void parseCapabilityStatement2RestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
4898    parseBackboneElementProperties(json, res);
4899    if (json.has("name"))
4900      res.setNameElement(parseString(json.get("name").getAsString()));
4901    if (json.has("_name"))
4902      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4903    if (json.has("definition"))
4904      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4905    if (json.has("_definition"))
4906      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
4907    if (json.has("type"))
4908      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
4909    if (json.has("_type"))
4910      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4911    if (json.has("documentation"))
4912      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4913    if (json.has("_documentation"))
4914      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4915  }
4916
4917  protected CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent parseCapabilityStatement2RestResourceOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
4918    CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent res = new CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent();
4919    parseCapabilityStatement2RestResourceOperationComponentProperties(json, res);
4920    return res;
4921  }
4922
4923  protected void parseCapabilityStatement2RestResourceOperationComponentProperties(JsonObject json, CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent res) throws IOException, FHIRFormatError {
4924    parseBackboneElementProperties(json, res);
4925    if (json.has("name"))
4926      res.setNameElement(parseString(json.get("name").getAsString()));
4927    if (json.has("_name"))
4928      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4929    if (json.has("definition"))
4930      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4931    if (json.has("_definition"))
4932      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
4933    if (json.has("documentation"))
4934      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4935    if (json.has("_documentation"))
4936      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4937  }
4938
4939  protected CapabilityStatement2.SystemInteractionComponent parseCapabilityStatement2SystemInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
4940    CapabilityStatement2.SystemInteractionComponent res = new CapabilityStatement2.SystemInteractionComponent();
4941    parseCapabilityStatement2SystemInteractionComponentProperties(json, res);
4942    return res;
4943  }
4944
4945  protected void parseCapabilityStatement2SystemInteractionComponentProperties(JsonObject json, CapabilityStatement2.SystemInteractionComponent res) throws IOException, FHIRFormatError {
4946    parseBackboneElementProperties(json, res);
4947    if (json.has("code"))
4948      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement2.SystemRestfulInteraction.NULL, new CapabilityStatement2.SystemRestfulInteractionEnumFactory()));
4949    if (json.has("_code"))
4950      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
4951    if (json.has("documentation"))
4952      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4953    if (json.has("_documentation"))
4954      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
4955  }
4956
4957  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
4958    CarePlan res = new CarePlan();
4959    parseCarePlanProperties(json, res);
4960    return res;
4961  }
4962
4963  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
4964    parseDomainResourceProperties(json, res);
4965    if (json.has("identifier")) {
4966      JsonArray array = json.getAsJsonArray("identifier");
4967      for (int i = 0; i < array.size(); i++) {
4968        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4969      }
4970    };
4971    if (json.has("instantiatesCanonical")) {
4972      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
4973      for (int i = 0; i < array.size(); i++) {
4974        if (array.get(i).isJsonNull()) {
4975          res.getInstantiatesCanonical().add(new CanonicalType());
4976        } else {;
4977          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
4978        }
4979      }
4980    };
4981    if (json.has("_instantiatesCanonical")) {
4982      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
4983      for (int i = 0; i < array.size(); i++) {
4984        if (i == res.getInstantiatesCanonical().size())
4985          res.getInstantiatesCanonical().add(parseCanonical(null));
4986        if (array.get(i) instanceof JsonObject) 
4987          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4988      }
4989    };
4990    if (json.has("instantiatesUri")) {
4991      JsonArray array = json.getAsJsonArray("instantiatesUri");
4992      for (int i = 0; i < array.size(); i++) {
4993        if (array.get(i).isJsonNull()) {
4994          res.getInstantiatesUri().add(new UriType());
4995        } else {;
4996          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4997        }
4998      }
4999    };
5000    if (json.has("_instantiatesUri")) {
5001      JsonArray array = json.getAsJsonArray("_instantiatesUri");
5002      for (int i = 0; i < array.size(); i++) {
5003        if (i == res.getInstantiatesUri().size())
5004          res.getInstantiatesUri().add(parseUri(null));
5005        if (array.get(i) instanceof JsonObject) 
5006          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
5007      }
5008    };
5009    if (json.has("basedOn")) {
5010      JsonArray array = json.getAsJsonArray("basedOn");
5011      for (int i = 0; i < array.size(); i++) {
5012        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
5013      }
5014    };
5015    if (json.has("replaces")) {
5016      JsonArray array = json.getAsJsonArray("replaces");
5017      for (int i = 0; i < array.size(); i++) {
5018        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
5019      }
5020    };
5021    if (json.has("partOf")) {
5022      JsonArray array = json.getAsJsonArray("partOf");
5023      for (int i = 0; i < array.size(); i++) {
5024        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
5025      }
5026    };
5027    if (json.has("status"))
5028      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
5029    if (json.has("_status"))
5030      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5031    if (json.has("intent"))
5032      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
5033    if (json.has("_intent"))
5034      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
5035    if (json.has("category")) {
5036      JsonArray array = json.getAsJsonArray("category");
5037      for (int i = 0; i < array.size(); i++) {
5038        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5039      }
5040    };
5041    if (json.has("title"))
5042      res.setTitleElement(parseString(json.get("title").getAsString()));
5043    if (json.has("_title"))
5044      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
5045    if (json.has("description"))
5046      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5047    if (json.has("_description"))
5048      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5049    if (json.has("subject"))
5050      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5051    if (json.has("encounter"))
5052      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
5053    if (json.has("period"))
5054      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5055    if (json.has("created"))
5056      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5057    if (json.has("_created"))
5058      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5059    if (json.has("author"))
5060      res.setAuthor(parseReference(json.getAsJsonObject("author")));
5061    if (json.has("contributor")) {
5062      JsonArray array = json.getAsJsonArray("contributor");
5063      for (int i = 0; i < array.size(); i++) {
5064        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
5065      }
5066    };
5067    if (json.has("careTeam")) {
5068      JsonArray array = json.getAsJsonArray("careTeam");
5069      for (int i = 0; i < array.size(); i++) {
5070        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
5071      }
5072    };
5073    if (json.has("addresses")) {
5074      JsonArray array = json.getAsJsonArray("addresses");
5075      for (int i = 0; i < array.size(); i++) {
5076        res.getAddresses().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5077      }
5078    };
5079    if (json.has("supportingInfo")) {
5080      JsonArray array = json.getAsJsonArray("supportingInfo");
5081      for (int i = 0; i < array.size(); i++) {
5082        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
5083      }
5084    };
5085    if (json.has("goal")) {
5086      JsonArray array = json.getAsJsonArray("goal");
5087      for (int i = 0; i < array.size(); i++) {
5088        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
5089      }
5090    };
5091    if (json.has("activity")) {
5092      JsonArray array = json.getAsJsonArray("activity");
5093      for (int i = 0; i < array.size(); i++) {
5094        res.getActivity().add(parseCarePlanActivityComponent(array.get(i).getAsJsonObject()));
5095      }
5096    };
5097    if (json.has("note")) {
5098      JsonArray array = json.getAsJsonArray("note");
5099      for (int i = 0; i < array.size(); i++) {
5100        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5101      }
5102    };
5103  }
5104
5105  protected CarePlan.CarePlanActivityComponent parseCarePlanActivityComponent(JsonObject json) throws IOException, FHIRFormatError {
5106    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
5107    parseCarePlanActivityComponentProperties(json, res);
5108    return res;
5109  }
5110
5111  protected void parseCarePlanActivityComponentProperties(JsonObject json, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
5112    parseBackboneElementProperties(json, res);
5113    if (json.has("outcome")) {
5114      JsonArray array = json.getAsJsonArray("outcome");
5115      for (int i = 0; i < array.size(); i++) {
5116        res.getOutcome().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5117      }
5118    };
5119    if (json.has("progress")) {
5120      JsonArray array = json.getAsJsonArray("progress");
5121      for (int i = 0; i < array.size(); i++) {
5122        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
5123      }
5124    };
5125    if (json.has("reference"))
5126      res.setReference(parseReference(json.getAsJsonObject("reference")));
5127    if (json.has("detail"))
5128      res.setDetail(parseCarePlanActivityDetailComponent(json.getAsJsonObject("detail")));
5129  }
5130
5131  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanActivityDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
5132    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
5133    parseCarePlanActivityDetailComponentProperties(json, res);
5134    return res;
5135  }
5136
5137  protected void parseCarePlanActivityDetailComponentProperties(JsonObject json, CarePlan.CarePlanActivityDetailComponent res) throws IOException, FHIRFormatError {
5138    parseBackboneElementProperties(json, res);
5139    if (json.has("kind"))
5140      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CarePlan.CarePlanActivityKind.NULL, new CarePlan.CarePlanActivityKindEnumFactory()));
5141    if (json.has("_kind"))
5142      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
5143    if (json.has("instantiatesCanonical")) {
5144      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
5145      for (int i = 0; i < array.size(); i++) {
5146        if (array.get(i).isJsonNull()) {
5147          res.getInstantiatesCanonical().add(new CanonicalType());
5148        } else {;
5149          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
5150        }
5151      }
5152    };
5153    if (json.has("_instantiatesCanonical")) {
5154      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
5155      for (int i = 0; i < array.size(); i++) {
5156        if (i == res.getInstantiatesCanonical().size())
5157          res.getInstantiatesCanonical().add(parseCanonical(null));
5158        if (array.get(i) instanceof JsonObject) 
5159          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
5160      }
5161    };
5162    if (json.has("instantiatesUri")) {
5163      JsonArray array = json.getAsJsonArray("instantiatesUri");
5164      for (int i = 0; i < array.size(); i++) {
5165        if (array.get(i).isJsonNull()) {
5166          res.getInstantiatesUri().add(new UriType());
5167        } else {;
5168          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
5169        }
5170      }
5171    };
5172    if (json.has("_instantiatesUri")) {
5173      JsonArray array = json.getAsJsonArray("_instantiatesUri");
5174      for (int i = 0; i < array.size(); i++) {
5175        if (i == res.getInstantiatesUri().size())
5176          res.getInstantiatesUri().add(parseUri(null));
5177        if (array.get(i) instanceof JsonObject) 
5178          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
5179      }
5180    };
5181    if (json.has("code"))
5182      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5183    if (json.has("reason")) {
5184      JsonArray array = json.getAsJsonArray("reason");
5185      for (int i = 0; i < array.size(); i++) {
5186        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5187      }
5188    };
5189    if (json.has("goal")) {
5190      JsonArray array = json.getAsJsonArray("goal");
5191      for (int i = 0; i < array.size(); i++) {
5192        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
5193      }
5194    };
5195    if (json.has("status"))
5196      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
5197    if (json.has("_status"))
5198      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5199    if (json.has("statusReason"))
5200      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
5201    if (json.has("doNotPerform"))
5202      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
5203    if (json.has("_doNotPerform"))
5204      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
5205    DataType scheduled = parseType("scheduled", json);
5206    if (scheduled != null)
5207      res.setScheduled(scheduled);
5208    if (json.has("location"))
5209      res.setLocation(parseReference(json.getAsJsonObject("location")));
5210    DataType reported = parseType("reported", json);
5211    if (reported != null)
5212      res.setReported(reported);
5213    if (json.has("performer")) {
5214      JsonArray array = json.getAsJsonArray("performer");
5215      for (int i = 0; i < array.size(); i++) {
5216        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
5217      }
5218    };
5219    DataType product = parseType("product", json);
5220    if (product != null)
5221      res.setProduct(product);
5222    if (json.has("dailyAmount"))
5223      res.setDailyAmount(parseQuantity(json.getAsJsonObject("dailyAmount")));
5224    if (json.has("quantity"))
5225      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5226    if (json.has("description"))
5227      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5228    if (json.has("_description"))
5229      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5230  }
5231
5232  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
5233    CareTeam res = new CareTeam();
5234    parseCareTeamProperties(json, res);
5235    return res;
5236  }
5237
5238  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
5239    parseDomainResourceProperties(json, res);
5240    if (json.has("identifier")) {
5241      JsonArray array = json.getAsJsonArray("identifier");
5242      for (int i = 0; i < array.size(); i++) {
5243        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5244      }
5245    };
5246    if (json.has("status"))
5247      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
5248    if (json.has("_status"))
5249      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5250    if (json.has("category")) {
5251      JsonArray array = json.getAsJsonArray("category");
5252      for (int i = 0; i < array.size(); i++) {
5253        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5254      }
5255    };
5256    if (json.has("name"))
5257      res.setNameElement(parseString(json.get("name").getAsString()));
5258    if (json.has("_name"))
5259      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5260    if (json.has("subject"))
5261      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5262    if (json.has("period"))
5263      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5264    if (json.has("participant")) {
5265      JsonArray array = json.getAsJsonArray("participant");
5266      for (int i = 0; i < array.size(); i++) {
5267        res.getParticipant().add(parseCareTeamParticipantComponent(array.get(i).getAsJsonObject()));
5268      }
5269    };
5270    if (json.has("reason")) {
5271      JsonArray array = json.getAsJsonArray("reason");
5272      for (int i = 0; i < array.size(); i++) {
5273        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
5274      }
5275    };
5276    if (json.has("managingOrganization")) {
5277      JsonArray array = json.getAsJsonArray("managingOrganization");
5278      for (int i = 0; i < array.size(); i++) {
5279        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
5280      }
5281    };
5282    if (json.has("telecom")) {
5283      JsonArray array = json.getAsJsonArray("telecom");
5284      for (int i = 0; i < array.size(); i++) {
5285        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
5286      }
5287    };
5288    if (json.has("note")) {
5289      JsonArray array = json.getAsJsonArray("note");
5290      for (int i = 0; i < array.size(); i++) {
5291        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5292      }
5293    };
5294  }
5295
5296  protected CareTeam.CareTeamParticipantComponent parseCareTeamParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
5297    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
5298    parseCareTeamParticipantComponentProperties(json, res);
5299    return res;
5300  }
5301
5302  protected void parseCareTeamParticipantComponentProperties(JsonObject json, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
5303    parseBackboneElementProperties(json, res);
5304    if (json.has("role"))
5305      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
5306    if (json.has("member"))
5307      res.setMember(parseReference(json.getAsJsonObject("member")));
5308    if (json.has("onBehalfOf"))
5309      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
5310    DataType coverage = parseType("coverage", json);
5311    if (coverage != null)
5312      res.setCoverage(coverage);
5313  }
5314
5315  protected CatalogEntry parseCatalogEntry(JsonObject json) throws IOException, FHIRFormatError {
5316    CatalogEntry res = new CatalogEntry();
5317    parseCatalogEntryProperties(json, res);
5318    return res;
5319  }
5320
5321  protected void parseCatalogEntryProperties(JsonObject json, CatalogEntry res) throws IOException, FHIRFormatError {
5322    parseDomainResourceProperties(json, res);
5323    if (json.has("identifier")) {
5324      JsonArray array = json.getAsJsonArray("identifier");
5325      for (int i = 0; i < array.size(); i++) {
5326        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5327      }
5328    };
5329    if (json.has("name"))
5330      res.setNameElement(parseString(json.get("name").getAsString()));
5331    if (json.has("_name"))
5332      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5333    if (json.has("type"))
5334      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CatalogEntry.CatalogEntryType.NULL, new CatalogEntry.CatalogEntryTypeEnumFactory()));
5335    if (json.has("_type"))
5336      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
5337    if (json.has("status"))
5338      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CatalogEntry.CatalogEntryStatus.NULL, new CatalogEntry.CatalogEntryStatusEnumFactory()));
5339    if (json.has("_status"))
5340      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5341    if (json.has("effectivePeriod"))
5342      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
5343    if (json.has("orderable"))
5344      res.setOrderableElement(parseBoolean(json.get("orderable").getAsBoolean()));
5345    if (json.has("_orderable"))
5346      parseElementProperties(json.getAsJsonObject("_orderable"), res.getOrderableElement());
5347    if (json.has("referencedItem"))
5348      res.setReferencedItem(parseReference(json.getAsJsonObject("referencedItem")));
5349    if (json.has("relatedEntry")) {
5350      JsonArray array = json.getAsJsonArray("relatedEntry");
5351      for (int i = 0; i < array.size(); i++) {
5352        res.getRelatedEntry().add(parseCatalogEntryRelatedEntryComponent(array.get(i).getAsJsonObject()));
5353      }
5354    };
5355    if (json.has("updatedBy"))
5356      res.setUpdatedBy(parseReference(json.getAsJsonObject("updatedBy")));
5357    if (json.has("note")) {
5358      JsonArray array = json.getAsJsonArray("note");
5359      for (int i = 0; i < array.size(); i++) {
5360        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5361      }
5362    };
5363    if (json.has("estimatedDuration"))
5364      res.setEstimatedDuration(parseDuration(json.getAsJsonObject("estimatedDuration")));
5365    if (json.has("billingCode")) {
5366      JsonArray array = json.getAsJsonArray("billingCode");
5367      for (int i = 0; i < array.size(); i++) {
5368        res.getBillingCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5369      }
5370    };
5371    if (json.has("billingSummary"))
5372      res.setBillingSummaryElement(parseString(json.get("billingSummary").getAsString()));
5373    if (json.has("_billingSummary"))
5374      parseElementProperties(json.getAsJsonObject("_billingSummary"), res.getBillingSummaryElement());
5375    if (json.has("scheduleSummary"))
5376      res.setScheduleSummaryElement(parseString(json.get("scheduleSummary").getAsString()));
5377    if (json.has("_scheduleSummary"))
5378      parseElementProperties(json.getAsJsonObject("_scheduleSummary"), res.getScheduleSummaryElement());
5379    if (json.has("limitationSummary"))
5380      res.setLimitationSummaryElement(parseString(json.get("limitationSummary").getAsString()));
5381    if (json.has("_limitationSummary"))
5382      parseElementProperties(json.getAsJsonObject("_limitationSummary"), res.getLimitationSummaryElement());
5383    if (json.has("regulatorySummary"))
5384      res.setRegulatorySummaryElement(parseString(json.get("regulatorySummary").getAsString()));
5385    if (json.has("_regulatorySummary"))
5386      parseElementProperties(json.getAsJsonObject("_regulatorySummary"), res.getRegulatorySummaryElement());
5387  }
5388
5389  protected CatalogEntry.CatalogEntryRelatedEntryComponent parseCatalogEntryRelatedEntryComponent(JsonObject json) throws IOException, FHIRFormatError {
5390    CatalogEntry.CatalogEntryRelatedEntryComponent res = new CatalogEntry.CatalogEntryRelatedEntryComponent();
5391    parseCatalogEntryRelatedEntryComponentProperties(json, res);
5392    return res;
5393  }
5394
5395  protected void parseCatalogEntryRelatedEntryComponentProperties(JsonObject json, CatalogEntry.CatalogEntryRelatedEntryComponent res) throws IOException, FHIRFormatError {
5396    parseBackboneElementProperties(json, res);
5397    if (json.has("relationship"))
5398      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), CatalogEntry.CatalogEntryRelationType.NULL, new CatalogEntry.CatalogEntryRelationTypeEnumFactory()));
5399    if (json.has("_relationship"))
5400      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
5401    if (json.has("target"))
5402      res.setTarget(parseReference(json.getAsJsonObject("target")));
5403  }
5404
5405  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
5406    ChargeItem res = new ChargeItem();
5407    parseChargeItemProperties(json, res);
5408    return res;
5409  }
5410
5411  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
5412    parseDomainResourceProperties(json, res);
5413    if (json.has("identifier")) {
5414      JsonArray array = json.getAsJsonArray("identifier");
5415      for (int i = 0; i < array.size(); i++) {
5416        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5417      }
5418    };
5419    if (json.has("definitionUri")) {
5420      JsonArray array = json.getAsJsonArray("definitionUri");
5421      for (int i = 0; i < array.size(); i++) {
5422        if (array.get(i).isJsonNull()) {
5423          res.getDefinitionUri().add(new UriType());
5424        } else {;
5425          res.getDefinitionUri().add(parseUri(array.get(i).getAsString()));
5426        }
5427      }
5428    };
5429    if (json.has("_definitionUri")) {
5430      JsonArray array = json.getAsJsonArray("_definitionUri");
5431      for (int i = 0; i < array.size(); i++) {
5432        if (i == res.getDefinitionUri().size())
5433          res.getDefinitionUri().add(parseUri(null));
5434        if (array.get(i) instanceof JsonObject) 
5435          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionUri().get(i));
5436      }
5437    };
5438    if (json.has("definitionCanonical")) {
5439      JsonArray array = json.getAsJsonArray("definitionCanonical");
5440      for (int i = 0; i < array.size(); i++) {
5441        if (array.get(i).isJsonNull()) {
5442          res.getDefinitionCanonical().add(new CanonicalType());
5443        } else {;
5444          res.getDefinitionCanonical().add(parseCanonical(array.get(i).getAsString()));
5445        }
5446      }
5447    };
5448    if (json.has("_definitionCanonical")) {
5449      JsonArray array = json.getAsJsonArray("_definitionCanonical");
5450      for (int i = 0; i < array.size(); i++) {
5451        if (i == res.getDefinitionCanonical().size())
5452          res.getDefinitionCanonical().add(parseCanonical(null));
5453        if (array.get(i) instanceof JsonObject) 
5454          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionCanonical().get(i));
5455      }
5456    };
5457    if (json.has("status"))
5458      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
5459    if (json.has("_status"))
5460      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5461    if (json.has("partOf")) {
5462      JsonArray array = json.getAsJsonArray("partOf");
5463      for (int i = 0; i < array.size(); i++) {
5464        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
5465      }
5466    };
5467    if (json.has("code"))
5468      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5469    if (json.has("subject"))
5470      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5471    if (json.has("context"))
5472      res.setContext(parseReference(json.getAsJsonObject("context")));
5473    DataType occurrence = parseType("occurrence", json);
5474    if (occurrence != null)
5475      res.setOccurrence(occurrence);
5476    if (json.has("performer")) {
5477      JsonArray array = json.getAsJsonArray("performer");
5478      for (int i = 0; i < array.size(); i++) {
5479        res.getPerformer().add(parseChargeItemPerformerComponent(array.get(i).getAsJsonObject()));
5480      }
5481    };
5482    if (json.has("performingOrganization"))
5483      res.setPerformingOrganization(parseReference(json.getAsJsonObject("performingOrganization")));
5484    if (json.has("requestingOrganization"))
5485      res.setRequestingOrganization(parseReference(json.getAsJsonObject("requestingOrganization")));
5486    if (json.has("costCenter"))
5487      res.setCostCenter(parseReference(json.getAsJsonObject("costCenter")));
5488    if (json.has("quantity"))
5489      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5490    if (json.has("bodysite")) {
5491      JsonArray array = json.getAsJsonArray("bodysite");
5492      for (int i = 0; i < array.size(); i++) {
5493        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5494      }
5495    };
5496    if (json.has("factorOverride"))
5497      res.setFactorOverrideElement(parseDecimal(json.get("factorOverride").getAsBigDecimal()));
5498    if (json.has("_factorOverride"))
5499      parseElementProperties(json.getAsJsonObject("_factorOverride"), res.getFactorOverrideElement());
5500    if (json.has("priceOverride"))
5501      res.setPriceOverride(parseMoney(json.getAsJsonObject("priceOverride")));
5502    if (json.has("overrideReason"))
5503      res.setOverrideReasonElement(parseString(json.get("overrideReason").getAsString()));
5504    if (json.has("_overrideReason"))
5505      parseElementProperties(json.getAsJsonObject("_overrideReason"), res.getOverrideReasonElement());
5506    if (json.has("enterer"))
5507      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
5508    if (json.has("enteredDate"))
5509      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
5510    if (json.has("_enteredDate"))
5511      parseElementProperties(json.getAsJsonObject("_enteredDate"), res.getEnteredDateElement());
5512    if (json.has("reason")) {
5513      JsonArray array = json.getAsJsonArray("reason");
5514      for (int i = 0; i < array.size(); i++) {
5515        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5516      }
5517    };
5518    if (json.has("service")) {
5519      JsonArray array = json.getAsJsonArray("service");
5520      for (int i = 0; i < array.size(); i++) {
5521        res.getService().add(parseReference(array.get(i).getAsJsonObject()));
5522      }
5523    };
5524    DataType product = parseType("product", json);
5525    if (product != null)
5526      res.setProduct(product);
5527    if (json.has("account")) {
5528      JsonArray array = json.getAsJsonArray("account");
5529      for (int i = 0; i < array.size(); i++) {
5530        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
5531      }
5532    };
5533    if (json.has("note")) {
5534      JsonArray array = json.getAsJsonArray("note");
5535      for (int i = 0; i < array.size(); i++) {
5536        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5537      }
5538    };
5539    if (json.has("supportingInformation")) {
5540      JsonArray array = json.getAsJsonArray("supportingInformation");
5541      for (int i = 0; i < array.size(); i++) {
5542        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
5543      }
5544    };
5545  }
5546
5547  protected ChargeItem.ChargeItemPerformerComponent parseChargeItemPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
5548    ChargeItem.ChargeItemPerformerComponent res = new ChargeItem.ChargeItemPerformerComponent();
5549    parseChargeItemPerformerComponentProperties(json, res);
5550    return res;
5551  }
5552
5553  protected void parseChargeItemPerformerComponentProperties(JsonObject json, ChargeItem.ChargeItemPerformerComponent res) throws IOException, FHIRFormatError {
5554    parseBackboneElementProperties(json, res);
5555    if (json.has("function"))
5556      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
5557    if (json.has("actor"))
5558      res.setActor(parseReference(json.getAsJsonObject("actor")));
5559  }
5560
5561  protected ChargeItemDefinition parseChargeItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
5562    ChargeItemDefinition res = new ChargeItemDefinition();
5563    parseChargeItemDefinitionProperties(json, res);
5564    return res;
5565  }
5566
5567  protected void parseChargeItemDefinitionProperties(JsonObject json, ChargeItemDefinition res) throws IOException, FHIRFormatError {
5568    parseMetadataResourceProperties(json, res);
5569    if (json.has("url"))
5570      res.setUrlElement(parseUri(json.get("url").getAsString()));
5571    if (json.has("_url"))
5572      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
5573    if (json.has("identifier")) {
5574      JsonArray array = json.getAsJsonArray("identifier");
5575      for (int i = 0; i < array.size(); i++) {
5576        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5577      }
5578    };
5579    if (json.has("version"))
5580      res.setVersionElement(parseString(json.get("version").getAsString()));
5581    if (json.has("_version"))
5582      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
5583    if (json.has("title"))
5584      res.setTitleElement(parseString(json.get("title").getAsString()));
5585    if (json.has("_title"))
5586      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
5587    if (json.has("derivedFromUri")) {
5588      JsonArray array = json.getAsJsonArray("derivedFromUri");
5589      for (int i = 0; i < array.size(); i++) {
5590        if (array.get(i).isJsonNull()) {
5591          res.getDerivedFromUri().add(new UriType());
5592        } else {;
5593          res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
5594        }
5595      }
5596    };
5597    if (json.has("_derivedFromUri")) {
5598      JsonArray array = json.getAsJsonArray("_derivedFromUri");
5599      for (int i = 0; i < array.size(); i++) {
5600        if (i == res.getDerivedFromUri().size())
5601          res.getDerivedFromUri().add(parseUri(null));
5602        if (array.get(i) instanceof JsonObject) 
5603          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
5604      }
5605    };
5606    if (json.has("partOf")) {
5607      JsonArray array = json.getAsJsonArray("partOf");
5608      for (int i = 0; i < array.size(); i++) {
5609        if (array.get(i).isJsonNull()) {
5610          res.getPartOf().add(new CanonicalType());
5611        } else {;
5612          res.getPartOf().add(parseCanonical(array.get(i).getAsString()));
5613        }
5614      }
5615    };
5616    if (json.has("_partOf")) {
5617      JsonArray array = json.getAsJsonArray("_partOf");
5618      for (int i = 0; i < array.size(); i++) {
5619        if (i == res.getPartOf().size())
5620          res.getPartOf().add(parseCanonical(null));
5621        if (array.get(i) instanceof JsonObject) 
5622          parseElementProperties(array.get(i).getAsJsonObject(), res.getPartOf().get(i));
5623      }
5624    };
5625    if (json.has("replaces")) {
5626      JsonArray array = json.getAsJsonArray("replaces");
5627      for (int i = 0; i < array.size(); i++) {
5628        if (array.get(i).isJsonNull()) {
5629          res.getReplaces().add(new CanonicalType());
5630        } else {;
5631          res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
5632        }
5633      }
5634    };
5635    if (json.has("_replaces")) {
5636      JsonArray array = json.getAsJsonArray("_replaces");
5637      for (int i = 0; i < array.size(); i++) {
5638        if (i == res.getReplaces().size())
5639          res.getReplaces().add(parseCanonical(null));
5640        if (array.get(i) instanceof JsonObject) 
5641          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
5642      }
5643    };
5644    if (json.has("status"))
5645      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5646    if (json.has("_status"))
5647      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5648    if (json.has("experimental"))
5649      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5650    if (json.has("_experimental"))
5651      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
5652    if (json.has("date"))
5653      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5654    if (json.has("_date"))
5655      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5656    if (json.has("publisher"))
5657      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5658    if (json.has("_publisher"))
5659      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
5660    if (json.has("contact")) {
5661      JsonArray array = json.getAsJsonArray("contact");
5662      for (int i = 0; i < array.size(); i++) {
5663        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5664      }
5665    };
5666    if (json.has("description"))
5667      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5668    if (json.has("_description"))
5669      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5670    if (json.has("useContext")) {
5671      JsonArray array = json.getAsJsonArray("useContext");
5672      for (int i = 0; i < array.size(); i++) {
5673        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5674      }
5675    };
5676    if (json.has("jurisdiction")) {
5677      JsonArray array = json.getAsJsonArray("jurisdiction");
5678      for (int i = 0; i < array.size(); i++) {
5679        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5680      }
5681    };
5682    if (json.has("copyright"))
5683      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5684    if (json.has("_copyright"))
5685      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
5686    if (json.has("approvalDate"))
5687      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
5688    if (json.has("_approvalDate"))
5689      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
5690    if (json.has("lastReviewDate"))
5691      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
5692    if (json.has("_lastReviewDate"))
5693      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
5694    if (json.has("effectivePeriod"))
5695      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
5696    if (json.has("code"))
5697      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5698    if (json.has("instance")) {
5699      JsonArray array = json.getAsJsonArray("instance");
5700      for (int i = 0; i < array.size(); i++) {
5701        res.getInstance().add(parseReference(array.get(i).getAsJsonObject()));
5702      }
5703    };
5704    if (json.has("applicability")) {
5705      JsonArray array = json.getAsJsonArray("applicability");
5706      for (int i = 0; i < array.size(); i++) {
5707        res.getApplicability().add(parseChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject()));
5708      }
5709    };
5710    if (json.has("propertyGroup")) {
5711      JsonArray array = json.getAsJsonArray("propertyGroup");
5712      for (int i = 0; i < array.size(); i++) {
5713        res.getPropertyGroup().add(parseChargeItemDefinitionPropertyGroupComponent(array.get(i).getAsJsonObject()));
5714      }
5715    };
5716  }
5717
5718  protected ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent parseChargeItemDefinitionApplicabilityComponent(JsonObject json) throws IOException, FHIRFormatError {
5719    ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res = new ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent();
5720    parseChargeItemDefinitionApplicabilityComponentProperties(json, res);
5721    return res;
5722  }
5723
5724  protected void parseChargeItemDefinitionApplicabilityComponentProperties(JsonObject json, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res) throws IOException, FHIRFormatError {
5725    parseBackboneElementProperties(json, res);
5726    if (json.has("description"))
5727      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5728    if (json.has("_description"))
5729      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5730    if (json.has("language"))
5731      res.setLanguageElement(parseString(json.get("language").getAsString()));
5732    if (json.has("_language"))
5733      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
5734    if (json.has("expression"))
5735      res.setExpressionElement(parseString(json.get("expression").getAsString()));
5736    if (json.has("_expression"))
5737      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
5738  }
5739
5740  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent parseChargeItemDefinitionPropertyGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
5741    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent();
5742    parseChargeItemDefinitionPropertyGroupComponentProperties(json, res);
5743    return res;
5744  }
5745
5746  protected void parseChargeItemDefinitionPropertyGroupComponentProperties(JsonObject json, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res) throws IOException, FHIRFormatError {
5747    parseBackboneElementProperties(json, res);
5748    if (json.has("applicability")) {
5749      JsonArray array = json.getAsJsonArray("applicability");
5750      for (int i = 0; i < array.size(); i++) {
5751        res.getApplicability().add(parseChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject()));
5752      }
5753    };
5754    if (json.has("priceComponent")) {
5755      JsonArray array = json.getAsJsonArray("priceComponent");
5756      for (int i = 0; i < array.size(); i++) {
5757        res.getPriceComponent().add(parseChargeItemDefinitionPropertyGroupPriceComponentComponent(array.get(i).getAsJsonObject()));
5758      }
5759    };
5760  }
5761
5762  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent parseChargeItemDefinitionPropertyGroupPriceComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
5763    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent();
5764    parseChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(json, res);
5765    return res;
5766  }
5767
5768  protected void parseChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(JsonObject json, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res) throws IOException, FHIRFormatError {
5769    parseBackboneElementProperties(json, res);
5770    if (json.has("type"))
5771      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.InvoicePriceComponentType.NULL, new Enumerations.InvoicePriceComponentTypeEnumFactory()));
5772    if (json.has("_type"))
5773      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
5774    if (json.has("code"))
5775      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5776    if (json.has("factor"))
5777      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5778    if (json.has("_factor"))
5779      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5780    if (json.has("amount"))
5781      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
5782  }
5783
5784  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
5785    Claim res = new Claim();
5786    parseClaimProperties(json, res);
5787    return res;
5788  }
5789
5790  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
5791    parseDomainResourceProperties(json, res);
5792    if (json.has("identifier")) {
5793      JsonArray array = json.getAsJsonArray("identifier");
5794      for (int i = 0; i < array.size(); i++) {
5795        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5796      }
5797    };
5798    if (json.has("status"))
5799      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
5800    if (json.has("_status"))
5801      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5802    if (json.has("type"))
5803      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5804    if (json.has("subType"))
5805      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
5806    if (json.has("use"))
5807      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.Use.NULL, new Enumerations.UseEnumFactory()));
5808    if (json.has("_use"))
5809      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
5810    if (json.has("patient"))
5811      res.setPatient(parseReference(json.getAsJsonObject("patient")));
5812    if (json.has("billablePeriod"))
5813      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
5814    if (json.has("created"))
5815      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5816    if (json.has("_created"))
5817      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5818    if (json.has("enterer"))
5819      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
5820    if (json.has("insurer"))
5821      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
5822    if (json.has("provider"))
5823      res.setProvider(parseReference(json.getAsJsonObject("provider")));
5824    if (json.has("priority"))
5825      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
5826    if (json.has("fundsReserve"))
5827      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
5828    if (json.has("related")) {
5829      JsonArray array = json.getAsJsonArray("related");
5830      for (int i = 0; i < array.size(); i++) {
5831        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject()));
5832      }
5833    };
5834    if (json.has("prescription"))
5835      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
5836    if (json.has("originalPrescription"))
5837      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
5838    if (json.has("payee"))
5839      res.setPayee(parseClaimPayeeComponent(json.getAsJsonObject("payee")));
5840    if (json.has("referral"))
5841      res.setReferral(parseReference(json.getAsJsonObject("referral")));
5842    if (json.has("facility"))
5843      res.setFacility(parseReference(json.getAsJsonObject("facility")));
5844    if (json.has("careTeam")) {
5845      JsonArray array = json.getAsJsonArray("careTeam");
5846      for (int i = 0; i < array.size(); i++) {
5847        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject()));
5848      }
5849    };
5850    if (json.has("supportingInfo")) {
5851      JsonArray array = json.getAsJsonArray("supportingInfo");
5852      for (int i = 0; i < array.size(); i++) {
5853        res.getSupportingInfo().add(parseClaimSupportingInformationComponent(array.get(i).getAsJsonObject()));
5854      }
5855    };
5856    if (json.has("diagnosis")) {
5857      JsonArray array = json.getAsJsonArray("diagnosis");
5858      for (int i = 0; i < array.size(); i++) {
5859        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject()));
5860      }
5861    };
5862    if (json.has("procedure")) {
5863      JsonArray array = json.getAsJsonArray("procedure");
5864      for (int i = 0; i < array.size(); i++) {
5865        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject()));
5866      }
5867    };
5868    if (json.has("insurance")) {
5869      JsonArray array = json.getAsJsonArray("insurance");
5870      for (int i = 0; i < array.size(); i++) {
5871        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject()));
5872      }
5873    };
5874    if (json.has("accident"))
5875      res.setAccident(parseClaimAccidentComponent(json.getAsJsonObject("accident")));
5876    if (json.has("item")) {
5877      JsonArray array = json.getAsJsonArray("item");
5878      for (int i = 0; i < array.size(); i++) {
5879        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject()));
5880      }
5881    };
5882    if (json.has("total"))
5883      res.setTotal(parseMoney(json.getAsJsonObject("total")));
5884  }
5885
5886  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json) throws IOException, FHIRFormatError {
5887    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
5888    parseClaimRelatedClaimComponentProperties(json, res);
5889    return res;
5890  }
5891
5892  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
5893    parseBackboneElementProperties(json, res);
5894    if (json.has("claim"))
5895      res.setClaim(parseReference(json.getAsJsonObject("claim")));
5896    if (json.has("relationship"))
5897      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
5898    if (json.has("reference"))
5899      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
5900  }
5901
5902  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json) throws IOException, FHIRFormatError {
5903    Claim.PayeeComponent res = new Claim.PayeeComponent();
5904    parseClaimPayeeComponentProperties(json, res);
5905    return res;
5906  }
5907
5908  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
5909    parseBackboneElementProperties(json, res);
5910    if (json.has("type"))
5911      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5912    if (json.has("party"))
5913      res.setParty(parseReference(json.getAsJsonObject("party")));
5914  }
5915
5916  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json) throws IOException, FHIRFormatError {
5917    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
5918    parseClaimCareTeamComponentProperties(json, res);
5919    return res;
5920  }
5921
5922  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
5923    parseBackboneElementProperties(json, res);
5924    if (json.has("sequence"))
5925      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5926    if (json.has("_sequence"))
5927      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5928    if (json.has("provider"))
5929      res.setProvider(parseReference(json.getAsJsonObject("provider")));
5930    if (json.has("responsible"))
5931      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
5932    if (json.has("_responsible"))
5933      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
5934    if (json.has("role"))
5935      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
5936    if (json.has("qualification"))
5937      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
5938  }
5939
5940  protected Claim.SupportingInformationComponent parseClaimSupportingInformationComponent(JsonObject json) throws IOException, FHIRFormatError {
5941    Claim.SupportingInformationComponent res = new Claim.SupportingInformationComponent();
5942    parseClaimSupportingInformationComponentProperties(json, res);
5943    return res;
5944  }
5945
5946  protected void parseClaimSupportingInformationComponentProperties(JsonObject json, Claim.SupportingInformationComponent res) throws IOException, FHIRFormatError {
5947    parseBackboneElementProperties(json, res);
5948    if (json.has("sequence"))
5949      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5950    if (json.has("_sequence"))
5951      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5952    if (json.has("category"))
5953      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5954    if (json.has("code"))
5955      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5956    DataType timing = parseType("timing", json);
5957    if (timing != null)
5958      res.setTiming(timing);
5959    DataType value = parseType("value", json);
5960    if (value != null)
5961      res.setValue(value);
5962    if (json.has("reason"))
5963      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
5964  }
5965
5966  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
5967    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
5968    parseClaimDiagnosisComponentProperties(json, res);
5969    return res;
5970  }
5971
5972  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
5973    parseBackboneElementProperties(json, res);
5974    if (json.has("sequence"))
5975      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5976    if (json.has("_sequence"))
5977      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5978    DataType diagnosis = parseType("diagnosis", json);
5979    if (diagnosis != null)
5980      res.setDiagnosis(diagnosis);
5981    if (json.has("type")) {
5982      JsonArray array = json.getAsJsonArray("type");
5983      for (int i = 0; i < array.size(); i++) {
5984        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5985      }
5986    };
5987    if (json.has("onAdmission"))
5988      res.setOnAdmission(parseCodeableConcept(json.getAsJsonObject("onAdmission")));
5989    if (json.has("packageCode"))
5990      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
5991  }
5992
5993  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json) throws IOException, FHIRFormatError {
5994    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
5995    parseClaimProcedureComponentProperties(json, res);
5996    return res;
5997  }
5998
5999  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
6000    parseBackboneElementProperties(json, res);
6001    if (json.has("sequence"))
6002      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6003    if (json.has("_sequence"))
6004      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
6005    if (json.has("type")) {
6006      JsonArray array = json.getAsJsonArray("type");
6007      for (int i = 0; i < array.size(); i++) {
6008        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6009      }
6010    };
6011    if (json.has("date"))
6012      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6013    if (json.has("_date"))
6014      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6015    DataType procedure = parseType("procedure", json);
6016    if (procedure != null)
6017      res.setProcedure(procedure);
6018    if (json.has("udi")) {
6019      JsonArray array = json.getAsJsonArray("udi");
6020      for (int i = 0; i < array.size(); i++) {
6021        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6022      }
6023    };
6024  }
6025
6026  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
6027    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
6028    parseClaimInsuranceComponentProperties(json, res);
6029    return res;
6030  }
6031
6032  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
6033    parseBackboneElementProperties(json, res);
6034    if (json.has("sequence"))
6035      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6036    if (json.has("_sequence"))
6037      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
6038    if (json.has("focal"))
6039      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
6040    if (json.has("_focal"))
6041      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
6042    if (json.has("identifier"))
6043      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6044    if (json.has("coverage"))
6045      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
6046    if (json.has("businessArrangement"))
6047      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
6048    if (json.has("_businessArrangement"))
6049      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
6050    if (json.has("preAuthRef")) {
6051      JsonArray array = json.getAsJsonArray("preAuthRef");
6052      for (int i = 0; i < array.size(); i++) {
6053        if (array.get(i).isJsonNull()) {
6054          res.getPreAuthRef().add(new StringType());
6055        } else {;
6056          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
6057        }
6058      }
6059    };
6060    if (json.has("_preAuthRef")) {
6061      JsonArray array = json.getAsJsonArray("_preAuthRef");
6062      for (int i = 0; i < array.size(); i++) {
6063        if (i == res.getPreAuthRef().size())
6064          res.getPreAuthRef().add(parseString(null));
6065        if (array.get(i) instanceof JsonObject) 
6066          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
6067      }
6068    };
6069    if (json.has("claimResponse"))
6070      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
6071  }
6072
6073  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json) throws IOException, FHIRFormatError {
6074    Claim.AccidentComponent res = new Claim.AccidentComponent();
6075    parseClaimAccidentComponentProperties(json, res);
6076    return res;
6077  }
6078
6079  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
6080    parseBackboneElementProperties(json, res);
6081    if (json.has("date"))
6082      res.setDateElement(parseDate(json.get("date").getAsString()));
6083    if (json.has("_date"))
6084      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6085    if (json.has("type"))
6086      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6087    DataType location = parseType("location", json);
6088    if (location != null)
6089      res.setLocation(location);
6090  }
6091
6092  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json) throws IOException, FHIRFormatError {
6093    Claim.ItemComponent res = new Claim.ItemComponent();
6094    parseClaimItemComponentProperties(json, res);
6095    return res;
6096  }
6097
6098  protected void parseClaimItemComponentProperties(JsonObject json, Claim.ItemComponent res) throws IOException, FHIRFormatError {
6099    parseBackboneElementProperties(json, res);
6100    if (json.has("sequence"))
6101      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6102    if (json.has("_sequence"))
6103      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
6104    if (json.has("careTeamSequence")) {
6105      JsonArray array = json.getAsJsonArray("careTeamSequence");
6106      for (int i = 0; i < array.size(); i++) {
6107        if (array.get(i).isJsonNull()) {
6108          res.getCareTeamSequence().add(new PositiveIntType());
6109        } else {;
6110          res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
6111        }
6112      }
6113    };
6114    if (json.has("_careTeamSequence")) {
6115      JsonArray array = json.getAsJsonArray("_careTeamSequence");
6116      for (int i = 0; i < array.size(); i++) {
6117        if (i == res.getCareTeamSequence().size())
6118          res.getCareTeamSequence().add(parsePositiveInt(null));
6119        if (array.get(i) instanceof JsonObject) 
6120          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
6121      }
6122    };
6123    if (json.has("diagnosisSequence")) {
6124      JsonArray array = json.getAsJsonArray("diagnosisSequence");
6125      for (int i = 0; i < array.size(); i++) {
6126        if (array.get(i).isJsonNull()) {
6127          res.getDiagnosisSequence().add(new PositiveIntType());
6128        } else {;
6129          res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
6130        }
6131      }
6132    };
6133    if (json.has("_diagnosisSequence")) {
6134      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
6135      for (int i = 0; i < array.size(); i++) {
6136        if (i == res.getDiagnosisSequence().size())
6137          res.getDiagnosisSequence().add(parsePositiveInt(null));
6138        if (array.get(i) instanceof JsonObject) 
6139          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
6140      }
6141    };
6142    if (json.has("procedureSequence")) {
6143      JsonArray array = json.getAsJsonArray("procedureSequence");
6144      for (int i = 0; i < array.size(); i++) {
6145        if (array.get(i).isJsonNull()) {
6146          res.getProcedureSequence().add(new PositiveIntType());
6147        } else {;
6148          res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
6149        }
6150      }
6151    };
6152    if (json.has("_procedureSequence")) {
6153      JsonArray array = json.getAsJsonArray("_procedureSequence");
6154      for (int i = 0; i < array.size(); i++) {
6155        if (i == res.getProcedureSequence().size())
6156          res.getProcedureSequence().add(parsePositiveInt(null));
6157        if (array.get(i) instanceof JsonObject) 
6158          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
6159      }
6160    };
6161    if (json.has("informationSequence")) {
6162      JsonArray array = json.getAsJsonArray("informationSequence");
6163      for (int i = 0; i < array.size(); i++) {
6164        if (array.get(i).isJsonNull()) {
6165          res.getInformationSequence().add(new PositiveIntType());
6166        } else {;
6167          res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
6168        }
6169      }
6170    };
6171    if (json.has("_informationSequence")) {
6172      JsonArray array = json.getAsJsonArray("_informationSequence");
6173      for (int i = 0; i < array.size(); i++) {
6174        if (i == res.getInformationSequence().size())
6175          res.getInformationSequence().add(parsePositiveInt(null));
6176        if (array.get(i) instanceof JsonObject) 
6177          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
6178      }
6179    };
6180    if (json.has("revenue"))
6181      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
6182    if (json.has("category"))
6183      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
6184    if (json.has("productOrService"))
6185      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
6186    if (json.has("modifier")) {
6187      JsonArray array = json.getAsJsonArray("modifier");
6188      for (int i = 0; i < array.size(); i++) {
6189        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6190      }
6191    };
6192    if (json.has("programCode")) {
6193      JsonArray array = json.getAsJsonArray("programCode");
6194      for (int i = 0; i < array.size(); i++) {
6195        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6196      }
6197    };
6198    DataType serviced = parseType("serviced", json);
6199    if (serviced != null)
6200      res.setServiced(serviced);
6201    DataType location = parseType("location", json);
6202    if (location != null)
6203      res.setLocation(location);
6204    if (json.has("quantity"))
6205      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
6206    if (json.has("unitPrice"))
6207      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
6208    if (json.has("factor"))
6209      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6210    if (json.has("_factor"))
6211      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
6212    if (json.has("net"))
6213      res.setNet(parseMoney(json.getAsJsonObject("net")));
6214    if (json.has("udi")) {
6215      JsonArray array = json.getAsJsonArray("udi");
6216      for (int i = 0; i < array.size(); i++) {
6217        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6218      }
6219    };
6220    if (json.has("bodySite"))
6221      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
6222    if (json.has("subSite")) {
6223      JsonArray array = json.getAsJsonArray("subSite");
6224      for (int i = 0; i < array.size(); i++) {
6225        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6226      }
6227    };
6228    if (json.has("encounter")) {
6229      JsonArray array = json.getAsJsonArray("encounter");
6230      for (int i = 0; i < array.size(); i++) {
6231        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
6232      }
6233    };
6234    if (json.has("detail")) {
6235      JsonArray array = json.getAsJsonArray("detail");
6236      for (int i = 0; i < array.size(); i++) {
6237        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject()));
6238      }
6239    };
6240  }
6241
6242  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
6243    Claim.DetailComponent res = new Claim.DetailComponent();
6244    parseClaimDetailComponentProperties(json, res);
6245    return res;
6246  }
6247
6248  protected void parseClaimDetailComponentProperties(JsonObject json, Claim.DetailComponent res) throws IOException, FHIRFormatError {
6249    parseBackboneElementProperties(json, res);
6250    if (json.has("sequence"))
6251      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6252    if (json.has("_sequence"))
6253      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
6254    if (json.has("revenue"))
6255      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
6256    if (json.has("category"))
6257      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
6258    if (json.has("productOrService"))
6259      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
6260    if (json.has("modifier")) {
6261      JsonArray array = json.getAsJsonArray("modifier");
6262      for (int i = 0; i < array.size(); i++) {
6263        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6264      }
6265    };
6266    if (json.has("programCode")) {
6267      JsonArray array = json.getAsJsonArray("programCode");
6268      for (int i = 0; i < array.size(); i++) {
6269        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6270      }
6271    };
6272    if (json.has("quantity"))
6273      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
6274    if (json.has("unitPrice"))
6275      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
6276    if (json.has("factor"))
6277      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6278    if (json.has("_factor"))
6279      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
6280    if (json.has("net"))
6281      res.setNet(parseMoney(json.getAsJsonObject("net")));
6282    if (json.has("udi")) {
6283      JsonArray array = json.getAsJsonArray("udi");
6284      for (int i = 0; i < array.size(); i++) {
6285        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6286      }
6287    };
6288    if (json.has("subDetail")) {
6289      JsonArray array = json.getAsJsonArray("subDetail");
6290      for (int i = 0; i < array.size(); i++) {
6291        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject()));
6292      }
6293    };
6294  }
6295
6296  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
6297    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
6298    parseClaimSubDetailComponentProperties(json, res);
6299    return res;
6300  }
6301
6302  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
6303    parseBackboneElementProperties(json, res);
6304    if (json.has("sequence"))
6305      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6306    if (json.has("_sequence"))
6307      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
6308    if (json.has("revenue"))
6309      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
6310    if (json.has("category"))
6311      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
6312    if (json.has("productOrService"))
6313      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
6314    if (json.has("modifier")) {
6315      JsonArray array = json.getAsJsonArray("modifier");
6316      for (int i = 0; i < array.size(); i++) {
6317        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6318      }
6319    };
6320    if (json.has("programCode")) {
6321      JsonArray array = json.getAsJsonArray("programCode");
6322      for (int i = 0; i < array.size(); i++) {
6323        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6324      }
6325    };
6326    if (json.has("quantity"))
6327      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
6328    if (json.has("unitPrice"))
6329      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
6330    if (json.has("factor"))
6331      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6332    if (json.has("_factor"))
6333      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
6334    if (json.has("net"))
6335      res.setNet(parseMoney(json.getAsJsonObject("net")));
6336    if (json.has("udi")) {
6337      JsonArray array = json.getAsJsonArray("udi");
6338      for (int i = 0; i < array.size(); i++) {
6339        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
6340      }
6341    };
6342  }
6343
6344  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
6345    ClaimResponse res = new ClaimResponse();
6346    parseClaimResponseProperties(json, res);
6347    return res;
6348  }
6349
6350  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
6351    parseDomainResourceProperties(json, res);
6352    if (json.has("identifier")) {
6353      JsonArray array = json.getAsJsonArray("identifier");
6354      for (int i = 0; i < array.size(); i++) {
6355        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6356      }
6357    };
6358    if (json.has("status"))
6359      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
6360    if (json.has("_status"))
6361      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6362    if (json.has("type"))
6363      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6364    if (json.has("subType"))
6365      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
6366    if (json.has("use"))
6367      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.Use.NULL, new Enumerations.UseEnumFactory()));
6368    if (json.has("_use"))
6369      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
6370    if (json.has("patient"))
6371      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6372    if (json.has("created"))
6373      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
6374    if (json.has("_created"))
6375      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
6376    if (json.has("insurer"))
6377      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
6378    if (json.has("requestor"))
6379      res.setRequestor(parseReference(json.getAsJsonObject("requestor")));
6380    if (json.has("request"))
6381      res.setRequest(parseReference(json.getAsJsonObject("request")));
6382    if (json.has("outcome"))
6383      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.ClaimProcessingCodes.NULL, new Enumerations.ClaimProcessingCodesEnumFactory()));
6384    if (json.has("_outcome"))
6385      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
6386    if (json.has("disposition"))
6387      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
6388    if (json.has("_disposition"))
6389      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
6390    if (json.has("preAuthRef"))
6391      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
6392    if (json.has("_preAuthRef"))
6393      parseElementProperties(json.getAsJsonObject("_preAuthRef"), res.getPreAuthRefElement());
6394    if (json.has("preAuthPeriod"))
6395      res.setPreAuthPeriod(parsePeriod(json.getAsJsonObject("preAuthPeriod")));
6396    if (json.has("payeeType"))
6397      res.setPayeeType(parseCodeableConcept(json.getAsJsonObject("payeeType")));
6398    if (json.has("item")) {
6399      JsonArray array = json.getAsJsonArray("item");
6400      for (int i = 0; i < array.size(); i++) {
6401        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject()));
6402      }
6403    };
6404    if (json.has("addItem")) {
6405      JsonArray array = json.getAsJsonArray("addItem");
6406      for (int i = 0; i < array.size(); i++) {
6407        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject()));
6408      }
6409    };
6410    if (json.has("adjudication")) {
6411      JsonArray array = json.getAsJsonArray("adjudication");
6412      for (int i = 0; i < array.size(); i++) {
6413        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
6414      }
6415    };
6416    if (json.has("total")) {
6417      JsonArray array = json.getAsJsonArray("total");
6418      for (int i = 0; i < array.size(); i++) {
6419        res.getTotal().add(parseClaimResponseTotalComponent(array.get(i).getAsJsonObject()));
6420      }
6421    };
6422    if (json.has("payment"))
6423      res.setPayment(parseClaimResponsePaymentComponent(json.getAsJsonObject("payment")));
6424    if (json.has("fundsReserve"))
6425      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
6426    if (json.has("formCode"))
6427      res.setFormCode(parseCodeableConcept(json.getAsJsonObject("formCode")));
6428    if (json.has("form"))
6429      res.setForm(parseAttachment(json.getAsJsonObject("form")));
6430    if (json.has("processNote")) {
6431      JsonArray array = json.getAsJsonArray("processNote");
6432      for (int i = 0; i < array.size(); i++) {
6433        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject()));
6434      }
6435    };
6436    if (json.has("communicationRequest")) {
6437      JsonArray array = json.getAsJsonArray("communicationRequest");
6438      for (int i = 0; i < array.size(); i++) {
6439        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
6440      }
6441    };
6442    if (json.has("insurance")) {
6443      JsonArray array = json.getAsJsonArray("insurance");
6444      for (int i = 0; i < array.size(); i++) {
6445        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject()));
6446      }
6447    };
6448    if (json.has("error")) {
6449      JsonArray array = json.getAsJsonArray("error");
6450      for (int i = 0; i < array.size(); i++) {
6451        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject()));
6452      }
6453    };
6454  }
6455
6456  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json) throws IOException, FHIRFormatError {
6457    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
6458    parseClaimResponseItemComponentProperties(json, res);
6459    return res;
6460  }
6461
6462  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
6463    parseBackboneElementProperties(json, res);
6464    if (json.has("itemSequence"))
6465      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
6466    if (json.has("_itemSequence"))
6467      parseElementProperties(json.getAsJsonObject("_itemSequence"), res.getItemSequenceElement());
6468    if (json.has("noteNumber")) {
6469      JsonArray array = json.getAsJsonArray("noteNumber");
6470      for (int i = 0; i < array.size(); i++) {
6471        if (array.get(i).isJsonNull()) {
6472          res.getNoteNumber().add(new PositiveIntType());
6473        } else {;
6474          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6475        }
6476      }
6477    };
6478    if (json.has("_noteNumber")) {
6479      JsonArray array = json.getAsJsonArray("_noteNumber");
6480      for (int i = 0; i < array.size(); i++) {
6481        if (i == res.getNoteNumber().size())
6482          res.getNoteNumber().add(parsePositiveInt(null));
6483        if (array.get(i) instanceof JsonObject) 
6484          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6485      }
6486    };
6487    if (json.has("adjudication")) {
6488      JsonArray array = json.getAsJsonArray("adjudication");
6489      for (int i = 0; i < array.size(); i++) {
6490        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
6491      }
6492    };
6493    if (json.has("detail")) {
6494      JsonArray array = json.getAsJsonArray("detail");
6495      for (int i = 0; i < array.size(); i++) {
6496        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject()));
6497      }
6498    };
6499  }
6500
6501  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json) throws IOException, FHIRFormatError {
6502    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
6503    parseClaimResponseAdjudicationComponentProperties(json, res);
6504    return res;
6505  }
6506
6507  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
6508    parseBackboneElementProperties(json, res);
6509    if (json.has("category"))
6510      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
6511    if (json.has("reason"))
6512      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
6513    if (json.has("amount"))
6514      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
6515    if (json.has("value"))
6516      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
6517    if (json.has("_value"))
6518      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
6519  }
6520
6521  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
6522    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
6523    parseClaimResponseItemDetailComponentProperties(json, res);
6524    return res;
6525  }
6526
6527  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
6528    parseBackboneElementProperties(json, res);
6529    if (json.has("detailSequence"))
6530      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
6531    if (json.has("_detailSequence"))
6532      parseElementProperties(json.getAsJsonObject("_detailSequence"), res.getDetailSequenceElement());
6533    if (json.has("noteNumber")) {
6534      JsonArray array = json.getAsJsonArray("noteNumber");
6535      for (int i = 0; i < array.size(); i++) {
6536        if (array.get(i).isJsonNull()) {
6537          res.getNoteNumber().add(new PositiveIntType());
6538        } else {;
6539          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6540        }
6541      }
6542    };
6543    if (json.has("_noteNumber")) {
6544      JsonArray array = json.getAsJsonArray("_noteNumber");
6545      for (int i = 0; i < array.size(); i++) {
6546        if (i == res.getNoteNumber().size())
6547          res.getNoteNumber().add(parsePositiveInt(null));
6548        if (array.get(i) instanceof JsonObject) 
6549          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6550      }
6551    };
6552    if (json.has("adjudication")) {
6553      JsonArray array = json.getAsJsonArray("adjudication");
6554      for (int i = 0; i < array.size(); i++) {
6555        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
6556      }
6557    };
6558    if (json.has("subDetail")) {
6559      JsonArray array = json.getAsJsonArray("subDetail");
6560      for (int i = 0; i < array.size(); i++) {
6561        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject()));
6562      }
6563    };
6564  }
6565
6566  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
6567    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
6568    parseClaimResponseSubDetailComponentProperties(json, res);
6569    return res;
6570  }
6571
6572  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
6573    parseBackboneElementProperties(json, res);
6574    if (json.has("subDetailSequence"))
6575      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
6576    if (json.has("_subDetailSequence"))
6577      parseElementProperties(json.getAsJsonObject("_subDetailSequence"), res.getSubDetailSequenceElement());
6578    if (json.has("noteNumber")) {
6579      JsonArray array = json.getAsJsonArray("noteNumber");
6580      for (int i = 0; i < array.size(); i++) {
6581        if (array.get(i).isJsonNull()) {
6582          res.getNoteNumber().add(new PositiveIntType());
6583        } else {;
6584          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6585        }
6586      }
6587    };
6588    if (json.has("_noteNumber")) {
6589      JsonArray array = json.getAsJsonArray("_noteNumber");
6590      for (int i = 0; i < array.size(); i++) {
6591        if (i == res.getNoteNumber().size())
6592          res.getNoteNumber().add(parsePositiveInt(null));
6593        if (array.get(i) instanceof JsonObject) 
6594          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6595      }
6596    };
6597    if (json.has("adjudication")) {
6598      JsonArray array = json.getAsJsonArray("adjudication");
6599      for (int i = 0; i < array.size(); i++) {
6600        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
6601      }
6602    };
6603  }
6604
6605  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
6606    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
6607    parseClaimResponseAddedItemComponentProperties(json, res);
6608    return res;
6609  }
6610
6611  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
6612    parseBackboneElementProperties(json, res);
6613    if (json.has("itemSequence")) {
6614      JsonArray array = json.getAsJsonArray("itemSequence");
6615      for (int i = 0; i < array.size(); i++) {
6616        if (array.get(i).isJsonNull()) {
6617          res.getItemSequence().add(new PositiveIntType());
6618        } else {;
6619          res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
6620        }
6621      }
6622    };
6623    if (json.has("_itemSequence")) {
6624      JsonArray array = json.getAsJsonArray("_itemSequence");
6625      for (int i = 0; i < array.size(); i++) {
6626        if (i == res.getItemSequence().size())
6627          res.getItemSequence().add(parsePositiveInt(null));
6628        if (array.get(i) instanceof JsonObject) 
6629          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
6630      }
6631    };
6632    if (json.has("detailSequence")) {
6633      JsonArray array = json.getAsJsonArray("detailSequence");
6634      for (int i = 0; i < array.size(); i++) {
6635        if (array.get(i).isJsonNull()) {
6636          res.getDetailSequence().add(new PositiveIntType());
6637        } else {;
6638          res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
6639        }
6640      }
6641    };
6642    if (json.has("_detailSequence")) {
6643      JsonArray array = json.getAsJsonArray("_detailSequence");
6644      for (int i = 0; i < array.size(); i++) {
6645        if (i == res.getDetailSequence().size())
6646          res.getDetailSequence().add(parsePositiveInt(null));
6647        if (array.get(i) instanceof JsonObject) 
6648          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
6649      }
6650    };
6651    if (json.has("subdetailSequence")) {
6652      JsonArray array = json.getAsJsonArray("subdetailSequence");
6653      for (int i = 0; i < array.size(); i++) {
6654        if (array.get(i).isJsonNull()) {
6655          res.getSubdetailSequence().add(new PositiveIntType());
6656        } else {;
6657          res.getSubdetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
6658        }
6659      }
6660    };
6661    if (json.has("_subdetailSequence")) {
6662      JsonArray array = json.getAsJsonArray("_subdetailSequence");
6663      for (int i = 0; i < array.size(); i++) {
6664        if (i == res.getSubdetailSequence().size())
6665          res.getSubdetailSequence().add(parsePositiveInt(null));
6666        if (array.get(i) instanceof JsonObject) 
6667          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubdetailSequence().get(i));
6668      }
6669    };
6670    if (json.has("provider")) {
6671      JsonArray array = json.getAsJsonArray("provider");
6672      for (int i = 0; i < array.size(); i++) {
6673        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
6674      }
6675    };
6676    if (json.has("productOrService"))
6677      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
6678    if (json.has("modifier")) {
6679      JsonArray array = json.getAsJsonArray("modifier");
6680      for (int i = 0; i < array.size(); i++) {
6681        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6682      }
6683    };
6684    if (json.has("programCode")) {
6685      JsonArray array = json.getAsJsonArray("programCode");
6686      for (int i = 0; i < array.size(); i++) {
6687        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6688      }
6689    };
6690    DataType serviced = parseType("serviced", json);
6691    if (serviced != null)
6692      res.setServiced(serviced);
6693    DataType location = parseType("location", json);
6694    if (location != null)
6695      res.setLocation(location);
6696    if (json.has("quantity"))
6697      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
6698    if (json.has("unitPrice"))
6699      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
6700    if (json.has("factor"))
6701      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6702    if (json.has("_factor"))
6703      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
6704    if (json.has("net"))
6705      res.setNet(parseMoney(json.getAsJsonObject("net")));
6706    if (json.has("bodySite"))
6707      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
6708    if (json.has("subSite")) {
6709      JsonArray array = json.getAsJsonArray("subSite");
6710      for (int i = 0; i < array.size(); i++) {
6711        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6712      }
6713    };
6714    if (json.has("noteNumber")) {
6715      JsonArray array = json.getAsJsonArray("noteNumber");
6716      for (int i = 0; i < array.size(); i++) {
6717        if (array.get(i).isJsonNull()) {
6718          res.getNoteNumber().add(new PositiveIntType());
6719        } else {;
6720          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6721        }
6722      }
6723    };
6724    if (json.has("_noteNumber")) {
6725      JsonArray array = json.getAsJsonArray("_noteNumber");
6726      for (int i = 0; i < array.size(); i++) {
6727        if (i == res.getNoteNumber().size())
6728          res.getNoteNumber().add(parsePositiveInt(null));
6729        if (array.get(i) instanceof JsonObject) 
6730          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6731      }
6732    };
6733    if (json.has("adjudication")) {
6734      JsonArray array = json.getAsJsonArray("adjudication");
6735      for (int i = 0; i < array.size(); i++) {
6736        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
6737      }
6738    };
6739    if (json.has("detail")) {
6740      JsonArray array = json.getAsJsonArray("detail");
6741      for (int i = 0; i < array.size(); i++) {
6742        res.getDetail().add(parseClaimResponseAddedItemDetailComponent(array.get(i).getAsJsonObject()));
6743      }
6744    };
6745  }
6746
6747  protected ClaimResponse.AddedItemDetailComponent parseClaimResponseAddedItemDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
6748    ClaimResponse.AddedItemDetailComponent res = new ClaimResponse.AddedItemDetailComponent();
6749    parseClaimResponseAddedItemDetailComponentProperties(json, res);
6750    return res;
6751  }
6752
6753  protected void parseClaimResponseAddedItemDetailComponentProperties(JsonObject json, ClaimResponse.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
6754    parseBackboneElementProperties(json, res);
6755    if (json.has("productOrService"))
6756      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
6757    if (json.has("modifier")) {
6758      JsonArray array = json.getAsJsonArray("modifier");
6759      for (int i = 0; i < array.size(); i++) {
6760        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6761      }
6762    };
6763    if (json.has("quantity"))
6764      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
6765    if (json.has("unitPrice"))
6766      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
6767    if (json.has("factor"))
6768      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6769    if (json.has("_factor"))
6770      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
6771    if (json.has("net"))
6772      res.setNet(parseMoney(json.getAsJsonObject("net")));
6773    if (json.has("noteNumber")) {
6774      JsonArray array = json.getAsJsonArray("noteNumber");
6775      for (int i = 0; i < array.size(); i++) {
6776        if (array.get(i).isJsonNull()) {
6777          res.getNoteNumber().add(new PositiveIntType());
6778        } else {;
6779          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6780        }
6781      }
6782    };
6783    if (json.has("_noteNumber")) {
6784      JsonArray array = json.getAsJsonArray("_noteNumber");
6785      for (int i = 0; i < array.size(); i++) {
6786        if (i == res.getNoteNumber().size())
6787          res.getNoteNumber().add(parsePositiveInt(null));
6788        if (array.get(i) instanceof JsonObject) 
6789          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6790      }
6791    };
6792    if (json.has("adjudication")) {
6793      JsonArray array = json.getAsJsonArray("adjudication");
6794      for (int i = 0; i < array.size(); i++) {
6795        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
6796      }
6797    };
6798    if (json.has("subDetail")) {
6799      JsonArray array = json.getAsJsonArray("subDetail");
6800      for (int i = 0; i < array.size(); i++) {
6801        res.getSubDetail().add(parseClaimResponseAddedItemSubDetailComponent(array.get(i).getAsJsonObject()));
6802      }
6803    };
6804  }
6805
6806  protected ClaimResponse.AddedItemSubDetailComponent parseClaimResponseAddedItemSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
6807    ClaimResponse.AddedItemSubDetailComponent res = new ClaimResponse.AddedItemSubDetailComponent();
6808    parseClaimResponseAddedItemSubDetailComponentProperties(json, res);
6809    return res;
6810  }
6811
6812  protected void parseClaimResponseAddedItemSubDetailComponentProperties(JsonObject json, ClaimResponse.AddedItemSubDetailComponent res) throws IOException, FHIRFormatError {
6813    parseBackboneElementProperties(json, res);
6814    if (json.has("productOrService"))
6815      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
6816    if (json.has("modifier")) {
6817      JsonArray array = json.getAsJsonArray("modifier");
6818      for (int i = 0; i < array.size(); i++) {
6819        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6820      }
6821    };
6822    if (json.has("quantity"))
6823      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
6824    if (json.has("unitPrice"))
6825      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
6826    if (json.has("factor"))
6827      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6828    if (json.has("_factor"))
6829      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
6830    if (json.has("net"))
6831      res.setNet(parseMoney(json.getAsJsonObject("net")));
6832    if (json.has("noteNumber")) {
6833      JsonArray array = json.getAsJsonArray("noteNumber");
6834      for (int i = 0; i < array.size(); i++) {
6835        if (array.get(i).isJsonNull()) {
6836          res.getNoteNumber().add(new PositiveIntType());
6837        } else {;
6838          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
6839        }
6840      }
6841    };
6842    if (json.has("_noteNumber")) {
6843      JsonArray array = json.getAsJsonArray("_noteNumber");
6844      for (int i = 0; i < array.size(); i++) {
6845        if (i == res.getNoteNumber().size())
6846          res.getNoteNumber().add(parsePositiveInt(null));
6847        if (array.get(i) instanceof JsonObject) 
6848          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6849      }
6850    };
6851    if (json.has("adjudication")) {
6852      JsonArray array = json.getAsJsonArray("adjudication");
6853      for (int i = 0; i < array.size(); i++) {
6854        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject()));
6855      }
6856    };
6857  }
6858
6859  protected ClaimResponse.TotalComponent parseClaimResponseTotalComponent(JsonObject json) throws IOException, FHIRFormatError {
6860    ClaimResponse.TotalComponent res = new ClaimResponse.TotalComponent();
6861    parseClaimResponseTotalComponentProperties(json, res);
6862    return res;
6863  }
6864
6865  protected void parseClaimResponseTotalComponentProperties(JsonObject json, ClaimResponse.TotalComponent res) throws IOException, FHIRFormatError {
6866    parseBackboneElementProperties(json, res);
6867    if (json.has("category"))
6868      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
6869    if (json.has("amount"))
6870      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
6871  }
6872
6873  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json) throws IOException, FHIRFormatError {
6874    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
6875    parseClaimResponsePaymentComponentProperties(json, res);
6876    return res;
6877  }
6878
6879  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
6880    parseBackboneElementProperties(json, res);
6881    if (json.has("type"))
6882      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6883    if (json.has("adjustment"))
6884      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
6885    if (json.has("adjustmentReason"))
6886      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
6887    if (json.has("date"))
6888      res.setDateElement(parseDate(json.get("date").getAsString()));
6889    if (json.has("_date"))
6890      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6891    if (json.has("amount"))
6892      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
6893    if (json.has("identifier"))
6894      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6895  }
6896
6897  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json) throws IOException, FHIRFormatError {
6898    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
6899    parseClaimResponseNoteComponentProperties(json, res);
6900    return res;
6901  }
6902
6903  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
6904    parseBackboneElementProperties(json, res);
6905    if (json.has("number"))
6906      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
6907    if (json.has("_number"))
6908      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
6909    if (json.has("type"))
6910      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
6911    if (json.has("_type"))
6912      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6913    if (json.has("text"))
6914      res.setTextElement(parseString(json.get("text").getAsString()));
6915    if (json.has("_text"))
6916      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
6917    if (json.has("language"))
6918      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
6919  }
6920
6921  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
6922    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
6923    parseClaimResponseInsuranceComponentProperties(json, res);
6924    return res;
6925  }
6926
6927  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
6928    parseBackboneElementProperties(json, res);
6929    if (json.has("sequence"))
6930      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6931    if (json.has("_sequence"))
6932      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
6933    if (json.has("focal"))
6934      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
6935    if (json.has("_focal"))
6936      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
6937    if (json.has("coverage"))
6938      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
6939    if (json.has("businessArrangement"))
6940      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
6941    if (json.has("_businessArrangement"))
6942      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
6943    if (json.has("claimResponse"))
6944      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
6945  }
6946
6947  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json) throws IOException, FHIRFormatError {
6948    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
6949    parseClaimResponseErrorComponentProperties(json, res);
6950    return res;
6951  }
6952
6953  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
6954    parseBackboneElementProperties(json, res);
6955    if (json.has("itemSequence"))
6956      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
6957    if (json.has("_itemSequence"))
6958      parseElementProperties(json.getAsJsonObject("_itemSequence"), res.getItemSequenceElement());
6959    if (json.has("detailSequence"))
6960      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
6961    if (json.has("_detailSequence"))
6962      parseElementProperties(json.getAsJsonObject("_detailSequence"), res.getDetailSequenceElement());
6963    if (json.has("subDetailSequence"))
6964      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
6965    if (json.has("_subDetailSequence"))
6966      parseElementProperties(json.getAsJsonObject("_subDetailSequence"), res.getSubDetailSequenceElement());
6967    if (json.has("code"))
6968      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6969  }
6970
6971  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
6972    ClinicalImpression res = new ClinicalImpression();
6973    parseClinicalImpressionProperties(json, res);
6974    return res;
6975  }
6976
6977  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
6978    parseDomainResourceProperties(json, res);
6979    if (json.has("identifier")) {
6980      JsonArray array = json.getAsJsonArray("identifier");
6981      for (int i = 0; i < array.size(); i++) {
6982        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6983      }
6984    };
6985    if (json.has("status"))
6986      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
6987    if (json.has("_status"))
6988      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6989    if (json.has("statusReason"))
6990      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
6991    if (json.has("description"))
6992      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6993    if (json.has("_description"))
6994      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6995    if (json.has("subject"))
6996      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6997    if (json.has("encounter"))
6998      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6999    DataType effective = parseType("effective", json);
7000    if (effective != null)
7001      res.setEffective(effective);
7002    if (json.has("date"))
7003      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7004    if (json.has("_date"))
7005      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7006    if (json.has("performer"))
7007      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
7008    if (json.has("previous"))
7009      res.setPrevious(parseReference(json.getAsJsonObject("previous")));
7010    if (json.has("problem")) {
7011      JsonArray array = json.getAsJsonArray("problem");
7012      for (int i = 0; i < array.size(); i++) {
7013        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
7014      }
7015    };
7016    if (json.has("protocol")) {
7017      JsonArray array = json.getAsJsonArray("protocol");
7018      for (int i = 0; i < array.size(); i++) {
7019        if (array.get(i).isJsonNull()) {
7020          res.getProtocol().add(new UriType());
7021        } else {;
7022          res.getProtocol().add(parseUri(array.get(i).getAsString()));
7023        }
7024      }
7025    };
7026    if (json.has("_protocol")) {
7027      JsonArray array = json.getAsJsonArray("_protocol");
7028      for (int i = 0; i < array.size(); i++) {
7029        if (i == res.getProtocol().size())
7030          res.getProtocol().add(parseUri(null));
7031        if (array.get(i) instanceof JsonObject) 
7032          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
7033      }
7034    };
7035    if (json.has("summary"))
7036      res.setSummaryElement(parseString(json.get("summary").getAsString()));
7037    if (json.has("_summary"))
7038      parseElementProperties(json.getAsJsonObject("_summary"), res.getSummaryElement());
7039    if (json.has("finding")) {
7040      JsonArray array = json.getAsJsonArray("finding");
7041      for (int i = 0; i < array.size(); i++) {
7042        res.getFinding().add(parseClinicalImpressionFindingComponent(array.get(i).getAsJsonObject()));
7043      }
7044    };
7045    if (json.has("prognosisCodeableConcept")) {
7046      JsonArray array = json.getAsJsonArray("prognosisCodeableConcept");
7047      for (int i = 0; i < array.size(); i++) {
7048        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7049      }
7050    };
7051    if (json.has("prognosisReference")) {
7052      JsonArray array = json.getAsJsonArray("prognosisReference");
7053      for (int i = 0; i < array.size(); i++) {
7054        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
7055      }
7056    };
7057    if (json.has("supportingInfo")) {
7058      JsonArray array = json.getAsJsonArray("supportingInfo");
7059      for (int i = 0; i < array.size(); i++) {
7060        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
7061      }
7062    };
7063    if (json.has("note")) {
7064      JsonArray array = json.getAsJsonArray("note");
7065      for (int i = 0; i < array.size(); i++) {
7066        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7067      }
7068    };
7069  }
7070
7071  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionFindingComponent(JsonObject json) throws IOException, FHIRFormatError {
7072    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
7073    parseClinicalImpressionFindingComponentProperties(json, res);
7074    return res;
7075  }
7076
7077  protected void parseClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
7078    parseBackboneElementProperties(json, res);
7079    if (json.has("item"))
7080      res.setItem(parseCodeableReference(json.getAsJsonObject("item")));
7081    if (json.has("basis"))
7082      res.setBasisElement(parseString(json.get("basis").getAsString()));
7083    if (json.has("_basis"))
7084      parseElementProperties(json.getAsJsonObject("_basis"), res.getBasisElement());
7085  }
7086
7087  protected ClinicalUseIssue parseClinicalUseIssue(JsonObject json) throws IOException, FHIRFormatError {
7088    ClinicalUseIssue res = new ClinicalUseIssue();
7089    parseClinicalUseIssueProperties(json, res);
7090    return res;
7091  }
7092
7093  protected void parseClinicalUseIssueProperties(JsonObject json, ClinicalUseIssue res) throws IOException, FHIRFormatError {
7094    parseDomainResourceProperties(json, res);
7095    if (json.has("identifier")) {
7096      JsonArray array = json.getAsJsonArray("identifier");
7097      for (int i = 0; i < array.size(); i++) {
7098        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7099      }
7100    };
7101    if (json.has("type"))
7102      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ClinicalUseIssue.ClinicalUseIssueType.NULL, new ClinicalUseIssue.ClinicalUseIssueTypeEnumFactory()));
7103    if (json.has("_type"))
7104      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
7105    if (json.has("subject")) {
7106      JsonArray array = json.getAsJsonArray("subject");
7107      for (int i = 0; i < array.size(); i++) {
7108        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
7109      }
7110    };
7111    if (json.has("status"))
7112      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
7113    if (json.has("description"))
7114      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
7115    if (json.has("_description"))
7116      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7117    if (json.has("contraindication"))
7118      res.setContraindication(parseClinicalUseIssueContraindicationComponent(json.getAsJsonObject("contraindication")));
7119    if (json.has("indication"))
7120      res.setIndication(parseClinicalUseIssueIndicationComponent(json.getAsJsonObject("indication")));
7121    if (json.has("interaction"))
7122      res.setInteraction(parseClinicalUseIssueInteractionComponent(json.getAsJsonObject("interaction")));
7123    if (json.has("population")) {
7124      JsonArray array = json.getAsJsonArray("population");
7125      for (int i = 0; i < array.size(); i++) {
7126        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
7127      }
7128    };
7129    if (json.has("undesirableEffect"))
7130      res.setUndesirableEffect(parseClinicalUseIssueUndesirableEffectComponent(json.getAsJsonObject("undesirableEffect")));
7131  }
7132
7133  protected ClinicalUseIssue.ClinicalUseIssueContraindicationComponent parseClinicalUseIssueContraindicationComponent(JsonObject json) throws IOException, FHIRFormatError {
7134    ClinicalUseIssue.ClinicalUseIssueContraindicationComponent res = new ClinicalUseIssue.ClinicalUseIssueContraindicationComponent();
7135    parseClinicalUseIssueContraindicationComponentProperties(json, res);
7136    return res;
7137  }
7138
7139  protected void parseClinicalUseIssueContraindicationComponentProperties(JsonObject json, ClinicalUseIssue.ClinicalUseIssueContraindicationComponent res) throws IOException, FHIRFormatError {
7140    parseBackboneElementProperties(json, res);
7141    if (json.has("diseaseSymptomProcedure"))
7142      res.setDiseaseSymptomProcedure(parseCodeableConcept(json.getAsJsonObject("diseaseSymptomProcedure")));
7143    if (json.has("diseaseStatus"))
7144      res.setDiseaseStatus(parseCodeableConcept(json.getAsJsonObject("diseaseStatus")));
7145    if (json.has("comorbidity")) {
7146      JsonArray array = json.getAsJsonArray("comorbidity");
7147      for (int i = 0; i < array.size(); i++) {
7148        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7149      }
7150    };
7151    if (json.has("indication")) {
7152      JsonArray array = json.getAsJsonArray("indication");
7153      for (int i = 0; i < array.size(); i++) {
7154        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
7155      }
7156    };
7157    if (json.has("otherTherapy")) {
7158      JsonArray array = json.getAsJsonArray("otherTherapy");
7159      for (int i = 0; i < array.size(); i++) {
7160        res.getOtherTherapy().add(parseClinicalUseIssueContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject()));
7161      }
7162    };
7163  }
7164
7165  protected ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent parseClinicalUseIssueContraindicationOtherTherapyComponent(JsonObject json) throws IOException, FHIRFormatError {
7166    ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent res = new ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent();
7167    parseClinicalUseIssueContraindicationOtherTherapyComponentProperties(json, res);
7168    return res;
7169  }
7170
7171  protected void parseClinicalUseIssueContraindicationOtherTherapyComponentProperties(JsonObject json, ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
7172    parseBackboneElementProperties(json, res);
7173    if (json.has("therapyRelationshipType"))
7174      res.setTherapyRelationshipType(parseCodeableConcept(json.getAsJsonObject("therapyRelationshipType")));
7175    DataType medication = parseType("medication", json);
7176    if (medication != null)
7177      res.setMedication(medication);
7178  }
7179
7180  protected ClinicalUseIssue.ClinicalUseIssueIndicationComponent parseClinicalUseIssueIndicationComponent(JsonObject json) throws IOException, FHIRFormatError {
7181    ClinicalUseIssue.ClinicalUseIssueIndicationComponent res = new ClinicalUseIssue.ClinicalUseIssueIndicationComponent();
7182    parseClinicalUseIssueIndicationComponentProperties(json, res);
7183    return res;
7184  }
7185
7186  protected void parseClinicalUseIssueIndicationComponentProperties(JsonObject json, ClinicalUseIssue.ClinicalUseIssueIndicationComponent res) throws IOException, FHIRFormatError {
7187    parseBackboneElementProperties(json, res);
7188    if (json.has("diseaseSymptomProcedure"))
7189      res.setDiseaseSymptomProcedure(parseCodeableConcept(json.getAsJsonObject("diseaseSymptomProcedure")));
7190    if (json.has("diseaseStatus"))
7191      res.setDiseaseStatus(parseCodeableConcept(json.getAsJsonObject("diseaseStatus")));
7192    if (json.has("comorbidity")) {
7193      JsonArray array = json.getAsJsonArray("comorbidity");
7194      for (int i = 0; i < array.size(); i++) {
7195        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7196      }
7197    };
7198    if (json.has("intendedEffect"))
7199      res.setIntendedEffect(parseCodeableConcept(json.getAsJsonObject("intendedEffect")));
7200    if (json.has("duration"))
7201      res.setDuration(parseQuantity(json.getAsJsonObject("duration")));
7202    if (json.has("undesirableEffect")) {
7203      JsonArray array = json.getAsJsonArray("undesirableEffect");
7204      for (int i = 0; i < array.size(); i++) {
7205        res.getUndesirableEffect().add(parseReference(array.get(i).getAsJsonObject()));
7206      }
7207    };
7208    if (json.has("otherTherapy")) {
7209      JsonArray array = json.getAsJsonArray("otherTherapy");
7210      for (int i = 0; i < array.size(); i++) {
7211        res.getOtherTherapy().add(parseClinicalUseIssueContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject()));
7212      }
7213    };
7214  }
7215
7216  protected ClinicalUseIssue.ClinicalUseIssueInteractionComponent parseClinicalUseIssueInteractionComponent(JsonObject json) throws IOException, FHIRFormatError {
7217    ClinicalUseIssue.ClinicalUseIssueInteractionComponent res = new ClinicalUseIssue.ClinicalUseIssueInteractionComponent();
7218    parseClinicalUseIssueInteractionComponentProperties(json, res);
7219    return res;
7220  }
7221
7222  protected void parseClinicalUseIssueInteractionComponentProperties(JsonObject json, ClinicalUseIssue.ClinicalUseIssueInteractionComponent res) throws IOException, FHIRFormatError {
7223    parseBackboneElementProperties(json, res);
7224    if (json.has("interactant")) {
7225      JsonArray array = json.getAsJsonArray("interactant");
7226      for (int i = 0; i < array.size(); i++) {
7227        res.getInteractant().add(parseClinicalUseIssueInteractionInteractantComponent(array.get(i).getAsJsonObject()));
7228      }
7229    };
7230    if (json.has("type"))
7231      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7232    if (json.has("effect"))
7233      res.setEffect(parseCodeableConcept(json.getAsJsonObject("effect")));
7234    if (json.has("incidence"))
7235      res.setIncidence(parseCodeableConcept(json.getAsJsonObject("incidence")));
7236    if (json.has("management"))
7237      res.setManagement(parseCodeableConcept(json.getAsJsonObject("management")));
7238  }
7239
7240  protected ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent parseClinicalUseIssueInteractionInteractantComponent(JsonObject json) throws IOException, FHIRFormatError {
7241    ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent res = new ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent();
7242    parseClinicalUseIssueInteractionInteractantComponentProperties(json, res);
7243    return res;
7244  }
7245
7246  protected void parseClinicalUseIssueInteractionInteractantComponentProperties(JsonObject json, ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent res) throws IOException, FHIRFormatError {
7247    parseBackboneElementProperties(json, res);
7248    DataType item = parseType("item", json);
7249    if (item != null)
7250      res.setItem(item);
7251  }
7252
7253  protected ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent parseClinicalUseIssueUndesirableEffectComponent(JsonObject json) throws IOException, FHIRFormatError {
7254    ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent res = new ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent();
7255    parseClinicalUseIssueUndesirableEffectComponentProperties(json, res);
7256    return res;
7257  }
7258
7259  protected void parseClinicalUseIssueUndesirableEffectComponentProperties(JsonObject json, ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent res) throws IOException, FHIRFormatError {
7260    parseBackboneElementProperties(json, res);
7261    if (json.has("symptomConditionEffect"))
7262      res.setSymptomConditionEffect(parseCodeableConcept(json.getAsJsonObject("symptomConditionEffect")));
7263    if (json.has("classification"))
7264      res.setClassification(parseCodeableConcept(json.getAsJsonObject("classification")));
7265    if (json.has("frequencyOfOccurrence"))
7266      res.setFrequencyOfOccurrence(parseCodeableConcept(json.getAsJsonObject("frequencyOfOccurrence")));
7267  }
7268
7269  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
7270    CodeSystem res = new CodeSystem();
7271    parseCodeSystemProperties(json, res);
7272    return res;
7273  }
7274
7275  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
7276    parseCanonicalResourceProperties(json, res);
7277    if (json.has("url"))
7278      res.setUrlElement(parseUri(json.get("url").getAsString()));
7279    if (json.has("_url"))
7280      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7281    if (json.has("identifier")) {
7282      JsonArray array = json.getAsJsonArray("identifier");
7283      for (int i = 0; i < array.size(); i++) {
7284        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7285      }
7286    };
7287    if (json.has("version"))
7288      res.setVersionElement(parseString(json.get("version").getAsString()));
7289    if (json.has("_version"))
7290      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
7291    if (json.has("name"))
7292      res.setNameElement(parseString(json.get("name").getAsString()));
7293    if (json.has("_name"))
7294      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7295    if (json.has("title"))
7296      res.setTitleElement(parseString(json.get("title").getAsString()));
7297    if (json.has("_title"))
7298      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
7299    if (json.has("status"))
7300      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
7301    if (json.has("_status"))
7302      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7303    if (json.has("experimental"))
7304      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
7305    if (json.has("_experimental"))
7306      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
7307    if (json.has("date"))
7308      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7309    if (json.has("_date"))
7310      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7311    if (json.has("publisher"))
7312      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7313    if (json.has("_publisher"))
7314      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
7315    if (json.has("contact")) {
7316      JsonArray array = json.getAsJsonArray("contact");
7317      for (int i = 0; i < array.size(); i++) {
7318        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
7319      }
7320    };
7321    if (json.has("description"))
7322      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
7323    if (json.has("_description"))
7324      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7325    if (json.has("useContext")) {
7326      JsonArray array = json.getAsJsonArray("useContext");
7327      for (int i = 0; i < array.size(); i++) {
7328        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
7329      }
7330    };
7331    if (json.has("jurisdiction")) {
7332      JsonArray array = json.getAsJsonArray("jurisdiction");
7333      for (int i = 0; i < array.size(); i++) {
7334        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7335      }
7336    };
7337    if (json.has("purpose"))
7338      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
7339    if (json.has("_purpose"))
7340      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
7341    if (json.has("copyright"))
7342      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
7343    if (json.has("_copyright"))
7344      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
7345    if (json.has("caseSensitive"))
7346      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
7347    if (json.has("_caseSensitive"))
7348      parseElementProperties(json.getAsJsonObject("_caseSensitive"), res.getCaseSensitiveElement());
7349    if (json.has("valueSet"))
7350      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
7351    if (json.has("_valueSet"))
7352      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
7353    if (json.has("hierarchyMeaning"))
7354      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
7355    if (json.has("_hierarchyMeaning"))
7356      parseElementProperties(json.getAsJsonObject("_hierarchyMeaning"), res.getHierarchyMeaningElement());
7357    if (json.has("compositional"))
7358      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
7359    if (json.has("_compositional"))
7360      parseElementProperties(json.getAsJsonObject("_compositional"), res.getCompositionalElement());
7361    if (json.has("versionNeeded"))
7362      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
7363    if (json.has("_versionNeeded"))
7364      parseElementProperties(json.getAsJsonObject("_versionNeeded"), res.getVersionNeededElement());
7365    if (json.has("content"))
7366      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
7367    if (json.has("_content"))
7368      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
7369    if (json.has("supplements"))
7370      res.setSupplementsElement(parseCanonical(json.get("supplements").getAsString()));
7371    if (json.has("_supplements"))
7372      parseElementProperties(json.getAsJsonObject("_supplements"), res.getSupplementsElement());
7373    if (json.has("count"))
7374      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
7375    if (json.has("_count"))
7376      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
7377    if (json.has("filter")) {
7378      JsonArray array = json.getAsJsonArray("filter");
7379      for (int i = 0; i < array.size(); i++) {
7380        res.getFilter().add(parseCodeSystemFilterComponent(array.get(i).getAsJsonObject()));
7381      }
7382    };
7383    if (json.has("property")) {
7384      JsonArray array = json.getAsJsonArray("property");
7385      for (int i = 0; i < array.size(); i++) {
7386        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject()));
7387      }
7388    };
7389    if (json.has("concept")) {
7390      JsonArray array = json.getAsJsonArray("concept");
7391      for (int i = 0; i < array.size(); i++) {
7392        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject()));
7393      }
7394    };
7395  }
7396
7397  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
7398    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
7399    parseCodeSystemFilterComponentProperties(json, res);
7400    return res;
7401  }
7402
7403  protected void parseCodeSystemFilterComponentProperties(JsonObject json, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
7404    parseBackboneElementProperties(json, res);
7405    if (json.has("code"))
7406      res.setCodeElement(parseCode(json.get("code").getAsString()));
7407    if (json.has("_code"))
7408      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7409    if (json.has("description"))
7410      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7411    if (json.has("_description"))
7412      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7413    if (json.has("operator")) {
7414      JsonArray array = json.getAsJsonArray("operator");
7415      for (int i = 0; i < array.size(); i++) {
7416        if (array.get(i).isJsonNull()) {
7417          res.getOperator().add(new Enumeration<Enumerations.FilterOperator>(new Enumerations.FilterOperatorEnumFactory(), Enumerations.FilterOperator.NULL));
7418        } else {;
7419          res.getOperator().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FilterOperator.NULL, new Enumerations.FilterOperatorEnumFactory()));
7420        }
7421      }
7422    };
7423    if (json.has("_operator")) {
7424      JsonArray array = json.getAsJsonArray("_operator");
7425      for (int i = 0; i < array.size(); i++) {
7426        if (i == res.getOperator().size())
7427          res.getOperator().add(parseEnumeration(null, Enumerations.FilterOperator.NULL, new Enumerations.FilterOperatorEnumFactory()));
7428        if (array.get(i) instanceof JsonObject) 
7429          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
7430      }
7431    };
7432    if (json.has("value"))
7433      res.setValueElement(parseString(json.get("value").getAsString()));
7434    if (json.has("_value"))
7435      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
7436  }
7437
7438  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
7439    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
7440    parseCodeSystemPropertyComponentProperties(json, res);
7441    return res;
7442  }
7443
7444  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
7445    parseBackboneElementProperties(json, res);
7446    if (json.has("code"))
7447      res.setCodeElement(parseCode(json.get("code").getAsString()));
7448    if (json.has("_code"))
7449      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7450    if (json.has("uri"))
7451      res.setUriElement(parseUri(json.get("uri").getAsString()));
7452    if (json.has("_uri"))
7453      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
7454    if (json.has("description"))
7455      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7456    if (json.has("_description"))
7457      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7458    if (json.has("type"))
7459      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
7460    if (json.has("_type"))
7461      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
7462  }
7463
7464  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json) throws IOException, FHIRFormatError {
7465    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
7466    parseCodeSystemConceptDefinitionComponentProperties(json, res);
7467    return res;
7468  }
7469
7470  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
7471    parseBackboneElementProperties(json, res);
7472    if (json.has("code"))
7473      res.setCodeElement(parseCode(json.get("code").getAsString()));
7474    if (json.has("_code"))
7475      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7476    if (json.has("display"))
7477      res.setDisplayElement(parseString(json.get("display").getAsString()));
7478    if (json.has("_display"))
7479      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
7480    if (json.has("definition"))
7481      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
7482    if (json.has("_definition"))
7483      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
7484    if (json.has("designation")) {
7485      JsonArray array = json.getAsJsonArray("designation");
7486      for (int i = 0; i < array.size(); i++) {
7487        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject()));
7488      }
7489    };
7490    if (json.has("property")) {
7491      JsonArray array = json.getAsJsonArray("property");
7492      for (int i = 0; i < array.size(); i++) {
7493        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject()));
7494      }
7495    };
7496    if (json.has("concept")) {
7497      JsonArray array = json.getAsJsonArray("concept");
7498      for (int i = 0; i < array.size(); i++) {
7499        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject()));
7500      }
7501    };
7502  }
7503
7504  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json) throws IOException, FHIRFormatError {
7505    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
7506    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, res);
7507    return res;
7508  }
7509
7510  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
7511    parseBackboneElementProperties(json, res);
7512    if (json.has("language"))
7513      res.setLanguageElement(parseCode(json.get("language").getAsString()));
7514    if (json.has("_language"))
7515      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
7516    if (json.has("use"))
7517      res.setUse(parseCoding(json.getAsJsonObject("use")));
7518    if (json.has("value"))
7519      res.setValueElement(parseString(json.get("value").getAsString()));
7520    if (json.has("_value"))
7521      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
7522  }
7523
7524  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
7525    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
7526    parseCodeSystemConceptPropertyComponentProperties(json, res);
7527    return res;
7528  }
7529
7530  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
7531    parseBackboneElementProperties(json, res);
7532    if (json.has("code"))
7533      res.setCodeElement(parseCode(json.get("code").getAsString()));
7534    if (json.has("_code"))
7535      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7536    DataType value = parseType("value", json);
7537    if (value != null)
7538      res.setValue(value);
7539  }
7540
7541  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
7542    Communication res = new Communication();
7543    parseCommunicationProperties(json, res);
7544    return res;
7545  }
7546
7547  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
7548    parseDomainResourceProperties(json, res);
7549    if (json.has("identifier")) {
7550      JsonArray array = json.getAsJsonArray("identifier");
7551      for (int i = 0; i < array.size(); i++) {
7552        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7553      }
7554    };
7555    if (json.has("instantiatesCanonical")) {
7556      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
7557      for (int i = 0; i < array.size(); i++) {
7558        if (array.get(i).isJsonNull()) {
7559          res.getInstantiatesCanonical().add(new CanonicalType());
7560        } else {;
7561          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
7562        }
7563      }
7564    };
7565    if (json.has("_instantiatesCanonical")) {
7566      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
7567      for (int i = 0; i < array.size(); i++) {
7568        if (i == res.getInstantiatesCanonical().size())
7569          res.getInstantiatesCanonical().add(parseCanonical(null));
7570        if (array.get(i) instanceof JsonObject) 
7571          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
7572      }
7573    };
7574    if (json.has("instantiatesUri")) {
7575      JsonArray array = json.getAsJsonArray("instantiatesUri");
7576      for (int i = 0; i < array.size(); i++) {
7577        if (array.get(i).isJsonNull()) {
7578          res.getInstantiatesUri().add(new UriType());
7579        } else {;
7580          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
7581        }
7582      }
7583    };
7584    if (json.has("_instantiatesUri")) {
7585      JsonArray array = json.getAsJsonArray("_instantiatesUri");
7586      for (int i = 0; i < array.size(); i++) {
7587        if (i == res.getInstantiatesUri().size())
7588          res.getInstantiatesUri().add(parseUri(null));
7589        if (array.get(i) instanceof JsonObject) 
7590          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
7591      }
7592    };
7593    if (json.has("basedOn")) {
7594      JsonArray array = json.getAsJsonArray("basedOn");
7595      for (int i = 0; i < array.size(); i++) {
7596        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7597      }
7598    };
7599    if (json.has("partOf")) {
7600      JsonArray array = json.getAsJsonArray("partOf");
7601      for (int i = 0; i < array.size(); i++) {
7602        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
7603      }
7604    };
7605    if (json.has("inResponseTo")) {
7606      JsonArray array = json.getAsJsonArray("inResponseTo");
7607      for (int i = 0; i < array.size(); i++) {
7608        res.getInResponseTo().add(parseReference(array.get(i).getAsJsonObject()));
7609      }
7610    };
7611    if (json.has("status"))
7612      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
7613    if (json.has("_status"))
7614      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7615    if (json.has("statusReason"))
7616      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
7617    if (json.has("category")) {
7618      JsonArray array = json.getAsJsonArray("category");
7619      for (int i = 0; i < array.size(); i++) {
7620        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7621      }
7622    };
7623    if (json.has("priority"))
7624      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
7625    if (json.has("_priority"))
7626      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
7627    if (json.has("medium")) {
7628      JsonArray array = json.getAsJsonArray("medium");
7629      for (int i = 0; i < array.size(); i++) {
7630        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7631      }
7632    };
7633    if (json.has("subject"))
7634      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7635    if (json.has("topic"))
7636      res.setTopic(parseCodeableConcept(json.getAsJsonObject("topic")));
7637    if (json.has("about")) {
7638      JsonArray array = json.getAsJsonArray("about");
7639      for (int i = 0; i < array.size(); i++) {
7640        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
7641      }
7642    };
7643    if (json.has("encounter"))
7644      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7645    if (json.has("sent"))
7646      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
7647    if (json.has("_sent"))
7648      parseElementProperties(json.getAsJsonObject("_sent"), res.getSentElement());
7649    if (json.has("received"))
7650      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
7651    if (json.has("_received"))
7652      parseElementProperties(json.getAsJsonObject("_received"), res.getReceivedElement());
7653    if (json.has("recipient")) {
7654      JsonArray array = json.getAsJsonArray("recipient");
7655      for (int i = 0; i < array.size(); i++) {
7656        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
7657      }
7658    };
7659    if (json.has("sender"))
7660      res.setSender(parseReference(json.getAsJsonObject("sender")));
7661    if (json.has("reason")) {
7662      JsonArray array = json.getAsJsonArray("reason");
7663      for (int i = 0; i < array.size(); i++) {
7664        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
7665      }
7666    };
7667    if (json.has("payload")) {
7668      JsonArray array = json.getAsJsonArray("payload");
7669      for (int i = 0; i < array.size(); i++) {
7670        res.getPayload().add(parseCommunicationPayloadComponent(array.get(i).getAsJsonObject()));
7671      }
7672    };
7673    if (json.has("note")) {
7674      JsonArray array = json.getAsJsonArray("note");
7675      for (int i = 0; i < array.size(); i++) {
7676        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7677      }
7678    };
7679  }
7680
7681  protected Communication.CommunicationPayloadComponent parseCommunicationPayloadComponent(JsonObject json) throws IOException, FHIRFormatError {
7682    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
7683    parseCommunicationPayloadComponentProperties(json, res);
7684    return res;
7685  }
7686
7687  protected void parseCommunicationPayloadComponentProperties(JsonObject json, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
7688    parseBackboneElementProperties(json, res);
7689    DataType content = parseType("content", json);
7690    if (content != null)
7691      res.setContent(content);
7692  }
7693
7694  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
7695    CommunicationRequest res = new CommunicationRequest();
7696    parseCommunicationRequestProperties(json, res);
7697    return res;
7698  }
7699
7700  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
7701    parseDomainResourceProperties(json, res);
7702    if (json.has("identifier")) {
7703      JsonArray array = json.getAsJsonArray("identifier");
7704      for (int i = 0; i < array.size(); i++) {
7705        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7706      }
7707    };
7708    if (json.has("basedOn")) {
7709      JsonArray array = json.getAsJsonArray("basedOn");
7710      for (int i = 0; i < array.size(); i++) {
7711        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7712      }
7713    };
7714    if (json.has("replaces")) {
7715      JsonArray array = json.getAsJsonArray("replaces");
7716      for (int i = 0; i < array.size(); i++) {
7717        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
7718      }
7719    };
7720    if (json.has("groupIdentifier"))
7721      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
7722    if (json.has("status"))
7723      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
7724    if (json.has("_status"))
7725      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7726    if (json.has("statusReason"))
7727      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
7728    if (json.has("category")) {
7729      JsonArray array = json.getAsJsonArray("category");
7730      for (int i = 0; i < array.size(); i++) {
7731        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7732      }
7733    };
7734    if (json.has("priority"))
7735      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
7736    if (json.has("_priority"))
7737      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
7738    if (json.has("doNotPerform"))
7739      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
7740    if (json.has("_doNotPerform"))
7741      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
7742    if (json.has("medium")) {
7743      JsonArray array = json.getAsJsonArray("medium");
7744      for (int i = 0; i < array.size(); i++) {
7745        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7746      }
7747    };
7748    if (json.has("subject"))
7749      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7750    if (json.has("about")) {
7751      JsonArray array = json.getAsJsonArray("about");
7752      for (int i = 0; i < array.size(); i++) {
7753        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
7754      }
7755    };
7756    if (json.has("encounter"))
7757      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7758    if (json.has("payload")) {
7759      JsonArray array = json.getAsJsonArray("payload");
7760      for (int i = 0; i < array.size(); i++) {
7761        res.getPayload().add(parseCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject()));
7762      }
7763    };
7764    DataType occurrence = parseType("occurrence", json);
7765    if (occurrence != null)
7766      res.setOccurrence(occurrence);
7767    if (json.has("authoredOn"))
7768      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
7769    if (json.has("_authoredOn"))
7770      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
7771    if (json.has("requester"))
7772      res.setRequester(parseReference(json.getAsJsonObject("requester")));
7773    if (json.has("recipient")) {
7774      JsonArray array = json.getAsJsonArray("recipient");
7775      for (int i = 0; i < array.size(); i++) {
7776        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
7777      }
7778    };
7779    if (json.has("informationProvider")) {
7780      JsonArray array = json.getAsJsonArray("informationProvider");
7781      for (int i = 0; i < array.size(); i++) {
7782        res.getInformationProvider().add(parseReference(array.get(i).getAsJsonObject()));
7783      }
7784    };
7785    if (json.has("reason")) {
7786      JsonArray array = json.getAsJsonArray("reason");
7787      for (int i = 0; i < array.size(); i++) {
7788        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
7789      }
7790    };
7791    if (json.has("note")) {
7792      JsonArray array = json.getAsJsonArray("note");
7793      for (int i = 0; i < array.size(); i++) {
7794        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7795      }
7796    };
7797  }
7798
7799  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestPayloadComponent(JsonObject json) throws IOException, FHIRFormatError {
7800    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
7801    parseCommunicationRequestPayloadComponentProperties(json, res);
7802    return res;
7803  }
7804
7805  protected void parseCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
7806    parseBackboneElementProperties(json, res);
7807    DataType content = parseType("content", json);
7808    if (content != null)
7809      res.setContent(content);
7810  }
7811
7812  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
7813    CompartmentDefinition res = new CompartmentDefinition();
7814    parseCompartmentDefinitionProperties(json, res);
7815    return res;
7816  }
7817
7818  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
7819    parseCanonicalResourceProperties(json, res);
7820    if (json.has("url"))
7821      res.setUrlElement(parseUri(json.get("url").getAsString()));
7822    if (json.has("_url"))
7823      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7824    if (json.has("version"))
7825      res.setVersionElement(parseString(json.get("version").getAsString()));
7826    if (json.has("_version"))
7827      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
7828    if (json.has("name"))
7829      res.setNameElement(parseString(json.get("name").getAsString()));
7830    if (json.has("_name"))
7831      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7832    if (json.has("status"))
7833      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
7834    if (json.has("_status"))
7835      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7836    if (json.has("experimental"))
7837      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
7838    if (json.has("_experimental"))
7839      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
7840    if (json.has("date"))
7841      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7842    if (json.has("_date"))
7843      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7844    if (json.has("publisher"))
7845      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7846    if (json.has("_publisher"))
7847      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
7848    if (json.has("contact")) {
7849      JsonArray array = json.getAsJsonArray("contact");
7850      for (int i = 0; i < array.size(); i++) {
7851        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
7852      }
7853    };
7854    if (json.has("description"))
7855      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
7856    if (json.has("_description"))
7857      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7858    if (json.has("useContext")) {
7859      JsonArray array = json.getAsJsonArray("useContext");
7860      for (int i = 0; i < array.size(); i++) {
7861        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
7862      }
7863    };
7864    if (json.has("purpose"))
7865      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
7866    if (json.has("_purpose"))
7867      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
7868    if (json.has("code"))
7869      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Enumerations.CompartmentType.NULL, new Enumerations.CompartmentTypeEnumFactory()));
7870    if (json.has("_code"))
7871      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7872    if (json.has("search"))
7873      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
7874    if (json.has("_search"))
7875      parseElementProperties(json.getAsJsonObject("_search"), res.getSearchElement());
7876    if (json.has("resource")) {
7877      JsonArray array = json.getAsJsonArray("resource");
7878      for (int i = 0; i < array.size(); i++) {
7879        res.getResource().add(parseCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject()));
7880      }
7881    };
7882  }
7883
7884  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
7885    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
7886    parseCompartmentDefinitionResourceComponentProperties(json, res);
7887    return res;
7888  }
7889
7890  protected void parseCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
7891    parseBackboneElementProperties(json, res);
7892    if (json.has("code"))
7893      res.setCodeElement(parseCode(json.get("code").getAsString()));
7894    if (json.has("_code"))
7895      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7896    if (json.has("param")) {
7897      JsonArray array = json.getAsJsonArray("param");
7898      for (int i = 0; i < array.size(); i++) {
7899        if (array.get(i).isJsonNull()) {
7900          res.getParam().add(new StringType());
7901        } else {;
7902          res.getParam().add(parseString(array.get(i).getAsString()));
7903        }
7904      }
7905    };
7906    if (json.has("_param")) {
7907      JsonArray array = json.getAsJsonArray("_param");
7908      for (int i = 0; i < array.size(); i++) {
7909        if (i == res.getParam().size())
7910          res.getParam().add(parseString(null));
7911        if (array.get(i) instanceof JsonObject) 
7912          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
7913      }
7914    };
7915    if (json.has("documentation"))
7916      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
7917    if (json.has("_documentation"))
7918      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
7919  }
7920
7921  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
7922    Composition res = new Composition();
7923    parseCompositionProperties(json, res);
7924    return res;
7925  }
7926
7927  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
7928    parseDomainResourceProperties(json, res);
7929    if (json.has("identifier"))
7930      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7931    if (json.has("status"))
7932      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.CompositionStatus.NULL, new Enumerations.CompositionStatusEnumFactory()));
7933    if (json.has("_status"))
7934      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7935    if (json.has("type"))
7936      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7937    if (json.has("category")) {
7938      JsonArray array = json.getAsJsonArray("category");
7939      for (int i = 0; i < array.size(); i++) {
7940        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7941      }
7942    };
7943    if (json.has("subject"))
7944      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7945    if (json.has("encounter"))
7946      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7947    if (json.has("date"))
7948      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7949    if (json.has("_date"))
7950      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7951    if (json.has("author")) {
7952      JsonArray array = json.getAsJsonArray("author");
7953      for (int i = 0; i < array.size(); i++) {
7954        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
7955      }
7956    };
7957    if (json.has("title"))
7958      res.setTitleElement(parseString(json.get("title").getAsString()));
7959    if (json.has("_title"))
7960      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
7961    if (json.has("confidentiality"))
7962      res.setConfidentialityElement(parseEnumeration(json.get("confidentiality").getAsString(), Composition.V3ConfidentialityClassification.NULL, new Composition.V3ConfidentialityClassificationEnumFactory()));
7963    if (json.has("_confidentiality"))
7964      parseElementProperties(json.getAsJsonObject("_confidentiality"), res.getConfidentialityElement());
7965    if (json.has("attester")) {
7966      JsonArray array = json.getAsJsonArray("attester");
7967      for (int i = 0; i < array.size(); i++) {
7968        res.getAttester().add(parseCompositionAttesterComponent(array.get(i).getAsJsonObject()));
7969      }
7970    };
7971    if (json.has("custodian"))
7972      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
7973    if (json.has("relatesTo")) {
7974      JsonArray array = json.getAsJsonArray("relatesTo");
7975      for (int i = 0; i < array.size(); i++) {
7976        res.getRelatesTo().add(parseCompositionRelatesToComponent(array.get(i).getAsJsonObject()));
7977      }
7978    };
7979    if (json.has("event")) {
7980      JsonArray array = json.getAsJsonArray("event");
7981      for (int i = 0; i < array.size(); i++) {
7982        res.getEvent().add(parseCompositionEventComponent(array.get(i).getAsJsonObject()));
7983      }
7984    };
7985    if (json.has("section")) {
7986      JsonArray array = json.getAsJsonArray("section");
7987      for (int i = 0; i < array.size(); i++) {
7988        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject()));
7989      }
7990    };
7991  }
7992
7993  protected Composition.CompositionAttesterComponent parseCompositionAttesterComponent(JsonObject json) throws IOException, FHIRFormatError {
7994    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
7995    parseCompositionAttesterComponentProperties(json, res);
7996    return res;
7997  }
7998
7999  protected void parseCompositionAttesterComponentProperties(JsonObject json, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
8000    parseBackboneElementProperties(json, res);
8001    if (json.has("mode"))
8002      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
8003    if (json.has("_mode"))
8004      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
8005    if (json.has("time"))
8006      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
8007    if (json.has("_time"))
8008      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
8009    if (json.has("party"))
8010      res.setParty(parseReference(json.getAsJsonObject("party")));
8011  }
8012
8013  protected Composition.CompositionRelatesToComponent parseCompositionRelatesToComponent(JsonObject json) throws IOException, FHIRFormatError {
8014    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
8015    parseCompositionRelatesToComponentProperties(json, res);
8016    return res;
8017  }
8018
8019  protected void parseCompositionRelatesToComponentProperties(JsonObject json, Composition.CompositionRelatesToComponent res) throws IOException, FHIRFormatError {
8020    parseBackboneElementProperties(json, res);
8021    if (json.has("code"))
8022      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Enumerations.DocumentRelationshipType.NULL, new Enumerations.DocumentRelationshipTypeEnumFactory()));
8023    if (json.has("_code"))
8024      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
8025    DataType target = parseType("target", json);
8026    if (target != null)
8027      res.setTarget(target);
8028  }
8029
8030  protected Composition.CompositionEventComponent parseCompositionEventComponent(JsonObject json) throws IOException, FHIRFormatError {
8031    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
8032    parseCompositionEventComponentProperties(json, res);
8033    return res;
8034  }
8035
8036  protected void parseCompositionEventComponentProperties(JsonObject json, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
8037    parseBackboneElementProperties(json, res);
8038    if (json.has("code")) {
8039      JsonArray array = json.getAsJsonArray("code");
8040      for (int i = 0; i < array.size(); i++) {
8041        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8042      }
8043    };
8044    if (json.has("period"))
8045      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8046    if (json.has("detail")) {
8047      JsonArray array = json.getAsJsonArray("detail");
8048      for (int i = 0; i < array.size(); i++) {
8049        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8050      }
8051    };
8052  }
8053
8054  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json) throws IOException, FHIRFormatError {
8055    Composition.SectionComponent res = new Composition.SectionComponent();
8056    parseCompositionSectionComponentProperties(json, res);
8057    return res;
8058  }
8059
8060  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition.SectionComponent res) throws IOException, FHIRFormatError {
8061    parseBackboneElementProperties(json, res);
8062    if (json.has("title"))
8063      res.setTitleElement(parseString(json.get("title").getAsString()));
8064    if (json.has("_title"))
8065      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
8066    if (json.has("code"))
8067      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8068    if (json.has("author")) {
8069      JsonArray array = json.getAsJsonArray("author");
8070      for (int i = 0; i < array.size(); i++) {
8071        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
8072      }
8073    };
8074    if (json.has("focus"))
8075      res.setFocus(parseReference(json.getAsJsonObject("focus")));
8076    if (json.has("text"))
8077      res.setText(parseNarrative(json.getAsJsonObject("text")));
8078    if (json.has("mode"))
8079      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Enumerations.ListMode.NULL, new Enumerations.ListModeEnumFactory()));
8080    if (json.has("_mode"))
8081      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
8082    if (json.has("orderedBy"))
8083      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
8084    if (json.has("entry")) {
8085      JsonArray array = json.getAsJsonArray("entry");
8086      for (int i = 0; i < array.size(); i++) {
8087        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
8088      }
8089    };
8090    if (json.has("emptyReason"))
8091      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
8092    if (json.has("section")) {
8093      JsonArray array = json.getAsJsonArray("section");
8094      for (int i = 0; i < array.size(); i++) {
8095        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject()));
8096      }
8097    };
8098  }
8099
8100  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
8101    ConceptMap res = new ConceptMap();
8102    parseConceptMapProperties(json, res);
8103    return res;
8104  }
8105
8106  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
8107    parseCanonicalResourceProperties(json, res);
8108    if (json.has("url"))
8109      res.setUrlElement(parseUri(json.get("url").getAsString()));
8110    if (json.has("_url"))
8111      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8112    if (json.has("identifier"))
8113      res.addIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
8114    if (json.has("version"))
8115      res.setVersionElement(parseString(json.get("version").getAsString()));
8116    if (json.has("_version"))
8117      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
8118    if (json.has("name"))
8119      res.setNameElement(parseString(json.get("name").getAsString()));
8120    if (json.has("_name"))
8121      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8122    if (json.has("title"))
8123      res.setTitleElement(parseString(json.get("title").getAsString()));
8124    if (json.has("_title"))
8125      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
8126    if (json.has("status"))
8127      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
8128    if (json.has("_status"))
8129      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8130    if (json.has("experimental"))
8131      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
8132    if (json.has("_experimental"))
8133      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
8134    if (json.has("date"))
8135      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8136    if (json.has("_date"))
8137      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8138    if (json.has("publisher"))
8139      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
8140    if (json.has("_publisher"))
8141      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
8142    if (json.has("contact")) {
8143      JsonArray array = json.getAsJsonArray("contact");
8144      for (int i = 0; i < array.size(); i++) {
8145        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
8146      }
8147    };
8148    if (json.has("description"))
8149      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
8150    if (json.has("_description"))
8151      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8152    if (json.has("useContext")) {
8153      JsonArray array = json.getAsJsonArray("useContext");
8154      for (int i = 0; i < array.size(); i++) {
8155        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
8156      }
8157    };
8158    if (json.has("jurisdiction")) {
8159      JsonArray array = json.getAsJsonArray("jurisdiction");
8160      for (int i = 0; i < array.size(); i++) {
8161        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8162      }
8163    };
8164    if (json.has("purpose"))
8165      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
8166    if (json.has("_purpose"))
8167      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
8168    if (json.has("copyright"))
8169      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
8170    if (json.has("_copyright"))
8171      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
8172    DataType source = parseType("source", json);
8173    if (source != null)
8174      res.setSource(source);
8175    DataType target = parseType("target", json);
8176    if (target != null)
8177      res.setTarget(target);
8178    if (json.has("group")) {
8179      JsonArray array = json.getAsJsonArray("group");
8180      for (int i = 0; i < array.size(); i++) {
8181        res.getGroup().add(parseConceptMapGroupComponent(array.get(i).getAsJsonObject()));
8182      }
8183    };
8184  }
8185
8186  protected ConceptMap.ConceptMapGroupComponent parseConceptMapGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
8187    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
8188    parseConceptMapGroupComponentProperties(json, res);
8189    return res;
8190  }
8191
8192  protected void parseConceptMapGroupComponentProperties(JsonObject json, ConceptMap.ConceptMapGroupComponent res) throws IOException, FHIRFormatError {
8193    parseBackboneElementProperties(json, res);
8194    if (json.has("source"))
8195      res.setSourceElement(parseUri(json.get("source").getAsString()));
8196    if (json.has("_source"))
8197      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
8198    if (json.has("sourceVersion"))
8199      res.setSourceVersionElement(parseString(json.get("sourceVersion").getAsString()));
8200    if (json.has("_sourceVersion"))
8201      parseElementProperties(json.getAsJsonObject("_sourceVersion"), res.getSourceVersionElement());
8202    if (json.has("target"))
8203      res.setTargetElement(parseUri(json.get("target").getAsString()));
8204    if (json.has("_target"))
8205      parseElementProperties(json.getAsJsonObject("_target"), res.getTargetElement());
8206    if (json.has("targetVersion"))
8207      res.setTargetVersionElement(parseString(json.get("targetVersion").getAsString()));
8208    if (json.has("_targetVersion"))
8209      parseElementProperties(json.getAsJsonObject("_targetVersion"), res.getTargetVersionElement());
8210    if (json.has("element")) {
8211      JsonArray array = json.getAsJsonArray("element");
8212      for (int i = 0; i < array.size(); i++) {
8213        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject()));
8214      }
8215    };
8216    if (json.has("unmapped"))
8217      res.setUnmapped(parseConceptMapGroupUnmappedComponent(json.getAsJsonObject("unmapped")));
8218  }
8219
8220  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json) throws IOException, FHIRFormatError {
8221    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
8222    parseConceptMapSourceElementComponentProperties(json, res);
8223    return res;
8224  }
8225
8226  protected void parseConceptMapSourceElementComponentProperties(JsonObject json, ConceptMap.SourceElementComponent res) throws IOException, FHIRFormatError {
8227    parseBackboneElementProperties(json, res);
8228    if (json.has("code"))
8229      res.setCodeElement(parseCode(json.get("code").getAsString()));
8230    if (json.has("_code"))
8231      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
8232    if (json.has("display"))
8233      res.setDisplayElement(parseString(json.get("display").getAsString()));
8234    if (json.has("_display"))
8235      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
8236    if (json.has("noMap"))
8237      res.setNoMapElement(parseBoolean(json.get("noMap").getAsBoolean()));
8238    if (json.has("_noMap"))
8239      parseElementProperties(json.getAsJsonObject("_noMap"), res.getNoMapElement());
8240    if (json.has("target")) {
8241      JsonArray array = json.getAsJsonArray("target");
8242      for (int i = 0; i < array.size(); i++) {
8243        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject()));
8244      }
8245    };
8246  }
8247
8248  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json) throws IOException, FHIRFormatError {
8249    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
8250    parseConceptMapTargetElementComponentProperties(json, res);
8251    return res;
8252  }
8253
8254  protected void parseConceptMapTargetElementComponentProperties(JsonObject json, ConceptMap.TargetElementComponent res) throws IOException, FHIRFormatError {
8255    parseBackboneElementProperties(json, res);
8256    if (json.has("code"))
8257      res.setCodeElement(parseCode(json.get("code").getAsString()));
8258    if (json.has("_code"))
8259      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
8260    if (json.has("display"))
8261      res.setDisplayElement(parseString(json.get("display").getAsString()));
8262    if (json.has("_display"))
8263      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
8264    if (json.has("relationship"))
8265      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), Enumerations.ConceptMapRelationship.NULL, new Enumerations.ConceptMapRelationshipEnumFactory()));
8266    if (json.has("_relationship"))
8267      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
8268    if (json.has("comment"))
8269      res.setCommentElement(parseString(json.get("comment").getAsString()));
8270    if (json.has("_comment"))
8271      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
8272    if (json.has("dependsOn")) {
8273      JsonArray array = json.getAsJsonArray("dependsOn");
8274      for (int i = 0; i < array.size(); i++) {
8275        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject()));
8276      }
8277    };
8278    if (json.has("product")) {
8279      JsonArray array = json.getAsJsonArray("product");
8280      for (int i = 0; i < array.size(); i++) {
8281        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject()));
8282      }
8283    };
8284  }
8285
8286  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json) throws IOException, FHIRFormatError {
8287    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
8288    parseConceptMapOtherElementComponentProperties(json, res);
8289    return res;
8290  }
8291
8292  protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
8293    parseBackboneElementProperties(json, res);
8294    if (json.has("property"))
8295      res.setPropertyElement(parseUri(json.get("property").getAsString()));
8296    if (json.has("_property"))
8297      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
8298    if (json.has("system"))
8299      res.setSystemElement(parseCanonical(json.get("system").getAsString()));
8300    if (json.has("_system"))
8301      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
8302    if (json.has("value"))
8303      res.setValueElement(parseString(json.get("value").getAsString()));
8304    if (json.has("_value"))
8305      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
8306    if (json.has("display"))
8307      res.setDisplayElement(parseString(json.get("display").getAsString()));
8308    if (json.has("_display"))
8309      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
8310  }
8311
8312  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapGroupUnmappedComponent(JsonObject json) throws IOException, FHIRFormatError {
8313    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
8314    parseConceptMapGroupUnmappedComponentProperties(json, res);
8315    return res;
8316  }
8317
8318  protected void parseConceptMapGroupUnmappedComponentProperties(JsonObject json, ConceptMap.ConceptMapGroupUnmappedComponent res) throws IOException, FHIRFormatError {
8319    parseBackboneElementProperties(json, res);
8320    if (json.has("mode"))
8321      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
8322    if (json.has("_mode"))
8323      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
8324    if (json.has("code"))
8325      res.setCodeElement(parseCode(json.get("code").getAsString()));
8326    if (json.has("_code"))
8327      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
8328    if (json.has("display"))
8329      res.setDisplayElement(parseString(json.get("display").getAsString()));
8330    if (json.has("_display"))
8331      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
8332    if (json.has("url"))
8333      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
8334    if (json.has("_url"))
8335      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8336  }
8337
8338  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
8339    Condition res = new Condition();
8340    parseConditionProperties(json, res);
8341    return res;
8342  }
8343
8344  protected void parseConditionProperties(JsonObject json, Condition res) throws IOException, FHIRFormatError {
8345    parseDomainResourceProperties(json, res);
8346    if (json.has("identifier")) {
8347      JsonArray array = json.getAsJsonArray("identifier");
8348      for (int i = 0; i < array.size(); i++) {
8349        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8350      }
8351    };
8352    if (json.has("clinicalStatus"))
8353      res.setClinicalStatus(parseCodeableConcept(json.getAsJsonObject("clinicalStatus")));
8354    if (json.has("verificationStatus"))
8355      res.setVerificationStatus(parseCodeableConcept(json.getAsJsonObject("verificationStatus")));
8356    if (json.has("category")) {
8357      JsonArray array = json.getAsJsonArray("category");
8358      for (int i = 0; i < array.size(); i++) {
8359        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8360      }
8361    };
8362    if (json.has("severity"))
8363      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
8364    if (json.has("code"))
8365      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8366    if (json.has("bodySite")) {
8367      JsonArray array = json.getAsJsonArray("bodySite");
8368      for (int i = 0; i < array.size(); i++) {
8369        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8370      }
8371    };
8372    if (json.has("subject"))
8373      res.setSubject(parseReference(json.getAsJsonObject("subject")));
8374    if (json.has("encounter"))
8375      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
8376    DataType onset = parseType("onset", json);
8377    if (onset != null)
8378      res.setOnset(onset);
8379    DataType abatement = parseType("abatement", json);
8380    if (abatement != null)
8381      res.setAbatement(abatement);
8382    if (json.has("recordedDate"))
8383      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
8384    if (json.has("_recordedDate"))
8385      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
8386    if (json.has("recorder"))
8387      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
8388    if (json.has("asserter"))
8389      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
8390    if (json.has("stage")) {
8391      JsonArray array = json.getAsJsonArray("stage");
8392      for (int i = 0; i < array.size(); i++) {
8393        res.getStage().add(parseConditionStageComponent(array.get(i).getAsJsonObject()));
8394      }
8395    };
8396    if (json.has("evidence")) {
8397      JsonArray array = json.getAsJsonArray("evidence");
8398      for (int i = 0; i < array.size(); i++) {
8399        res.getEvidence().add(parseConditionEvidenceComponent(array.get(i).getAsJsonObject()));
8400      }
8401    };
8402    if (json.has("note")) {
8403      JsonArray array = json.getAsJsonArray("note");
8404      for (int i = 0; i < array.size(); i++) {
8405        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8406      }
8407    };
8408  }
8409
8410  protected Condition.ConditionStageComponent parseConditionStageComponent(JsonObject json) throws IOException, FHIRFormatError {
8411    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
8412    parseConditionStageComponentProperties(json, res);
8413    return res;
8414  }
8415
8416  protected void parseConditionStageComponentProperties(JsonObject json, Condition.ConditionStageComponent res) throws IOException, FHIRFormatError {
8417    parseBackboneElementProperties(json, res);
8418    if (json.has("summary"))
8419      res.setSummary(parseCodeableConcept(json.getAsJsonObject("summary")));
8420    if (json.has("assessment")) {
8421      JsonArray array = json.getAsJsonArray("assessment");
8422      for (int i = 0; i < array.size(); i++) {
8423        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
8424      }
8425    };
8426    if (json.has("type"))
8427      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8428  }
8429
8430  protected Condition.ConditionEvidenceComponent parseConditionEvidenceComponent(JsonObject json) throws IOException, FHIRFormatError {
8431    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
8432    parseConditionEvidenceComponentProperties(json, res);
8433    return res;
8434  }
8435
8436  protected void parseConditionEvidenceComponentProperties(JsonObject json, Condition.ConditionEvidenceComponent res) throws IOException, FHIRFormatError {
8437    parseBackboneElementProperties(json, res);
8438    if (json.has("code")) {
8439      JsonArray array = json.getAsJsonArray("code");
8440      for (int i = 0; i < array.size(); i++) {
8441        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8442      }
8443    };
8444    if (json.has("detail")) {
8445      JsonArray array = json.getAsJsonArray("detail");
8446      for (int i = 0; i < array.size(); i++) {
8447        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8448      }
8449    };
8450  }
8451
8452  protected ConditionDefinition parseConditionDefinition(JsonObject json) throws IOException, FHIRFormatError {
8453    ConditionDefinition res = new ConditionDefinition();
8454    parseConditionDefinitionProperties(json, res);
8455    return res;
8456  }
8457
8458  protected void parseConditionDefinitionProperties(JsonObject json, ConditionDefinition res) throws IOException, FHIRFormatError {
8459    parseMetadataResourceProperties(json, res);
8460    if (json.has("url"))
8461      res.setUrlElement(parseUri(json.get("url").getAsString()));
8462    if (json.has("_url"))
8463      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8464    if (json.has("identifier")) {
8465      JsonArray array = json.getAsJsonArray("identifier");
8466      for (int i = 0; i < array.size(); i++) {
8467        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8468      }
8469    };
8470    if (json.has("version"))
8471      res.setVersionElement(parseString(json.get("version").getAsString()));
8472    if (json.has("_version"))
8473      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
8474    if (json.has("name"))
8475      res.setNameElement(parseString(json.get("name").getAsString()));
8476    if (json.has("_name"))
8477      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8478    if (json.has("title"))
8479      res.setTitleElement(parseString(json.get("title").getAsString()));
8480    if (json.has("_title"))
8481      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
8482    if (json.has("subtitle"))
8483      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
8484    if (json.has("_subtitle"))
8485      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
8486    if (json.has("status"))
8487      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
8488    if (json.has("_status"))
8489      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8490    if (json.has("experimental"))
8491      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
8492    if (json.has("_experimental"))
8493      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
8494    if (json.has("date"))
8495      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8496    if (json.has("_date"))
8497      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8498    if (json.has("publisher"))
8499      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
8500    if (json.has("_publisher"))
8501      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
8502    if (json.has("contact")) {
8503      JsonArray array = json.getAsJsonArray("contact");
8504      for (int i = 0; i < array.size(); i++) {
8505        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
8506      }
8507    };
8508    if (json.has("description"))
8509      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
8510    if (json.has("_description"))
8511      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8512    if (json.has("useContext")) {
8513      JsonArray array = json.getAsJsonArray("useContext");
8514      for (int i = 0; i < array.size(); i++) {
8515        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
8516      }
8517    };
8518    if (json.has("jurisdiction")) {
8519      JsonArray array = json.getAsJsonArray("jurisdiction");
8520      for (int i = 0; i < array.size(); i++) {
8521        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8522      }
8523    };
8524    if (json.has("code"))
8525      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8526    if (json.has("severity"))
8527      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
8528    if (json.has("bodySite"))
8529      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
8530    if (json.has("stage"))
8531      res.setStage(parseCodeableConcept(json.getAsJsonObject("stage")));
8532    if (json.has("hasSeverity"))
8533      res.setHasSeverityElement(parseBoolean(json.get("hasSeverity").getAsBoolean()));
8534    if (json.has("_hasSeverity"))
8535      parseElementProperties(json.getAsJsonObject("_hasSeverity"), res.getHasSeverityElement());
8536    if (json.has("hasBodySite"))
8537      res.setHasBodySiteElement(parseBoolean(json.get("hasBodySite").getAsBoolean()));
8538    if (json.has("_hasBodySite"))
8539      parseElementProperties(json.getAsJsonObject("_hasBodySite"), res.getHasBodySiteElement());
8540    if (json.has("hasStage"))
8541      res.setHasStageElement(parseBoolean(json.get("hasStage").getAsBoolean()));
8542    if (json.has("_hasStage"))
8543      parseElementProperties(json.getAsJsonObject("_hasStage"), res.getHasStageElement());
8544    if (json.has("definition")) {
8545      JsonArray array = json.getAsJsonArray("definition");
8546      for (int i = 0; i < array.size(); i++) {
8547        if (array.get(i).isJsonNull()) {
8548          res.getDefinition().add(new UriType());
8549        } else {;
8550          res.getDefinition().add(parseUri(array.get(i).getAsString()));
8551        }
8552      }
8553    };
8554    if (json.has("_definition")) {
8555      JsonArray array = json.getAsJsonArray("_definition");
8556      for (int i = 0; i < array.size(); i++) {
8557        if (i == res.getDefinition().size())
8558          res.getDefinition().add(parseUri(null));
8559        if (array.get(i) instanceof JsonObject) 
8560          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
8561      }
8562    };
8563    if (json.has("observation")) {
8564      JsonArray array = json.getAsJsonArray("observation");
8565      for (int i = 0; i < array.size(); i++) {
8566        res.getObservation().add(parseConditionDefinitionObservationComponent(array.get(i).getAsJsonObject()));
8567      }
8568    };
8569    if (json.has("medication")) {
8570      JsonArray array = json.getAsJsonArray("medication");
8571      for (int i = 0; i < array.size(); i++) {
8572        res.getMedication().add(parseConditionDefinitionMedicationComponent(array.get(i).getAsJsonObject()));
8573      }
8574    };
8575    if (json.has("precondition")) {
8576      JsonArray array = json.getAsJsonArray("precondition");
8577      for (int i = 0; i < array.size(); i++) {
8578        res.getPrecondition().add(parseConditionDefinitionPreconditionComponent(array.get(i).getAsJsonObject()));
8579      }
8580    };
8581    if (json.has("team")) {
8582      JsonArray array = json.getAsJsonArray("team");
8583      for (int i = 0; i < array.size(); i++) {
8584        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
8585      }
8586    };
8587    if (json.has("questionnaire")) {
8588      JsonArray array = json.getAsJsonArray("questionnaire");
8589      for (int i = 0; i < array.size(); i++) {
8590        res.getQuestionnaire().add(parseConditionDefinitionQuestionnaireComponent(array.get(i).getAsJsonObject()));
8591      }
8592    };
8593    if (json.has("plan")) {
8594      JsonArray array = json.getAsJsonArray("plan");
8595      for (int i = 0; i < array.size(); i++) {
8596        res.getPlan().add(parseConditionDefinitionPlanComponent(array.get(i).getAsJsonObject()));
8597      }
8598    };
8599  }
8600
8601  protected ConditionDefinition.ConditionDefinitionObservationComponent parseConditionDefinitionObservationComponent(JsonObject json) throws IOException, FHIRFormatError {
8602    ConditionDefinition.ConditionDefinitionObservationComponent res = new ConditionDefinition.ConditionDefinitionObservationComponent();
8603    parseConditionDefinitionObservationComponentProperties(json, res);
8604    return res;
8605  }
8606
8607  protected void parseConditionDefinitionObservationComponentProperties(JsonObject json, ConditionDefinition.ConditionDefinitionObservationComponent res) throws IOException, FHIRFormatError {
8608    parseBackboneElementProperties(json, res);
8609    if (json.has("category"))
8610      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8611    if (json.has("code"))
8612      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8613  }
8614
8615  protected ConditionDefinition.ConditionDefinitionMedicationComponent parseConditionDefinitionMedicationComponent(JsonObject json) throws IOException, FHIRFormatError {
8616    ConditionDefinition.ConditionDefinitionMedicationComponent res = new ConditionDefinition.ConditionDefinitionMedicationComponent();
8617    parseConditionDefinitionMedicationComponentProperties(json, res);
8618    return res;
8619  }
8620
8621  protected void parseConditionDefinitionMedicationComponentProperties(JsonObject json, ConditionDefinition.ConditionDefinitionMedicationComponent res) throws IOException, FHIRFormatError {
8622    parseBackboneElementProperties(json, res);
8623    if (json.has("category"))
8624      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8625    if (json.has("code"))
8626      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8627  }
8628
8629  protected ConditionDefinition.ConditionDefinitionPreconditionComponent parseConditionDefinitionPreconditionComponent(JsonObject json) throws IOException, FHIRFormatError {
8630    ConditionDefinition.ConditionDefinitionPreconditionComponent res = new ConditionDefinition.ConditionDefinitionPreconditionComponent();
8631    parseConditionDefinitionPreconditionComponentProperties(json, res);
8632    return res;
8633  }
8634
8635  protected void parseConditionDefinitionPreconditionComponentProperties(JsonObject json, ConditionDefinition.ConditionDefinitionPreconditionComponent res) throws IOException, FHIRFormatError {
8636    parseBackboneElementProperties(json, res);
8637    if (json.has("type"))
8638      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ConditionDefinition.ConditionPreconditionType.NULL, new ConditionDefinition.ConditionPreconditionTypeEnumFactory()));
8639    if (json.has("_type"))
8640      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
8641    if (json.has("code"))
8642      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8643    DataType value = parseType("value", json);
8644    if (value != null)
8645      res.setValue(value);
8646  }
8647
8648  protected ConditionDefinition.ConditionDefinitionQuestionnaireComponent parseConditionDefinitionQuestionnaireComponent(JsonObject json) throws IOException, FHIRFormatError {
8649    ConditionDefinition.ConditionDefinitionQuestionnaireComponent res = new ConditionDefinition.ConditionDefinitionQuestionnaireComponent();
8650    parseConditionDefinitionQuestionnaireComponentProperties(json, res);
8651    return res;
8652  }
8653
8654  protected void parseConditionDefinitionQuestionnaireComponentProperties(JsonObject json, ConditionDefinition.ConditionDefinitionQuestionnaireComponent res) throws IOException, FHIRFormatError {
8655    parseBackboneElementProperties(json, res);
8656    if (json.has("purpose"))
8657      res.setPurposeElement(parseEnumeration(json.get("purpose").getAsString(), ConditionDefinition.ConditionQuestionnairePurpose.NULL, new ConditionDefinition.ConditionQuestionnairePurposeEnumFactory()));
8658    if (json.has("_purpose"))
8659      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
8660    if (json.has("reference"))
8661      res.setReference(parseReference(json.getAsJsonObject("reference")));
8662  }
8663
8664  protected ConditionDefinition.ConditionDefinitionPlanComponent parseConditionDefinitionPlanComponent(JsonObject json) throws IOException, FHIRFormatError {
8665    ConditionDefinition.ConditionDefinitionPlanComponent res = new ConditionDefinition.ConditionDefinitionPlanComponent();
8666    parseConditionDefinitionPlanComponentProperties(json, res);
8667    return res;
8668  }
8669
8670  protected void parseConditionDefinitionPlanComponentProperties(JsonObject json, ConditionDefinition.ConditionDefinitionPlanComponent res) throws IOException, FHIRFormatError {
8671    parseBackboneElementProperties(json, res);
8672    if (json.has("role"))
8673      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8674    if (json.has("reference"))
8675      res.setReference(parseReference(json.getAsJsonObject("reference")));
8676  }
8677
8678  protected Consent parseConsent(JsonObject json) throws IOException, FHIRFormatError {
8679    Consent res = new Consent();
8680    parseConsentProperties(json, res);
8681    return res;
8682  }
8683
8684  protected void parseConsentProperties(JsonObject json, Consent res) throws IOException, FHIRFormatError {
8685    parseDomainResourceProperties(json, res);
8686    if (json.has("identifier")) {
8687      JsonArray array = json.getAsJsonArray("identifier");
8688      for (int i = 0; i < array.size(); i++) {
8689        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8690      }
8691    };
8692    if (json.has("status"))
8693      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
8694    if (json.has("_status"))
8695      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8696    if (json.has("scope"))
8697      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
8698    if (json.has("category")) {
8699      JsonArray array = json.getAsJsonArray("category");
8700      for (int i = 0; i < array.size(); i++) {
8701        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8702      }
8703    };
8704    if (json.has("patient"))
8705      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8706    if (json.has("dateTime"))
8707      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
8708    if (json.has("_dateTime"))
8709      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
8710    if (json.has("performer")) {
8711      JsonArray array = json.getAsJsonArray("performer");
8712      for (int i = 0; i < array.size(); i++) {
8713        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
8714      }
8715    };
8716    if (json.has("organization")) {
8717      JsonArray array = json.getAsJsonArray("organization");
8718      for (int i = 0; i < array.size(); i++) {
8719        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
8720      }
8721    };
8722    if (json.has("sourceAttachment")) {
8723      JsonArray array = json.getAsJsonArray("sourceAttachment");
8724      for (int i = 0; i < array.size(); i++) {
8725        res.getSourceAttachment().add(parseAttachment(array.get(i).getAsJsonObject()));
8726      }
8727    };
8728    if (json.has("sourceReference")) {
8729      JsonArray array = json.getAsJsonArray("sourceReference");
8730      for (int i = 0; i < array.size(); i++) {
8731        res.getSourceReference().add(parseReference(array.get(i).getAsJsonObject()));
8732      }
8733    };
8734    if (json.has("policy")) {
8735      JsonArray array = json.getAsJsonArray("policy");
8736      for (int i = 0; i < array.size(); i++) {
8737        res.getPolicy().add(parseConsentPolicyComponent(array.get(i).getAsJsonObject()));
8738      }
8739    };
8740    if (json.has("policyRule"))
8741      res.setPolicyRule(parseCodeableConcept(json.getAsJsonObject("policyRule")));
8742    if (json.has("verification")) {
8743      JsonArray array = json.getAsJsonArray("verification");
8744      for (int i = 0; i < array.size(); i++) {
8745        res.getVerification().add(parseConsentVerificationComponent(array.get(i).getAsJsonObject()));
8746      }
8747    };
8748    if (json.has("provision"))
8749      res.setProvision(parseConsentProvisionComponent(json.getAsJsonObject("provision")));
8750  }
8751
8752  protected Consent.ConsentPolicyComponent parseConsentPolicyComponent(JsonObject json) throws IOException, FHIRFormatError {
8753    Consent.ConsentPolicyComponent res = new Consent.ConsentPolicyComponent();
8754    parseConsentPolicyComponentProperties(json, res);
8755    return res;
8756  }
8757
8758  protected void parseConsentPolicyComponentProperties(JsonObject json, Consent.ConsentPolicyComponent res) throws IOException, FHIRFormatError {
8759    parseBackboneElementProperties(json, res);
8760    if (json.has("authority"))
8761      res.setAuthorityElement(parseUri(json.get("authority").getAsString()));
8762    if (json.has("_authority"))
8763      parseElementProperties(json.getAsJsonObject("_authority"), res.getAuthorityElement());
8764    if (json.has("uri"))
8765      res.setUriElement(parseUri(json.get("uri").getAsString()));
8766    if (json.has("_uri"))
8767      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
8768  }
8769
8770  protected Consent.ConsentVerificationComponent parseConsentVerificationComponent(JsonObject json) throws IOException, FHIRFormatError {
8771    Consent.ConsentVerificationComponent res = new Consent.ConsentVerificationComponent();
8772    parseConsentVerificationComponentProperties(json, res);
8773    return res;
8774  }
8775
8776  protected void parseConsentVerificationComponentProperties(JsonObject json, Consent.ConsentVerificationComponent res) throws IOException, FHIRFormatError {
8777    parseBackboneElementProperties(json, res);
8778    if (json.has("verified"))
8779      res.setVerifiedElement(parseBoolean(json.get("verified").getAsBoolean()));
8780    if (json.has("_verified"))
8781      parseElementProperties(json.getAsJsonObject("_verified"), res.getVerifiedElement());
8782    if (json.has("verificationType"))
8783      res.setVerificationType(parseCodeableConcept(json.getAsJsonObject("verificationType")));
8784    if (json.has("verifiedBy"))
8785      res.setVerifiedBy(parseReference(json.getAsJsonObject("verifiedBy")));
8786    if (json.has("verifiedWith"))
8787      res.setVerifiedWith(parseReference(json.getAsJsonObject("verifiedWith")));
8788    if (json.has("verificationDate")) {
8789      JsonArray array = json.getAsJsonArray("verificationDate");
8790      for (int i = 0; i < array.size(); i++) {
8791        if (array.get(i).isJsonNull()) {
8792          res.getVerificationDate().add(new DateTimeType());
8793        } else {;
8794          res.getVerificationDate().add(parseDateTime(array.get(i).getAsString()));
8795        }
8796      }
8797    };
8798    if (json.has("_verificationDate")) {
8799      JsonArray array = json.getAsJsonArray("_verificationDate");
8800      for (int i = 0; i < array.size(); i++) {
8801        if (i == res.getVerificationDate().size())
8802          res.getVerificationDate().add(parseDateTime(null));
8803        if (array.get(i) instanceof JsonObject) 
8804          parseElementProperties(array.get(i).getAsJsonObject(), res.getVerificationDate().get(i));
8805      }
8806    };
8807  }
8808
8809  protected Consent.ProvisionComponent parseConsentProvisionComponent(JsonObject json) throws IOException, FHIRFormatError {
8810    Consent.ProvisionComponent res = new Consent.ProvisionComponent();
8811    parseConsentProvisionComponentProperties(json, res);
8812    return res;
8813  }
8814
8815  protected void parseConsentProvisionComponentProperties(JsonObject json, Consent.ProvisionComponent res) throws IOException, FHIRFormatError {
8816    parseBackboneElementProperties(json, res);
8817    if (json.has("type"))
8818      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Consent.ConsentProvisionType.NULL, new Consent.ConsentProvisionTypeEnumFactory()));
8819    if (json.has("_type"))
8820      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
8821    if (json.has("period"))
8822      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8823    if (json.has("actor")) {
8824      JsonArray array = json.getAsJsonArray("actor");
8825      for (int i = 0; i < array.size(); i++) {
8826        res.getActor().add(parseConsentProvisionActorComponent(array.get(i).getAsJsonObject()));
8827      }
8828    };
8829    if (json.has("action")) {
8830      JsonArray array = json.getAsJsonArray("action");
8831      for (int i = 0; i < array.size(); i++) {
8832        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8833      }
8834    };
8835    if (json.has("securityLabel")) {
8836      JsonArray array = json.getAsJsonArray("securityLabel");
8837      for (int i = 0; i < array.size(); i++) {
8838        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
8839      }
8840    };
8841    if (json.has("purpose")) {
8842      JsonArray array = json.getAsJsonArray("purpose");
8843      for (int i = 0; i < array.size(); i++) {
8844        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
8845      }
8846    };
8847    if (json.has("class")) {
8848      JsonArray array = json.getAsJsonArray("class");
8849      for (int i = 0; i < array.size(); i++) {
8850        res.getClass_().add(parseCoding(array.get(i).getAsJsonObject()));
8851      }
8852    };
8853    if (json.has("code")) {
8854      JsonArray array = json.getAsJsonArray("code");
8855      for (int i = 0; i < array.size(); i++) {
8856        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8857      }
8858    };
8859    if (json.has("dataPeriod"))
8860      res.setDataPeriod(parsePeriod(json.getAsJsonObject("dataPeriod")));
8861    if (json.has("data")) {
8862      JsonArray array = json.getAsJsonArray("data");
8863      for (int i = 0; i < array.size(); i++) {
8864        res.getData().add(parseConsentProvisionDataComponent(array.get(i).getAsJsonObject()));
8865      }
8866    };
8867    if (json.has("provision")) {
8868      JsonArray array = json.getAsJsonArray("provision");
8869      for (int i = 0; i < array.size(); i++) {
8870        res.getProvision().add(parseConsentProvisionComponent(array.get(i).getAsJsonObject()));
8871      }
8872    };
8873  }
8874
8875  protected Consent.ProvisionActorComponent parseConsentProvisionActorComponent(JsonObject json) throws IOException, FHIRFormatError {
8876    Consent.ProvisionActorComponent res = new Consent.ProvisionActorComponent();
8877    parseConsentProvisionActorComponentProperties(json, res);
8878    return res;
8879  }
8880
8881  protected void parseConsentProvisionActorComponentProperties(JsonObject json, Consent.ProvisionActorComponent res) throws IOException, FHIRFormatError {
8882    parseBackboneElementProperties(json, res);
8883    if (json.has("role"))
8884      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8885    if (json.has("reference"))
8886      res.setReference(parseReference(json.getAsJsonObject("reference")));
8887  }
8888
8889  protected Consent.ProvisionDataComponent parseConsentProvisionDataComponent(JsonObject json) throws IOException, FHIRFormatError {
8890    Consent.ProvisionDataComponent res = new Consent.ProvisionDataComponent();
8891    parseConsentProvisionDataComponentProperties(json, res);
8892    return res;
8893  }
8894
8895  protected void parseConsentProvisionDataComponentProperties(JsonObject json, Consent.ProvisionDataComponent res) throws IOException, FHIRFormatError {
8896    parseBackboneElementProperties(json, res);
8897    if (json.has("meaning"))
8898      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
8899    if (json.has("_meaning"))
8900      parseElementProperties(json.getAsJsonObject("_meaning"), res.getMeaningElement());
8901    if (json.has("reference"))
8902      res.setReference(parseReference(json.getAsJsonObject("reference")));
8903  }
8904
8905  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
8906    Contract res = new Contract();
8907    parseContractProperties(json, res);
8908    return res;
8909  }
8910
8911  protected void parseContractProperties(JsonObject json, Contract res) throws IOException, FHIRFormatError {
8912    parseDomainResourceProperties(json, res);
8913    if (json.has("identifier")) {
8914      JsonArray array = json.getAsJsonArray("identifier");
8915      for (int i = 0; i < array.size(); i++) {
8916        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8917      }
8918    };
8919    if (json.has("url"))
8920      res.setUrlElement(parseUri(json.get("url").getAsString()));
8921    if (json.has("_url"))
8922      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8923    if (json.has("version"))
8924      res.setVersionElement(parseString(json.get("version").getAsString()));
8925    if (json.has("_version"))
8926      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
8927    if (json.has("status"))
8928      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Contract.ContractResourceStatusCodes.NULL, new Contract.ContractResourceStatusCodesEnumFactory()));
8929    if (json.has("_status"))
8930      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8931    if (json.has("legalState"))
8932      res.setLegalState(parseCodeableConcept(json.getAsJsonObject("legalState")));
8933    if (json.has("instantiatesCanonical"))
8934      res.setInstantiatesCanonical(parseReference(json.getAsJsonObject("instantiatesCanonical")));
8935    if (json.has("instantiatesUri"))
8936      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
8937    if (json.has("_instantiatesUri"))
8938      parseElementProperties(json.getAsJsonObject("_instantiatesUri"), res.getInstantiatesUriElement());
8939    if (json.has("contentDerivative"))
8940      res.setContentDerivative(parseCodeableConcept(json.getAsJsonObject("contentDerivative")));
8941    if (json.has("issued"))
8942      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
8943    if (json.has("_issued"))
8944      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
8945    if (json.has("applies"))
8946      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
8947    if (json.has("expirationType"))
8948      res.setExpirationType(parseCodeableConcept(json.getAsJsonObject("expirationType")));
8949    if (json.has("subject")) {
8950      JsonArray array = json.getAsJsonArray("subject");
8951      for (int i = 0; i < array.size(); i++) {
8952        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
8953      }
8954    };
8955    if (json.has("authority")) {
8956      JsonArray array = json.getAsJsonArray("authority");
8957      for (int i = 0; i < array.size(); i++) {
8958        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
8959      }
8960    };
8961    if (json.has("domain")) {
8962      JsonArray array = json.getAsJsonArray("domain");
8963      for (int i = 0; i < array.size(); i++) {
8964        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
8965      }
8966    };
8967    if (json.has("site")) {
8968      JsonArray array = json.getAsJsonArray("site");
8969      for (int i = 0; i < array.size(); i++) {
8970        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
8971      }
8972    };
8973    if (json.has("name"))
8974      res.setNameElement(parseString(json.get("name").getAsString()));
8975    if (json.has("_name"))
8976      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8977    if (json.has("title"))
8978      res.setTitleElement(parseString(json.get("title").getAsString()));
8979    if (json.has("_title"))
8980      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
8981    if (json.has("subtitle"))
8982      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
8983    if (json.has("_subtitle"))
8984      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
8985    if (json.has("alias")) {
8986      JsonArray array = json.getAsJsonArray("alias");
8987      for (int i = 0; i < array.size(); i++) {
8988        if (array.get(i).isJsonNull()) {
8989          res.getAlias().add(new StringType());
8990        } else {;
8991          res.getAlias().add(parseString(array.get(i).getAsString()));
8992        }
8993      }
8994    };
8995    if (json.has("_alias")) {
8996      JsonArray array = json.getAsJsonArray("_alias");
8997      for (int i = 0; i < array.size(); i++) {
8998        if (i == res.getAlias().size())
8999          res.getAlias().add(parseString(null));
9000        if (array.get(i) instanceof JsonObject) 
9001          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
9002      }
9003    };
9004    if (json.has("author"))
9005      res.setAuthor(parseReference(json.getAsJsonObject("author")));
9006    if (json.has("scope"))
9007      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
9008    DataType topic = parseType("topic", json);
9009    if (topic != null)
9010      res.setTopic(topic);
9011    if (json.has("type"))
9012      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9013    if (json.has("subType")) {
9014      JsonArray array = json.getAsJsonArray("subType");
9015      for (int i = 0; i < array.size(); i++) {
9016        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9017      }
9018    };
9019    if (json.has("contentDefinition"))
9020      res.setContentDefinition(parseContractContentDefinitionComponent(json.getAsJsonObject("contentDefinition")));
9021    if (json.has("term")) {
9022      JsonArray array = json.getAsJsonArray("term");
9023      for (int i = 0; i < array.size(); i++) {
9024        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject()));
9025      }
9026    };
9027    if (json.has("supportingInfo")) {
9028      JsonArray array = json.getAsJsonArray("supportingInfo");
9029      for (int i = 0; i < array.size(); i++) {
9030        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
9031      }
9032    };
9033    if (json.has("relevantHistory")) {
9034      JsonArray array = json.getAsJsonArray("relevantHistory");
9035      for (int i = 0; i < array.size(); i++) {
9036        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
9037      }
9038    };
9039    if (json.has("signer")) {
9040      JsonArray array = json.getAsJsonArray("signer");
9041      for (int i = 0; i < array.size(); i++) {
9042        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject()));
9043      }
9044    };
9045    if (json.has("friendly")) {
9046      JsonArray array = json.getAsJsonArray("friendly");
9047      for (int i = 0; i < array.size(); i++) {
9048        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject()));
9049      }
9050    };
9051    if (json.has("legal")) {
9052      JsonArray array = json.getAsJsonArray("legal");
9053      for (int i = 0; i < array.size(); i++) {
9054        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject()));
9055      }
9056    };
9057    if (json.has("rule")) {
9058      JsonArray array = json.getAsJsonArray("rule");
9059      for (int i = 0; i < array.size(); i++) {
9060        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject()));
9061      }
9062    };
9063    DataType legallyBinding = parseType("legallyBinding", json);
9064    if (legallyBinding != null)
9065      res.setLegallyBinding(legallyBinding);
9066  }
9067
9068  protected Contract.ContentDefinitionComponent parseContractContentDefinitionComponent(JsonObject json) throws IOException, FHIRFormatError {
9069    Contract.ContentDefinitionComponent res = new Contract.ContentDefinitionComponent();
9070    parseContractContentDefinitionComponentProperties(json, res);
9071    return res;
9072  }
9073
9074  protected void parseContractContentDefinitionComponentProperties(JsonObject json, Contract.ContentDefinitionComponent res) throws IOException, FHIRFormatError {
9075    parseBackboneElementProperties(json, res);
9076    if (json.has("type"))
9077      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9078    if (json.has("subType"))
9079      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
9080    if (json.has("publisher"))
9081      res.setPublisher(parseReference(json.getAsJsonObject("publisher")));
9082    if (json.has("publicationDate"))
9083      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
9084    if (json.has("_publicationDate"))
9085      parseElementProperties(json.getAsJsonObject("_publicationDate"), res.getPublicationDateElement());
9086    if (json.has("publicationStatus"))
9087      res.setPublicationStatusElement(parseEnumeration(json.get("publicationStatus").getAsString(), Contract.ContractResourcePublicationStatusCodes.NULL, new Contract.ContractResourcePublicationStatusCodesEnumFactory()));
9088    if (json.has("_publicationStatus"))
9089      parseElementProperties(json.getAsJsonObject("_publicationStatus"), res.getPublicationStatusElement());
9090    if (json.has("copyright"))
9091      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
9092    if (json.has("_copyright"))
9093      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
9094  }
9095
9096  protected Contract.TermComponent parseContractTermComponent(JsonObject json) throws IOException, FHIRFormatError {
9097    Contract.TermComponent res = new Contract.TermComponent();
9098    parseContractTermComponentProperties(json, res);
9099    return res;
9100  }
9101
9102  protected void parseContractTermComponentProperties(JsonObject json, Contract.TermComponent res) throws IOException, FHIRFormatError {
9103    parseBackboneElementProperties(json, res);
9104    if (json.has("identifier"))
9105      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9106    if (json.has("issued"))
9107      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
9108    if (json.has("_issued"))
9109      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
9110    if (json.has("applies"))
9111      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
9112    DataType topic = parseType("topic", json);
9113    if (topic != null)
9114      res.setTopic(topic);
9115    if (json.has("type"))
9116      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9117    if (json.has("subType"))
9118      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
9119    if (json.has("text"))
9120      res.setTextElement(parseString(json.get("text").getAsString()));
9121    if (json.has("_text"))
9122      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9123    if (json.has("securityLabel")) {
9124      JsonArray array = json.getAsJsonArray("securityLabel");
9125      for (int i = 0; i < array.size(); i++) {
9126        res.getSecurityLabel().add(parseContractSecurityLabelComponent(array.get(i).getAsJsonObject()));
9127      }
9128    };
9129    if (json.has("offer"))
9130      res.setOffer(parseContractOfferComponent(json.getAsJsonObject("offer")));
9131    if (json.has("asset")) {
9132      JsonArray array = json.getAsJsonArray("asset");
9133      for (int i = 0; i < array.size(); i++) {
9134        res.getAsset().add(parseContractAssetComponent(array.get(i).getAsJsonObject()));
9135      }
9136    };
9137    if (json.has("action")) {
9138      JsonArray array = json.getAsJsonArray("action");
9139      for (int i = 0; i < array.size(); i++) {
9140        res.getAction().add(parseContractActionComponent(array.get(i).getAsJsonObject()));
9141      }
9142    };
9143    if (json.has("group")) {
9144      JsonArray array = json.getAsJsonArray("group");
9145      for (int i = 0; i < array.size(); i++) {
9146        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject()));
9147      }
9148    };
9149  }
9150
9151  protected Contract.SecurityLabelComponent parseContractSecurityLabelComponent(JsonObject json) throws IOException, FHIRFormatError {
9152    Contract.SecurityLabelComponent res = new Contract.SecurityLabelComponent();
9153    parseContractSecurityLabelComponentProperties(json, res);
9154    return res;
9155  }
9156
9157  protected void parseContractSecurityLabelComponentProperties(JsonObject json, Contract.SecurityLabelComponent res) throws IOException, FHIRFormatError {
9158    parseBackboneElementProperties(json, res);
9159    if (json.has("number")) {
9160      JsonArray array = json.getAsJsonArray("number");
9161      for (int i = 0; i < array.size(); i++) {
9162        if (array.get(i).isJsonNull()) {
9163          res.getNumber().add(new UnsignedIntType());
9164        } else {;
9165          res.getNumber().add(parseUnsignedInt(array.get(i).getAsString()));
9166        }
9167      }
9168    };
9169    if (json.has("_number")) {
9170      JsonArray array = json.getAsJsonArray("_number");
9171      for (int i = 0; i < array.size(); i++) {
9172        if (i == res.getNumber().size())
9173          res.getNumber().add(parseUnsignedInt(null));
9174        if (array.get(i) instanceof JsonObject) 
9175          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumber().get(i));
9176      }
9177    };
9178    if (json.has("classification"))
9179      res.setClassification(parseCoding(json.getAsJsonObject("classification")));
9180    if (json.has("category")) {
9181      JsonArray array = json.getAsJsonArray("category");
9182      for (int i = 0; i < array.size(); i++) {
9183        res.getCategory().add(parseCoding(array.get(i).getAsJsonObject()));
9184      }
9185    };
9186    if (json.has("control")) {
9187      JsonArray array = json.getAsJsonArray("control");
9188      for (int i = 0; i < array.size(); i++) {
9189        res.getControl().add(parseCoding(array.get(i).getAsJsonObject()));
9190      }
9191    };
9192  }
9193
9194  protected Contract.ContractOfferComponent parseContractOfferComponent(JsonObject json) throws IOException, FHIRFormatError {
9195    Contract.ContractOfferComponent res = new Contract.ContractOfferComponent();
9196    parseContractOfferComponentProperties(json, res);
9197    return res;
9198  }
9199
9200  protected void parseContractOfferComponentProperties(JsonObject json, Contract.ContractOfferComponent res) throws IOException, FHIRFormatError {
9201    parseBackboneElementProperties(json, res);
9202    if (json.has("identifier")) {
9203      JsonArray array = json.getAsJsonArray("identifier");
9204      for (int i = 0; i < array.size(); i++) {
9205        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9206      }
9207    };
9208    if (json.has("party")) {
9209      JsonArray array = json.getAsJsonArray("party");
9210      for (int i = 0; i < array.size(); i++) {
9211        res.getParty().add(parseContractPartyComponent(array.get(i).getAsJsonObject()));
9212      }
9213    };
9214    if (json.has("topic"))
9215      res.setTopic(parseReference(json.getAsJsonObject("topic")));
9216    if (json.has("type"))
9217      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9218    if (json.has("decision"))
9219      res.setDecision(parseCodeableConcept(json.getAsJsonObject("decision")));
9220    if (json.has("decisionMode")) {
9221      JsonArray array = json.getAsJsonArray("decisionMode");
9222      for (int i = 0; i < array.size(); i++) {
9223        res.getDecisionMode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9224      }
9225    };
9226    if (json.has("answer")) {
9227      JsonArray array = json.getAsJsonArray("answer");
9228      for (int i = 0; i < array.size(); i++) {
9229        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject()));
9230      }
9231    };
9232    if (json.has("text"))
9233      res.setTextElement(parseString(json.get("text").getAsString()));
9234    if (json.has("_text"))
9235      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9236    if (json.has("linkId")) {
9237      JsonArray array = json.getAsJsonArray("linkId");
9238      for (int i = 0; i < array.size(); i++) {
9239        if (array.get(i).isJsonNull()) {
9240          res.getLinkId().add(new StringType());
9241        } else {;
9242          res.getLinkId().add(parseString(array.get(i).getAsString()));
9243        }
9244      }
9245    };
9246    if (json.has("_linkId")) {
9247      JsonArray array = json.getAsJsonArray("_linkId");
9248      for (int i = 0; i < array.size(); i++) {
9249        if (i == res.getLinkId().size())
9250          res.getLinkId().add(parseString(null));
9251        if (array.get(i) instanceof JsonObject) 
9252          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
9253      }
9254    };
9255    if (json.has("securityLabelNumber")) {
9256      JsonArray array = json.getAsJsonArray("securityLabelNumber");
9257      for (int i = 0; i < array.size(); i++) {
9258        if (array.get(i).isJsonNull()) {
9259          res.getSecurityLabelNumber().add(new UnsignedIntType());
9260        } else {;
9261          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
9262        }
9263      }
9264    };
9265    if (json.has("_securityLabelNumber")) {
9266      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
9267      for (int i = 0; i < array.size(); i++) {
9268        if (i == res.getSecurityLabelNumber().size())
9269          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
9270        if (array.get(i) instanceof JsonObject) 
9271          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
9272      }
9273    };
9274  }
9275
9276  protected Contract.ContractPartyComponent parseContractPartyComponent(JsonObject json) throws IOException, FHIRFormatError {
9277    Contract.ContractPartyComponent res = new Contract.ContractPartyComponent();
9278    parseContractPartyComponentProperties(json, res);
9279    return res;
9280  }
9281
9282  protected void parseContractPartyComponentProperties(JsonObject json, Contract.ContractPartyComponent res) throws IOException, FHIRFormatError {
9283    parseBackboneElementProperties(json, res);
9284    if (json.has("reference")) {
9285      JsonArray array = json.getAsJsonArray("reference");
9286      for (int i = 0; i < array.size(); i++) {
9287        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
9288      }
9289    };
9290    if (json.has("role"))
9291      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
9292  }
9293
9294  protected Contract.AnswerComponent parseContractAnswerComponent(JsonObject json) throws IOException, FHIRFormatError {
9295    Contract.AnswerComponent res = new Contract.AnswerComponent();
9296    parseContractAnswerComponentProperties(json, res);
9297    return res;
9298  }
9299
9300  protected void parseContractAnswerComponentProperties(JsonObject json, Contract.AnswerComponent res) throws IOException, FHIRFormatError {
9301    parseBackboneElementProperties(json, res);
9302    DataType value = parseType("value", json);
9303    if (value != null)
9304      res.setValue(value);
9305  }
9306
9307  protected Contract.ContractAssetComponent parseContractAssetComponent(JsonObject json) throws IOException, FHIRFormatError {
9308    Contract.ContractAssetComponent res = new Contract.ContractAssetComponent();
9309    parseContractAssetComponentProperties(json, res);
9310    return res;
9311  }
9312
9313  protected void parseContractAssetComponentProperties(JsonObject json, Contract.ContractAssetComponent res) throws IOException, FHIRFormatError {
9314    parseBackboneElementProperties(json, res);
9315    if (json.has("scope"))
9316      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
9317    if (json.has("type")) {
9318      JsonArray array = json.getAsJsonArray("type");
9319      for (int i = 0; i < array.size(); i++) {
9320        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9321      }
9322    };
9323    if (json.has("typeReference")) {
9324      JsonArray array = json.getAsJsonArray("typeReference");
9325      for (int i = 0; i < array.size(); i++) {
9326        res.getTypeReference().add(parseReference(array.get(i).getAsJsonObject()));
9327      }
9328    };
9329    if (json.has("subtype")) {
9330      JsonArray array = json.getAsJsonArray("subtype");
9331      for (int i = 0; i < array.size(); i++) {
9332        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9333      }
9334    };
9335    if (json.has("relationship"))
9336      res.setRelationship(parseCoding(json.getAsJsonObject("relationship")));
9337    if (json.has("context")) {
9338      JsonArray array = json.getAsJsonArray("context");
9339      for (int i = 0; i < array.size(); i++) {
9340        res.getContext().add(parseContractAssetContextComponent(array.get(i).getAsJsonObject()));
9341      }
9342    };
9343    if (json.has("condition"))
9344      res.setConditionElement(parseString(json.get("condition").getAsString()));
9345    if (json.has("_condition"))
9346      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
9347    if (json.has("periodType")) {
9348      JsonArray array = json.getAsJsonArray("periodType");
9349      for (int i = 0; i < array.size(); i++) {
9350        res.getPeriodType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9351      }
9352    };
9353    if (json.has("period")) {
9354      JsonArray array = json.getAsJsonArray("period");
9355      for (int i = 0; i < array.size(); i++) {
9356        res.getPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
9357      }
9358    };
9359    if (json.has("usePeriod")) {
9360      JsonArray array = json.getAsJsonArray("usePeriod");
9361      for (int i = 0; i < array.size(); i++) {
9362        res.getUsePeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
9363      }
9364    };
9365    if (json.has("text"))
9366      res.setTextElement(parseString(json.get("text").getAsString()));
9367    if (json.has("_text"))
9368      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9369    if (json.has("linkId")) {
9370      JsonArray array = json.getAsJsonArray("linkId");
9371      for (int i = 0; i < array.size(); i++) {
9372        if (array.get(i).isJsonNull()) {
9373          res.getLinkId().add(new StringType());
9374        } else {;
9375          res.getLinkId().add(parseString(array.get(i).getAsString()));
9376        }
9377      }
9378    };
9379    if (json.has("_linkId")) {
9380      JsonArray array = json.getAsJsonArray("_linkId");
9381      for (int i = 0; i < array.size(); i++) {
9382        if (i == res.getLinkId().size())
9383          res.getLinkId().add(parseString(null));
9384        if (array.get(i) instanceof JsonObject) 
9385          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
9386      }
9387    };
9388    if (json.has("answer")) {
9389      JsonArray array = json.getAsJsonArray("answer");
9390      for (int i = 0; i < array.size(); i++) {
9391        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject()));
9392      }
9393    };
9394    if (json.has("securityLabelNumber")) {
9395      JsonArray array = json.getAsJsonArray("securityLabelNumber");
9396      for (int i = 0; i < array.size(); i++) {
9397        if (array.get(i).isJsonNull()) {
9398          res.getSecurityLabelNumber().add(new UnsignedIntType());
9399        } else {;
9400          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
9401        }
9402      }
9403    };
9404    if (json.has("_securityLabelNumber")) {
9405      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
9406      for (int i = 0; i < array.size(); i++) {
9407        if (i == res.getSecurityLabelNumber().size())
9408          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
9409        if (array.get(i) instanceof JsonObject) 
9410          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
9411      }
9412    };
9413    if (json.has("valuedItem")) {
9414      JsonArray array = json.getAsJsonArray("valuedItem");
9415      for (int i = 0; i < array.size(); i++) {
9416        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject()));
9417      }
9418    };
9419  }
9420
9421  protected Contract.AssetContextComponent parseContractAssetContextComponent(JsonObject json) throws IOException, FHIRFormatError {
9422    Contract.AssetContextComponent res = new Contract.AssetContextComponent();
9423    parseContractAssetContextComponentProperties(json, res);
9424    return res;
9425  }
9426
9427  protected void parseContractAssetContextComponentProperties(JsonObject json, Contract.AssetContextComponent res) throws IOException, FHIRFormatError {
9428    parseBackboneElementProperties(json, res);
9429    if (json.has("reference"))
9430      res.setReference(parseReference(json.getAsJsonObject("reference")));
9431    if (json.has("code")) {
9432      JsonArray array = json.getAsJsonArray("code");
9433      for (int i = 0; i < array.size(); i++) {
9434        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9435      }
9436    };
9437    if (json.has("text"))
9438      res.setTextElement(parseString(json.get("text").getAsString()));
9439    if (json.has("_text"))
9440      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9441  }
9442
9443  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
9444    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
9445    parseContractValuedItemComponentProperties(json, res);
9446    return res;
9447  }
9448
9449  protected void parseContractValuedItemComponentProperties(JsonObject json, Contract.ValuedItemComponent res) throws IOException, FHIRFormatError {
9450    parseBackboneElementProperties(json, res);
9451    DataType entity = parseType("entity", json);
9452    if (entity != null)
9453      res.setEntity(entity);
9454    if (json.has("identifier"))
9455      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9456    if (json.has("effectiveTime"))
9457      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
9458    if (json.has("_effectiveTime"))
9459      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
9460    if (json.has("quantity"))
9461      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
9462    if (json.has("unitPrice"))
9463      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
9464    if (json.has("factor"))
9465      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
9466    if (json.has("_factor"))
9467      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
9468    if (json.has("points"))
9469      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
9470    if (json.has("_points"))
9471      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
9472    if (json.has("net"))
9473      res.setNet(parseMoney(json.getAsJsonObject("net")));
9474    if (json.has("payment"))
9475      res.setPaymentElement(parseString(json.get("payment").getAsString()));
9476    if (json.has("_payment"))
9477      parseElementProperties(json.getAsJsonObject("_payment"), res.getPaymentElement());
9478    if (json.has("paymentDate"))
9479      res.setPaymentDateElement(parseDateTime(json.get("paymentDate").getAsString()));
9480    if (json.has("_paymentDate"))
9481      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
9482    if (json.has("responsible"))
9483      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
9484    if (json.has("recipient"))
9485      res.setRecipient(parseReference(json.getAsJsonObject("recipient")));
9486    if (json.has("linkId")) {
9487      JsonArray array = json.getAsJsonArray("linkId");
9488      for (int i = 0; i < array.size(); i++) {
9489        if (array.get(i).isJsonNull()) {
9490          res.getLinkId().add(new StringType());
9491        } else {;
9492          res.getLinkId().add(parseString(array.get(i).getAsString()));
9493        }
9494      }
9495    };
9496    if (json.has("_linkId")) {
9497      JsonArray array = json.getAsJsonArray("_linkId");
9498      for (int i = 0; i < array.size(); i++) {
9499        if (i == res.getLinkId().size())
9500          res.getLinkId().add(parseString(null));
9501        if (array.get(i) instanceof JsonObject) 
9502          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
9503      }
9504    };
9505    if (json.has("securityLabelNumber")) {
9506      JsonArray array = json.getAsJsonArray("securityLabelNumber");
9507      for (int i = 0; i < array.size(); i++) {
9508        if (array.get(i).isJsonNull()) {
9509          res.getSecurityLabelNumber().add(new UnsignedIntType());
9510        } else {;
9511          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
9512        }
9513      }
9514    };
9515    if (json.has("_securityLabelNumber")) {
9516      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
9517      for (int i = 0; i < array.size(); i++) {
9518        if (i == res.getSecurityLabelNumber().size())
9519          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
9520        if (array.get(i) instanceof JsonObject) 
9521          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
9522      }
9523    };
9524  }
9525
9526  protected Contract.ActionComponent parseContractActionComponent(JsonObject json) throws IOException, FHIRFormatError {
9527    Contract.ActionComponent res = new Contract.ActionComponent();
9528    parseContractActionComponentProperties(json, res);
9529    return res;
9530  }
9531
9532  protected void parseContractActionComponentProperties(JsonObject json, Contract.ActionComponent res) throws IOException, FHIRFormatError {
9533    parseBackboneElementProperties(json, res);
9534    if (json.has("doNotPerform"))
9535      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
9536    if (json.has("_doNotPerform"))
9537      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
9538    if (json.has("type"))
9539      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9540    if (json.has("subject")) {
9541      JsonArray array = json.getAsJsonArray("subject");
9542      for (int i = 0; i < array.size(); i++) {
9543        res.getSubject().add(parseContractActionSubjectComponent(array.get(i).getAsJsonObject()));
9544      }
9545    };
9546    if (json.has("intent"))
9547      res.setIntent(parseCodeableConcept(json.getAsJsonObject("intent")));
9548    if (json.has("linkId")) {
9549      JsonArray array = json.getAsJsonArray("linkId");
9550      for (int i = 0; i < array.size(); i++) {
9551        if (array.get(i).isJsonNull()) {
9552          res.getLinkId().add(new StringType());
9553        } else {;
9554          res.getLinkId().add(parseString(array.get(i).getAsString()));
9555        }
9556      }
9557    };
9558    if (json.has("_linkId")) {
9559      JsonArray array = json.getAsJsonArray("_linkId");
9560      for (int i = 0; i < array.size(); i++) {
9561        if (i == res.getLinkId().size())
9562          res.getLinkId().add(parseString(null));
9563        if (array.get(i) instanceof JsonObject) 
9564          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
9565      }
9566    };
9567    if (json.has("status"))
9568      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
9569    if (json.has("context"))
9570      res.setContext(parseReference(json.getAsJsonObject("context")));
9571    if (json.has("contextLinkId")) {
9572      JsonArray array = json.getAsJsonArray("contextLinkId");
9573      for (int i = 0; i < array.size(); i++) {
9574        if (array.get(i).isJsonNull()) {
9575          res.getContextLinkId().add(new StringType());
9576        } else {;
9577          res.getContextLinkId().add(parseString(array.get(i).getAsString()));
9578        }
9579      }
9580    };
9581    if (json.has("_contextLinkId")) {
9582      JsonArray array = json.getAsJsonArray("_contextLinkId");
9583      for (int i = 0; i < array.size(); i++) {
9584        if (i == res.getContextLinkId().size())
9585          res.getContextLinkId().add(parseString(null));
9586        if (array.get(i) instanceof JsonObject) 
9587          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextLinkId().get(i));
9588      }
9589    };
9590    DataType occurrence = parseType("occurrence", json);
9591    if (occurrence != null)
9592      res.setOccurrence(occurrence);
9593    if (json.has("requester")) {
9594      JsonArray array = json.getAsJsonArray("requester");
9595      for (int i = 0; i < array.size(); i++) {
9596        res.getRequester().add(parseReference(array.get(i).getAsJsonObject()));
9597      }
9598    };
9599    if (json.has("requesterLinkId")) {
9600      JsonArray array = json.getAsJsonArray("requesterLinkId");
9601      for (int i = 0; i < array.size(); i++) {
9602        if (array.get(i).isJsonNull()) {
9603          res.getRequesterLinkId().add(new StringType());
9604        } else {;
9605          res.getRequesterLinkId().add(parseString(array.get(i).getAsString()));
9606        }
9607      }
9608    };
9609    if (json.has("_requesterLinkId")) {
9610      JsonArray array = json.getAsJsonArray("_requesterLinkId");
9611      for (int i = 0; i < array.size(); i++) {
9612        if (i == res.getRequesterLinkId().size())
9613          res.getRequesterLinkId().add(parseString(null));
9614        if (array.get(i) instanceof JsonObject) 
9615          parseElementProperties(array.get(i).getAsJsonObject(), res.getRequesterLinkId().get(i));
9616      }
9617    };
9618    if (json.has("performerType")) {
9619      JsonArray array = json.getAsJsonArray("performerType");
9620      for (int i = 0; i < array.size(); i++) {
9621        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9622      }
9623    };
9624    if (json.has("performerRole"))
9625      res.setPerformerRole(parseCodeableConcept(json.getAsJsonObject("performerRole")));
9626    if (json.has("performer"))
9627      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
9628    if (json.has("performerLinkId")) {
9629      JsonArray array = json.getAsJsonArray("performerLinkId");
9630      for (int i = 0; i < array.size(); i++) {
9631        if (array.get(i).isJsonNull()) {
9632          res.getPerformerLinkId().add(new StringType());
9633        } else {;
9634          res.getPerformerLinkId().add(parseString(array.get(i).getAsString()));
9635        }
9636      }
9637    };
9638    if (json.has("_performerLinkId")) {
9639      JsonArray array = json.getAsJsonArray("_performerLinkId");
9640      for (int i = 0; i < array.size(); i++) {
9641        if (i == res.getPerformerLinkId().size())
9642          res.getPerformerLinkId().add(parseString(null));
9643        if (array.get(i) instanceof JsonObject) 
9644          parseElementProperties(array.get(i).getAsJsonObject(), res.getPerformerLinkId().get(i));
9645      }
9646    };
9647    if (json.has("reason")) {
9648      JsonArray array = json.getAsJsonArray("reason");
9649      for (int i = 0; i < array.size(); i++) {
9650        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
9651      }
9652    };
9653    if (json.has("reasonLinkId")) {
9654      JsonArray array = json.getAsJsonArray("reasonLinkId");
9655      for (int i = 0; i < array.size(); i++) {
9656        if (array.get(i).isJsonNull()) {
9657          res.getReasonLinkId().add(new StringType());
9658        } else {;
9659          res.getReasonLinkId().add(parseString(array.get(i).getAsString()));
9660        }
9661      }
9662    };
9663    if (json.has("_reasonLinkId")) {
9664      JsonArray array = json.getAsJsonArray("_reasonLinkId");
9665      for (int i = 0; i < array.size(); i++) {
9666        if (i == res.getReasonLinkId().size())
9667          res.getReasonLinkId().add(parseString(null));
9668        if (array.get(i) instanceof JsonObject) 
9669          parseElementProperties(array.get(i).getAsJsonObject(), res.getReasonLinkId().get(i));
9670      }
9671    };
9672    if (json.has("note")) {
9673      JsonArray array = json.getAsJsonArray("note");
9674      for (int i = 0; i < array.size(); i++) {
9675        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9676      }
9677    };
9678    if (json.has("securityLabelNumber")) {
9679      JsonArray array = json.getAsJsonArray("securityLabelNumber");
9680      for (int i = 0; i < array.size(); i++) {
9681        if (array.get(i).isJsonNull()) {
9682          res.getSecurityLabelNumber().add(new UnsignedIntType());
9683        } else {;
9684          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
9685        }
9686      }
9687    };
9688    if (json.has("_securityLabelNumber")) {
9689      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
9690      for (int i = 0; i < array.size(); i++) {
9691        if (i == res.getSecurityLabelNumber().size())
9692          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
9693        if (array.get(i) instanceof JsonObject) 
9694          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
9695      }
9696    };
9697  }
9698
9699  protected Contract.ActionSubjectComponent parseContractActionSubjectComponent(JsonObject json) throws IOException, FHIRFormatError {
9700    Contract.ActionSubjectComponent res = new Contract.ActionSubjectComponent();
9701    parseContractActionSubjectComponentProperties(json, res);
9702    return res;
9703  }
9704
9705  protected void parseContractActionSubjectComponentProperties(JsonObject json, Contract.ActionSubjectComponent res) throws IOException, FHIRFormatError {
9706    parseBackboneElementProperties(json, res);
9707    if (json.has("reference")) {
9708      JsonArray array = json.getAsJsonArray("reference");
9709      for (int i = 0; i < array.size(); i++) {
9710        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
9711      }
9712    };
9713    if (json.has("role"))
9714      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
9715  }
9716
9717  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json) throws IOException, FHIRFormatError {
9718    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
9719    parseContractSignatoryComponentProperties(json, res);
9720    return res;
9721  }
9722
9723  protected void parseContractSignatoryComponentProperties(JsonObject json, Contract.SignatoryComponent res) throws IOException, FHIRFormatError {
9724    parseBackboneElementProperties(json, res);
9725    if (json.has("type"))
9726      res.setType(parseCoding(json.getAsJsonObject("type")));
9727    if (json.has("party"))
9728      res.setParty(parseReference(json.getAsJsonObject("party")));
9729    if (json.has("signature")) {
9730      JsonArray array = json.getAsJsonArray("signature");
9731      for (int i = 0; i < array.size(); i++) {
9732        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
9733      }
9734    };
9735  }
9736
9737  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json) throws IOException, FHIRFormatError {
9738    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
9739    parseContractFriendlyLanguageComponentProperties(json, res);
9740    return res;
9741  }
9742
9743  protected void parseContractFriendlyLanguageComponentProperties(JsonObject json, Contract.FriendlyLanguageComponent res) throws IOException, FHIRFormatError {
9744    parseBackboneElementProperties(json, res);
9745    DataType content = parseType("content", json);
9746    if (content != null)
9747      res.setContent(content);
9748  }
9749
9750  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json) throws IOException, FHIRFormatError {
9751    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
9752    parseContractLegalLanguageComponentProperties(json, res);
9753    return res;
9754  }
9755
9756  protected void parseContractLegalLanguageComponentProperties(JsonObject json, Contract.LegalLanguageComponent res) throws IOException, FHIRFormatError {
9757    parseBackboneElementProperties(json, res);
9758    DataType content = parseType("content", json);
9759    if (content != null)
9760      res.setContent(content);
9761  }
9762
9763  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json) throws IOException, FHIRFormatError {
9764    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
9765    parseContractComputableLanguageComponentProperties(json, res);
9766    return res;
9767  }
9768
9769  protected void parseContractComputableLanguageComponentProperties(JsonObject json, Contract.ComputableLanguageComponent res) throws IOException, FHIRFormatError {
9770    parseBackboneElementProperties(json, res);
9771    DataType content = parseType("content", json);
9772    if (content != null)
9773      res.setContent(content);
9774  }
9775
9776  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
9777    Coverage res = new Coverage();
9778    parseCoverageProperties(json, res);
9779    return res;
9780  }
9781
9782  protected void parseCoverageProperties(JsonObject json, Coverage res) throws IOException, FHIRFormatError {
9783    parseDomainResourceProperties(json, res);
9784    if (json.has("identifier")) {
9785      JsonArray array = json.getAsJsonArray("identifier");
9786      for (int i = 0; i < array.size(); i++) {
9787        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9788      }
9789    };
9790    if (json.has("status"))
9791      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
9792    if (json.has("_status"))
9793      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9794    if (json.has("type"))
9795      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9796    if (json.has("policyHolder"))
9797      res.setPolicyHolder(parseReference(json.getAsJsonObject("policyHolder")));
9798    if (json.has("subscriber"))
9799      res.setSubscriber(parseReference(json.getAsJsonObject("subscriber")));
9800    if (json.has("subscriberId"))
9801      res.setSubscriberId(parseIdentifier(json.getAsJsonObject("subscriberId")));
9802    if (json.has("beneficiary"))
9803      res.setBeneficiary(parseReference(json.getAsJsonObject("beneficiary")));
9804    if (json.has("dependent"))
9805      res.setDependentElement(parseString(json.get("dependent").getAsString()));
9806    if (json.has("_dependent"))
9807      parseElementProperties(json.getAsJsonObject("_dependent"), res.getDependentElement());
9808    if (json.has("relationship"))
9809      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
9810    if (json.has("period"))
9811      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9812    if (json.has("payor")) {
9813      JsonArray array = json.getAsJsonArray("payor");
9814      for (int i = 0; i < array.size(); i++) {
9815        res.getPayor().add(parseReference(array.get(i).getAsJsonObject()));
9816      }
9817    };
9818    if (json.has("class")) {
9819      JsonArray array = json.getAsJsonArray("class");
9820      for (int i = 0; i < array.size(); i++) {
9821        res.getClass_().add(parseCoverageClassComponent(array.get(i).getAsJsonObject()));
9822      }
9823    };
9824    if (json.has("order"))
9825      res.setOrderElement(parsePositiveInt(json.get("order").getAsString()));
9826    if (json.has("_order"))
9827      parseElementProperties(json.getAsJsonObject("_order"), res.getOrderElement());
9828    if (json.has("network"))
9829      res.setNetworkElement(parseString(json.get("network").getAsString()));
9830    if (json.has("_network"))
9831      parseElementProperties(json.getAsJsonObject("_network"), res.getNetworkElement());
9832    if (json.has("costToBeneficiary")) {
9833      JsonArray array = json.getAsJsonArray("costToBeneficiary");
9834      for (int i = 0; i < array.size(); i++) {
9835        res.getCostToBeneficiary().add(parseCoverageCostToBeneficiaryComponent(array.get(i).getAsJsonObject()));
9836      }
9837    };
9838    if (json.has("subrogation"))
9839      res.setSubrogationElement(parseBoolean(json.get("subrogation").getAsBoolean()));
9840    if (json.has("_subrogation"))
9841      parseElementProperties(json.getAsJsonObject("_subrogation"), res.getSubrogationElement());
9842    if (json.has("contract")) {
9843      JsonArray array = json.getAsJsonArray("contract");
9844      for (int i = 0; i < array.size(); i++) {
9845        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
9846      }
9847    };
9848  }
9849
9850  protected Coverage.ClassComponent parseCoverageClassComponent(JsonObject json) throws IOException, FHIRFormatError {
9851    Coverage.ClassComponent res = new Coverage.ClassComponent();
9852    parseCoverageClassComponentProperties(json, res);
9853    return res;
9854  }
9855
9856  protected void parseCoverageClassComponentProperties(JsonObject json, Coverage.ClassComponent res) throws IOException, FHIRFormatError {
9857    parseBackboneElementProperties(json, res);
9858    if (json.has("type"))
9859      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9860    if (json.has("value"))
9861      res.setValueElement(parseString(json.get("value").getAsString()));
9862    if (json.has("_value"))
9863      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
9864    if (json.has("name"))
9865      res.setNameElement(parseString(json.get("name").getAsString()));
9866    if (json.has("_name"))
9867      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9868  }
9869
9870  protected Coverage.CostToBeneficiaryComponent parseCoverageCostToBeneficiaryComponent(JsonObject json) throws IOException, FHIRFormatError {
9871    Coverage.CostToBeneficiaryComponent res = new Coverage.CostToBeneficiaryComponent();
9872    parseCoverageCostToBeneficiaryComponentProperties(json, res);
9873    return res;
9874  }
9875
9876  protected void parseCoverageCostToBeneficiaryComponentProperties(JsonObject json, Coverage.CostToBeneficiaryComponent res) throws IOException, FHIRFormatError {
9877    parseBackboneElementProperties(json, res);
9878    if (json.has("type"))
9879      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9880    DataType value = parseType("value", json);
9881    if (value != null)
9882      res.setValue(value);
9883    if (json.has("exception")) {
9884      JsonArray array = json.getAsJsonArray("exception");
9885      for (int i = 0; i < array.size(); i++) {
9886        res.getException().add(parseCoverageExemptionComponent(array.get(i).getAsJsonObject()));
9887      }
9888    };
9889  }
9890
9891  protected Coverage.ExemptionComponent parseCoverageExemptionComponent(JsonObject json) throws IOException, FHIRFormatError {
9892    Coverage.ExemptionComponent res = new Coverage.ExemptionComponent();
9893    parseCoverageExemptionComponentProperties(json, res);
9894    return res;
9895  }
9896
9897  protected void parseCoverageExemptionComponentProperties(JsonObject json, Coverage.ExemptionComponent res) throws IOException, FHIRFormatError {
9898    parseBackboneElementProperties(json, res);
9899    if (json.has("type"))
9900      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9901    if (json.has("period"))
9902      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9903  }
9904
9905  protected CoverageEligibilityRequest parseCoverageEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
9906    CoverageEligibilityRequest res = new CoverageEligibilityRequest();
9907    parseCoverageEligibilityRequestProperties(json, res);
9908    return res;
9909  }
9910
9911  protected void parseCoverageEligibilityRequestProperties(JsonObject json, CoverageEligibilityRequest res) throws IOException, FHIRFormatError {
9912    parseDomainResourceProperties(json, res);
9913    if (json.has("identifier")) {
9914      JsonArray array = json.getAsJsonArray("identifier");
9915      for (int i = 0; i < array.size(); i++) {
9916        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9917      }
9918    };
9919    if (json.has("status"))
9920      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
9921    if (json.has("_status"))
9922      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9923    if (json.has("priority"))
9924      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
9925    if (json.has("purpose")) {
9926      JsonArray array = json.getAsJsonArray("purpose");
9927      for (int i = 0; i < array.size(); i++) {
9928        if (array.get(i).isJsonNull()) {
9929          res.getPurpose().add(new Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose>(new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), CoverageEligibilityRequest.EligibilityRequestPurpose.NULL));
9930        } else {;
9931          res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
9932        }
9933      }
9934    };
9935    if (json.has("_purpose")) {
9936      JsonArray array = json.getAsJsonArray("_purpose");
9937      for (int i = 0; i < array.size(); i++) {
9938        if (i == res.getPurpose().size())
9939          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
9940        if (array.get(i) instanceof JsonObject) 
9941          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
9942      }
9943    };
9944    if (json.has("patient"))
9945      res.setPatient(parseReference(json.getAsJsonObject("patient")));
9946    DataType serviced = parseType("serviced", json);
9947    if (serviced != null)
9948      res.setServiced(serviced);
9949    if (json.has("created"))
9950      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
9951    if (json.has("_created"))
9952      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
9953    if (json.has("enterer"))
9954      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
9955    if (json.has("provider"))
9956      res.setProvider(parseReference(json.getAsJsonObject("provider")));
9957    if (json.has("insurer"))
9958      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
9959    if (json.has("facility"))
9960      res.setFacility(parseReference(json.getAsJsonObject("facility")));
9961    if (json.has("supportingInfo")) {
9962      JsonArray array = json.getAsJsonArray("supportingInfo");
9963      for (int i = 0; i < array.size(); i++) {
9964        res.getSupportingInfo().add(parseCoverageEligibilityRequestSupportingInformationComponent(array.get(i).getAsJsonObject()));
9965      }
9966    };
9967    if (json.has("insurance")) {
9968      JsonArray array = json.getAsJsonArray("insurance");
9969      for (int i = 0; i < array.size(); i++) {
9970        res.getInsurance().add(parseCoverageEligibilityRequestInsuranceComponent(array.get(i).getAsJsonObject()));
9971      }
9972    };
9973    if (json.has("item")) {
9974      JsonArray array = json.getAsJsonArray("item");
9975      for (int i = 0; i < array.size(); i++) {
9976        res.getItem().add(parseCoverageEligibilityRequestDetailsComponent(array.get(i).getAsJsonObject()));
9977      }
9978    };
9979  }
9980
9981  protected CoverageEligibilityRequest.SupportingInformationComponent parseCoverageEligibilityRequestSupportingInformationComponent(JsonObject json) throws IOException, FHIRFormatError {
9982    CoverageEligibilityRequest.SupportingInformationComponent res = new CoverageEligibilityRequest.SupportingInformationComponent();
9983    parseCoverageEligibilityRequestSupportingInformationComponentProperties(json, res);
9984    return res;
9985  }
9986
9987  protected void parseCoverageEligibilityRequestSupportingInformationComponentProperties(JsonObject json, CoverageEligibilityRequest.SupportingInformationComponent res) throws IOException, FHIRFormatError {
9988    parseBackboneElementProperties(json, res);
9989    if (json.has("sequence"))
9990      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9991    if (json.has("_sequence"))
9992      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
9993    if (json.has("information"))
9994      res.setInformation(parseReference(json.getAsJsonObject("information")));
9995    if (json.has("appliesToAll"))
9996      res.setAppliesToAllElement(parseBoolean(json.get("appliesToAll").getAsBoolean()));
9997    if (json.has("_appliesToAll"))
9998      parseElementProperties(json.getAsJsonObject("_appliesToAll"), res.getAppliesToAllElement());
9999  }
10000
10001  protected CoverageEligibilityRequest.InsuranceComponent parseCoverageEligibilityRequestInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
10002    CoverageEligibilityRequest.InsuranceComponent res = new CoverageEligibilityRequest.InsuranceComponent();
10003    parseCoverageEligibilityRequestInsuranceComponentProperties(json, res);
10004    return res;
10005  }
10006
10007  protected void parseCoverageEligibilityRequestInsuranceComponentProperties(JsonObject json, CoverageEligibilityRequest.InsuranceComponent res) throws IOException, FHIRFormatError {
10008    parseBackboneElementProperties(json, res);
10009    if (json.has("focal"))
10010      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
10011    if (json.has("_focal"))
10012      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
10013    if (json.has("coverage"))
10014      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
10015    if (json.has("businessArrangement"))
10016      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
10017    if (json.has("_businessArrangement"))
10018      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
10019  }
10020
10021  protected CoverageEligibilityRequest.DetailsComponent parseCoverageEligibilityRequestDetailsComponent(JsonObject json) throws IOException, FHIRFormatError {
10022    CoverageEligibilityRequest.DetailsComponent res = new CoverageEligibilityRequest.DetailsComponent();
10023    parseCoverageEligibilityRequestDetailsComponentProperties(json, res);
10024    return res;
10025  }
10026
10027  protected void parseCoverageEligibilityRequestDetailsComponentProperties(JsonObject json, CoverageEligibilityRequest.DetailsComponent res) throws IOException, FHIRFormatError {
10028    parseBackboneElementProperties(json, res);
10029    if (json.has("supportingInfoSequence")) {
10030      JsonArray array = json.getAsJsonArray("supportingInfoSequence");
10031      for (int i = 0; i < array.size(); i++) {
10032        if (array.get(i).isJsonNull()) {
10033          res.getSupportingInfoSequence().add(new PositiveIntType());
10034        } else {;
10035          res.getSupportingInfoSequence().add(parsePositiveInt(array.get(i).getAsString()));
10036        }
10037      }
10038    };
10039    if (json.has("_supportingInfoSequence")) {
10040      JsonArray array = json.getAsJsonArray("_supportingInfoSequence");
10041      for (int i = 0; i < array.size(); i++) {
10042        if (i == res.getSupportingInfoSequence().size())
10043          res.getSupportingInfoSequence().add(parsePositiveInt(null));
10044        if (array.get(i) instanceof JsonObject) 
10045          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportingInfoSequence().get(i));
10046      }
10047    };
10048    if (json.has("category"))
10049      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
10050    if (json.has("productOrService"))
10051      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
10052    if (json.has("modifier")) {
10053      JsonArray array = json.getAsJsonArray("modifier");
10054      for (int i = 0; i < array.size(); i++) {
10055        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10056      }
10057    };
10058    if (json.has("provider"))
10059      res.setProvider(parseReference(json.getAsJsonObject("provider")));
10060    if (json.has("quantity"))
10061      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
10062    if (json.has("unitPrice"))
10063      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
10064    if (json.has("facility"))
10065      res.setFacility(parseReference(json.getAsJsonObject("facility")));
10066    if (json.has("diagnosis")) {
10067      JsonArray array = json.getAsJsonArray("diagnosis");
10068      for (int i = 0; i < array.size(); i++) {
10069        res.getDiagnosis().add(parseCoverageEligibilityRequestDiagnosisComponent(array.get(i).getAsJsonObject()));
10070      }
10071    };
10072    if (json.has("detail")) {
10073      JsonArray array = json.getAsJsonArray("detail");
10074      for (int i = 0; i < array.size(); i++) {
10075        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
10076      }
10077    };
10078  }
10079
10080  protected CoverageEligibilityRequest.DiagnosisComponent parseCoverageEligibilityRequestDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
10081    CoverageEligibilityRequest.DiagnosisComponent res = new CoverageEligibilityRequest.DiagnosisComponent();
10082    parseCoverageEligibilityRequestDiagnosisComponentProperties(json, res);
10083    return res;
10084  }
10085
10086  protected void parseCoverageEligibilityRequestDiagnosisComponentProperties(JsonObject json, CoverageEligibilityRequest.DiagnosisComponent res) throws IOException, FHIRFormatError {
10087    parseBackboneElementProperties(json, res);
10088    DataType diagnosis = parseType("diagnosis", json);
10089    if (diagnosis != null)
10090      res.setDiagnosis(diagnosis);
10091  }
10092
10093  protected CoverageEligibilityResponse parseCoverageEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
10094    CoverageEligibilityResponse res = new CoverageEligibilityResponse();
10095    parseCoverageEligibilityResponseProperties(json, res);
10096    return res;
10097  }
10098
10099  protected void parseCoverageEligibilityResponseProperties(JsonObject json, CoverageEligibilityResponse res) throws IOException, FHIRFormatError {
10100    parseDomainResourceProperties(json, res);
10101    if (json.has("identifier")) {
10102      JsonArray array = json.getAsJsonArray("identifier");
10103      for (int i = 0; i < array.size(); i++) {
10104        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10105      }
10106    };
10107    if (json.has("status"))
10108      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
10109    if (json.has("_status"))
10110      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10111    if (json.has("purpose")) {
10112      JsonArray array = json.getAsJsonArray("purpose");
10113      for (int i = 0; i < array.size(); i++) {
10114        if (array.get(i).isJsonNull()) {
10115          res.getPurpose().add(new Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose>(new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), CoverageEligibilityResponse.EligibilityResponsePurpose.NULL));
10116        } else {;
10117          res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
10118        }
10119      }
10120    };
10121    if (json.has("_purpose")) {
10122      JsonArray array = json.getAsJsonArray("_purpose");
10123      for (int i = 0; i < array.size(); i++) {
10124        if (i == res.getPurpose().size())
10125          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
10126        if (array.get(i) instanceof JsonObject) 
10127          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
10128      }
10129    };
10130    if (json.has("patient"))
10131      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10132    DataType serviced = parseType("serviced", json);
10133    if (serviced != null)
10134      res.setServiced(serviced);
10135    if (json.has("created"))
10136      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
10137    if (json.has("_created"))
10138      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
10139    if (json.has("requestor"))
10140      res.setRequestor(parseReference(json.getAsJsonObject("requestor")));
10141    if (json.has("request"))
10142      res.setRequest(parseReference(json.getAsJsonObject("request")));
10143    if (json.has("outcome"))
10144      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.ClaimProcessingCodes.NULL, new Enumerations.ClaimProcessingCodesEnumFactory()));
10145    if (json.has("_outcome"))
10146      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
10147    if (json.has("disposition"))
10148      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
10149    if (json.has("_disposition"))
10150      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
10151    if (json.has("insurer"))
10152      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
10153    if (json.has("insurance")) {
10154      JsonArray array = json.getAsJsonArray("insurance");
10155      for (int i = 0; i < array.size(); i++) {
10156        res.getInsurance().add(parseCoverageEligibilityResponseInsuranceComponent(array.get(i).getAsJsonObject()));
10157      }
10158    };
10159    if (json.has("preAuthRef"))
10160      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
10161    if (json.has("_preAuthRef"))
10162      parseElementProperties(json.getAsJsonObject("_preAuthRef"), res.getPreAuthRefElement());
10163    if (json.has("form"))
10164      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
10165    if (json.has("error")) {
10166      JsonArray array = json.getAsJsonArray("error");
10167      for (int i = 0; i < array.size(); i++) {
10168        res.getError().add(parseCoverageEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject()));
10169      }
10170    };
10171  }
10172
10173  protected CoverageEligibilityResponse.InsuranceComponent parseCoverageEligibilityResponseInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
10174    CoverageEligibilityResponse.InsuranceComponent res = new CoverageEligibilityResponse.InsuranceComponent();
10175    parseCoverageEligibilityResponseInsuranceComponentProperties(json, res);
10176    return res;
10177  }
10178
10179  protected void parseCoverageEligibilityResponseInsuranceComponentProperties(JsonObject json, CoverageEligibilityResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
10180    parseBackboneElementProperties(json, res);
10181    if (json.has("coverage"))
10182      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
10183    if (json.has("inforce"))
10184      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
10185    if (json.has("_inforce"))
10186      parseElementProperties(json.getAsJsonObject("_inforce"), res.getInforceElement());
10187    if (json.has("benefitPeriod"))
10188      res.setBenefitPeriod(parsePeriod(json.getAsJsonObject("benefitPeriod")));
10189    if (json.has("item")) {
10190      JsonArray array = json.getAsJsonArray("item");
10191      for (int i = 0; i < array.size(); i++) {
10192        res.getItem().add(parseCoverageEligibilityResponseItemsComponent(array.get(i).getAsJsonObject()));
10193      }
10194    };
10195  }
10196
10197  protected CoverageEligibilityResponse.ItemsComponent parseCoverageEligibilityResponseItemsComponent(JsonObject json) throws IOException, FHIRFormatError {
10198    CoverageEligibilityResponse.ItemsComponent res = new CoverageEligibilityResponse.ItemsComponent();
10199    parseCoverageEligibilityResponseItemsComponentProperties(json, res);
10200    return res;
10201  }
10202
10203  protected void parseCoverageEligibilityResponseItemsComponentProperties(JsonObject json, CoverageEligibilityResponse.ItemsComponent res) throws IOException, FHIRFormatError {
10204    parseBackboneElementProperties(json, res);
10205    if (json.has("category"))
10206      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
10207    if (json.has("productOrService"))
10208      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
10209    if (json.has("modifier")) {
10210      JsonArray array = json.getAsJsonArray("modifier");
10211      for (int i = 0; i < array.size(); i++) {
10212        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10213      }
10214    };
10215    if (json.has("provider"))
10216      res.setProvider(parseReference(json.getAsJsonObject("provider")));
10217    if (json.has("excluded"))
10218      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
10219    if (json.has("_excluded"))
10220      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
10221    if (json.has("name"))
10222      res.setNameElement(parseString(json.get("name").getAsString()));
10223    if (json.has("_name"))
10224      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10225    if (json.has("description"))
10226      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10227    if (json.has("_description"))
10228      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10229    if (json.has("network"))
10230      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
10231    if (json.has("unit"))
10232      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
10233    if (json.has("term"))
10234      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
10235    if (json.has("benefit")) {
10236      JsonArray array = json.getAsJsonArray("benefit");
10237      for (int i = 0; i < array.size(); i++) {
10238        res.getBenefit().add(parseCoverageEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject()));
10239      }
10240    };
10241    if (json.has("authorizationRequired"))
10242      res.setAuthorizationRequiredElement(parseBoolean(json.get("authorizationRequired").getAsBoolean()));
10243    if (json.has("_authorizationRequired"))
10244      parseElementProperties(json.getAsJsonObject("_authorizationRequired"), res.getAuthorizationRequiredElement());
10245    if (json.has("authorizationSupporting")) {
10246      JsonArray array = json.getAsJsonArray("authorizationSupporting");
10247      for (int i = 0; i < array.size(); i++) {
10248        res.getAuthorizationSupporting().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10249      }
10250    };
10251    if (json.has("authorizationUrl"))
10252      res.setAuthorizationUrlElement(parseUri(json.get("authorizationUrl").getAsString()));
10253    if (json.has("_authorizationUrl"))
10254      parseElementProperties(json.getAsJsonObject("_authorizationUrl"), res.getAuthorizationUrlElement());
10255  }
10256
10257  protected CoverageEligibilityResponse.BenefitComponent parseCoverageEligibilityResponseBenefitComponent(JsonObject json) throws IOException, FHIRFormatError {
10258    CoverageEligibilityResponse.BenefitComponent res = new CoverageEligibilityResponse.BenefitComponent();
10259    parseCoverageEligibilityResponseBenefitComponentProperties(json, res);
10260    return res;
10261  }
10262
10263  protected void parseCoverageEligibilityResponseBenefitComponentProperties(JsonObject json, CoverageEligibilityResponse.BenefitComponent res) throws IOException, FHIRFormatError {
10264    parseBackboneElementProperties(json, res);
10265    if (json.has("type"))
10266      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10267    DataType allowed = parseType("allowed", json);
10268    if (allowed != null)
10269      res.setAllowed(allowed);
10270    DataType used = parseType("used", json);
10271    if (used != null)
10272      res.setUsed(used);
10273  }
10274
10275  protected CoverageEligibilityResponse.ErrorsComponent parseCoverageEligibilityResponseErrorsComponent(JsonObject json) throws IOException, FHIRFormatError {
10276    CoverageEligibilityResponse.ErrorsComponent res = new CoverageEligibilityResponse.ErrorsComponent();
10277    parseCoverageEligibilityResponseErrorsComponentProperties(json, res);
10278    return res;
10279  }
10280
10281  protected void parseCoverageEligibilityResponseErrorsComponentProperties(JsonObject json, CoverageEligibilityResponse.ErrorsComponent res) throws IOException, FHIRFormatError {
10282    parseBackboneElementProperties(json, res);
10283    if (json.has("code"))
10284      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
10285  }
10286
10287  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
10288    DetectedIssue res = new DetectedIssue();
10289    parseDetectedIssueProperties(json, res);
10290    return res;
10291  }
10292
10293  protected void parseDetectedIssueProperties(JsonObject json, DetectedIssue res) throws IOException, FHIRFormatError {
10294    parseDomainResourceProperties(json, res);
10295    if (json.has("identifier")) {
10296      JsonArray array = json.getAsJsonArray("identifier");
10297      for (int i = 0; i < array.size(); i++) {
10298        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10299      }
10300    };
10301    if (json.has("status"))
10302      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ObservationStatus.NULL, new Enumerations.ObservationStatusEnumFactory()));
10303    if (json.has("_status"))
10304      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10305    if (json.has("code"))
10306      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
10307    if (json.has("severity"))
10308      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
10309    if (json.has("_severity"))
10310      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
10311    if (json.has("patient"))
10312      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10313    DataType identified = parseType("identified", json);
10314    if (identified != null)
10315      res.setIdentified(identified);
10316    if (json.has("author"))
10317      res.setAuthor(parseReference(json.getAsJsonObject("author")));
10318    if (json.has("implicated")) {
10319      JsonArray array = json.getAsJsonArray("implicated");
10320      for (int i = 0; i < array.size(); i++) {
10321        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
10322      }
10323    };
10324    if (json.has("evidence")) {
10325      JsonArray array = json.getAsJsonArray("evidence");
10326      for (int i = 0; i < array.size(); i++) {
10327        res.getEvidence().add(parseDetectedIssueEvidenceComponent(array.get(i).getAsJsonObject()));
10328      }
10329    };
10330    if (json.has("detail"))
10331      res.setDetailElement(parseString(json.get("detail").getAsString()));
10332    if (json.has("_detail"))
10333      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
10334    if (json.has("reference"))
10335      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
10336    if (json.has("_reference"))
10337      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
10338    if (json.has("mitigation")) {
10339      JsonArray array = json.getAsJsonArray("mitigation");
10340      for (int i = 0; i < array.size(); i++) {
10341        res.getMitigation().add(parseDetectedIssueMitigationComponent(array.get(i).getAsJsonObject()));
10342      }
10343    };
10344  }
10345
10346  protected DetectedIssue.DetectedIssueEvidenceComponent parseDetectedIssueEvidenceComponent(JsonObject json) throws IOException, FHIRFormatError {
10347    DetectedIssue.DetectedIssueEvidenceComponent res = new DetectedIssue.DetectedIssueEvidenceComponent();
10348    parseDetectedIssueEvidenceComponentProperties(json, res);
10349    return res;
10350  }
10351
10352  protected void parseDetectedIssueEvidenceComponentProperties(JsonObject json, DetectedIssue.DetectedIssueEvidenceComponent res) throws IOException, FHIRFormatError {
10353    parseBackboneElementProperties(json, res);
10354    if (json.has("code")) {
10355      JsonArray array = json.getAsJsonArray("code");
10356      for (int i = 0; i < array.size(); i++) {
10357        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10358      }
10359    };
10360    if (json.has("detail")) {
10361      JsonArray array = json.getAsJsonArray("detail");
10362      for (int i = 0; i < array.size(); i++) {
10363        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
10364      }
10365    };
10366  }
10367
10368  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueMitigationComponent(JsonObject json) throws IOException, FHIRFormatError {
10369    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
10370    parseDetectedIssueMitigationComponentProperties(json, res);
10371    return res;
10372  }
10373
10374  protected void parseDetectedIssueMitigationComponentProperties(JsonObject json, DetectedIssue.DetectedIssueMitigationComponent res) throws IOException, FHIRFormatError {
10375    parseBackboneElementProperties(json, res);
10376    if (json.has("action"))
10377      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
10378    if (json.has("date"))
10379      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10380    if (json.has("_date"))
10381      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10382    if (json.has("author"))
10383      res.setAuthor(parseReference(json.getAsJsonObject("author")));
10384  }
10385
10386  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
10387    Device res = new Device();
10388    parseDeviceProperties(json, res);
10389    return res;
10390  }
10391
10392  protected void parseDeviceProperties(JsonObject json, Device res) throws IOException, FHIRFormatError {
10393    parseDomainResourceProperties(json, res);
10394    if (json.has("identifier")) {
10395      JsonArray array = json.getAsJsonArray("identifier");
10396      for (int i = 0; i < array.size(); i++) {
10397        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10398      }
10399    };
10400    if (json.has("definition"))
10401      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
10402    if (json.has("udiCarrier")) {
10403      JsonArray array = json.getAsJsonArray("udiCarrier");
10404      for (int i = 0; i < array.size(); i++) {
10405        res.getUdiCarrier().add(parseDeviceUdiCarrierComponent(array.get(i).getAsJsonObject()));
10406      }
10407    };
10408    if (json.has("status"))
10409      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.FHIRDeviceStatus.NULL, new Device.FHIRDeviceStatusEnumFactory()));
10410    if (json.has("_status"))
10411      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10412    if (json.has("statusReason")) {
10413      JsonArray array = json.getAsJsonArray("statusReason");
10414      for (int i = 0; i < array.size(); i++) {
10415        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10416      }
10417    };
10418    if (json.has("distinctIdentifier"))
10419      res.setDistinctIdentifierElement(parseString(json.get("distinctIdentifier").getAsString()));
10420    if (json.has("_distinctIdentifier"))
10421      parseElementProperties(json.getAsJsonObject("_distinctIdentifier"), res.getDistinctIdentifierElement());
10422    if (json.has("manufacturer"))
10423      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
10424    if (json.has("_manufacturer"))
10425      parseElementProperties(json.getAsJsonObject("_manufacturer"), res.getManufacturerElement());
10426    if (json.has("manufactureDate"))
10427      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
10428    if (json.has("_manufactureDate"))
10429      parseElementProperties(json.getAsJsonObject("_manufactureDate"), res.getManufactureDateElement());
10430    if (json.has("expirationDate"))
10431      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
10432    if (json.has("_expirationDate"))
10433      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
10434    if (json.has("lotNumber"))
10435      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
10436    if (json.has("_lotNumber"))
10437      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
10438    if (json.has("serialNumber"))
10439      res.setSerialNumberElement(parseString(json.get("serialNumber").getAsString()));
10440    if (json.has("_serialNumber"))
10441      parseElementProperties(json.getAsJsonObject("_serialNumber"), res.getSerialNumberElement());
10442    if (json.has("deviceName")) {
10443      JsonArray array = json.getAsJsonArray("deviceName");
10444      for (int i = 0; i < array.size(); i++) {
10445        res.getDeviceName().add(parseDeviceDeviceNameComponent(array.get(i).getAsJsonObject()));
10446      }
10447    };
10448    if (json.has("modelNumber"))
10449      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
10450    if (json.has("_modelNumber"))
10451      parseElementProperties(json.getAsJsonObject("_modelNumber"), res.getModelNumberElement());
10452    if (json.has("partNumber"))
10453      res.setPartNumberElement(parseString(json.get("partNumber").getAsString()));
10454    if (json.has("_partNumber"))
10455      parseElementProperties(json.getAsJsonObject("_partNumber"), res.getPartNumberElement());
10456    if (json.has("type"))
10457      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10458    if (json.has("specialization")) {
10459      JsonArray array = json.getAsJsonArray("specialization");
10460      for (int i = 0; i < array.size(); i++) {
10461        res.getSpecialization().add(parseDeviceSpecializationComponent(array.get(i).getAsJsonObject()));
10462      }
10463    };
10464    if (json.has("version")) {
10465      JsonArray array = json.getAsJsonArray("version");
10466      for (int i = 0; i < array.size(); i++) {
10467        res.getVersion().add(parseDeviceVersionComponent(array.get(i).getAsJsonObject()));
10468      }
10469    };
10470    if (json.has("property")) {
10471      JsonArray array = json.getAsJsonArray("property");
10472      for (int i = 0; i < array.size(); i++) {
10473        res.getProperty().add(parseDevicePropertyComponent(array.get(i).getAsJsonObject()));
10474      }
10475    };
10476    if (json.has("patient"))
10477      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10478    if (json.has("owner"))
10479      res.setOwner(parseReference(json.getAsJsonObject("owner")));
10480    if (json.has("contact")) {
10481      JsonArray array = json.getAsJsonArray("contact");
10482      for (int i = 0; i < array.size(); i++) {
10483        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
10484      }
10485    };
10486    if (json.has("location"))
10487      res.setLocation(parseReference(json.getAsJsonObject("location")));
10488    if (json.has("url"))
10489      res.setUrlElement(parseUri(json.get("url").getAsString()));
10490    if (json.has("_url"))
10491      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10492    if (json.has("note")) {
10493      JsonArray array = json.getAsJsonArray("note");
10494      for (int i = 0; i < array.size(); i++) {
10495        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10496      }
10497    };
10498    if (json.has("safety")) {
10499      JsonArray array = json.getAsJsonArray("safety");
10500      for (int i = 0; i < array.size(); i++) {
10501        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10502      }
10503    };
10504    if (json.has("parent"))
10505      res.setParent(parseReference(json.getAsJsonObject("parent")));
10506  }
10507
10508  protected Device.DeviceUdiCarrierComponent parseDeviceUdiCarrierComponent(JsonObject json) throws IOException, FHIRFormatError {
10509    Device.DeviceUdiCarrierComponent res = new Device.DeviceUdiCarrierComponent();
10510    parseDeviceUdiCarrierComponentProperties(json, res);
10511    return res;
10512  }
10513
10514  protected void parseDeviceUdiCarrierComponentProperties(JsonObject json, Device.DeviceUdiCarrierComponent res) throws IOException, FHIRFormatError {
10515    parseBackboneElementProperties(json, res);
10516    if (json.has("deviceIdentifier"))
10517      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
10518    if (json.has("_deviceIdentifier"))
10519      parseElementProperties(json.getAsJsonObject("_deviceIdentifier"), res.getDeviceIdentifierElement());
10520    if (json.has("issuer"))
10521      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
10522    if (json.has("_issuer"))
10523      parseElementProperties(json.getAsJsonObject("_issuer"), res.getIssuerElement());
10524    if (json.has("jurisdiction"))
10525      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
10526    if (json.has("_jurisdiction"))
10527      parseElementProperties(json.getAsJsonObject("_jurisdiction"), res.getJurisdictionElement());
10528    if (json.has("carrierAIDC"))
10529      res.setCarrierAIDCElement(parseBase64Binary(json.get("carrierAIDC").getAsString()));
10530    if (json.has("_carrierAIDC"))
10531      parseElementProperties(json.getAsJsonObject("_carrierAIDC"), res.getCarrierAIDCElement());
10532    if (json.has("carrierHRF"))
10533      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
10534    if (json.has("_carrierHRF"))
10535      parseElementProperties(json.getAsJsonObject("_carrierHRF"), res.getCarrierHRFElement());
10536    if (json.has("entryType"))
10537      res.setEntryTypeElement(parseEnumeration(json.get("entryType").getAsString(), Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
10538    if (json.has("_entryType"))
10539      parseElementProperties(json.getAsJsonObject("_entryType"), res.getEntryTypeElement());
10540  }
10541
10542  protected Device.DeviceDeviceNameComponent parseDeviceDeviceNameComponent(JsonObject json) throws IOException, FHIRFormatError {
10543    Device.DeviceDeviceNameComponent res = new Device.DeviceDeviceNameComponent();
10544    parseDeviceDeviceNameComponentProperties(json, res);
10545    return res;
10546  }
10547
10548  protected void parseDeviceDeviceNameComponentProperties(JsonObject json, Device.DeviceDeviceNameComponent res) throws IOException, FHIRFormatError {
10549    parseBackboneElementProperties(json, res);
10550    if (json.has("name"))
10551      res.setNameElement(parseString(json.get("name").getAsString()));
10552    if (json.has("_name"))
10553      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10554    if (json.has("type"))
10555      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.DeviceNameType.NULL, new Enumerations.DeviceNameTypeEnumFactory()));
10556    if (json.has("_type"))
10557      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10558  }
10559
10560  protected Device.DeviceSpecializationComponent parseDeviceSpecializationComponent(JsonObject json) throws IOException, FHIRFormatError {
10561    Device.DeviceSpecializationComponent res = new Device.DeviceSpecializationComponent();
10562    parseDeviceSpecializationComponentProperties(json, res);
10563    return res;
10564  }
10565
10566  protected void parseDeviceSpecializationComponentProperties(JsonObject json, Device.DeviceSpecializationComponent res) throws IOException, FHIRFormatError {
10567    parseBackboneElementProperties(json, res);
10568    if (json.has("systemType"))
10569      res.setSystemType(parseCodeableConcept(json.getAsJsonObject("systemType")));
10570    if (json.has("version"))
10571      res.setVersionElement(parseString(json.get("version").getAsString()));
10572    if (json.has("_version"))
10573      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10574  }
10575
10576  protected Device.DeviceVersionComponent parseDeviceVersionComponent(JsonObject json) throws IOException, FHIRFormatError {
10577    Device.DeviceVersionComponent res = new Device.DeviceVersionComponent();
10578    parseDeviceVersionComponentProperties(json, res);
10579    return res;
10580  }
10581
10582  protected void parseDeviceVersionComponentProperties(JsonObject json, Device.DeviceVersionComponent res) throws IOException, FHIRFormatError {
10583    parseBackboneElementProperties(json, res);
10584    if (json.has("type"))
10585      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10586    if (json.has("component"))
10587      res.setComponent(parseIdentifier(json.getAsJsonObject("component")));
10588    if (json.has("value"))
10589      res.setValueElement(parseString(json.get("value").getAsString()));
10590    if (json.has("_value"))
10591      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10592  }
10593
10594  protected Device.DevicePropertyComponent parseDevicePropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
10595    Device.DevicePropertyComponent res = new Device.DevicePropertyComponent();
10596    parseDevicePropertyComponentProperties(json, res);
10597    return res;
10598  }
10599
10600  protected void parseDevicePropertyComponentProperties(JsonObject json, Device.DevicePropertyComponent res) throws IOException, FHIRFormatError {
10601    parseBackboneElementProperties(json, res);
10602    if (json.has("type"))
10603      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10604    if (json.has("valueQuantity")) {
10605      JsonArray array = json.getAsJsonArray("valueQuantity");
10606      for (int i = 0; i < array.size(); i++) {
10607        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
10608      }
10609    };
10610    if (json.has("valueCode")) {
10611      JsonArray array = json.getAsJsonArray("valueCode");
10612      for (int i = 0; i < array.size(); i++) {
10613        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10614      }
10615    };
10616  }
10617
10618  protected DeviceDefinition parseDeviceDefinition(JsonObject json) throws IOException, FHIRFormatError {
10619    DeviceDefinition res = new DeviceDefinition();
10620    parseDeviceDefinitionProperties(json, res);
10621    return res;
10622  }
10623
10624  protected void parseDeviceDefinitionProperties(JsonObject json, DeviceDefinition res) throws IOException, FHIRFormatError {
10625    parseDomainResourceProperties(json, res);
10626    if (json.has("identifier")) {
10627      JsonArray array = json.getAsJsonArray("identifier");
10628      for (int i = 0; i < array.size(); i++) {
10629        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10630      }
10631    };
10632    if (json.has("udiDeviceIdentifier")) {
10633      JsonArray array = json.getAsJsonArray("udiDeviceIdentifier");
10634      for (int i = 0; i < array.size(); i++) {
10635        res.getUdiDeviceIdentifier().add(parseDeviceDefinitionUdiDeviceIdentifierComponent(array.get(i).getAsJsonObject()));
10636      }
10637    };
10638    DataType manufacturer = parseType("manufacturer", json);
10639    if (manufacturer != null)
10640      res.setManufacturer(manufacturer);
10641    if (json.has("deviceName")) {
10642      JsonArray array = json.getAsJsonArray("deviceName");
10643      for (int i = 0; i < array.size(); i++) {
10644        res.getDeviceName().add(parseDeviceDefinitionDeviceNameComponent(array.get(i).getAsJsonObject()));
10645      }
10646    };
10647    if (json.has("modelNumber"))
10648      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
10649    if (json.has("_modelNumber"))
10650      parseElementProperties(json.getAsJsonObject("_modelNumber"), res.getModelNumberElement());
10651    if (json.has("type"))
10652      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10653    if (json.has("specialization")) {
10654      JsonArray array = json.getAsJsonArray("specialization");
10655      for (int i = 0; i < array.size(); i++) {
10656        res.getSpecialization().add(parseDeviceDefinitionSpecializationComponent(array.get(i).getAsJsonObject()));
10657      }
10658    };
10659    if (json.has("version")) {
10660      JsonArray array = json.getAsJsonArray("version");
10661      for (int i = 0; i < array.size(); i++) {
10662        if (array.get(i).isJsonNull()) {
10663          res.getVersion().add(new StringType());
10664        } else {;
10665          res.getVersion().add(parseString(array.get(i).getAsString()));
10666        }
10667      }
10668    };
10669    if (json.has("_version")) {
10670      JsonArray array = json.getAsJsonArray("_version");
10671      for (int i = 0; i < array.size(); i++) {
10672        if (i == res.getVersion().size())
10673          res.getVersion().add(parseString(null));
10674        if (array.get(i) instanceof JsonObject) 
10675          parseElementProperties(array.get(i).getAsJsonObject(), res.getVersion().get(i));
10676      }
10677    };
10678    if (json.has("safety")) {
10679      JsonArray array = json.getAsJsonArray("safety");
10680      for (int i = 0; i < array.size(); i++) {
10681        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10682      }
10683    };
10684    if (json.has("shelfLifeStorage")) {
10685      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
10686      for (int i = 0; i < array.size(); i++) {
10687        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
10688      }
10689    };
10690    if (json.has("physicalCharacteristics"))
10691      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
10692    if (json.has("languageCode")) {
10693      JsonArray array = json.getAsJsonArray("languageCode");
10694      for (int i = 0; i < array.size(); i++) {
10695        res.getLanguageCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10696      }
10697    };
10698    if (json.has("capability")) {
10699      JsonArray array = json.getAsJsonArray("capability");
10700      for (int i = 0; i < array.size(); i++) {
10701        res.getCapability().add(parseDeviceDefinitionCapabilityComponent(array.get(i).getAsJsonObject()));
10702      }
10703    };
10704    if (json.has("property")) {
10705      JsonArray array = json.getAsJsonArray("property");
10706      for (int i = 0; i < array.size(); i++) {
10707        res.getProperty().add(parseDeviceDefinitionPropertyComponent(array.get(i).getAsJsonObject()));
10708      }
10709    };
10710    if (json.has("owner"))
10711      res.setOwner(parseReference(json.getAsJsonObject("owner")));
10712    if (json.has("contact")) {
10713      JsonArray array = json.getAsJsonArray("contact");
10714      for (int i = 0; i < array.size(); i++) {
10715        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
10716      }
10717    };
10718    if (json.has("url"))
10719      res.setUrlElement(parseUri(json.get("url").getAsString()));
10720    if (json.has("_url"))
10721      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10722    if (json.has("onlineInformation"))
10723      res.setOnlineInformationElement(parseUri(json.get("onlineInformation").getAsString()));
10724    if (json.has("_onlineInformation"))
10725      parseElementProperties(json.getAsJsonObject("_onlineInformation"), res.getOnlineInformationElement());
10726    if (json.has("note")) {
10727      JsonArray array = json.getAsJsonArray("note");
10728      for (int i = 0; i < array.size(); i++) {
10729        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10730      }
10731    };
10732    if (json.has("quantity"))
10733      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
10734    if (json.has("parentDevice"))
10735      res.setParentDevice(parseReference(json.getAsJsonObject("parentDevice")));
10736    if (json.has("material")) {
10737      JsonArray array = json.getAsJsonArray("material");
10738      for (int i = 0; i < array.size(); i++) {
10739        res.getMaterial().add(parseDeviceDefinitionMaterialComponent(array.get(i).getAsJsonObject()));
10740      }
10741    };
10742  }
10743
10744  protected DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent parseDeviceDefinitionUdiDeviceIdentifierComponent(JsonObject json) throws IOException, FHIRFormatError {
10745    DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res = new DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent();
10746    parseDeviceDefinitionUdiDeviceIdentifierComponentProperties(json, res);
10747    return res;
10748  }
10749
10750  protected void parseDeviceDefinitionUdiDeviceIdentifierComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res) throws IOException, FHIRFormatError {
10751    parseBackboneElementProperties(json, res);
10752    if (json.has("deviceIdentifier"))
10753      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
10754    if (json.has("_deviceIdentifier"))
10755      parseElementProperties(json.getAsJsonObject("_deviceIdentifier"), res.getDeviceIdentifierElement());
10756    if (json.has("issuer"))
10757      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
10758    if (json.has("_issuer"))
10759      parseElementProperties(json.getAsJsonObject("_issuer"), res.getIssuerElement());
10760    if (json.has("jurisdiction"))
10761      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
10762    if (json.has("_jurisdiction"))
10763      parseElementProperties(json.getAsJsonObject("_jurisdiction"), res.getJurisdictionElement());
10764  }
10765
10766  protected DeviceDefinition.DeviceDefinitionDeviceNameComponent parseDeviceDefinitionDeviceNameComponent(JsonObject json) throws IOException, FHIRFormatError {
10767    DeviceDefinition.DeviceDefinitionDeviceNameComponent res = new DeviceDefinition.DeviceDefinitionDeviceNameComponent();
10768    parseDeviceDefinitionDeviceNameComponentProperties(json, res);
10769    return res;
10770  }
10771
10772  protected void parseDeviceDefinitionDeviceNameComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionDeviceNameComponent res) throws IOException, FHIRFormatError {
10773    parseBackboneElementProperties(json, res);
10774    if (json.has("name"))
10775      res.setNameElement(parseString(json.get("name").getAsString()));
10776    if (json.has("_name"))
10777      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10778    if (json.has("type"))
10779      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.DeviceNameType.NULL, new Enumerations.DeviceNameTypeEnumFactory()));
10780    if (json.has("_type"))
10781      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10782  }
10783
10784  protected DeviceDefinition.DeviceDefinitionSpecializationComponent parseDeviceDefinitionSpecializationComponent(JsonObject json) throws IOException, FHIRFormatError {
10785    DeviceDefinition.DeviceDefinitionSpecializationComponent res = new DeviceDefinition.DeviceDefinitionSpecializationComponent();
10786    parseDeviceDefinitionSpecializationComponentProperties(json, res);
10787    return res;
10788  }
10789
10790  protected void parseDeviceDefinitionSpecializationComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionSpecializationComponent res) throws IOException, FHIRFormatError {
10791    parseBackboneElementProperties(json, res);
10792    if (json.has("systemType"))
10793      res.setSystemTypeElement(parseString(json.get("systemType").getAsString()));
10794    if (json.has("_systemType"))
10795      parseElementProperties(json.getAsJsonObject("_systemType"), res.getSystemTypeElement());
10796    if (json.has("version"))
10797      res.setVersionElement(parseString(json.get("version").getAsString()));
10798    if (json.has("_version"))
10799      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10800  }
10801
10802  protected DeviceDefinition.DeviceDefinitionCapabilityComponent parseDeviceDefinitionCapabilityComponent(JsonObject json) throws IOException, FHIRFormatError {
10803    DeviceDefinition.DeviceDefinitionCapabilityComponent res = new DeviceDefinition.DeviceDefinitionCapabilityComponent();
10804    parseDeviceDefinitionCapabilityComponentProperties(json, res);
10805    return res;
10806  }
10807
10808  protected void parseDeviceDefinitionCapabilityComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionCapabilityComponent res) throws IOException, FHIRFormatError {
10809    parseBackboneElementProperties(json, res);
10810    if (json.has("type"))
10811      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10812    if (json.has("description")) {
10813      JsonArray array = json.getAsJsonArray("description");
10814      for (int i = 0; i < array.size(); i++) {
10815        res.getDescription().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10816      }
10817    };
10818  }
10819
10820  protected DeviceDefinition.DeviceDefinitionPropertyComponent parseDeviceDefinitionPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
10821    DeviceDefinition.DeviceDefinitionPropertyComponent res = new DeviceDefinition.DeviceDefinitionPropertyComponent();
10822    parseDeviceDefinitionPropertyComponentProperties(json, res);
10823    return res;
10824  }
10825
10826  protected void parseDeviceDefinitionPropertyComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
10827    parseBackboneElementProperties(json, res);
10828    if (json.has("type"))
10829      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10830    if (json.has("valueQuantity")) {
10831      JsonArray array = json.getAsJsonArray("valueQuantity");
10832      for (int i = 0; i < array.size(); i++) {
10833        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
10834      }
10835    };
10836    if (json.has("valueCode")) {
10837      JsonArray array = json.getAsJsonArray("valueCode");
10838      for (int i = 0; i < array.size(); i++) {
10839        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10840      }
10841    };
10842  }
10843
10844  protected DeviceDefinition.DeviceDefinitionMaterialComponent parseDeviceDefinitionMaterialComponent(JsonObject json) throws IOException, FHIRFormatError {
10845    DeviceDefinition.DeviceDefinitionMaterialComponent res = new DeviceDefinition.DeviceDefinitionMaterialComponent();
10846    parseDeviceDefinitionMaterialComponentProperties(json, res);
10847    return res;
10848  }
10849
10850  protected void parseDeviceDefinitionMaterialComponentProperties(JsonObject json, DeviceDefinition.DeviceDefinitionMaterialComponent res) throws IOException, FHIRFormatError {
10851    parseBackboneElementProperties(json, res);
10852    if (json.has("substance"))
10853      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
10854    if (json.has("alternate"))
10855      res.setAlternateElement(parseBoolean(json.get("alternate").getAsBoolean()));
10856    if (json.has("_alternate"))
10857      parseElementProperties(json.getAsJsonObject("_alternate"), res.getAlternateElement());
10858    if (json.has("allergenicIndicator"))
10859      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
10860    if (json.has("_allergenicIndicator"))
10861      parseElementProperties(json.getAsJsonObject("_allergenicIndicator"), res.getAllergenicIndicatorElement());
10862  }
10863
10864  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
10865    DeviceMetric res = new DeviceMetric();
10866    parseDeviceMetricProperties(json, res);
10867    return res;
10868  }
10869
10870  protected void parseDeviceMetricProperties(JsonObject json, DeviceMetric res) throws IOException, FHIRFormatError {
10871    parseDomainResourceProperties(json, res);
10872    if (json.has("identifier")) {
10873      JsonArray array = json.getAsJsonArray("identifier");
10874      for (int i = 0; i < array.size(); i++) {
10875        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10876      }
10877    };
10878    if (json.has("type"))
10879      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10880    if (json.has("unit"))
10881      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
10882    if (json.has("source"))
10883      res.setSource(parseReference(json.getAsJsonObject("source")));
10884    if (json.has("parent"))
10885      res.setParent(parseReference(json.getAsJsonObject("parent")));
10886    if (json.has("operationalStatus"))
10887      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
10888    if (json.has("_operationalStatus"))
10889      parseElementProperties(json.getAsJsonObject("_operationalStatus"), res.getOperationalStatusElement());
10890    if (json.has("color"))
10891      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
10892    if (json.has("_color"))
10893      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
10894    if (json.has("category"))
10895      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
10896    if (json.has("_category"))
10897      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
10898    if (json.has("measurementPeriod"))
10899      res.setMeasurementPeriod(parseTiming(json.getAsJsonObject("measurementPeriod")));
10900    if (json.has("calibration")) {
10901      JsonArray array = json.getAsJsonArray("calibration");
10902      for (int i = 0; i < array.size(); i++) {
10903        res.getCalibration().add(parseDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject()));
10904      }
10905    };
10906  }
10907
10908  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricCalibrationComponent(JsonObject json) throws IOException, FHIRFormatError {
10909    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
10910    parseDeviceMetricCalibrationComponentProperties(json, res);
10911    return res;
10912  }
10913
10914  protected void parseDeviceMetricCalibrationComponentProperties(JsonObject json, DeviceMetric.DeviceMetricCalibrationComponent res) throws IOException, FHIRFormatError {
10915    parseBackboneElementProperties(json, res);
10916    if (json.has("type"))
10917      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
10918    if (json.has("_type"))
10919      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10920    if (json.has("state"))
10921      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
10922    if (json.has("_state"))
10923      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
10924    if (json.has("time"))
10925      res.setTimeElement(parseInstant(json.get("time").getAsString()));
10926    if (json.has("_time"))
10927      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
10928  }
10929
10930  protected DeviceRequest parseDeviceRequest(JsonObject json) throws IOException, FHIRFormatError {
10931    DeviceRequest res = new DeviceRequest();
10932    parseDeviceRequestProperties(json, res);
10933    return res;
10934  }
10935
10936  protected void parseDeviceRequestProperties(JsonObject json, DeviceRequest res) throws IOException, FHIRFormatError {
10937    parseDomainResourceProperties(json, res);
10938    if (json.has("identifier")) {
10939      JsonArray array = json.getAsJsonArray("identifier");
10940      for (int i = 0; i < array.size(); i++) {
10941        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10942      }
10943    };
10944    if (json.has("instantiatesCanonical")) {
10945      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
10946      for (int i = 0; i < array.size(); i++) {
10947        if (array.get(i).isJsonNull()) {
10948          res.getInstantiatesCanonical().add(new CanonicalType());
10949        } else {;
10950          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
10951        }
10952      }
10953    };
10954    if (json.has("_instantiatesCanonical")) {
10955      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
10956      for (int i = 0; i < array.size(); i++) {
10957        if (i == res.getInstantiatesCanonical().size())
10958          res.getInstantiatesCanonical().add(parseCanonical(null));
10959        if (array.get(i) instanceof JsonObject) 
10960          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
10961      }
10962    };
10963    if (json.has("instantiatesUri")) {
10964      JsonArray array = json.getAsJsonArray("instantiatesUri");
10965      for (int i = 0; i < array.size(); i++) {
10966        if (array.get(i).isJsonNull()) {
10967          res.getInstantiatesUri().add(new UriType());
10968        } else {;
10969          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
10970        }
10971      }
10972    };
10973    if (json.has("_instantiatesUri")) {
10974      JsonArray array = json.getAsJsonArray("_instantiatesUri");
10975      for (int i = 0; i < array.size(); i++) {
10976        if (i == res.getInstantiatesUri().size())
10977          res.getInstantiatesUri().add(parseUri(null));
10978        if (array.get(i) instanceof JsonObject) 
10979          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
10980      }
10981    };
10982    if (json.has("basedOn")) {
10983      JsonArray array = json.getAsJsonArray("basedOn");
10984      for (int i = 0; i < array.size(); i++) {
10985        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
10986      }
10987    };
10988    if (json.has("priorRequest")) {
10989      JsonArray array = json.getAsJsonArray("priorRequest");
10990      for (int i = 0; i < array.size(); i++) {
10991        res.getPriorRequest().add(parseReference(array.get(i).getAsJsonObject()));
10992      }
10993    };
10994    if (json.has("groupIdentifier"))
10995      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
10996    if (json.has("status"))
10997      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
10998    if (json.has("_status"))
10999      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11000    if (json.has("intent"))
11001      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
11002    if (json.has("_intent"))
11003      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
11004    if (json.has("priority"))
11005      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
11006    if (json.has("_priority"))
11007      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
11008    DataType code = parseType("code", json);
11009    if (code != null)
11010      res.setCode(code);
11011    if (json.has("parameter")) {
11012      JsonArray array = json.getAsJsonArray("parameter");
11013      for (int i = 0; i < array.size(); i++) {
11014        res.getParameter().add(parseDeviceRequestParameterComponent(array.get(i).getAsJsonObject()));
11015      }
11016    };
11017    if (json.has("subject"))
11018      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11019    if (json.has("encounter"))
11020      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
11021    DataType occurrence = parseType("occurrence", json);
11022    if (occurrence != null)
11023      res.setOccurrence(occurrence);
11024    if (json.has("authoredOn"))
11025      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
11026    if (json.has("_authoredOn"))
11027      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
11028    if (json.has("requester"))
11029      res.setRequester(parseReference(json.getAsJsonObject("requester")));
11030    if (json.has("performerType"))
11031      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
11032    if (json.has("performer"))
11033      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
11034    if (json.has("reason")) {
11035      JsonArray array = json.getAsJsonArray("reason");
11036      for (int i = 0; i < array.size(); i++) {
11037        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
11038      }
11039    };
11040    if (json.has("insurance")) {
11041      JsonArray array = json.getAsJsonArray("insurance");
11042      for (int i = 0; i < array.size(); i++) {
11043        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
11044      }
11045    };
11046    if (json.has("supportingInfo")) {
11047      JsonArray array = json.getAsJsonArray("supportingInfo");
11048      for (int i = 0; i < array.size(); i++) {
11049        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
11050      }
11051    };
11052    if (json.has("note")) {
11053      JsonArray array = json.getAsJsonArray("note");
11054      for (int i = 0; i < array.size(); i++) {
11055        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11056      }
11057    };
11058    if (json.has("relevantHistory")) {
11059      JsonArray array = json.getAsJsonArray("relevantHistory");
11060      for (int i = 0; i < array.size(); i++) {
11061        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
11062      }
11063    };
11064  }
11065
11066  protected DeviceRequest.DeviceRequestParameterComponent parseDeviceRequestParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
11067    DeviceRequest.DeviceRequestParameterComponent res = new DeviceRequest.DeviceRequestParameterComponent();
11068    parseDeviceRequestParameterComponentProperties(json, res);
11069    return res;
11070  }
11071
11072  protected void parseDeviceRequestParameterComponentProperties(JsonObject json, DeviceRequest.DeviceRequestParameterComponent res) throws IOException, FHIRFormatError {
11073    parseBackboneElementProperties(json, res);
11074    if (json.has("code"))
11075      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11076    DataType value = parseType("value", json);
11077    if (value != null)
11078      res.setValue(value);
11079  }
11080
11081  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
11082    DeviceUseStatement res = new DeviceUseStatement();
11083    parseDeviceUseStatementProperties(json, res);
11084    return res;
11085  }
11086
11087  protected void parseDeviceUseStatementProperties(JsonObject json, DeviceUseStatement res) throws IOException, FHIRFormatError {
11088    parseDomainResourceProperties(json, res);
11089    if (json.has("identifier")) {
11090      JsonArray array = json.getAsJsonArray("identifier");
11091      for (int i = 0; i < array.size(); i++) {
11092        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11093      }
11094    };
11095    if (json.has("basedOn")) {
11096      JsonArray array = json.getAsJsonArray("basedOn");
11097      for (int i = 0; i < array.size(); i++) {
11098        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
11099      }
11100    };
11101    if (json.has("status"))
11102      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseStatement.DeviceUseStatementStatus.NULL, new DeviceUseStatement.DeviceUseStatementStatusEnumFactory()));
11103    if (json.has("_status"))
11104      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11105    if (json.has("subject"))
11106      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11107    if (json.has("derivedFrom")) {
11108      JsonArray array = json.getAsJsonArray("derivedFrom");
11109      for (int i = 0; i < array.size(); i++) {
11110        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
11111      }
11112    };
11113    DataType timing = parseType("timing", json);
11114    if (timing != null)
11115      res.setTiming(timing);
11116    if (json.has("recordedOn"))
11117      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
11118    if (json.has("_recordedOn"))
11119      parseElementProperties(json.getAsJsonObject("_recordedOn"), res.getRecordedOnElement());
11120    if (json.has("source"))
11121      res.setSource(parseReference(json.getAsJsonObject("source")));
11122    if (json.has("device"))
11123      res.setDevice(parseReference(json.getAsJsonObject("device")));
11124    if (json.has("reason")) {
11125      JsonArray array = json.getAsJsonArray("reason");
11126      for (int i = 0; i < array.size(); i++) {
11127        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
11128      }
11129    };
11130    if (json.has("bodySite"))
11131      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
11132    if (json.has("note")) {
11133      JsonArray array = json.getAsJsonArray("note");
11134      for (int i = 0; i < array.size(); i++) {
11135        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11136      }
11137    };
11138  }
11139
11140  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
11141    DiagnosticReport res = new DiagnosticReport();
11142    parseDiagnosticReportProperties(json, res);
11143    return res;
11144  }
11145
11146  protected void parseDiagnosticReportProperties(JsonObject json, DiagnosticReport res) throws IOException, FHIRFormatError {
11147    parseDomainResourceProperties(json, res);
11148    if (json.has("identifier")) {
11149      JsonArray array = json.getAsJsonArray("identifier");
11150      for (int i = 0; i < array.size(); i++) {
11151        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11152      }
11153    };
11154    if (json.has("basedOn")) {
11155      JsonArray array = json.getAsJsonArray("basedOn");
11156      for (int i = 0; i < array.size(); i++) {
11157        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
11158      }
11159    };
11160    if (json.has("status"))
11161      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
11162    if (json.has("_status"))
11163      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11164    if (json.has("category")) {
11165      JsonArray array = json.getAsJsonArray("category");
11166      for (int i = 0; i < array.size(); i++) {
11167        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11168      }
11169    };
11170    if (json.has("code"))
11171      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11172    if (json.has("subject"))
11173      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11174    if (json.has("encounter"))
11175      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
11176    DataType effective = parseType("effective", json);
11177    if (effective != null)
11178      res.setEffective(effective);
11179    if (json.has("issued"))
11180      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
11181    if (json.has("_issued"))
11182      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
11183    if (json.has("performer")) {
11184      JsonArray array = json.getAsJsonArray("performer");
11185      for (int i = 0; i < array.size(); i++) {
11186        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
11187      }
11188    };
11189    if (json.has("resultsInterpreter")) {
11190      JsonArray array = json.getAsJsonArray("resultsInterpreter");
11191      for (int i = 0; i < array.size(); i++) {
11192        res.getResultsInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
11193      }
11194    };
11195    if (json.has("specimen")) {
11196      JsonArray array = json.getAsJsonArray("specimen");
11197      for (int i = 0; i < array.size(); i++) {
11198        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
11199      }
11200    };
11201    if (json.has("result")) {
11202      JsonArray array = json.getAsJsonArray("result");
11203      for (int i = 0; i < array.size(); i++) {
11204        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
11205      }
11206    };
11207    if (json.has("imagingStudy")) {
11208      JsonArray array = json.getAsJsonArray("imagingStudy");
11209      for (int i = 0; i < array.size(); i++) {
11210        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
11211      }
11212    };
11213    if (json.has("media")) {
11214      JsonArray array = json.getAsJsonArray("media");
11215      for (int i = 0; i < array.size(); i++) {
11216        res.getMedia().add(parseDiagnosticReportMediaComponent(array.get(i).getAsJsonObject()));
11217      }
11218    };
11219    if (json.has("conclusion"))
11220      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
11221    if (json.has("_conclusion"))
11222      parseElementProperties(json.getAsJsonObject("_conclusion"), res.getConclusionElement());
11223    if (json.has("conclusionCode")) {
11224      JsonArray array = json.getAsJsonArray("conclusionCode");
11225      for (int i = 0; i < array.size(); i++) {
11226        res.getConclusionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11227      }
11228    };
11229    if (json.has("presentedForm")) {
11230      JsonArray array = json.getAsJsonArray("presentedForm");
11231      for (int i = 0; i < array.size(); i++) {
11232        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
11233      }
11234    };
11235  }
11236
11237  protected DiagnosticReport.DiagnosticReportMediaComponent parseDiagnosticReportMediaComponent(JsonObject json) throws IOException, FHIRFormatError {
11238    DiagnosticReport.DiagnosticReportMediaComponent res = new DiagnosticReport.DiagnosticReportMediaComponent();
11239    parseDiagnosticReportMediaComponentProperties(json, res);
11240    return res;
11241  }
11242
11243  protected void parseDiagnosticReportMediaComponentProperties(JsonObject json, DiagnosticReport.DiagnosticReportMediaComponent res) throws IOException, FHIRFormatError {
11244    parseBackboneElementProperties(json, res);
11245    if (json.has("comment"))
11246      res.setCommentElement(parseString(json.get("comment").getAsString()));
11247    if (json.has("_comment"))
11248      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
11249    if (json.has("link"))
11250      res.setLink(parseReference(json.getAsJsonObject("link")));
11251  }
11252
11253  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
11254    DocumentManifest res = new DocumentManifest();
11255    parseDocumentManifestProperties(json, res);
11256    return res;
11257  }
11258
11259  protected void parseDocumentManifestProperties(JsonObject json, DocumentManifest res) throws IOException, FHIRFormatError {
11260    parseDomainResourceProperties(json, res);
11261    if (json.has("masterIdentifier"))
11262      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
11263    if (json.has("identifier")) {
11264      JsonArray array = json.getAsJsonArray("identifier");
11265      for (int i = 0; i < array.size(); i++) {
11266        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11267      }
11268    };
11269    if (json.has("status"))
11270      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
11271    if (json.has("_status"))
11272      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11273    if (json.has("type"))
11274      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11275    if (json.has("subject"))
11276      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11277    if (json.has("created"))
11278      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11279    if (json.has("_created"))
11280      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
11281    if (json.has("author")) {
11282      JsonArray array = json.getAsJsonArray("author");
11283      for (int i = 0; i < array.size(); i++) {
11284        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
11285      }
11286    };
11287    if (json.has("recipient")) {
11288      JsonArray array = json.getAsJsonArray("recipient");
11289      for (int i = 0; i < array.size(); i++) {
11290        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
11291      }
11292    };
11293    if (json.has("source"))
11294      res.setSourceElement(parseUri(json.get("source").getAsString()));
11295    if (json.has("_source"))
11296      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
11297    if (json.has("description"))
11298      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11299    if (json.has("_description"))
11300      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11301    if (json.has("content")) {
11302      JsonArray array = json.getAsJsonArray("content");
11303      for (int i = 0; i < array.size(); i++) {
11304        res.getContent().add(parseReference(array.get(i).getAsJsonObject()));
11305      }
11306    };
11307    if (json.has("related")) {
11308      JsonArray array = json.getAsJsonArray("related");
11309      for (int i = 0; i < array.size(); i++) {
11310        res.getRelated().add(parseDocumentManifestRelatedComponent(array.get(i).getAsJsonObject()));
11311      }
11312    };
11313  }
11314
11315  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestRelatedComponent(JsonObject json) throws IOException, FHIRFormatError {
11316    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
11317    parseDocumentManifestRelatedComponentProperties(json, res);
11318    return res;
11319  }
11320
11321  protected void parseDocumentManifestRelatedComponentProperties(JsonObject json, DocumentManifest.DocumentManifestRelatedComponent res) throws IOException, FHIRFormatError {
11322    parseBackboneElementProperties(json, res);
11323    if (json.has("identifier"))
11324      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11325    if (json.has("ref"))
11326      res.setRef(parseReference(json.getAsJsonObject("ref")));
11327  }
11328
11329  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
11330    DocumentReference res = new DocumentReference();
11331    parseDocumentReferenceProperties(json, res);
11332    return res;
11333  }
11334
11335  protected void parseDocumentReferenceProperties(JsonObject json, DocumentReference res) throws IOException, FHIRFormatError {
11336    parseDomainResourceProperties(json, res);
11337    if (json.has("masterIdentifier"))
11338      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
11339    if (json.has("identifier")) {
11340      JsonArray array = json.getAsJsonArray("identifier");
11341      for (int i = 0; i < array.size(); i++) {
11342        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11343      }
11344    };
11345    if (json.has("status"))
11346      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
11347    if (json.has("_status"))
11348      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11349    if (json.has("docStatus"))
11350      res.setDocStatusElement(parseEnumeration(json.get("docStatus").getAsString(), Enumerations.CompositionStatus.NULL, new Enumerations.CompositionStatusEnumFactory()));
11351    if (json.has("_docStatus"))
11352      parseElementProperties(json.getAsJsonObject("_docStatus"), res.getDocStatusElement());
11353    if (json.has("type"))
11354      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11355    if (json.has("category")) {
11356      JsonArray array = json.getAsJsonArray("category");
11357      for (int i = 0; i < array.size(); i++) {
11358        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11359      }
11360    };
11361    if (json.has("subject"))
11362      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11363    if (json.has("date"))
11364      res.setDateElement(parseInstant(json.get("date").getAsString()));
11365    if (json.has("_date"))
11366      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11367    if (json.has("author")) {
11368      JsonArray array = json.getAsJsonArray("author");
11369      for (int i = 0; i < array.size(); i++) {
11370        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
11371      }
11372    };
11373    if (json.has("authenticator"))
11374      res.setAuthenticator(parseReference(json.getAsJsonObject("authenticator")));
11375    if (json.has("custodian"))
11376      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
11377    if (json.has("relatesTo")) {
11378      JsonArray array = json.getAsJsonArray("relatesTo");
11379      for (int i = 0; i < array.size(); i++) {
11380        res.getRelatesTo().add(parseDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject()));
11381      }
11382    };
11383    if (json.has("description"))
11384      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11385    if (json.has("_description"))
11386      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11387    if (json.has("securityLabel")) {
11388      JsonArray array = json.getAsJsonArray("securityLabel");
11389      for (int i = 0; i < array.size(); i++) {
11390        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11391      }
11392    };
11393    if (json.has("content")) {
11394      JsonArray array = json.getAsJsonArray("content");
11395      for (int i = 0; i < array.size(); i++) {
11396        res.getContent().add(parseDocumentReferenceContentComponent(array.get(i).getAsJsonObject()));
11397      }
11398    };
11399    if (json.has("context"))
11400      res.setContext(parseDocumentReferenceContextComponent(json.getAsJsonObject("context")));
11401  }
11402
11403  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceRelatesToComponent(JsonObject json) throws IOException, FHIRFormatError {
11404    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
11405    parseDocumentReferenceRelatesToComponentProperties(json, res);
11406    return res;
11407  }
11408
11409  protected void parseDocumentReferenceRelatesToComponentProperties(JsonObject json, DocumentReference.DocumentReferenceRelatesToComponent res) throws IOException, FHIRFormatError {
11410    parseBackboneElementProperties(json, res);
11411    if (json.has("code"))
11412      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Enumerations.DocumentRelationshipType.NULL, new Enumerations.DocumentRelationshipTypeEnumFactory()));
11413    if (json.has("_code"))
11414      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
11415    if (json.has("target"))
11416      res.setTarget(parseReference(json.getAsJsonObject("target")));
11417  }
11418
11419  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceContentComponent(JsonObject json) throws IOException, FHIRFormatError {
11420    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
11421    parseDocumentReferenceContentComponentProperties(json, res);
11422    return res;
11423  }
11424
11425  protected void parseDocumentReferenceContentComponentProperties(JsonObject json, DocumentReference.DocumentReferenceContentComponent res) throws IOException, FHIRFormatError {
11426    parseBackboneElementProperties(json, res);
11427    if (json.has("attachment"))
11428      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
11429    if (json.has("format"))
11430      res.setFormat(parseCoding(json.getAsJsonObject("format")));
11431  }
11432
11433  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceContextComponent(JsonObject json) throws IOException, FHIRFormatError {
11434    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
11435    parseDocumentReferenceContextComponentProperties(json, res);
11436    return res;
11437  }
11438
11439  protected void parseDocumentReferenceContextComponentProperties(JsonObject json, DocumentReference.DocumentReferenceContextComponent res) throws IOException, FHIRFormatError {
11440    parseBackboneElementProperties(json, res);
11441    if (json.has("encounter")) {
11442      JsonArray array = json.getAsJsonArray("encounter");
11443      for (int i = 0; i < array.size(); i++) {
11444        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
11445      }
11446    };
11447    if (json.has("event")) {
11448      JsonArray array = json.getAsJsonArray("event");
11449      for (int i = 0; i < array.size(); i++) {
11450        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11451      }
11452    };
11453    if (json.has("period"))
11454      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11455    if (json.has("facilityType"))
11456      res.setFacilityType(parseCodeableConcept(json.getAsJsonObject("facilityType")));
11457    if (json.has("practiceSetting"))
11458      res.setPracticeSetting(parseCodeableConcept(json.getAsJsonObject("practiceSetting")));
11459    if (json.has("sourcePatientInfo"))
11460      res.setSourcePatientInfo(parseReference(json.getAsJsonObject("sourcePatientInfo")));
11461    if (json.has("related")) {
11462      JsonArray array = json.getAsJsonArray("related");
11463      for (int i = 0; i < array.size(); i++) {
11464        res.getRelated().add(parseReference(array.get(i).getAsJsonObject()));
11465      }
11466    };
11467    if (json.has("basedOn")) {
11468      JsonArray array = json.getAsJsonArray("basedOn");
11469      for (int i = 0; i < array.size(); i++) {
11470        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
11471      }
11472    };
11473  }
11474
11475  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
11476    Encounter res = new Encounter();
11477    parseEncounterProperties(json, res);
11478    return res;
11479  }
11480
11481  protected void parseEncounterProperties(JsonObject json, Encounter res) throws IOException, FHIRFormatError {
11482    parseDomainResourceProperties(json, res);
11483    if (json.has("identifier")) {
11484      JsonArray array = json.getAsJsonArray("identifier");
11485      for (int i = 0; i < array.size(); i++) {
11486        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11487      }
11488    };
11489    if (json.has("status"))
11490      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
11491    if (json.has("_status"))
11492      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11493    if (json.has("statusHistory")) {
11494      JsonArray array = json.getAsJsonArray("statusHistory");
11495      for (int i = 0; i < array.size(); i++) {
11496        res.getStatusHistory().add(parseEncounterStatusHistoryComponent(array.get(i).getAsJsonObject()));
11497      }
11498    };
11499    if (json.has("class"))
11500      res.setClass_(parseCoding(json.getAsJsonObject("class")));
11501    if (json.has("classHistory")) {
11502      JsonArray array = json.getAsJsonArray("classHistory");
11503      for (int i = 0; i < array.size(); i++) {
11504        res.getClassHistory().add(parseEncounterClassHistoryComponent(array.get(i).getAsJsonObject()));
11505      }
11506    };
11507    if (json.has("type")) {
11508      JsonArray array = json.getAsJsonArray("type");
11509      for (int i = 0; i < array.size(); i++) {
11510        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11511      }
11512    };
11513    if (json.has("serviceType"))
11514      res.setServiceType(parseCodeableConcept(json.getAsJsonObject("serviceType")));
11515    if (json.has("priority"))
11516      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
11517    if (json.has("subject"))
11518      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11519    if (json.has("subjectStatus"))
11520      res.setSubjectStatus(parseCodeableConcept(json.getAsJsonObject("subjectStatus")));
11521    if (json.has("episodeOfCare")) {
11522      JsonArray array = json.getAsJsonArray("episodeOfCare");
11523      for (int i = 0; i < array.size(); i++) {
11524        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
11525      }
11526    };
11527    if (json.has("basedOn")) {
11528      JsonArray array = json.getAsJsonArray("basedOn");
11529      for (int i = 0; i < array.size(); i++) {
11530        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
11531      }
11532    };
11533    if (json.has("participant")) {
11534      JsonArray array = json.getAsJsonArray("participant");
11535      for (int i = 0; i < array.size(); i++) {
11536        res.getParticipant().add(parseEncounterParticipantComponent(array.get(i).getAsJsonObject()));
11537      }
11538    };
11539    if (json.has("appointment")) {
11540      JsonArray array = json.getAsJsonArray("appointment");
11541      for (int i = 0; i < array.size(); i++) {
11542        res.getAppointment().add(parseReference(array.get(i).getAsJsonObject()));
11543      }
11544    };
11545    if (json.has("period"))
11546      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11547    if (json.has("length"))
11548      res.setLength(parseDuration(json.getAsJsonObject("length")));
11549    if (json.has("reason")) {
11550      JsonArray array = json.getAsJsonArray("reason");
11551      for (int i = 0; i < array.size(); i++) {
11552        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
11553      }
11554    };
11555    if (json.has("diagnosis")) {
11556      JsonArray array = json.getAsJsonArray("diagnosis");
11557      for (int i = 0; i < array.size(); i++) {
11558        res.getDiagnosis().add(parseEncounterDiagnosisComponent(array.get(i).getAsJsonObject()));
11559      }
11560    };
11561    if (json.has("account")) {
11562      JsonArray array = json.getAsJsonArray("account");
11563      for (int i = 0; i < array.size(); i++) {
11564        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
11565      }
11566    };
11567    if (json.has("hospitalization"))
11568      res.setHospitalization(parseEncounterHospitalizationComponent(json.getAsJsonObject("hospitalization")));
11569    if (json.has("location")) {
11570      JsonArray array = json.getAsJsonArray("location");
11571      for (int i = 0; i < array.size(); i++) {
11572        res.getLocation().add(parseEncounterLocationComponent(array.get(i).getAsJsonObject()));
11573      }
11574    };
11575    if (json.has("serviceProvider"))
11576      res.setServiceProvider(parseReference(json.getAsJsonObject("serviceProvider")));
11577    if (json.has("partOf"))
11578      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
11579  }
11580
11581  protected Encounter.StatusHistoryComponent parseEncounterStatusHistoryComponent(JsonObject json) throws IOException, FHIRFormatError {
11582    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
11583    parseEncounterStatusHistoryComponentProperties(json, res);
11584    return res;
11585  }
11586
11587  protected void parseEncounterStatusHistoryComponentProperties(JsonObject json, Encounter.StatusHistoryComponent res) throws IOException, FHIRFormatError {
11588    parseBackboneElementProperties(json, res);
11589    if (json.has("status"))
11590      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
11591    if (json.has("_status"))
11592      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11593    if (json.has("period"))
11594      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11595  }
11596
11597  protected Encounter.ClassHistoryComponent parseEncounterClassHistoryComponent(JsonObject json) throws IOException, FHIRFormatError {
11598    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
11599    parseEncounterClassHistoryComponentProperties(json, res);
11600    return res;
11601  }
11602
11603  protected void parseEncounterClassHistoryComponentProperties(JsonObject json, Encounter.ClassHistoryComponent res) throws IOException, FHIRFormatError {
11604    parseBackboneElementProperties(json, res);
11605    if (json.has("class"))
11606      res.setClass_(parseCoding(json.getAsJsonObject("class")));
11607    if (json.has("period"))
11608      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11609  }
11610
11611  protected Encounter.EncounterParticipantComponent parseEncounterParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
11612    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
11613    parseEncounterParticipantComponentProperties(json, res);
11614    return res;
11615  }
11616
11617  protected void parseEncounterParticipantComponentProperties(JsonObject json, Encounter.EncounterParticipantComponent res) throws IOException, FHIRFormatError {
11618    parseBackboneElementProperties(json, res);
11619    if (json.has("type")) {
11620      JsonArray array = json.getAsJsonArray("type");
11621      for (int i = 0; i < array.size(); i++) {
11622        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11623      }
11624    };
11625    if (json.has("period"))
11626      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11627    if (json.has("individual"))
11628      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
11629  }
11630
11631  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
11632    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
11633    parseEncounterDiagnosisComponentProperties(json, res);
11634    return res;
11635  }
11636
11637  protected void parseEncounterDiagnosisComponentProperties(JsonObject json, Encounter.DiagnosisComponent res) throws IOException, FHIRFormatError {
11638    parseBackboneElementProperties(json, res);
11639    if (json.has("condition"))
11640      res.setCondition(parseReference(json.getAsJsonObject("condition")));
11641    if (json.has("use"))
11642      res.setUse(parseCodeableConcept(json.getAsJsonObject("use")));
11643    if (json.has("rank"))
11644      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
11645    if (json.has("_rank"))
11646      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
11647  }
11648
11649  protected Encounter.EncounterHospitalizationComponent parseEncounterHospitalizationComponent(JsonObject json) throws IOException, FHIRFormatError {
11650    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
11651    parseEncounterHospitalizationComponentProperties(json, res);
11652    return res;
11653  }
11654
11655  protected void parseEncounterHospitalizationComponentProperties(JsonObject json, Encounter.EncounterHospitalizationComponent res) throws IOException, FHIRFormatError {
11656    parseBackboneElementProperties(json, res);
11657    if (json.has("preAdmissionIdentifier"))
11658      res.setPreAdmissionIdentifier(parseIdentifier(json.getAsJsonObject("preAdmissionIdentifier")));
11659    if (json.has("origin"))
11660      res.setOrigin(parseReference(json.getAsJsonObject("origin")));
11661    if (json.has("admitSource"))
11662      res.setAdmitSource(parseCodeableConcept(json.getAsJsonObject("admitSource")));
11663    if (json.has("reAdmission"))
11664      res.setReAdmission(parseCodeableConcept(json.getAsJsonObject("reAdmission")));
11665    if (json.has("dietPreference")) {
11666      JsonArray array = json.getAsJsonArray("dietPreference");
11667      for (int i = 0; i < array.size(); i++) {
11668        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11669      }
11670    };
11671    if (json.has("specialCourtesy")) {
11672      JsonArray array = json.getAsJsonArray("specialCourtesy");
11673      for (int i = 0; i < array.size(); i++) {
11674        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11675      }
11676    };
11677    if (json.has("specialArrangement")) {
11678      JsonArray array = json.getAsJsonArray("specialArrangement");
11679      for (int i = 0; i < array.size(); i++) {
11680        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11681      }
11682    };
11683    if (json.has("destination"))
11684      res.setDestination(parseReference(json.getAsJsonObject("destination")));
11685    if (json.has("dischargeDisposition"))
11686      res.setDischargeDisposition(parseCodeableConcept(json.getAsJsonObject("dischargeDisposition")));
11687  }
11688
11689  protected Encounter.EncounterLocationComponent parseEncounterLocationComponent(JsonObject json) throws IOException, FHIRFormatError {
11690    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
11691    parseEncounterLocationComponentProperties(json, res);
11692    return res;
11693  }
11694
11695  protected void parseEncounterLocationComponentProperties(JsonObject json, Encounter.EncounterLocationComponent res) throws IOException, FHIRFormatError {
11696    parseBackboneElementProperties(json, res);
11697    if (json.has("location"))
11698      res.setLocation(parseReference(json.getAsJsonObject("location")));
11699    if (json.has("status"))
11700      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
11701    if (json.has("_status"))
11702      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11703    if (json.has("physicalType"))
11704      res.setPhysicalType(parseCodeableConcept(json.getAsJsonObject("physicalType")));
11705    if (json.has("period"))
11706      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11707  }
11708
11709  protected Endpoint parseEndpoint(JsonObject json) throws IOException, FHIRFormatError {
11710    Endpoint res = new Endpoint();
11711    parseEndpointProperties(json, res);
11712    return res;
11713  }
11714
11715  protected void parseEndpointProperties(JsonObject json, Endpoint res) throws IOException, FHIRFormatError {
11716    parseDomainResourceProperties(json, res);
11717    if (json.has("identifier")) {
11718      JsonArray array = json.getAsJsonArray("identifier");
11719      for (int i = 0; i < array.size(); i++) {
11720        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11721      }
11722    };
11723    if (json.has("status"))
11724      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Endpoint.EndpointStatus.NULL, new Endpoint.EndpointStatusEnumFactory()));
11725    if (json.has("_status"))
11726      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11727    if (json.has("connectionType"))
11728      res.setConnectionType(parseCoding(json.getAsJsonObject("connectionType")));
11729    if (json.has("name"))
11730      res.setNameElement(parseString(json.get("name").getAsString()));
11731    if (json.has("_name"))
11732      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11733    if (json.has("managingOrganization"))
11734      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
11735    if (json.has("contact")) {
11736      JsonArray array = json.getAsJsonArray("contact");
11737      for (int i = 0; i < array.size(); i++) {
11738        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
11739      }
11740    };
11741    if (json.has("period"))
11742      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11743    if (json.has("payloadType")) {
11744      JsonArray array = json.getAsJsonArray("payloadType");
11745      for (int i = 0; i < array.size(); i++) {
11746        res.getPayloadType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11747      }
11748    };
11749    if (json.has("payloadMimeType")) {
11750      JsonArray array = json.getAsJsonArray("payloadMimeType");
11751      for (int i = 0; i < array.size(); i++) {
11752        if (array.get(i).isJsonNull()) {
11753          res.getPayloadMimeType().add(new CodeType());
11754        } else {;
11755          res.getPayloadMimeType().add(parseCode(array.get(i).getAsString()));
11756        }
11757      }
11758    };
11759    if (json.has("_payloadMimeType")) {
11760      JsonArray array = json.getAsJsonArray("_payloadMimeType");
11761      for (int i = 0; i < array.size(); i++) {
11762        if (i == res.getPayloadMimeType().size())
11763          res.getPayloadMimeType().add(parseCode(null));
11764        if (array.get(i) instanceof JsonObject) 
11765          parseElementProperties(array.get(i).getAsJsonObject(), res.getPayloadMimeType().get(i));
11766      }
11767    };
11768    if (json.has("address"))
11769      res.setAddressElement(parseUrl(json.get("address").getAsString()));
11770    if (json.has("_address"))
11771      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
11772    if (json.has("header")) {
11773      JsonArray array = json.getAsJsonArray("header");
11774      for (int i = 0; i < array.size(); i++) {
11775        if (array.get(i).isJsonNull()) {
11776          res.getHeader().add(new StringType());
11777        } else {;
11778          res.getHeader().add(parseString(array.get(i).getAsString()));
11779        }
11780      }
11781    };
11782    if (json.has("_header")) {
11783      JsonArray array = json.getAsJsonArray("_header");
11784      for (int i = 0; i < array.size(); i++) {
11785        if (i == res.getHeader().size())
11786          res.getHeader().add(parseString(null));
11787        if (array.get(i) instanceof JsonObject) 
11788          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
11789      }
11790    };
11791  }
11792
11793  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
11794    EnrollmentRequest res = new EnrollmentRequest();
11795    parseEnrollmentRequestProperties(json, res);
11796    return res;
11797  }
11798
11799  protected void parseEnrollmentRequestProperties(JsonObject json, EnrollmentRequest res) throws IOException, FHIRFormatError {
11800    parseDomainResourceProperties(json, res);
11801    if (json.has("identifier")) {
11802      JsonArray array = json.getAsJsonArray("identifier");
11803      for (int i = 0; i < array.size(); i++) {
11804        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11805      }
11806    };
11807    if (json.has("status"))
11808      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
11809    if (json.has("_status"))
11810      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11811    if (json.has("created"))
11812      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11813    if (json.has("_created"))
11814      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
11815    if (json.has("insurer"))
11816      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
11817    if (json.has("provider"))
11818      res.setProvider(parseReference(json.getAsJsonObject("provider")));
11819    if (json.has("candidate"))
11820      res.setCandidate(parseReference(json.getAsJsonObject("candidate")));
11821    if (json.has("coverage"))
11822      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
11823  }
11824
11825  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
11826    EnrollmentResponse res = new EnrollmentResponse();
11827    parseEnrollmentResponseProperties(json, res);
11828    return res;
11829  }
11830
11831  protected void parseEnrollmentResponseProperties(JsonObject json, EnrollmentResponse res) throws IOException, FHIRFormatError {
11832    parseDomainResourceProperties(json, res);
11833    if (json.has("identifier")) {
11834      JsonArray array = json.getAsJsonArray("identifier");
11835      for (int i = 0; i < array.size(); i++) {
11836        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11837      }
11838    };
11839    if (json.has("status"))
11840      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
11841    if (json.has("_status"))
11842      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11843    if (json.has("request"))
11844      res.setRequest(parseReference(json.getAsJsonObject("request")));
11845    if (json.has("outcome"))
11846      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.ClaimProcessingCodes.NULL, new Enumerations.ClaimProcessingCodesEnumFactory()));
11847    if (json.has("_outcome"))
11848      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
11849    if (json.has("disposition"))
11850      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
11851    if (json.has("_disposition"))
11852      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
11853    if (json.has("created"))
11854      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11855    if (json.has("_created"))
11856      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
11857    if (json.has("organization"))
11858      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
11859    if (json.has("requestProvider"))
11860      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
11861  }
11862
11863  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
11864    EpisodeOfCare res = new EpisodeOfCare();
11865    parseEpisodeOfCareProperties(json, res);
11866    return res;
11867  }
11868
11869  protected void parseEpisodeOfCareProperties(JsonObject json, EpisodeOfCare res) throws IOException, FHIRFormatError {
11870    parseDomainResourceProperties(json, res);
11871    if (json.has("identifier")) {
11872      JsonArray array = json.getAsJsonArray("identifier");
11873      for (int i = 0; i < array.size(); i++) {
11874        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11875      }
11876    };
11877    if (json.has("status"))
11878      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
11879    if (json.has("_status"))
11880      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11881    if (json.has("statusHistory")) {
11882      JsonArray array = json.getAsJsonArray("statusHistory");
11883      for (int i = 0; i < array.size(); i++) {
11884        res.getStatusHistory().add(parseEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject()));
11885      }
11886    };
11887    if (json.has("type")) {
11888      JsonArray array = json.getAsJsonArray("type");
11889      for (int i = 0; i < array.size(); i++) {
11890        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11891      }
11892    };
11893    if (json.has("diagnosis")) {
11894      JsonArray array = json.getAsJsonArray("diagnosis");
11895      for (int i = 0; i < array.size(); i++) {
11896        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(array.get(i).getAsJsonObject()));
11897      }
11898    };
11899    if (json.has("patient"))
11900      res.setPatient(parseReference(json.getAsJsonObject("patient")));
11901    if (json.has("managingOrganization"))
11902      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
11903    if (json.has("period"))
11904      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11905    if (json.has("referralRequest")) {
11906      JsonArray array = json.getAsJsonArray("referralRequest");
11907      for (int i = 0; i < array.size(); i++) {
11908        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
11909      }
11910    };
11911    if (json.has("careManager"))
11912      res.setCareManager(parseReference(json.getAsJsonObject("careManager")));
11913    if (json.has("team")) {
11914      JsonArray array = json.getAsJsonArray("team");
11915      for (int i = 0; i < array.size(); i++) {
11916        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
11917      }
11918    };
11919    if (json.has("account")) {
11920      JsonArray array = json.getAsJsonArray("account");
11921      for (int i = 0; i < array.size(); i++) {
11922        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
11923      }
11924    };
11925  }
11926
11927  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareStatusHistoryComponent(JsonObject json) throws IOException, FHIRFormatError {
11928    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
11929    parseEpisodeOfCareStatusHistoryComponentProperties(json, res);
11930    return res;
11931  }
11932
11933  protected void parseEpisodeOfCareStatusHistoryComponentProperties(JsonObject json, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws IOException, FHIRFormatError {
11934    parseBackboneElementProperties(json, res);
11935    if (json.has("status"))
11936      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
11937    if (json.has("_status"))
11938      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11939    if (json.has("period"))
11940      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11941  }
11942
11943  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
11944    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
11945    parseEpisodeOfCareDiagnosisComponentProperties(json, res);
11946    return res;
11947  }
11948
11949  protected void parseEpisodeOfCareDiagnosisComponentProperties(JsonObject json, EpisodeOfCare.DiagnosisComponent res) throws IOException, FHIRFormatError {
11950    parseBackboneElementProperties(json, res);
11951    if (json.has("condition"))
11952      res.setCondition(parseReference(json.getAsJsonObject("condition")));
11953    if (json.has("role"))
11954      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
11955    if (json.has("rank"))
11956      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
11957    if (json.has("_rank"))
11958      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
11959  }
11960
11961  protected EventDefinition parseEventDefinition(JsonObject json) throws IOException, FHIRFormatError {
11962    EventDefinition res = new EventDefinition();
11963    parseEventDefinitionProperties(json, res);
11964    return res;
11965  }
11966
11967  protected void parseEventDefinitionProperties(JsonObject json, EventDefinition res) throws IOException, FHIRFormatError {
11968    parseMetadataResourceProperties(json, res);
11969    if (json.has("url"))
11970      res.setUrlElement(parseUri(json.get("url").getAsString()));
11971    if (json.has("_url"))
11972      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
11973    if (json.has("identifier")) {
11974      JsonArray array = json.getAsJsonArray("identifier");
11975      for (int i = 0; i < array.size(); i++) {
11976        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11977      }
11978    };
11979    if (json.has("version"))
11980      res.setVersionElement(parseString(json.get("version").getAsString()));
11981    if (json.has("_version"))
11982      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
11983    if (json.has("name"))
11984      res.setNameElement(parseString(json.get("name").getAsString()));
11985    if (json.has("_name"))
11986      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11987    if (json.has("title"))
11988      res.setTitleElement(parseString(json.get("title").getAsString()));
11989    if (json.has("_title"))
11990      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11991    if (json.has("subtitle"))
11992      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
11993    if (json.has("_subtitle"))
11994      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
11995    if (json.has("status"))
11996      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11997    if (json.has("_status"))
11998      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11999    if (json.has("experimental"))
12000      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
12001    if (json.has("_experimental"))
12002      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
12003    DataType subject = parseType("subject", json);
12004    if (subject != null)
12005      res.setSubject(subject);
12006    if (json.has("date"))
12007      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12008    if (json.has("_date"))
12009      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12010    if (json.has("publisher"))
12011      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12012    if (json.has("_publisher"))
12013      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
12014    if (json.has("contact")) {
12015      JsonArray array = json.getAsJsonArray("contact");
12016      for (int i = 0; i < array.size(); i++) {
12017        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12018      }
12019    };
12020    if (json.has("description"))
12021      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12022    if (json.has("_description"))
12023      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12024    if (json.has("useContext")) {
12025      JsonArray array = json.getAsJsonArray("useContext");
12026      for (int i = 0; i < array.size(); i++) {
12027        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12028      }
12029    };
12030    if (json.has("jurisdiction")) {
12031      JsonArray array = json.getAsJsonArray("jurisdiction");
12032      for (int i = 0; i < array.size(); i++) {
12033        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12034      }
12035    };
12036    if (json.has("purpose"))
12037      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
12038    if (json.has("_purpose"))
12039      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
12040    if (json.has("usage"))
12041      res.setUsageElement(parseString(json.get("usage").getAsString()));
12042    if (json.has("_usage"))
12043      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
12044    if (json.has("copyright"))
12045      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
12046    if (json.has("_copyright"))
12047      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
12048    if (json.has("approvalDate"))
12049      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
12050    if (json.has("_approvalDate"))
12051      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
12052    if (json.has("lastReviewDate"))
12053      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
12054    if (json.has("_lastReviewDate"))
12055      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
12056    if (json.has("effectivePeriod"))
12057      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
12058    if (json.has("topic")) {
12059      JsonArray array = json.getAsJsonArray("topic");
12060      for (int i = 0; i < array.size(); i++) {
12061        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12062      }
12063    };
12064    if (json.has("author")) {
12065      JsonArray array = json.getAsJsonArray("author");
12066      for (int i = 0; i < array.size(); i++) {
12067        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12068      }
12069    };
12070    if (json.has("editor")) {
12071      JsonArray array = json.getAsJsonArray("editor");
12072      for (int i = 0; i < array.size(); i++) {
12073        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12074      }
12075    };
12076    if (json.has("reviewer")) {
12077      JsonArray array = json.getAsJsonArray("reviewer");
12078      for (int i = 0; i < array.size(); i++) {
12079        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
12080      }
12081    };
12082    if (json.has("endorser")) {
12083      JsonArray array = json.getAsJsonArray("endorser");
12084      for (int i = 0; i < array.size(); i++) {
12085        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
12086      }
12087    };
12088    if (json.has("relatedArtifact")) {
12089      JsonArray array = json.getAsJsonArray("relatedArtifact");
12090      for (int i = 0; i < array.size(); i++) {
12091        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
12092      }
12093    };
12094    if (json.has("trigger")) {
12095      JsonArray array = json.getAsJsonArray("trigger");
12096      for (int i = 0; i < array.size(); i++) {
12097        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
12098      }
12099    };
12100  }
12101
12102  protected Evidence parseEvidence(JsonObject json) throws IOException, FHIRFormatError {
12103    Evidence res = new Evidence();
12104    parseEvidenceProperties(json, res);
12105    return res;
12106  }
12107
12108  protected void parseEvidenceProperties(JsonObject json, Evidence res) throws IOException, FHIRFormatError {
12109    parseMetadataResourceProperties(json, res);
12110    if (json.has("url"))
12111      res.setUrlElement(parseUri(json.get("url").getAsString()));
12112    if (json.has("_url"))
12113      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
12114    if (json.has("identifier")) {
12115      JsonArray array = json.getAsJsonArray("identifier");
12116      for (int i = 0; i < array.size(); i++) {
12117        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12118      }
12119    };
12120    if (json.has("version"))
12121      res.setVersionElement(parseString(json.get("version").getAsString()));
12122    if (json.has("_version"))
12123      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
12124    if (json.has("title"))
12125      res.setTitleElement(parseString(json.get("title").getAsString()));
12126    if (json.has("_title"))
12127      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12128    if (json.has("status"))
12129      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12130    if (json.has("_status"))
12131      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12132    if (json.has("date"))
12133      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12134    if (json.has("_date"))
12135      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12136    if (json.has("useContext")) {
12137      JsonArray array = json.getAsJsonArray("useContext");
12138      for (int i = 0; i < array.size(); i++) {
12139        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12140      }
12141    };
12142    if (json.has("approvalDate"))
12143      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
12144    if (json.has("_approvalDate"))
12145      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
12146    if (json.has("lastReviewDate"))
12147      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
12148    if (json.has("_lastReviewDate"))
12149      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
12150    if (json.has("contributor")) {
12151      JsonArray array = json.getAsJsonArray("contributor");
12152      for (int i = 0; i < array.size(); i++) {
12153        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
12154      }
12155    };
12156    if (json.has("relatedArtifact")) {
12157      JsonArray array = json.getAsJsonArray("relatedArtifact");
12158      for (int i = 0; i < array.size(); i++) {
12159        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
12160      }
12161    };
12162    if (json.has("description"))
12163      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12164    if (json.has("_description"))
12165      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12166    if (json.has("assertion"))
12167      res.setAssertionElement(parseMarkdown(json.get("assertion").getAsString()));
12168    if (json.has("_assertion"))
12169      parseElementProperties(json.getAsJsonObject("_assertion"), res.getAssertionElement());
12170    if (json.has("note")) {
12171      JsonArray array = json.getAsJsonArray("note");
12172      for (int i = 0; i < array.size(); i++) {
12173        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12174      }
12175    };
12176    if (json.has("referentGroup"))
12177      res.setReferentGroup(parseEvidenceReferentGroupComponent(json.getAsJsonObject("referentGroup")));
12178    if (json.has("variableDefinition")) {
12179      JsonArray array = json.getAsJsonArray("variableDefinition");
12180      for (int i = 0; i < array.size(); i++) {
12181        res.getVariableDefinition().add(parseEvidenceVariableDefinitionComponent(array.get(i).getAsJsonObject()));
12182      }
12183    };
12184    if (json.has("synthesisType"))
12185      res.setSynthesisType(parseCodeableConcept(json.getAsJsonObject("synthesisType")));
12186    if (json.has("studyType"))
12187      res.setStudyType(parseCodeableConcept(json.getAsJsonObject("studyType")));
12188    if (json.has("statistic")) {
12189      JsonArray array = json.getAsJsonArray("statistic");
12190      for (int i = 0; i < array.size(); i++) {
12191        res.getStatistic().add(parseStatistic(array.get(i).getAsJsonObject()));
12192      }
12193    };
12194    if (json.has("distribution")) {
12195      JsonArray array = json.getAsJsonArray("distribution");
12196      for (int i = 0; i < array.size(); i++) {
12197        res.getDistribution().add(parseOrderedDistribution(array.get(i).getAsJsonObject()));
12198      }
12199    };
12200    if (json.has("certainty")) {
12201      JsonArray array = json.getAsJsonArray("certainty");
12202      for (int i = 0; i < array.size(); i++) {
12203        res.getCertainty().add(parseEvidenceCertaintyComponent(array.get(i).getAsJsonObject()));
12204      }
12205    };
12206  }
12207
12208  protected Evidence.EvidenceReferentGroupComponent parseEvidenceReferentGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
12209    Evidence.EvidenceReferentGroupComponent res = new Evidence.EvidenceReferentGroupComponent();
12210    parseEvidenceReferentGroupComponentProperties(json, res);
12211    return res;
12212  }
12213
12214  protected void parseEvidenceReferentGroupComponentProperties(JsonObject json, Evidence.EvidenceReferentGroupComponent res) throws IOException, FHIRFormatError {
12215    parseBackboneElementProperties(json, res);
12216    if (json.has("description"))
12217      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12218    if (json.has("_description"))
12219      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12220    if (json.has("note")) {
12221      JsonArray array = json.getAsJsonArray("note");
12222      for (int i = 0; i < array.size(); i++) {
12223        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12224      }
12225    };
12226    if (json.has("evidenceSource"))
12227      res.setEvidenceSource(parseReference(json.getAsJsonObject("evidenceSource")));
12228    if (json.has("intendedGroup"))
12229      res.setIntendedGroup(parseReference(json.getAsJsonObject("intendedGroup")));
12230    if (json.has("directnessMatch"))
12231      res.setDirectnessMatch(parseCodeableConcept(json.getAsJsonObject("directnessMatch")));
12232  }
12233
12234  protected Evidence.EvidenceVariableDefinitionComponent parseEvidenceVariableDefinitionComponent(JsonObject json) throws IOException, FHIRFormatError {
12235    Evidence.EvidenceVariableDefinitionComponent res = new Evidence.EvidenceVariableDefinitionComponent();
12236    parseEvidenceVariableDefinitionComponentProperties(json, res);
12237    return res;
12238  }
12239
12240  protected void parseEvidenceVariableDefinitionComponentProperties(JsonObject json, Evidence.EvidenceVariableDefinitionComponent res) throws IOException, FHIRFormatError {
12241    parseBackboneElementProperties(json, res);
12242    if (json.has("description"))
12243      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12244    if (json.has("_description"))
12245      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12246    if (json.has("note")) {
12247      JsonArray array = json.getAsJsonArray("note");
12248      for (int i = 0; i < array.size(); i++) {
12249        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12250      }
12251    };
12252    if (json.has("variableRole"))
12253      res.setVariableRole(parseCodeableConcept(json.getAsJsonObject("variableRole")));
12254    if (json.has("actualDefinition"))
12255      res.setActualDefinition(parseReference(json.getAsJsonObject("actualDefinition")));
12256    if (json.has("intendedDefinition"))
12257      res.setIntendedDefinition(parseReference(json.getAsJsonObject("intendedDefinition")));
12258    if (json.has("directnessMatch"))
12259      res.setDirectnessMatch(parseCodeableConcept(json.getAsJsonObject("directnessMatch")));
12260  }
12261
12262  protected Evidence.EvidenceCertaintyComponent parseEvidenceCertaintyComponent(JsonObject json) throws IOException, FHIRFormatError {
12263    Evidence.EvidenceCertaintyComponent res = new Evidence.EvidenceCertaintyComponent();
12264    parseEvidenceCertaintyComponentProperties(json, res);
12265    return res;
12266  }
12267
12268  protected void parseEvidenceCertaintyComponentProperties(JsonObject json, Evidence.EvidenceCertaintyComponent res) throws IOException, FHIRFormatError {
12269    parseBackboneElementProperties(json, res);
12270    if (json.has("description"))
12271      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12272    if (json.has("_description"))
12273      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12274    if (json.has("note"))
12275      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
12276    if (json.has("rating")) {
12277      JsonArray array = json.getAsJsonArray("rating");
12278      for (int i = 0; i < array.size(); i++) {
12279        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12280      }
12281    };
12282    if (json.has("certaintySubcomponent")) {
12283      JsonArray array = json.getAsJsonArray("certaintySubcomponent");
12284      for (int i = 0; i < array.size(); i++) {
12285        res.getCertaintySubcomponent().add(parseEvidenceCertaintyCertaintySubcomponentComponent(array.get(i).getAsJsonObject()));
12286      }
12287    };
12288  }
12289
12290  protected Evidence.EvidenceCertaintyCertaintySubcomponentComponent parseEvidenceCertaintyCertaintySubcomponentComponent(JsonObject json) throws IOException, FHIRFormatError {
12291    Evidence.EvidenceCertaintyCertaintySubcomponentComponent res = new Evidence.EvidenceCertaintyCertaintySubcomponentComponent();
12292    parseEvidenceCertaintyCertaintySubcomponentComponentProperties(json, res);
12293    return res;
12294  }
12295
12296  protected void parseEvidenceCertaintyCertaintySubcomponentComponentProperties(JsonObject json, Evidence.EvidenceCertaintyCertaintySubcomponentComponent res) throws IOException, FHIRFormatError {
12297    parseBackboneElementProperties(json, res);
12298    if (json.has("description"))
12299      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12300    if (json.has("_description"))
12301      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12302    if (json.has("note"))
12303      res.setNote(parseAnnotation(json.getAsJsonObject("note")));
12304    if (json.has("type")) {
12305      JsonArray array = json.getAsJsonArray("type");
12306      for (int i = 0; i < array.size(); i++) {
12307        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12308      }
12309    };
12310    if (json.has("rating")) {
12311      JsonArray array = json.getAsJsonArray("rating");
12312      for (int i = 0; i < array.size(); i++) {
12313        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12314      }
12315    };
12316  }
12317
12318  protected EvidenceVariable parseEvidenceVariable(JsonObject json) throws IOException, FHIRFormatError {
12319    EvidenceVariable res = new EvidenceVariable();
12320    parseEvidenceVariableProperties(json, res);
12321    return res;
12322  }
12323
12324  protected void parseEvidenceVariableProperties(JsonObject json, EvidenceVariable res) throws IOException, FHIRFormatError {
12325    parseMetadataResourceProperties(json, res);
12326    if (json.has("url"))
12327      res.setUrlElement(parseUri(json.get("url").getAsString()));
12328    if (json.has("_url"))
12329      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
12330    if (json.has("identifier")) {
12331      JsonArray array = json.getAsJsonArray("identifier");
12332      for (int i = 0; i < array.size(); i++) {
12333        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12334      }
12335    };
12336    if (json.has("version"))
12337      res.setVersionElement(parseString(json.get("version").getAsString()));
12338    if (json.has("_version"))
12339      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
12340    if (json.has("name"))
12341      res.setNameElement(parseString(json.get("name").getAsString()));
12342    if (json.has("_name"))
12343      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12344    if (json.has("title"))
12345      res.setTitleElement(parseString(json.get("title").getAsString()));
12346    if (json.has("_title"))
12347      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12348    if (json.has("shortTitle"))
12349      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
12350    if (json.has("_shortTitle"))
12351      parseElementProperties(json.getAsJsonObject("_shortTitle"), res.getShortTitleElement());
12352    if (json.has("subtitle"))
12353      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
12354    if (json.has("_subtitle"))
12355      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
12356    if (json.has("status"))
12357      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12358    if (json.has("_status"))
12359      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12360    if (json.has("date"))
12361      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12362    if (json.has("_date"))
12363      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12364    if (json.has("publisher"))
12365      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12366    if (json.has("_publisher"))
12367      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
12368    if (json.has("contact")) {
12369      JsonArray array = json.getAsJsonArray("contact");
12370      for (int i = 0; i < array.size(); i++) {
12371        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12372      }
12373    };
12374    if (json.has("description"))
12375      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12376    if (json.has("_description"))
12377      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12378    if (json.has("note")) {
12379      JsonArray array = json.getAsJsonArray("note");
12380      for (int i = 0; i < array.size(); i++) {
12381        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12382      }
12383    };
12384    if (json.has("useContext")) {
12385      JsonArray array = json.getAsJsonArray("useContext");
12386      for (int i = 0; i < array.size(); i++) {
12387        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12388      }
12389    };
12390    if (json.has("jurisdiction")) {
12391      JsonArray array = json.getAsJsonArray("jurisdiction");
12392      for (int i = 0; i < array.size(); i++) {
12393        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12394      }
12395    };
12396    if (json.has("copyright"))
12397      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
12398    if (json.has("_copyright"))
12399      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
12400    if (json.has("approvalDate"))
12401      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
12402    if (json.has("_approvalDate"))
12403      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
12404    if (json.has("lastReviewDate"))
12405      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
12406    if (json.has("_lastReviewDate"))
12407      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
12408    if (json.has("effectivePeriod"))
12409      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
12410    if (json.has("topic")) {
12411      JsonArray array = json.getAsJsonArray("topic");
12412      for (int i = 0; i < array.size(); i++) {
12413        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12414      }
12415    };
12416    if (json.has("author")) {
12417      JsonArray array = json.getAsJsonArray("author");
12418      for (int i = 0; i < array.size(); i++) {
12419        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12420      }
12421    };
12422    if (json.has("editor")) {
12423      JsonArray array = json.getAsJsonArray("editor");
12424      for (int i = 0; i < array.size(); i++) {
12425        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
12426      }
12427    };
12428    if (json.has("reviewer")) {
12429      JsonArray array = json.getAsJsonArray("reviewer");
12430      for (int i = 0; i < array.size(); i++) {
12431        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
12432      }
12433    };
12434    if (json.has("endorser")) {
12435      JsonArray array = json.getAsJsonArray("endorser");
12436      for (int i = 0; i < array.size(); i++) {
12437        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
12438      }
12439    };
12440    if (json.has("relatedArtifact")) {
12441      JsonArray array = json.getAsJsonArray("relatedArtifact");
12442      for (int i = 0; i < array.size(); i++) {
12443        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
12444      }
12445    };
12446    if (json.has("type"))
12447      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), EvidenceVariable.EvidenceVariableType.NULL, new EvidenceVariable.EvidenceVariableTypeEnumFactory()));
12448    if (json.has("_type"))
12449      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12450    if (json.has("actual"))
12451      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
12452    if (json.has("_actual"))
12453      parseElementProperties(json.getAsJsonObject("_actual"), res.getActualElement());
12454    if (json.has("characteristic")) {
12455      JsonArray array = json.getAsJsonArray("characteristic");
12456      for (int i = 0; i < array.size(); i++) {
12457        res.getCharacteristic().add(parseEvidenceVariableCharacteristicComponent(array.get(i).getAsJsonObject()));
12458      }
12459    };
12460  }
12461
12462  protected EvidenceVariable.EvidenceVariableCharacteristicComponent parseEvidenceVariableCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
12463    EvidenceVariable.EvidenceVariableCharacteristicComponent res = new EvidenceVariable.EvidenceVariableCharacteristicComponent();
12464    parseEvidenceVariableCharacteristicComponentProperties(json, res);
12465    return res;
12466  }
12467
12468  protected void parseEvidenceVariableCharacteristicComponentProperties(JsonObject json, EvidenceVariable.EvidenceVariableCharacteristicComponent res) throws IOException, FHIRFormatError {
12469    parseBackboneElementProperties(json, res);
12470    if (json.has("description"))
12471      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12472    if (json.has("_description"))
12473      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12474    DataType definition = parseType("definition", json);
12475    if (definition != null)
12476      res.setDefinition(definition);
12477    if (json.has("method"))
12478      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
12479    if (json.has("device"))
12480      res.setDevice(parseReference(json.getAsJsonObject("device")));
12481    if (json.has("booleanSet")) {
12482      JsonArray array = json.getAsJsonArray("booleanSet");
12483      for (int i = 0; i < array.size(); i++) {
12484        if (array.get(i).isJsonNull()) {
12485          res.getBooleanSet().add(new StringType());
12486        } else {;
12487          res.getBooleanSet().add(parseString(array.get(i).getAsString()));
12488        }
12489      }
12490    };
12491    if (json.has("_booleanSet")) {
12492      JsonArray array = json.getAsJsonArray("_booleanSet");
12493      for (int i = 0; i < array.size(); i++) {
12494        if (i == res.getBooleanSet().size())
12495          res.getBooleanSet().add(parseString(null));
12496        if (array.get(i) instanceof JsonObject) 
12497          parseElementProperties(array.get(i).getAsJsonObject(), res.getBooleanSet().get(i));
12498      }
12499    };
12500    if (json.has("exclude"))
12501      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
12502    if (json.has("_exclude"))
12503      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
12504    DataType participantEffective = parseType("participantEffective", json);
12505    if (participantEffective != null)
12506      res.setParticipantEffective(participantEffective);
12507    if (json.has("timeFromStart"))
12508      res.setTimeFromStart(parseDuration(json.getAsJsonObject("timeFromStart")));
12509    if (json.has("groupMeasure"))
12510      res.setGroupMeasureElement(parseEnumeration(json.get("groupMeasure").getAsString(), EvidenceVariable.GroupMeasure.NULL, new EvidenceVariable.GroupMeasureEnumFactory()));
12511    if (json.has("_groupMeasure"))
12512      parseElementProperties(json.getAsJsonObject("_groupMeasure"), res.getGroupMeasureElement());
12513  }
12514
12515  protected ExampleScenario parseExampleScenario(JsonObject json) throws IOException, FHIRFormatError {
12516    ExampleScenario res = new ExampleScenario();
12517    parseExampleScenarioProperties(json, res);
12518    return res;
12519  }
12520
12521  protected void parseExampleScenarioProperties(JsonObject json, ExampleScenario res) throws IOException, FHIRFormatError {
12522    parseCanonicalResourceProperties(json, res);
12523    if (json.has("url"))
12524      res.setUrlElement(parseUri(json.get("url").getAsString()));
12525    if (json.has("_url"))
12526      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
12527    if (json.has("identifier")) {
12528      JsonArray array = json.getAsJsonArray("identifier");
12529      for (int i = 0; i < array.size(); i++) {
12530        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12531      }
12532    };
12533    if (json.has("version"))
12534      res.setVersionElement(parseString(json.get("version").getAsString()));
12535    if (json.has("_version"))
12536      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
12537    if (json.has("name"))
12538      res.setNameElement(parseString(json.get("name").getAsString()));
12539    if (json.has("_name"))
12540      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12541    if (json.has("status"))
12542      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12543    if (json.has("_status"))
12544      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12545    if (json.has("experimental"))
12546      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
12547    if (json.has("_experimental"))
12548      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
12549    if (json.has("date"))
12550      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12551    if (json.has("_date"))
12552      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12553    if (json.has("publisher"))
12554      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12555    if (json.has("_publisher"))
12556      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
12557    if (json.has("contact")) {
12558      JsonArray array = json.getAsJsonArray("contact");
12559      for (int i = 0; i < array.size(); i++) {
12560        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12561      }
12562    };
12563    if (json.has("useContext")) {
12564      JsonArray array = json.getAsJsonArray("useContext");
12565      for (int i = 0; i < array.size(); i++) {
12566        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12567      }
12568    };
12569    if (json.has("jurisdiction")) {
12570      JsonArray array = json.getAsJsonArray("jurisdiction");
12571      for (int i = 0; i < array.size(); i++) {
12572        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12573      }
12574    };
12575    if (json.has("purpose"))
12576      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
12577    if (json.has("_purpose"))
12578      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
12579    if (json.has("copyright"))
12580      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
12581    if (json.has("_copyright"))
12582      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
12583    if (json.has("actor")) {
12584      JsonArray array = json.getAsJsonArray("actor");
12585      for (int i = 0; i < array.size(); i++) {
12586        res.getActor().add(parseExampleScenarioActorComponent(array.get(i).getAsJsonObject()));
12587      }
12588    };
12589    if (json.has("instance")) {
12590      JsonArray array = json.getAsJsonArray("instance");
12591      for (int i = 0; i < array.size(); i++) {
12592        res.getInstance().add(parseExampleScenarioInstanceComponent(array.get(i).getAsJsonObject()));
12593      }
12594    };
12595    if (json.has("process")) {
12596      JsonArray array = json.getAsJsonArray("process");
12597      for (int i = 0; i < array.size(); i++) {
12598        res.getProcess().add(parseExampleScenarioProcessComponent(array.get(i).getAsJsonObject()));
12599      }
12600    };
12601    if (json.has("workflow")) {
12602      JsonArray array = json.getAsJsonArray("workflow");
12603      for (int i = 0; i < array.size(); i++) {
12604        if (array.get(i).isJsonNull()) {
12605          res.getWorkflow().add(new CanonicalType());
12606        } else {;
12607          res.getWorkflow().add(parseCanonical(array.get(i).getAsString()));
12608        }
12609      }
12610    };
12611    if (json.has("_workflow")) {
12612      JsonArray array = json.getAsJsonArray("_workflow");
12613      for (int i = 0; i < array.size(); i++) {
12614        if (i == res.getWorkflow().size())
12615          res.getWorkflow().add(parseCanonical(null));
12616        if (array.get(i) instanceof JsonObject) 
12617          parseElementProperties(array.get(i).getAsJsonObject(), res.getWorkflow().get(i));
12618      }
12619    };
12620  }
12621
12622  protected ExampleScenario.ExampleScenarioActorComponent parseExampleScenarioActorComponent(JsonObject json) throws IOException, FHIRFormatError {
12623    ExampleScenario.ExampleScenarioActorComponent res = new ExampleScenario.ExampleScenarioActorComponent();
12624    parseExampleScenarioActorComponentProperties(json, res);
12625    return res;
12626  }
12627
12628  protected void parseExampleScenarioActorComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioActorComponent res) throws IOException, FHIRFormatError {
12629    parseBackboneElementProperties(json, res);
12630    if (json.has("actorId"))
12631      res.setActorIdElement(parseString(json.get("actorId").getAsString()));
12632    if (json.has("_actorId"))
12633      parseElementProperties(json.getAsJsonObject("_actorId"), res.getActorIdElement());
12634    if (json.has("type"))
12635      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ExampleScenario.ExampleScenarioActorType.NULL, new ExampleScenario.ExampleScenarioActorTypeEnumFactory()));
12636    if (json.has("_type"))
12637      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12638    if (json.has("name"))
12639      res.setNameElement(parseString(json.get("name").getAsString()));
12640    if (json.has("_name"))
12641      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12642    if (json.has("description"))
12643      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12644    if (json.has("_description"))
12645      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12646  }
12647
12648  protected ExampleScenario.ExampleScenarioInstanceComponent parseExampleScenarioInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
12649    ExampleScenario.ExampleScenarioInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceComponent();
12650    parseExampleScenarioInstanceComponentProperties(json, res);
12651    return res;
12652  }
12653
12654  protected void parseExampleScenarioInstanceComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioInstanceComponent res) throws IOException, FHIRFormatError {
12655    parseBackboneElementProperties(json, res);
12656    if (json.has("resourceId"))
12657      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
12658    if (json.has("_resourceId"))
12659      parseElementProperties(json.getAsJsonObject("_resourceId"), res.getResourceIdElement());
12660    if (json.has("resourceType"))
12661      res.setResourceTypeElement(parseCode(json.get("resourceType").getAsString()));
12662    if (json.has("_resourceType"))
12663      parseElementProperties(json.getAsJsonObject("_resourceType"), res.getResourceTypeElement());
12664    if (json.has("name"))
12665      res.setNameElement(parseString(json.get("name").getAsString()));
12666    if (json.has("_name"))
12667      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12668    if (json.has("description"))
12669      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12670    if (json.has("_description"))
12671      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12672    if (json.has("version")) {
12673      JsonArray array = json.getAsJsonArray("version");
12674      for (int i = 0; i < array.size(); i++) {
12675        res.getVersion().add(parseExampleScenarioInstanceVersionComponent(array.get(i).getAsJsonObject()));
12676      }
12677    };
12678    if (json.has("containedInstance")) {
12679      JsonArray array = json.getAsJsonArray("containedInstance");
12680      for (int i = 0; i < array.size(); i++) {
12681        res.getContainedInstance().add(parseExampleScenarioInstanceContainedInstanceComponent(array.get(i).getAsJsonObject()));
12682      }
12683    };
12684  }
12685
12686  protected ExampleScenario.ExampleScenarioInstanceVersionComponent parseExampleScenarioInstanceVersionComponent(JsonObject json) throws IOException, FHIRFormatError {
12687    ExampleScenario.ExampleScenarioInstanceVersionComponent res = new ExampleScenario.ExampleScenarioInstanceVersionComponent();
12688    parseExampleScenarioInstanceVersionComponentProperties(json, res);
12689    return res;
12690  }
12691
12692  protected void parseExampleScenarioInstanceVersionComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioInstanceVersionComponent res) throws IOException, FHIRFormatError {
12693    parseBackboneElementProperties(json, res);
12694    if (json.has("versionId"))
12695      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
12696    if (json.has("_versionId"))
12697      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
12698    if (json.has("description"))
12699      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12700    if (json.has("_description"))
12701      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12702  }
12703
12704  protected ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent parseExampleScenarioInstanceContainedInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
12705    ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent();
12706    parseExampleScenarioInstanceContainedInstanceComponentProperties(json, res);
12707    return res;
12708  }
12709
12710  protected void parseExampleScenarioInstanceContainedInstanceComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res) throws IOException, FHIRFormatError {
12711    parseBackboneElementProperties(json, res);
12712    if (json.has("resourceId"))
12713      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
12714    if (json.has("_resourceId"))
12715      parseElementProperties(json.getAsJsonObject("_resourceId"), res.getResourceIdElement());
12716    if (json.has("versionId"))
12717      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
12718    if (json.has("_versionId"))
12719      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
12720  }
12721
12722  protected ExampleScenario.ExampleScenarioProcessComponent parseExampleScenarioProcessComponent(JsonObject json) throws IOException, FHIRFormatError {
12723    ExampleScenario.ExampleScenarioProcessComponent res = new ExampleScenario.ExampleScenarioProcessComponent();
12724    parseExampleScenarioProcessComponentProperties(json, res);
12725    return res;
12726  }
12727
12728  protected void parseExampleScenarioProcessComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioProcessComponent res) throws IOException, FHIRFormatError {
12729    parseBackboneElementProperties(json, res);
12730    if (json.has("title"))
12731      res.setTitleElement(parseString(json.get("title").getAsString()));
12732    if (json.has("_title"))
12733      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12734    if (json.has("description"))
12735      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12736    if (json.has("_description"))
12737      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12738    if (json.has("preConditions"))
12739      res.setPreConditionsElement(parseMarkdown(json.get("preConditions").getAsString()));
12740    if (json.has("_preConditions"))
12741      parseElementProperties(json.getAsJsonObject("_preConditions"), res.getPreConditionsElement());
12742    if (json.has("postConditions"))
12743      res.setPostConditionsElement(parseMarkdown(json.get("postConditions").getAsString()));
12744    if (json.has("_postConditions"))
12745      parseElementProperties(json.getAsJsonObject("_postConditions"), res.getPostConditionsElement());
12746    if (json.has("step")) {
12747      JsonArray array = json.getAsJsonArray("step");
12748      for (int i = 0; i < array.size(); i++) {
12749        res.getStep().add(parseExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject()));
12750      }
12751    };
12752  }
12753
12754  protected ExampleScenario.ExampleScenarioProcessStepComponent parseExampleScenarioProcessStepComponent(JsonObject json) throws IOException, FHIRFormatError {
12755    ExampleScenario.ExampleScenarioProcessStepComponent res = new ExampleScenario.ExampleScenarioProcessStepComponent();
12756    parseExampleScenarioProcessStepComponentProperties(json, res);
12757    return res;
12758  }
12759
12760  protected void parseExampleScenarioProcessStepComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioProcessStepComponent res) throws IOException, FHIRFormatError {
12761    parseBackboneElementProperties(json, res);
12762    if (json.has("process")) {
12763      JsonArray array = json.getAsJsonArray("process");
12764      for (int i = 0; i < array.size(); i++) {
12765        res.getProcess().add(parseExampleScenarioProcessComponent(array.get(i).getAsJsonObject()));
12766      }
12767    };
12768    if (json.has("pause"))
12769      res.setPauseElement(parseBoolean(json.get("pause").getAsBoolean()));
12770    if (json.has("_pause"))
12771      parseElementProperties(json.getAsJsonObject("_pause"), res.getPauseElement());
12772    if (json.has("operation"))
12773      res.setOperation(parseExampleScenarioProcessStepOperationComponent(json.getAsJsonObject("operation")));
12774    if (json.has("alternative")) {
12775      JsonArray array = json.getAsJsonArray("alternative");
12776      for (int i = 0; i < array.size(); i++) {
12777        res.getAlternative().add(parseExampleScenarioProcessStepAlternativeComponent(array.get(i).getAsJsonObject()));
12778      }
12779    };
12780  }
12781
12782  protected ExampleScenario.ExampleScenarioProcessStepOperationComponent parseExampleScenarioProcessStepOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
12783    ExampleScenario.ExampleScenarioProcessStepOperationComponent res = new ExampleScenario.ExampleScenarioProcessStepOperationComponent();
12784    parseExampleScenarioProcessStepOperationComponentProperties(json, res);
12785    return res;
12786  }
12787
12788  protected void parseExampleScenarioProcessStepOperationComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioProcessStepOperationComponent res) throws IOException, FHIRFormatError {
12789    parseBackboneElementProperties(json, res);
12790    if (json.has("number"))
12791      res.setNumberElement(parseString(json.get("number").getAsString()));
12792    if (json.has("_number"))
12793      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
12794    if (json.has("type"))
12795      res.setTypeElement(parseString(json.get("type").getAsString()));
12796    if (json.has("_type"))
12797      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12798    if (json.has("name"))
12799      res.setNameElement(parseString(json.get("name").getAsString()));
12800    if (json.has("_name"))
12801      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12802    if (json.has("initiator"))
12803      res.setInitiatorElement(parseString(json.get("initiator").getAsString()));
12804    if (json.has("_initiator"))
12805      parseElementProperties(json.getAsJsonObject("_initiator"), res.getInitiatorElement());
12806    if (json.has("receiver"))
12807      res.setReceiverElement(parseString(json.get("receiver").getAsString()));
12808    if (json.has("_receiver"))
12809      parseElementProperties(json.getAsJsonObject("_receiver"), res.getReceiverElement());
12810    if (json.has("description"))
12811      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12812    if (json.has("_description"))
12813      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12814    if (json.has("initiatorActive"))
12815      res.setInitiatorActiveElement(parseBoolean(json.get("initiatorActive").getAsBoolean()));
12816    if (json.has("_initiatorActive"))
12817      parseElementProperties(json.getAsJsonObject("_initiatorActive"), res.getInitiatorActiveElement());
12818    if (json.has("receiverActive"))
12819      res.setReceiverActiveElement(parseBoolean(json.get("receiverActive").getAsBoolean()));
12820    if (json.has("_receiverActive"))
12821      parseElementProperties(json.getAsJsonObject("_receiverActive"), res.getReceiverActiveElement());
12822    if (json.has("request"))
12823      res.setRequest(parseExampleScenarioInstanceContainedInstanceComponent(json.getAsJsonObject("request")));
12824    if (json.has("response"))
12825      res.setResponse(parseExampleScenarioInstanceContainedInstanceComponent(json.getAsJsonObject("response")));
12826  }
12827
12828  protected ExampleScenario.ExampleScenarioProcessStepAlternativeComponent parseExampleScenarioProcessStepAlternativeComponent(JsonObject json) throws IOException, FHIRFormatError {
12829    ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res = new ExampleScenario.ExampleScenarioProcessStepAlternativeComponent();
12830    parseExampleScenarioProcessStepAlternativeComponentProperties(json, res);
12831    return res;
12832  }
12833
12834  protected void parseExampleScenarioProcessStepAlternativeComponentProperties(JsonObject json, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res) throws IOException, FHIRFormatError {
12835    parseBackboneElementProperties(json, res);
12836    if (json.has("title"))
12837      res.setTitleElement(parseString(json.get("title").getAsString()));
12838    if (json.has("_title"))
12839      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12840    if (json.has("description"))
12841      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12842    if (json.has("_description"))
12843      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12844    if (json.has("step")) {
12845      JsonArray array = json.getAsJsonArray("step");
12846      for (int i = 0; i < array.size(); i++) {
12847        res.getStep().add(parseExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject()));
12848      }
12849    };
12850  }
12851
12852  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
12853    ExplanationOfBenefit res = new ExplanationOfBenefit();
12854    parseExplanationOfBenefitProperties(json, res);
12855    return res;
12856  }
12857
12858  protected void parseExplanationOfBenefitProperties(JsonObject json, ExplanationOfBenefit res) throws IOException, FHIRFormatError {
12859    parseDomainResourceProperties(json, res);
12860    if (json.has("identifier")) {
12861      JsonArray array = json.getAsJsonArray("identifier");
12862      for (int i = 0; i < array.size(); i++) {
12863        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12864      }
12865    };
12866    if (json.has("status"))
12867      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL, new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
12868    if (json.has("_status"))
12869      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12870    if (json.has("type"))
12871      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12872    if (json.has("subType"))
12873      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
12874    if (json.has("use"))
12875      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.Use.NULL, new Enumerations.UseEnumFactory()));
12876    if (json.has("_use"))
12877      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
12878    if (json.has("patient"))
12879      res.setPatient(parseReference(json.getAsJsonObject("patient")));
12880    if (json.has("billablePeriod"))
12881      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
12882    if (json.has("created"))
12883      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
12884    if (json.has("_created"))
12885      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
12886    if (json.has("enterer"))
12887      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
12888    if (json.has("insurer"))
12889      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
12890    if (json.has("provider"))
12891      res.setProvider(parseReference(json.getAsJsonObject("provider")));
12892    if (json.has("priority"))
12893      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
12894    if (json.has("fundsReserveRequested"))
12895      res.setFundsReserveRequested(parseCodeableConcept(json.getAsJsonObject("fundsReserveRequested")));
12896    if (json.has("fundsReserve"))
12897      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
12898    if (json.has("related")) {
12899      JsonArray array = json.getAsJsonArray("related");
12900      for (int i = 0; i < array.size(); i++) {
12901        res.getRelated().add(parseExplanationOfBenefitRelatedClaimComponent(array.get(i).getAsJsonObject()));
12902      }
12903    };
12904    if (json.has("prescription"))
12905      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
12906    if (json.has("originalPrescription"))
12907      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
12908    if (json.has("payee"))
12909      res.setPayee(parseExplanationOfBenefitPayeeComponent(json.getAsJsonObject("payee")));
12910    if (json.has("referral"))
12911      res.setReferral(parseReference(json.getAsJsonObject("referral")));
12912    if (json.has("facility"))
12913      res.setFacility(parseReference(json.getAsJsonObject("facility")));
12914    if (json.has("claim"))
12915      res.setClaim(parseReference(json.getAsJsonObject("claim")));
12916    if (json.has("claimResponse"))
12917      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
12918    if (json.has("outcome"))
12919      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.ClaimProcessingCodes.NULL, new Enumerations.ClaimProcessingCodesEnumFactory()));
12920    if (json.has("_outcome"))
12921      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
12922    if (json.has("disposition"))
12923      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
12924    if (json.has("_disposition"))
12925      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
12926    if (json.has("preAuthRef")) {
12927      JsonArray array = json.getAsJsonArray("preAuthRef");
12928      for (int i = 0; i < array.size(); i++) {
12929        if (array.get(i).isJsonNull()) {
12930          res.getPreAuthRef().add(new StringType());
12931        } else {;
12932          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
12933        }
12934      }
12935    };
12936    if (json.has("_preAuthRef")) {
12937      JsonArray array = json.getAsJsonArray("_preAuthRef");
12938      for (int i = 0; i < array.size(); i++) {
12939        if (i == res.getPreAuthRef().size())
12940          res.getPreAuthRef().add(parseString(null));
12941        if (array.get(i) instanceof JsonObject) 
12942          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
12943      }
12944    };
12945    if (json.has("preAuthRefPeriod")) {
12946      JsonArray array = json.getAsJsonArray("preAuthRefPeriod");
12947      for (int i = 0; i < array.size(); i++) {
12948        res.getPreAuthRefPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
12949      }
12950    };
12951    if (json.has("careTeam")) {
12952      JsonArray array = json.getAsJsonArray("careTeam");
12953      for (int i = 0; i < array.size(); i++) {
12954        res.getCareTeam().add(parseExplanationOfBenefitCareTeamComponent(array.get(i).getAsJsonObject()));
12955      }
12956    };
12957    if (json.has("supportingInfo")) {
12958      JsonArray array = json.getAsJsonArray("supportingInfo");
12959      for (int i = 0; i < array.size(); i++) {
12960        res.getSupportingInfo().add(parseExplanationOfBenefitSupportingInformationComponent(array.get(i).getAsJsonObject()));
12961      }
12962    };
12963    if (json.has("diagnosis")) {
12964      JsonArray array = json.getAsJsonArray("diagnosis");
12965      for (int i = 0; i < array.size(); i++) {
12966        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(array.get(i).getAsJsonObject()));
12967      }
12968    };
12969    if (json.has("procedure")) {
12970      JsonArray array = json.getAsJsonArray("procedure");
12971      for (int i = 0; i < array.size(); i++) {
12972        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(array.get(i).getAsJsonObject()));
12973      }
12974    };
12975    if (json.has("precedence"))
12976      res.setPrecedenceElement(parsePositiveInt(json.get("precedence").getAsString()));
12977    if (json.has("_precedence"))
12978      parseElementProperties(json.getAsJsonObject("_precedence"), res.getPrecedenceElement());
12979    if (json.has("insurance")) {
12980      JsonArray array = json.getAsJsonArray("insurance");
12981      for (int i = 0; i < array.size(); i++) {
12982        res.getInsurance().add(parseExplanationOfBenefitInsuranceComponent(array.get(i).getAsJsonObject()));
12983      }
12984    };
12985    if (json.has("accident"))
12986      res.setAccident(parseExplanationOfBenefitAccidentComponent(json.getAsJsonObject("accident")));
12987    if (json.has("item")) {
12988      JsonArray array = json.getAsJsonArray("item");
12989      for (int i = 0; i < array.size(); i++) {
12990        res.getItem().add(parseExplanationOfBenefitItemComponent(array.get(i).getAsJsonObject()));
12991      }
12992    };
12993    if (json.has("addItem")) {
12994      JsonArray array = json.getAsJsonArray("addItem");
12995      for (int i = 0; i < array.size(); i++) {
12996        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(array.get(i).getAsJsonObject()));
12997      }
12998    };
12999    if (json.has("adjudication")) {
13000      JsonArray array = json.getAsJsonArray("adjudication");
13001      for (int i = 0; i < array.size(); i++) {
13002        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
13003      }
13004    };
13005    if (json.has("total")) {
13006      JsonArray array = json.getAsJsonArray("total");
13007      for (int i = 0; i < array.size(); i++) {
13008        res.getTotal().add(parseExplanationOfBenefitTotalComponent(array.get(i).getAsJsonObject()));
13009      }
13010    };
13011    if (json.has("payment"))
13012      res.setPayment(parseExplanationOfBenefitPaymentComponent(json.getAsJsonObject("payment")));
13013    if (json.has("formCode"))
13014      res.setFormCode(parseCodeableConcept(json.getAsJsonObject("formCode")));
13015    if (json.has("form"))
13016      res.setForm(parseAttachment(json.getAsJsonObject("form")));
13017    if (json.has("processNote")) {
13018      JsonArray array = json.getAsJsonArray("processNote");
13019      for (int i = 0; i < array.size(); i++) {
13020        res.getProcessNote().add(parseExplanationOfBenefitNoteComponent(array.get(i).getAsJsonObject()));
13021      }
13022    };
13023    if (json.has("benefitPeriod"))
13024      res.setBenefitPeriod(parsePeriod(json.getAsJsonObject("benefitPeriod")));
13025    if (json.has("benefitBalance")) {
13026      JsonArray array = json.getAsJsonArray("benefitBalance");
13027      for (int i = 0; i < array.size(); i++) {
13028        res.getBenefitBalance().add(parseExplanationOfBenefitBenefitBalanceComponent(array.get(i).getAsJsonObject()));
13029      }
13030    };
13031  }
13032
13033  protected ExplanationOfBenefit.RelatedClaimComponent parseExplanationOfBenefitRelatedClaimComponent(JsonObject json) throws IOException, FHIRFormatError {
13034    ExplanationOfBenefit.RelatedClaimComponent res = new ExplanationOfBenefit.RelatedClaimComponent();
13035    parseExplanationOfBenefitRelatedClaimComponentProperties(json, res);
13036    return res;
13037  }
13038
13039  protected void parseExplanationOfBenefitRelatedClaimComponentProperties(JsonObject json, ExplanationOfBenefit.RelatedClaimComponent res) throws IOException, FHIRFormatError {
13040    parseBackboneElementProperties(json, res);
13041    if (json.has("claim"))
13042      res.setClaim(parseReference(json.getAsJsonObject("claim")));
13043    if (json.has("relationship"))
13044      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
13045    if (json.has("reference"))
13046      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
13047  }
13048
13049  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(JsonObject json) throws IOException, FHIRFormatError {
13050    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
13051    parseExplanationOfBenefitPayeeComponentProperties(json, res);
13052    return res;
13053  }
13054
13055  protected void parseExplanationOfBenefitPayeeComponentProperties(JsonObject json, ExplanationOfBenefit.PayeeComponent res) throws IOException, FHIRFormatError {
13056    parseBackboneElementProperties(json, res);
13057    if (json.has("type"))
13058      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13059    if (json.has("party"))
13060      res.setParty(parseReference(json.getAsJsonObject("party")));
13061  }
13062
13063  protected ExplanationOfBenefit.CareTeamComponent parseExplanationOfBenefitCareTeamComponent(JsonObject json) throws IOException, FHIRFormatError {
13064    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
13065    parseExplanationOfBenefitCareTeamComponentProperties(json, res);
13066    return res;
13067  }
13068
13069  protected void parseExplanationOfBenefitCareTeamComponentProperties(JsonObject json, ExplanationOfBenefit.CareTeamComponent res) throws IOException, FHIRFormatError {
13070    parseBackboneElementProperties(json, res);
13071    if (json.has("sequence"))
13072      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13073    if (json.has("_sequence"))
13074      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
13075    if (json.has("provider"))
13076      res.setProvider(parseReference(json.getAsJsonObject("provider")));
13077    if (json.has("responsible"))
13078      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
13079    if (json.has("_responsible"))
13080      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
13081    if (json.has("role"))
13082      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
13083    if (json.has("qualification"))
13084      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
13085  }
13086
13087  protected ExplanationOfBenefit.SupportingInformationComponent parseExplanationOfBenefitSupportingInformationComponent(JsonObject json) throws IOException, FHIRFormatError {
13088    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
13089    parseExplanationOfBenefitSupportingInformationComponentProperties(json, res);
13090    return res;
13091  }
13092
13093  protected void parseExplanationOfBenefitSupportingInformationComponentProperties(JsonObject json, ExplanationOfBenefit.SupportingInformationComponent res) throws IOException, FHIRFormatError {
13094    parseBackboneElementProperties(json, res);
13095    if (json.has("sequence"))
13096      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13097    if (json.has("_sequence"))
13098      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
13099    if (json.has("category"))
13100      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
13101    if (json.has("code"))
13102      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13103    DataType timing = parseType("timing", json);
13104    if (timing != null)
13105      res.setTiming(timing);
13106    DataType value = parseType("value", json);
13107    if (value != null)
13108      res.setValue(value);
13109    if (json.has("reason"))
13110      res.setReason(parseCoding(json.getAsJsonObject("reason")));
13111  }
13112
13113  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(JsonObject json) throws IOException, FHIRFormatError {
13114    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
13115    parseExplanationOfBenefitDiagnosisComponentProperties(json, res);
13116    return res;
13117  }
13118
13119  protected void parseExplanationOfBenefitDiagnosisComponentProperties(JsonObject json, ExplanationOfBenefit.DiagnosisComponent res) throws IOException, FHIRFormatError {
13120    parseBackboneElementProperties(json, res);
13121    if (json.has("sequence"))
13122      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13123    if (json.has("_sequence"))
13124      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
13125    DataType diagnosis = parseType("diagnosis", json);
13126    if (diagnosis != null)
13127      res.setDiagnosis(diagnosis);
13128    if (json.has("type")) {
13129      JsonArray array = json.getAsJsonArray("type");
13130      for (int i = 0; i < array.size(); i++) {
13131        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13132      }
13133    };
13134    if (json.has("onAdmission"))
13135      res.setOnAdmission(parseCodeableConcept(json.getAsJsonObject("onAdmission")));
13136    if (json.has("packageCode"))
13137      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
13138  }
13139
13140  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(JsonObject json) throws IOException, FHIRFormatError {
13141    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
13142    parseExplanationOfBenefitProcedureComponentProperties(json, res);
13143    return res;
13144  }
13145
13146  protected void parseExplanationOfBenefitProcedureComponentProperties(JsonObject json, ExplanationOfBenefit.ProcedureComponent res) throws IOException, FHIRFormatError {
13147    parseBackboneElementProperties(json, res);
13148    if (json.has("sequence"))
13149      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13150    if (json.has("_sequence"))
13151      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
13152    if (json.has("type")) {
13153      JsonArray array = json.getAsJsonArray("type");
13154      for (int i = 0; i < array.size(); i++) {
13155        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13156      }
13157    };
13158    if (json.has("date"))
13159      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13160    if (json.has("_date"))
13161      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13162    DataType procedure = parseType("procedure", json);
13163    if (procedure != null)
13164      res.setProcedure(procedure);
13165    if (json.has("udi")) {
13166      JsonArray array = json.getAsJsonArray("udi");
13167      for (int i = 0; i < array.size(); i++) {
13168        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
13169      }
13170    };
13171  }
13172
13173  protected ExplanationOfBenefit.InsuranceComponent parseExplanationOfBenefitInsuranceComponent(JsonObject json) throws IOException, FHIRFormatError {
13174    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
13175    parseExplanationOfBenefitInsuranceComponentProperties(json, res);
13176    return res;
13177  }
13178
13179  protected void parseExplanationOfBenefitInsuranceComponentProperties(JsonObject json, ExplanationOfBenefit.InsuranceComponent res) throws IOException, FHIRFormatError {
13180    parseBackboneElementProperties(json, res);
13181    if (json.has("focal"))
13182      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
13183    if (json.has("_focal"))
13184      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
13185    if (json.has("coverage"))
13186      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
13187    if (json.has("preAuthRef")) {
13188      JsonArray array = json.getAsJsonArray("preAuthRef");
13189      for (int i = 0; i < array.size(); i++) {
13190        if (array.get(i).isJsonNull()) {
13191          res.getPreAuthRef().add(new StringType());
13192        } else {;
13193          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
13194        }
13195      }
13196    };
13197    if (json.has("_preAuthRef")) {
13198      JsonArray array = json.getAsJsonArray("_preAuthRef");
13199      for (int i = 0; i < array.size(); i++) {
13200        if (i == res.getPreAuthRef().size())
13201          res.getPreAuthRef().add(parseString(null));
13202        if (array.get(i) instanceof JsonObject) 
13203          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
13204      }
13205    };
13206  }
13207
13208  protected ExplanationOfBenefit.AccidentComponent parseExplanationOfBenefitAccidentComponent(JsonObject json) throws IOException, FHIRFormatError {
13209    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
13210    parseExplanationOfBenefitAccidentComponentProperties(json, res);
13211    return res;
13212  }
13213
13214  protected void parseExplanationOfBenefitAccidentComponentProperties(JsonObject json, ExplanationOfBenefit.AccidentComponent res) throws IOException, FHIRFormatError {
13215    parseBackboneElementProperties(json, res);
13216    if (json.has("date"))
13217      res.setDateElement(parseDate(json.get("date").getAsString()));
13218    if (json.has("_date"))
13219      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13220    if (json.has("type"))
13221      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13222    DataType location = parseType("location", json);
13223    if (location != null)
13224      res.setLocation(location);
13225  }
13226
13227  protected ExplanationOfBenefit.ItemComponent parseExplanationOfBenefitItemComponent(JsonObject json) throws IOException, FHIRFormatError {
13228    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
13229    parseExplanationOfBenefitItemComponentProperties(json, res);
13230    return res;
13231  }
13232
13233  protected void parseExplanationOfBenefitItemComponentProperties(JsonObject json, ExplanationOfBenefit.ItemComponent res) throws IOException, FHIRFormatError {
13234    parseBackboneElementProperties(json, res);
13235    if (json.has("sequence"))
13236      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13237    if (json.has("_sequence"))
13238      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
13239    if (json.has("careTeamSequence")) {
13240      JsonArray array = json.getAsJsonArray("careTeamSequence");
13241      for (int i = 0; i < array.size(); i++) {
13242        if (array.get(i).isJsonNull()) {
13243          res.getCareTeamSequence().add(new PositiveIntType());
13244        } else {;
13245          res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
13246        }
13247      }
13248    };
13249    if (json.has("_careTeamSequence")) {
13250      JsonArray array = json.getAsJsonArray("_careTeamSequence");
13251      for (int i = 0; i < array.size(); i++) {
13252        if (i == res.getCareTeamSequence().size())
13253          res.getCareTeamSequence().add(parsePositiveInt(null));
13254        if (array.get(i) instanceof JsonObject) 
13255          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
13256      }
13257    };
13258    if (json.has("diagnosisSequence")) {
13259      JsonArray array = json.getAsJsonArray("diagnosisSequence");
13260      for (int i = 0; i < array.size(); i++) {
13261        if (array.get(i).isJsonNull()) {
13262          res.getDiagnosisSequence().add(new PositiveIntType());
13263        } else {;
13264          res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
13265        }
13266      }
13267    };
13268    if (json.has("_diagnosisSequence")) {
13269      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
13270      for (int i = 0; i < array.size(); i++) {
13271        if (i == res.getDiagnosisSequence().size())
13272          res.getDiagnosisSequence().add(parsePositiveInt(null));
13273        if (array.get(i) instanceof JsonObject) 
13274          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
13275      }
13276    };
13277    if (json.has("procedureSequence")) {
13278      JsonArray array = json.getAsJsonArray("procedureSequence");
13279      for (int i = 0; i < array.size(); i++) {
13280        if (array.get(i).isJsonNull()) {
13281          res.getProcedureSequence().add(new PositiveIntType());
13282        } else {;
13283          res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
13284        }
13285      }
13286    };
13287    if (json.has("_procedureSequence")) {
13288      JsonArray array = json.getAsJsonArray("_procedureSequence");
13289      for (int i = 0; i < array.size(); i++) {
13290        if (i == res.getProcedureSequence().size())
13291          res.getProcedureSequence().add(parsePositiveInt(null));
13292        if (array.get(i) instanceof JsonObject) 
13293          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
13294      }
13295    };
13296    if (json.has("informationSequence")) {
13297      JsonArray array = json.getAsJsonArray("informationSequence");
13298      for (int i = 0; i < array.size(); i++) {
13299        if (array.get(i).isJsonNull()) {
13300          res.getInformationSequence().add(new PositiveIntType());
13301        } else {;
13302          res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
13303        }
13304      }
13305    };
13306    if (json.has("_informationSequence")) {
13307      JsonArray array = json.getAsJsonArray("_informationSequence");
13308      for (int i = 0; i < array.size(); i++) {
13309        if (i == res.getInformationSequence().size())
13310          res.getInformationSequence().add(parsePositiveInt(null));
13311        if (array.get(i) instanceof JsonObject) 
13312          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
13313      }
13314    };
13315    if (json.has("revenue"))
13316      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
13317    if (json.has("category"))
13318      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
13319    if (json.has("productOrService"))
13320      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
13321    if (json.has("modifier")) {
13322      JsonArray array = json.getAsJsonArray("modifier");
13323      for (int i = 0; i < array.size(); i++) {
13324        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13325      }
13326    };
13327    if (json.has("programCode")) {
13328      JsonArray array = json.getAsJsonArray("programCode");
13329      for (int i = 0; i < array.size(); i++) {
13330        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13331      }
13332    };
13333    DataType serviced = parseType("serviced", json);
13334    if (serviced != null)
13335      res.setServiced(serviced);
13336    DataType location = parseType("location", json);
13337    if (location != null)
13338      res.setLocation(location);
13339    if (json.has("quantity"))
13340      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
13341    if (json.has("unitPrice"))
13342      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
13343    if (json.has("factor"))
13344      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13345    if (json.has("_factor"))
13346      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
13347    if (json.has("net"))
13348      res.setNet(parseMoney(json.getAsJsonObject("net")));
13349    if (json.has("udi")) {
13350      JsonArray array = json.getAsJsonArray("udi");
13351      for (int i = 0; i < array.size(); i++) {
13352        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
13353      }
13354    };
13355    if (json.has("bodySite"))
13356      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
13357    if (json.has("subSite")) {
13358      JsonArray array = json.getAsJsonArray("subSite");
13359      for (int i = 0; i < array.size(); i++) {
13360        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13361      }
13362    };
13363    if (json.has("encounter")) {
13364      JsonArray array = json.getAsJsonArray("encounter");
13365      for (int i = 0; i < array.size(); i++) {
13366        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
13367      }
13368    };
13369    if (json.has("noteNumber")) {
13370      JsonArray array = json.getAsJsonArray("noteNumber");
13371      for (int i = 0; i < array.size(); i++) {
13372        if (array.get(i).isJsonNull()) {
13373          res.getNoteNumber().add(new PositiveIntType());
13374        } else {;
13375          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13376        }
13377      }
13378    };
13379    if (json.has("_noteNumber")) {
13380      JsonArray array = json.getAsJsonArray("_noteNumber");
13381      for (int i = 0; i < array.size(); i++) {
13382        if (i == res.getNoteNumber().size())
13383          res.getNoteNumber().add(parsePositiveInt(null));
13384        if (array.get(i) instanceof JsonObject) 
13385          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13386      }
13387    };
13388    if (json.has("adjudication")) {
13389      JsonArray array = json.getAsJsonArray("adjudication");
13390      for (int i = 0; i < array.size(); i++) {
13391        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
13392      }
13393    };
13394    if (json.has("detail")) {
13395      JsonArray array = json.getAsJsonArray("detail");
13396      for (int i = 0; i < array.size(); i++) {
13397        res.getDetail().add(parseExplanationOfBenefitDetailComponent(array.get(i).getAsJsonObject()));
13398      }
13399    };
13400  }
13401
13402  protected ExplanationOfBenefit.AdjudicationComponent parseExplanationOfBenefitAdjudicationComponent(JsonObject json) throws IOException, FHIRFormatError {
13403    ExplanationOfBenefit.AdjudicationComponent res = new ExplanationOfBenefit.AdjudicationComponent();
13404    parseExplanationOfBenefitAdjudicationComponentProperties(json, res);
13405    return res;
13406  }
13407
13408  protected void parseExplanationOfBenefitAdjudicationComponentProperties(JsonObject json, ExplanationOfBenefit.AdjudicationComponent res) throws IOException, FHIRFormatError {
13409    parseBackboneElementProperties(json, res);
13410    if (json.has("category"))
13411      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
13412    if (json.has("reason"))
13413      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
13414    if (json.has("amount"))
13415      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
13416    if (json.has("value"))
13417      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
13418    if (json.has("_value"))
13419      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
13420  }
13421
13422  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
13423    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
13424    parseExplanationOfBenefitDetailComponentProperties(json, res);
13425    return res;
13426  }
13427
13428  protected void parseExplanationOfBenefitDetailComponentProperties(JsonObject json, ExplanationOfBenefit.DetailComponent res) throws IOException, FHIRFormatError {
13429    parseBackboneElementProperties(json, res);
13430    if (json.has("sequence"))
13431      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13432    if (json.has("_sequence"))
13433      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
13434    if (json.has("revenue"))
13435      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
13436    if (json.has("category"))
13437      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
13438    if (json.has("productOrService"))
13439      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
13440    if (json.has("modifier")) {
13441      JsonArray array = json.getAsJsonArray("modifier");
13442      for (int i = 0; i < array.size(); i++) {
13443        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13444      }
13445    };
13446    if (json.has("programCode")) {
13447      JsonArray array = json.getAsJsonArray("programCode");
13448      for (int i = 0; i < array.size(); i++) {
13449        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13450      }
13451    };
13452    if (json.has("quantity"))
13453      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
13454    if (json.has("unitPrice"))
13455      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
13456    if (json.has("factor"))
13457      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13458    if (json.has("_factor"))
13459      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
13460    if (json.has("net"))
13461      res.setNet(parseMoney(json.getAsJsonObject("net")));
13462    if (json.has("udi")) {
13463      JsonArray array = json.getAsJsonArray("udi");
13464      for (int i = 0; i < array.size(); i++) {
13465        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
13466      }
13467    };
13468    if (json.has("noteNumber")) {
13469      JsonArray array = json.getAsJsonArray("noteNumber");
13470      for (int i = 0; i < array.size(); i++) {
13471        if (array.get(i).isJsonNull()) {
13472          res.getNoteNumber().add(new PositiveIntType());
13473        } else {;
13474          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13475        }
13476      }
13477    };
13478    if (json.has("_noteNumber")) {
13479      JsonArray array = json.getAsJsonArray("_noteNumber");
13480      for (int i = 0; i < array.size(); i++) {
13481        if (i == res.getNoteNumber().size())
13482          res.getNoteNumber().add(parsePositiveInt(null));
13483        if (array.get(i) instanceof JsonObject) 
13484          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13485      }
13486    };
13487    if (json.has("adjudication")) {
13488      JsonArray array = json.getAsJsonArray("adjudication");
13489      for (int i = 0; i < array.size(); i++) {
13490        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
13491      }
13492    };
13493    if (json.has("subDetail")) {
13494      JsonArray array = json.getAsJsonArray("subDetail");
13495      for (int i = 0; i < array.size(); i++) {
13496        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(array.get(i).getAsJsonObject()));
13497      }
13498    };
13499  }
13500
13501  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
13502    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
13503    parseExplanationOfBenefitSubDetailComponentProperties(json, res);
13504    return res;
13505  }
13506
13507  protected void parseExplanationOfBenefitSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit.SubDetailComponent res) throws IOException, FHIRFormatError {
13508    parseBackboneElementProperties(json, res);
13509    if (json.has("sequence"))
13510      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13511    if (json.has("_sequence"))
13512      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
13513    if (json.has("revenue"))
13514      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
13515    if (json.has("category"))
13516      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
13517    if (json.has("productOrService"))
13518      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
13519    if (json.has("modifier")) {
13520      JsonArray array = json.getAsJsonArray("modifier");
13521      for (int i = 0; i < array.size(); i++) {
13522        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13523      }
13524    };
13525    if (json.has("programCode")) {
13526      JsonArray array = json.getAsJsonArray("programCode");
13527      for (int i = 0; i < array.size(); i++) {
13528        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13529      }
13530    };
13531    if (json.has("quantity"))
13532      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
13533    if (json.has("unitPrice"))
13534      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
13535    if (json.has("factor"))
13536      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13537    if (json.has("_factor"))
13538      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
13539    if (json.has("net"))
13540      res.setNet(parseMoney(json.getAsJsonObject("net")));
13541    if (json.has("udi")) {
13542      JsonArray array = json.getAsJsonArray("udi");
13543      for (int i = 0; i < array.size(); i++) {
13544        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
13545      }
13546    };
13547    if (json.has("noteNumber")) {
13548      JsonArray array = json.getAsJsonArray("noteNumber");
13549      for (int i = 0; i < array.size(); i++) {
13550        if (array.get(i).isJsonNull()) {
13551          res.getNoteNumber().add(new PositiveIntType());
13552        } else {;
13553          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13554        }
13555      }
13556    };
13557    if (json.has("_noteNumber")) {
13558      JsonArray array = json.getAsJsonArray("_noteNumber");
13559      for (int i = 0; i < array.size(); i++) {
13560        if (i == res.getNoteNumber().size())
13561          res.getNoteNumber().add(parsePositiveInt(null));
13562        if (array.get(i) instanceof JsonObject) 
13563          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13564      }
13565    };
13566    if (json.has("adjudication")) {
13567      JsonArray array = json.getAsJsonArray("adjudication");
13568      for (int i = 0; i < array.size(); i++) {
13569        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
13570      }
13571    };
13572  }
13573
13574  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
13575    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
13576    parseExplanationOfBenefitAddedItemComponentProperties(json, res);
13577    return res;
13578  }
13579
13580  protected void parseExplanationOfBenefitAddedItemComponentProperties(JsonObject json, ExplanationOfBenefit.AddedItemComponent res) throws IOException, FHIRFormatError {
13581    parseBackboneElementProperties(json, res);
13582    if (json.has("itemSequence")) {
13583      JsonArray array = json.getAsJsonArray("itemSequence");
13584      for (int i = 0; i < array.size(); i++) {
13585        if (array.get(i).isJsonNull()) {
13586          res.getItemSequence().add(new PositiveIntType());
13587        } else {;
13588          res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
13589        }
13590      }
13591    };
13592    if (json.has("_itemSequence")) {
13593      JsonArray array = json.getAsJsonArray("_itemSequence");
13594      for (int i = 0; i < array.size(); i++) {
13595        if (i == res.getItemSequence().size())
13596          res.getItemSequence().add(parsePositiveInt(null));
13597        if (array.get(i) instanceof JsonObject) 
13598          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
13599      }
13600    };
13601    if (json.has("detailSequence")) {
13602      JsonArray array = json.getAsJsonArray("detailSequence");
13603      for (int i = 0; i < array.size(); i++) {
13604        if (array.get(i).isJsonNull()) {
13605          res.getDetailSequence().add(new PositiveIntType());
13606        } else {;
13607          res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
13608        }
13609      }
13610    };
13611    if (json.has("_detailSequence")) {
13612      JsonArray array = json.getAsJsonArray("_detailSequence");
13613      for (int i = 0; i < array.size(); i++) {
13614        if (i == res.getDetailSequence().size())
13615          res.getDetailSequence().add(parsePositiveInt(null));
13616        if (array.get(i) instanceof JsonObject) 
13617          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
13618      }
13619    };
13620    if (json.has("subDetailSequence")) {
13621      JsonArray array = json.getAsJsonArray("subDetailSequence");
13622      for (int i = 0; i < array.size(); i++) {
13623        if (array.get(i).isJsonNull()) {
13624          res.getSubDetailSequence().add(new PositiveIntType());
13625        } else {;
13626          res.getSubDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
13627        }
13628      }
13629    };
13630    if (json.has("_subDetailSequence")) {
13631      JsonArray array = json.getAsJsonArray("_subDetailSequence");
13632      for (int i = 0; i < array.size(); i++) {
13633        if (i == res.getSubDetailSequence().size())
13634          res.getSubDetailSequence().add(parsePositiveInt(null));
13635        if (array.get(i) instanceof JsonObject) 
13636          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubDetailSequence().get(i));
13637      }
13638    };
13639    if (json.has("provider")) {
13640      JsonArray array = json.getAsJsonArray("provider");
13641      for (int i = 0; i < array.size(); i++) {
13642        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
13643      }
13644    };
13645    if (json.has("productOrService"))
13646      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
13647    if (json.has("modifier")) {
13648      JsonArray array = json.getAsJsonArray("modifier");
13649      for (int i = 0; i < array.size(); i++) {
13650        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13651      }
13652    };
13653    if (json.has("programCode")) {
13654      JsonArray array = json.getAsJsonArray("programCode");
13655      for (int i = 0; i < array.size(); i++) {
13656        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13657      }
13658    };
13659    DataType serviced = parseType("serviced", json);
13660    if (serviced != null)
13661      res.setServiced(serviced);
13662    DataType location = parseType("location", json);
13663    if (location != null)
13664      res.setLocation(location);
13665    if (json.has("quantity"))
13666      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
13667    if (json.has("unitPrice"))
13668      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
13669    if (json.has("factor"))
13670      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13671    if (json.has("_factor"))
13672      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
13673    if (json.has("net"))
13674      res.setNet(parseMoney(json.getAsJsonObject("net")));
13675    if (json.has("bodySite"))
13676      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
13677    if (json.has("subSite")) {
13678      JsonArray array = json.getAsJsonArray("subSite");
13679      for (int i = 0; i < array.size(); i++) {
13680        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13681      }
13682    };
13683    if (json.has("noteNumber")) {
13684      JsonArray array = json.getAsJsonArray("noteNumber");
13685      for (int i = 0; i < array.size(); i++) {
13686        if (array.get(i).isJsonNull()) {
13687          res.getNoteNumber().add(new PositiveIntType());
13688        } else {;
13689          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13690        }
13691      }
13692    };
13693    if (json.has("_noteNumber")) {
13694      JsonArray array = json.getAsJsonArray("_noteNumber");
13695      for (int i = 0; i < array.size(); i++) {
13696        if (i == res.getNoteNumber().size())
13697          res.getNoteNumber().add(parsePositiveInt(null));
13698        if (array.get(i) instanceof JsonObject) 
13699          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13700      }
13701    };
13702    if (json.has("adjudication")) {
13703      JsonArray array = json.getAsJsonArray("adjudication");
13704      for (int i = 0; i < array.size(); i++) {
13705        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
13706      }
13707    };
13708    if (json.has("detail")) {
13709      JsonArray array = json.getAsJsonArray("detail");
13710      for (int i = 0; i < array.size(); i++) {
13711        res.getDetail().add(parseExplanationOfBenefitAddedItemDetailComponent(array.get(i).getAsJsonObject()));
13712      }
13713    };
13714  }
13715
13716  protected ExplanationOfBenefit.AddedItemDetailComponent parseExplanationOfBenefitAddedItemDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
13717    ExplanationOfBenefit.AddedItemDetailComponent res = new ExplanationOfBenefit.AddedItemDetailComponent();
13718    parseExplanationOfBenefitAddedItemDetailComponentProperties(json, res);
13719    return res;
13720  }
13721
13722  protected void parseExplanationOfBenefitAddedItemDetailComponentProperties(JsonObject json, ExplanationOfBenefit.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
13723    parseBackboneElementProperties(json, res);
13724    if (json.has("productOrService"))
13725      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
13726    if (json.has("modifier")) {
13727      JsonArray array = json.getAsJsonArray("modifier");
13728      for (int i = 0; i < array.size(); i++) {
13729        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13730      }
13731    };
13732    if (json.has("quantity"))
13733      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
13734    if (json.has("unitPrice"))
13735      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
13736    if (json.has("factor"))
13737      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13738    if (json.has("_factor"))
13739      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
13740    if (json.has("net"))
13741      res.setNet(parseMoney(json.getAsJsonObject("net")));
13742    if (json.has("noteNumber")) {
13743      JsonArray array = json.getAsJsonArray("noteNumber");
13744      for (int i = 0; i < array.size(); i++) {
13745        if (array.get(i).isJsonNull()) {
13746          res.getNoteNumber().add(new PositiveIntType());
13747        } else {;
13748          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13749        }
13750      }
13751    };
13752    if (json.has("_noteNumber")) {
13753      JsonArray array = json.getAsJsonArray("_noteNumber");
13754      for (int i = 0; i < array.size(); i++) {
13755        if (i == res.getNoteNumber().size())
13756          res.getNoteNumber().add(parsePositiveInt(null));
13757        if (array.get(i) instanceof JsonObject) 
13758          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13759      }
13760    };
13761    if (json.has("adjudication")) {
13762      JsonArray array = json.getAsJsonArray("adjudication");
13763      for (int i = 0; i < array.size(); i++) {
13764        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
13765      }
13766    };
13767    if (json.has("subDetail")) {
13768      JsonArray array = json.getAsJsonArray("subDetail");
13769      for (int i = 0; i < array.size(); i++) {
13770        res.getSubDetail().add(parseExplanationOfBenefitAddedItemDetailSubDetailComponent(array.get(i).getAsJsonObject()));
13771      }
13772    };
13773  }
13774
13775  protected ExplanationOfBenefit.AddedItemDetailSubDetailComponent parseExplanationOfBenefitAddedItemDetailSubDetailComponent(JsonObject json) throws IOException, FHIRFormatError {
13776    ExplanationOfBenefit.AddedItemDetailSubDetailComponent res = new ExplanationOfBenefit.AddedItemDetailSubDetailComponent();
13777    parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(json, res);
13778    return res;
13779  }
13780
13781  protected void parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit.AddedItemDetailSubDetailComponent res) throws IOException, FHIRFormatError {
13782    parseBackboneElementProperties(json, res);
13783    if (json.has("productOrService"))
13784      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
13785    if (json.has("modifier")) {
13786      JsonArray array = json.getAsJsonArray("modifier");
13787      for (int i = 0; i < array.size(); i++) {
13788        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13789      }
13790    };
13791    if (json.has("quantity"))
13792      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
13793    if (json.has("unitPrice"))
13794      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
13795    if (json.has("factor"))
13796      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13797    if (json.has("_factor"))
13798      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
13799    if (json.has("net"))
13800      res.setNet(parseMoney(json.getAsJsonObject("net")));
13801    if (json.has("noteNumber")) {
13802      JsonArray array = json.getAsJsonArray("noteNumber");
13803      for (int i = 0; i < array.size(); i++) {
13804        if (array.get(i).isJsonNull()) {
13805          res.getNoteNumber().add(new PositiveIntType());
13806        } else {;
13807          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
13808        }
13809      }
13810    };
13811    if (json.has("_noteNumber")) {
13812      JsonArray array = json.getAsJsonArray("_noteNumber");
13813      for (int i = 0; i < array.size(); i++) {
13814        if (i == res.getNoteNumber().size())
13815          res.getNoteNumber().add(parsePositiveInt(null));
13816        if (array.get(i) instanceof JsonObject) 
13817          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
13818      }
13819    };
13820    if (json.has("adjudication")) {
13821      JsonArray array = json.getAsJsonArray("adjudication");
13822      for (int i = 0; i < array.size(); i++) {
13823        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject()));
13824      }
13825    };
13826  }
13827
13828  protected ExplanationOfBenefit.TotalComponent parseExplanationOfBenefitTotalComponent(JsonObject json) throws IOException, FHIRFormatError {
13829    ExplanationOfBenefit.TotalComponent res = new ExplanationOfBenefit.TotalComponent();
13830    parseExplanationOfBenefitTotalComponentProperties(json, res);
13831    return res;
13832  }
13833
13834  protected void parseExplanationOfBenefitTotalComponentProperties(JsonObject json, ExplanationOfBenefit.TotalComponent res) throws IOException, FHIRFormatError {
13835    parseBackboneElementProperties(json, res);
13836    if (json.has("category"))
13837      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
13838    if (json.has("amount"))
13839      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
13840  }
13841
13842  protected ExplanationOfBenefit.PaymentComponent parseExplanationOfBenefitPaymentComponent(JsonObject json) throws IOException, FHIRFormatError {
13843    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
13844    parseExplanationOfBenefitPaymentComponentProperties(json, res);
13845    return res;
13846  }
13847
13848  protected void parseExplanationOfBenefitPaymentComponentProperties(JsonObject json, ExplanationOfBenefit.PaymentComponent res) throws IOException, FHIRFormatError {
13849    parseBackboneElementProperties(json, res);
13850    if (json.has("type"))
13851      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13852    if (json.has("adjustment"))
13853      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
13854    if (json.has("adjustmentReason"))
13855      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
13856    if (json.has("date"))
13857      res.setDateElement(parseDate(json.get("date").getAsString()));
13858    if (json.has("_date"))
13859      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13860    if (json.has("amount"))
13861      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
13862    if (json.has("identifier"))
13863      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
13864  }
13865
13866  protected ExplanationOfBenefit.NoteComponent parseExplanationOfBenefitNoteComponent(JsonObject json) throws IOException, FHIRFormatError {
13867    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
13868    parseExplanationOfBenefitNoteComponentProperties(json, res);
13869    return res;
13870  }
13871
13872  protected void parseExplanationOfBenefitNoteComponentProperties(JsonObject json, ExplanationOfBenefit.NoteComponent res) throws IOException, FHIRFormatError {
13873    parseBackboneElementProperties(json, res);
13874    if (json.has("number"))
13875      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
13876    if (json.has("_number"))
13877      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
13878    if (json.has("type"))
13879      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
13880    if (json.has("_type"))
13881      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13882    if (json.has("text"))
13883      res.setTextElement(parseString(json.get("text").getAsString()));
13884    if (json.has("_text"))
13885      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
13886    if (json.has("language"))
13887      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
13888  }
13889
13890  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(JsonObject json) throws IOException, FHIRFormatError {
13891    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
13892    parseExplanationOfBenefitBenefitBalanceComponentProperties(json, res);
13893    return res;
13894  }
13895
13896  protected void parseExplanationOfBenefitBenefitBalanceComponentProperties(JsonObject json, ExplanationOfBenefit.BenefitBalanceComponent res) throws IOException, FHIRFormatError {
13897    parseBackboneElementProperties(json, res);
13898    if (json.has("category"))
13899      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
13900    if (json.has("excluded"))
13901      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
13902    if (json.has("_excluded"))
13903      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
13904    if (json.has("name"))
13905      res.setNameElement(parseString(json.get("name").getAsString()));
13906    if (json.has("_name"))
13907      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13908    if (json.has("description"))
13909      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13910    if (json.has("_description"))
13911      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13912    if (json.has("network"))
13913      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
13914    if (json.has("unit"))
13915      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
13916    if (json.has("term"))
13917      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
13918    if (json.has("financial")) {
13919      JsonArray array = json.getAsJsonArray("financial");
13920      for (int i = 0; i < array.size(); i++) {
13921        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(array.get(i).getAsJsonObject()));
13922      }
13923    };
13924  }
13925
13926  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(JsonObject json) throws IOException, FHIRFormatError {
13927    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
13928    parseExplanationOfBenefitBenefitComponentProperties(json, res);
13929    return res;
13930  }
13931
13932  protected void parseExplanationOfBenefitBenefitComponentProperties(JsonObject json, ExplanationOfBenefit.BenefitComponent res) throws IOException, FHIRFormatError {
13933    parseBackboneElementProperties(json, res);
13934    if (json.has("type"))
13935      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13936    DataType allowed = parseType("allowed", json);
13937    if (allowed != null)
13938      res.setAllowed(allowed);
13939    DataType used = parseType("used", json);
13940    if (used != null)
13941      res.setUsed(used);
13942  }
13943
13944  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
13945    FamilyMemberHistory res = new FamilyMemberHistory();
13946    parseFamilyMemberHistoryProperties(json, res);
13947    return res;
13948  }
13949
13950  protected void parseFamilyMemberHistoryProperties(JsonObject json, FamilyMemberHistory res) throws IOException, FHIRFormatError {
13951    parseDomainResourceProperties(json, res);
13952    if (json.has("identifier")) {
13953      JsonArray array = json.getAsJsonArray("identifier");
13954      for (int i = 0; i < array.size(); i++) {
13955        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13956      }
13957    };
13958    if (json.has("instantiatesCanonical")) {
13959      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
13960      for (int i = 0; i < array.size(); i++) {
13961        if (array.get(i).isJsonNull()) {
13962          res.getInstantiatesCanonical().add(new CanonicalType());
13963        } else {;
13964          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
13965        }
13966      }
13967    };
13968    if (json.has("_instantiatesCanonical")) {
13969      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
13970      for (int i = 0; i < array.size(); i++) {
13971        if (i == res.getInstantiatesCanonical().size())
13972          res.getInstantiatesCanonical().add(parseCanonical(null));
13973        if (array.get(i) instanceof JsonObject) 
13974          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
13975      }
13976    };
13977    if (json.has("instantiatesUri")) {
13978      JsonArray array = json.getAsJsonArray("instantiatesUri");
13979      for (int i = 0; i < array.size(); i++) {
13980        if (array.get(i).isJsonNull()) {
13981          res.getInstantiatesUri().add(new UriType());
13982        } else {;
13983          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
13984        }
13985      }
13986    };
13987    if (json.has("_instantiatesUri")) {
13988      JsonArray array = json.getAsJsonArray("_instantiatesUri");
13989      for (int i = 0; i < array.size(); i++) {
13990        if (i == res.getInstantiatesUri().size())
13991          res.getInstantiatesUri().add(parseUri(null));
13992        if (array.get(i) instanceof JsonObject) 
13993          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
13994      }
13995    };
13996    if (json.has("status"))
13997      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
13998    if (json.has("_status"))
13999      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14000    if (json.has("dataAbsentReason"))
14001      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
14002    if (json.has("patient"))
14003      res.setPatient(parseReference(json.getAsJsonObject("patient")));
14004    if (json.has("date"))
14005      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14006    if (json.has("_date"))
14007      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14008    if (json.has("name"))
14009      res.setNameElement(parseString(json.get("name").getAsString()));
14010    if (json.has("_name"))
14011      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14012    if (json.has("relationship"))
14013      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
14014    if (json.has("sex"))
14015      res.setSex(parseCodeableConcept(json.getAsJsonObject("sex")));
14016    DataType born = parseType("born", json);
14017    if (born != null)
14018      res.setBorn(born);
14019    DataType age = parseType("age", json);
14020    if (age != null)
14021      res.setAge(age);
14022    if (json.has("estimatedAge"))
14023      res.setEstimatedAgeElement(parseBoolean(json.get("estimatedAge").getAsBoolean()));
14024    if (json.has("_estimatedAge"))
14025      parseElementProperties(json.getAsJsonObject("_estimatedAge"), res.getEstimatedAgeElement());
14026    DataType deceased = parseType("deceased", json);
14027    if (deceased != null)
14028      res.setDeceased(deceased);
14029    if (json.has("reason")) {
14030      JsonArray array = json.getAsJsonArray("reason");
14031      for (int i = 0; i < array.size(); i++) {
14032        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
14033      }
14034    };
14035    if (json.has("note")) {
14036      JsonArray array = json.getAsJsonArray("note");
14037      for (int i = 0; i < array.size(); i++) {
14038        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14039      }
14040    };
14041    if (json.has("condition")) {
14042      JsonArray array = json.getAsJsonArray("condition");
14043      for (int i = 0; i < array.size(); i++) {
14044        res.getCondition().add(parseFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject()));
14045      }
14046    };
14047    if (json.has("procedure")) {
14048      JsonArray array = json.getAsJsonArray("procedure");
14049      for (int i = 0; i < array.size(); i++) {
14050        res.getProcedure().add(parseFamilyMemberHistoryProcedureComponent(array.get(i).getAsJsonObject()));
14051      }
14052    };
14053  }
14054
14055  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryConditionComponent(JsonObject json) throws IOException, FHIRFormatError {
14056    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
14057    parseFamilyMemberHistoryConditionComponentProperties(json, res);
14058    return res;
14059  }
14060
14061  protected void parseFamilyMemberHistoryConditionComponentProperties(JsonObject json, FamilyMemberHistory.FamilyMemberHistoryConditionComponent res) throws IOException, FHIRFormatError {
14062    parseBackboneElementProperties(json, res);
14063    if (json.has("code"))
14064      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14065    if (json.has("outcome"))
14066      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
14067    if (json.has("contributedToDeath"))
14068      res.setContributedToDeathElement(parseBoolean(json.get("contributedToDeath").getAsBoolean()));
14069    if (json.has("_contributedToDeath"))
14070      parseElementProperties(json.getAsJsonObject("_contributedToDeath"), res.getContributedToDeathElement());
14071    DataType onset = parseType("onset", json);
14072    if (onset != null)
14073      res.setOnset(onset);
14074    if (json.has("note")) {
14075      JsonArray array = json.getAsJsonArray("note");
14076      for (int i = 0; i < array.size(); i++) {
14077        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14078      }
14079    };
14080  }
14081
14082  protected FamilyMemberHistory.FamilyMemberHistoryProcedureComponent parseFamilyMemberHistoryProcedureComponent(JsonObject json) throws IOException, FHIRFormatError {
14083    FamilyMemberHistory.FamilyMemberHistoryProcedureComponent res = new FamilyMemberHistory.FamilyMemberHistoryProcedureComponent();
14084    parseFamilyMemberHistoryProcedureComponentProperties(json, res);
14085    return res;
14086  }
14087
14088  protected void parseFamilyMemberHistoryProcedureComponentProperties(JsonObject json, FamilyMemberHistory.FamilyMemberHistoryProcedureComponent res) throws IOException, FHIRFormatError {
14089    parseBackboneElementProperties(json, res);
14090    if (json.has("code"))
14091      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14092    if (json.has("outcome"))
14093      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
14094    if (json.has("contributedToDeath"))
14095      res.setContributedToDeathElement(parseBoolean(json.get("contributedToDeath").getAsBoolean()));
14096    if (json.has("_contributedToDeath"))
14097      parseElementProperties(json.getAsJsonObject("_contributedToDeath"), res.getContributedToDeathElement());
14098    DataType performed = parseType("performed", json);
14099    if (performed != null)
14100      res.setPerformed(performed);
14101    if (json.has("note")) {
14102      JsonArray array = json.getAsJsonArray("note");
14103      for (int i = 0; i < array.size(); i++) {
14104        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14105      }
14106    };
14107  }
14108
14109  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
14110    Flag res = new Flag();
14111    parseFlagProperties(json, res);
14112    return res;
14113  }
14114
14115  protected void parseFlagProperties(JsonObject json, Flag res) throws IOException, FHIRFormatError {
14116    parseDomainResourceProperties(json, res);
14117    if (json.has("identifier")) {
14118      JsonArray array = json.getAsJsonArray("identifier");
14119      for (int i = 0; i < array.size(); i++) {
14120        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14121      }
14122    };
14123    if (json.has("status"))
14124      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
14125    if (json.has("_status"))
14126      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14127    if (json.has("category")) {
14128      JsonArray array = json.getAsJsonArray("category");
14129      for (int i = 0; i < array.size(); i++) {
14130        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14131      }
14132    };
14133    if (json.has("code"))
14134      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14135    if (json.has("subject"))
14136      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14137    if (json.has("period"))
14138      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
14139    if (json.has("encounter"))
14140      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
14141    if (json.has("author"))
14142      res.setAuthor(parseReference(json.getAsJsonObject("author")));
14143  }
14144
14145  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
14146    Goal res = new Goal();
14147    parseGoalProperties(json, res);
14148    return res;
14149  }
14150
14151  protected void parseGoalProperties(JsonObject json, Goal res) throws IOException, FHIRFormatError {
14152    parseDomainResourceProperties(json, res);
14153    if (json.has("identifier")) {
14154      JsonArray array = json.getAsJsonArray("identifier");
14155      for (int i = 0; i < array.size(); i++) {
14156        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14157      }
14158    };
14159    if (json.has("lifecycleStatus"))
14160      res.setLifecycleStatusElement(parseEnumeration(json.get("lifecycleStatus").getAsString(), Goal.GoalLifecycleStatus.NULL, new Goal.GoalLifecycleStatusEnumFactory()));
14161    if (json.has("_lifecycleStatus"))
14162      parseElementProperties(json.getAsJsonObject("_lifecycleStatus"), res.getLifecycleStatusElement());
14163    if (json.has("achievementStatus"))
14164      res.setAchievementStatus(parseCodeableConcept(json.getAsJsonObject("achievementStatus")));
14165    if (json.has("category")) {
14166      JsonArray array = json.getAsJsonArray("category");
14167      for (int i = 0; i < array.size(); i++) {
14168        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14169      }
14170    };
14171    if (json.has("continuous"))
14172      res.setContinuousElement(parseBoolean(json.get("continuous").getAsBoolean()));
14173    if (json.has("_continuous"))
14174      parseElementProperties(json.getAsJsonObject("_continuous"), res.getContinuousElement());
14175    if (json.has("priority"))
14176      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
14177    if (json.has("description"))
14178      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
14179    if (json.has("subject"))
14180      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14181    DataType start = parseType("start", json);
14182    if (start != null)
14183      res.setStart(start);
14184    if (json.has("target")) {
14185      JsonArray array = json.getAsJsonArray("target");
14186      for (int i = 0; i < array.size(); i++) {
14187        res.getTarget().add(parseGoalTargetComponent(array.get(i).getAsJsonObject()));
14188      }
14189    };
14190    if (json.has("statusDate"))
14191      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
14192    if (json.has("_statusDate"))
14193      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
14194    if (json.has("statusReason"))
14195      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
14196    if (json.has("_statusReason"))
14197      parseElementProperties(json.getAsJsonObject("_statusReason"), res.getStatusReasonElement());
14198    if (json.has("expressedBy"))
14199      res.setExpressedBy(parseReference(json.getAsJsonObject("expressedBy")));
14200    if (json.has("addresses")) {
14201      JsonArray array = json.getAsJsonArray("addresses");
14202      for (int i = 0; i < array.size(); i++) {
14203        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
14204      }
14205    };
14206    if (json.has("note")) {
14207      JsonArray array = json.getAsJsonArray("note");
14208      for (int i = 0; i < array.size(); i++) {
14209        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14210      }
14211    };
14212    if (json.has("outcome")) {
14213      JsonArray array = json.getAsJsonArray("outcome");
14214      for (int i = 0; i < array.size(); i++) {
14215        res.getOutcome().add(parseCodeableReference(array.get(i).getAsJsonObject()));
14216      }
14217    };
14218  }
14219
14220  protected Goal.GoalTargetComponent parseGoalTargetComponent(JsonObject json) throws IOException, FHIRFormatError {
14221    Goal.GoalTargetComponent res = new Goal.GoalTargetComponent();
14222    parseGoalTargetComponentProperties(json, res);
14223    return res;
14224  }
14225
14226  protected void parseGoalTargetComponentProperties(JsonObject json, Goal.GoalTargetComponent res) throws IOException, FHIRFormatError {
14227    parseBackboneElementProperties(json, res);
14228    if (json.has("measure"))
14229      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
14230    DataType detail = parseType("detail", json);
14231    if (detail != null)
14232      res.setDetail(detail);
14233    DataType due = parseType("due", json);
14234    if (due != null)
14235      res.setDue(due);
14236  }
14237
14238  protected GraphDefinition parseGraphDefinition(JsonObject json) throws IOException, FHIRFormatError {
14239    GraphDefinition res = new GraphDefinition();
14240    parseGraphDefinitionProperties(json, res);
14241    return res;
14242  }
14243
14244  protected void parseGraphDefinitionProperties(JsonObject json, GraphDefinition res) throws IOException, FHIRFormatError {
14245    parseCanonicalResourceProperties(json, res);
14246    if (json.has("url"))
14247      res.setUrlElement(parseUri(json.get("url").getAsString()));
14248    if (json.has("_url"))
14249      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
14250    if (json.has("version"))
14251      res.setVersionElement(parseString(json.get("version").getAsString()));
14252    if (json.has("_version"))
14253      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
14254    if (json.has("name"))
14255      res.setNameElement(parseString(json.get("name").getAsString()));
14256    if (json.has("_name"))
14257      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14258    if (json.has("status"))
14259      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14260    if (json.has("_status"))
14261      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14262    if (json.has("experimental"))
14263      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14264    if (json.has("_experimental"))
14265      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
14266    if (json.has("date"))
14267      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14268    if (json.has("_date"))
14269      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14270    if (json.has("publisher"))
14271      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14272    if (json.has("_publisher"))
14273      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
14274    if (json.has("contact")) {
14275      JsonArray array = json.getAsJsonArray("contact");
14276      for (int i = 0; i < array.size(); i++) {
14277        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14278      }
14279    };
14280    if (json.has("description"))
14281      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14282    if (json.has("_description"))
14283      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14284    if (json.has("useContext")) {
14285      JsonArray array = json.getAsJsonArray("useContext");
14286      for (int i = 0; i < array.size(); i++) {
14287        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14288      }
14289    };
14290    if (json.has("jurisdiction")) {
14291      JsonArray array = json.getAsJsonArray("jurisdiction");
14292      for (int i = 0; i < array.size(); i++) {
14293        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14294      }
14295    };
14296    if (json.has("purpose"))
14297      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
14298    if (json.has("_purpose"))
14299      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
14300    if (json.has("start"))
14301      res.setStartElement(parseCode(json.get("start").getAsString()));
14302    if (json.has("_start"))
14303      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
14304    if (json.has("profile"))
14305      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
14306    if (json.has("_profile"))
14307      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
14308    if (json.has("link")) {
14309      JsonArray array = json.getAsJsonArray("link");
14310      for (int i = 0; i < array.size(); i++) {
14311        res.getLink().add(parseGraphDefinitionLinkComponent(array.get(i).getAsJsonObject()));
14312      }
14313    };
14314  }
14315
14316  protected GraphDefinition.GraphDefinitionLinkComponent parseGraphDefinitionLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
14317    GraphDefinition.GraphDefinitionLinkComponent res = new GraphDefinition.GraphDefinitionLinkComponent();
14318    parseGraphDefinitionLinkComponentProperties(json, res);
14319    return res;
14320  }
14321
14322  protected void parseGraphDefinitionLinkComponentProperties(JsonObject json, GraphDefinition.GraphDefinitionLinkComponent res) throws IOException, FHIRFormatError {
14323    parseBackboneElementProperties(json, res);
14324    if (json.has("path"))
14325      res.setPathElement(parseString(json.get("path").getAsString()));
14326    if (json.has("_path"))
14327      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
14328    if (json.has("sliceName"))
14329      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
14330    if (json.has("_sliceName"))
14331      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
14332    if (json.has("min"))
14333      res.setMinElement(parseInteger(json.get("min").getAsLong()));
14334    if (json.has("_min"))
14335      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
14336    if (json.has("max"))
14337      res.setMaxElement(parseString(json.get("max").getAsString()));
14338    if (json.has("_max"))
14339      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
14340    if (json.has("description"))
14341      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14342    if (json.has("_description"))
14343      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14344    if (json.has("target")) {
14345      JsonArray array = json.getAsJsonArray("target");
14346      for (int i = 0; i < array.size(); i++) {
14347        res.getTarget().add(parseGraphDefinitionLinkTargetComponent(array.get(i).getAsJsonObject()));
14348      }
14349    };
14350  }
14351
14352  protected GraphDefinition.GraphDefinitionLinkTargetComponent parseGraphDefinitionLinkTargetComponent(JsonObject json) throws IOException, FHIRFormatError {
14353    GraphDefinition.GraphDefinitionLinkTargetComponent res = new GraphDefinition.GraphDefinitionLinkTargetComponent();
14354    parseGraphDefinitionLinkTargetComponentProperties(json, res);
14355    return res;
14356  }
14357
14358  protected void parseGraphDefinitionLinkTargetComponentProperties(JsonObject json, GraphDefinition.GraphDefinitionLinkTargetComponent res) throws IOException, FHIRFormatError {
14359    parseBackboneElementProperties(json, res);
14360    if (json.has("type"))
14361      res.setTypeElement(parseCode(json.get("type").getAsString()));
14362    if (json.has("_type"))
14363      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
14364    if (json.has("params"))
14365      res.setParamsElement(parseString(json.get("params").getAsString()));
14366    if (json.has("_params"))
14367      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
14368    if (json.has("profile"))
14369      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
14370    if (json.has("_profile"))
14371      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
14372    if (json.has("compartment")) {
14373      JsonArray array = json.getAsJsonArray("compartment");
14374      for (int i = 0; i < array.size(); i++) {
14375        res.getCompartment().add(parseGraphDefinitionLinkTargetCompartmentComponent(array.get(i).getAsJsonObject()));
14376      }
14377    };
14378    if (json.has("link")) {
14379      JsonArray array = json.getAsJsonArray("link");
14380      for (int i = 0; i < array.size(); i++) {
14381        res.getLink().add(parseGraphDefinitionLinkComponent(array.get(i).getAsJsonObject()));
14382      }
14383    };
14384  }
14385
14386  protected GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent parseGraphDefinitionLinkTargetCompartmentComponent(JsonObject json) throws IOException, FHIRFormatError {
14387    GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res = new GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent();
14388    parseGraphDefinitionLinkTargetCompartmentComponentProperties(json, res);
14389    return res;
14390  }
14391
14392  protected void parseGraphDefinitionLinkTargetCompartmentComponentProperties(JsonObject json, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res) throws IOException, FHIRFormatError {
14393    parseBackboneElementProperties(json, res);
14394    if (json.has("use"))
14395      res.setUseElement(parseEnumeration(json.get("use").getAsString(), GraphDefinition.GraphCompartmentUse.NULL, new GraphDefinition.GraphCompartmentUseEnumFactory()));
14396    if (json.has("_use"))
14397      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
14398    if (json.has("code"))
14399      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Enumerations.CompartmentType.NULL, new Enumerations.CompartmentTypeEnumFactory()));
14400    if (json.has("_code"))
14401      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
14402    if (json.has("rule"))
14403      res.setRuleElement(parseEnumeration(json.get("rule").getAsString(), GraphDefinition.GraphCompartmentRule.NULL, new GraphDefinition.GraphCompartmentRuleEnumFactory()));
14404    if (json.has("_rule"))
14405      parseElementProperties(json.getAsJsonObject("_rule"), res.getRuleElement());
14406    if (json.has("expression"))
14407      res.setExpressionElement(parseString(json.get("expression").getAsString()));
14408    if (json.has("_expression"))
14409      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
14410    if (json.has("description"))
14411      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14412    if (json.has("_description"))
14413      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14414  }
14415
14416  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
14417    Group res = new Group();
14418    parseGroupProperties(json, res);
14419    return res;
14420  }
14421
14422  protected void parseGroupProperties(JsonObject json, Group res) throws IOException, FHIRFormatError {
14423    parseDomainResourceProperties(json, res);
14424    if (json.has("identifier")) {
14425      JsonArray array = json.getAsJsonArray("identifier");
14426      for (int i = 0; i < array.size(); i++) {
14427        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14428      }
14429    };
14430    if (json.has("active"))
14431      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14432    if (json.has("_active"))
14433      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
14434    if (json.has("type"))
14435      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
14436    if (json.has("_type"))
14437      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
14438    if (json.has("actual"))
14439      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
14440    if (json.has("_actual"))
14441      parseElementProperties(json.getAsJsonObject("_actual"), res.getActualElement());
14442    if (json.has("code"))
14443      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14444    if (json.has("name"))
14445      res.setNameElement(parseString(json.get("name").getAsString()));
14446    if (json.has("_name"))
14447      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14448    if (json.has("quantity"))
14449      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
14450    if (json.has("_quantity"))
14451      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
14452    if (json.has("managingEntity"))
14453      res.setManagingEntity(parseReference(json.getAsJsonObject("managingEntity")));
14454    if (json.has("characteristic")) {
14455      JsonArray array = json.getAsJsonArray("characteristic");
14456      for (int i = 0; i < array.size(); i++) {
14457        res.getCharacteristic().add(parseGroupCharacteristicComponent(array.get(i).getAsJsonObject()));
14458      }
14459    };
14460    if (json.has("member")) {
14461      JsonArray array = json.getAsJsonArray("member");
14462      for (int i = 0; i < array.size(); i++) {
14463        res.getMember().add(parseGroupMemberComponent(array.get(i).getAsJsonObject()));
14464      }
14465    };
14466  }
14467
14468  protected Group.GroupCharacteristicComponent parseGroupCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
14469    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
14470    parseGroupCharacteristicComponentProperties(json, res);
14471    return res;
14472  }
14473
14474  protected void parseGroupCharacteristicComponentProperties(JsonObject json, Group.GroupCharacteristicComponent res) throws IOException, FHIRFormatError {
14475    parseBackboneElementProperties(json, res);
14476    if (json.has("code"))
14477      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14478    DataType value = parseType("value", json);
14479    if (value != null)
14480      res.setValue(value);
14481    if (json.has("exclude"))
14482      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
14483    if (json.has("_exclude"))
14484      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
14485    if (json.has("period"))
14486      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
14487  }
14488
14489  protected Group.GroupMemberComponent parseGroupMemberComponent(JsonObject json) throws IOException, FHIRFormatError {
14490    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
14491    parseGroupMemberComponentProperties(json, res);
14492    return res;
14493  }
14494
14495  protected void parseGroupMemberComponentProperties(JsonObject json, Group.GroupMemberComponent res) throws IOException, FHIRFormatError {
14496    parseBackboneElementProperties(json, res);
14497    if (json.has("entity"))
14498      res.setEntity(parseReference(json.getAsJsonObject("entity")));
14499    if (json.has("period"))
14500      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
14501    if (json.has("inactive"))
14502      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
14503    if (json.has("_inactive"))
14504      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
14505  }
14506
14507  protected GuidanceResponse parseGuidanceResponse(JsonObject json) throws IOException, FHIRFormatError {
14508    GuidanceResponse res = new GuidanceResponse();
14509    parseGuidanceResponseProperties(json, res);
14510    return res;
14511  }
14512
14513  protected void parseGuidanceResponseProperties(JsonObject json, GuidanceResponse res) throws IOException, FHIRFormatError {
14514    parseDomainResourceProperties(json, res);
14515    if (json.has("requestIdentifier"))
14516      res.setRequestIdentifier(parseIdentifier(json.getAsJsonObject("requestIdentifier")));
14517    if (json.has("identifier")) {
14518      JsonArray array = json.getAsJsonArray("identifier");
14519      for (int i = 0; i < array.size(); i++) {
14520        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14521      }
14522    };
14523    DataType module = parseType("module", json);
14524    if (module != null)
14525      res.setModule(module);
14526    if (json.has("status"))
14527      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
14528    if (json.has("_status"))
14529      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14530    if (json.has("subject"))
14531      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14532    if (json.has("encounter"))
14533      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
14534    if (json.has("occurrenceDateTime"))
14535      res.setOccurrenceDateTimeElement(parseDateTime(json.get("occurrenceDateTime").getAsString()));
14536    if (json.has("_occurrenceDateTime"))
14537      parseElementProperties(json.getAsJsonObject("_occurrenceDateTime"), res.getOccurrenceDateTimeElement());
14538    if (json.has("performer"))
14539      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
14540    if (json.has("reason")) {
14541      JsonArray array = json.getAsJsonArray("reason");
14542      for (int i = 0; i < array.size(); i++) {
14543        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
14544      }
14545    };
14546    if (json.has("note")) {
14547      JsonArray array = json.getAsJsonArray("note");
14548      for (int i = 0; i < array.size(); i++) {
14549        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14550      }
14551    };
14552    if (json.has("evaluationMessage")) {
14553      JsonArray array = json.getAsJsonArray("evaluationMessage");
14554      for (int i = 0; i < array.size(); i++) {
14555        res.getEvaluationMessage().add(parseReference(array.get(i).getAsJsonObject()));
14556      }
14557    };
14558    if (json.has("outputParameters"))
14559      res.setOutputParameters(parseReference(json.getAsJsonObject("outputParameters")));
14560    if (json.has("result"))
14561      res.setResult(parseReference(json.getAsJsonObject("result")));
14562    if (json.has("dataRequirement")) {
14563      JsonArray array = json.getAsJsonArray("dataRequirement");
14564      for (int i = 0; i < array.size(); i++) {
14565        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
14566      }
14567    };
14568  }
14569
14570  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
14571    HealthcareService res = new HealthcareService();
14572    parseHealthcareServiceProperties(json, res);
14573    return res;
14574  }
14575
14576  protected void parseHealthcareServiceProperties(JsonObject json, HealthcareService res) throws IOException, FHIRFormatError {
14577    parseDomainResourceProperties(json, res);
14578    if (json.has("identifier")) {
14579      JsonArray array = json.getAsJsonArray("identifier");
14580      for (int i = 0; i < array.size(); i++) {
14581        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14582      }
14583    };
14584    if (json.has("active"))
14585      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14586    if (json.has("_active"))
14587      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
14588    if (json.has("providedBy"))
14589      res.setProvidedBy(parseReference(json.getAsJsonObject("providedBy")));
14590    if (json.has("category")) {
14591      JsonArray array = json.getAsJsonArray("category");
14592      for (int i = 0; i < array.size(); i++) {
14593        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14594      }
14595    };
14596    if (json.has("type")) {
14597      JsonArray array = json.getAsJsonArray("type");
14598      for (int i = 0; i < array.size(); i++) {
14599        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14600      }
14601    };
14602    if (json.has("specialty")) {
14603      JsonArray array = json.getAsJsonArray("specialty");
14604      for (int i = 0; i < array.size(); i++) {
14605        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14606      }
14607    };
14608    if (json.has("location")) {
14609      JsonArray array = json.getAsJsonArray("location");
14610      for (int i = 0; i < array.size(); i++) {
14611        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
14612      }
14613    };
14614    if (json.has("name"))
14615      res.setNameElement(parseString(json.get("name").getAsString()));
14616    if (json.has("_name"))
14617      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14618    if (json.has("comment"))
14619      res.setCommentElement(parseString(json.get("comment").getAsString()));
14620    if (json.has("_comment"))
14621      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
14622    if (json.has("extraDetails"))
14623      res.setExtraDetailsElement(parseMarkdown(json.get("extraDetails").getAsString()));
14624    if (json.has("_extraDetails"))
14625      parseElementProperties(json.getAsJsonObject("_extraDetails"), res.getExtraDetailsElement());
14626    if (json.has("photo"))
14627      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
14628    if (json.has("telecom")) {
14629      JsonArray array = json.getAsJsonArray("telecom");
14630      for (int i = 0; i < array.size(); i++) {
14631        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14632      }
14633    };
14634    if (json.has("coverageArea")) {
14635      JsonArray array = json.getAsJsonArray("coverageArea");
14636      for (int i = 0; i < array.size(); i++) {
14637        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
14638      }
14639    };
14640    if (json.has("serviceProvisionCode")) {
14641      JsonArray array = json.getAsJsonArray("serviceProvisionCode");
14642      for (int i = 0; i < array.size(); i++) {
14643        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14644      }
14645    };
14646    if (json.has("eligibility")) {
14647      JsonArray array = json.getAsJsonArray("eligibility");
14648      for (int i = 0; i < array.size(); i++) {
14649        res.getEligibility().add(parseHealthcareServiceEligibilityComponent(array.get(i).getAsJsonObject()));
14650      }
14651    };
14652    if (json.has("program")) {
14653      JsonArray array = json.getAsJsonArray("program");
14654      for (int i = 0; i < array.size(); i++) {
14655        res.getProgram().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14656      }
14657    };
14658    if (json.has("characteristic")) {
14659      JsonArray array = json.getAsJsonArray("characteristic");
14660      for (int i = 0; i < array.size(); i++) {
14661        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14662      }
14663    };
14664    if (json.has("communication")) {
14665      JsonArray array = json.getAsJsonArray("communication");
14666      for (int i = 0; i < array.size(); i++) {
14667        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14668      }
14669    };
14670    if (json.has("referralMethod")) {
14671      JsonArray array = json.getAsJsonArray("referralMethod");
14672      for (int i = 0; i < array.size(); i++) {
14673        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14674      }
14675    };
14676    if (json.has("appointmentRequired"))
14677      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
14678    if (json.has("_appointmentRequired"))
14679      parseElementProperties(json.getAsJsonObject("_appointmentRequired"), res.getAppointmentRequiredElement());
14680    if (json.has("availableTime")) {
14681      JsonArray array = json.getAsJsonArray("availableTime");
14682      for (int i = 0; i < array.size(); i++) {
14683        res.getAvailableTime().add(parseHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject()));
14684      }
14685    };
14686    if (json.has("notAvailable")) {
14687      JsonArray array = json.getAsJsonArray("notAvailable");
14688      for (int i = 0; i < array.size(); i++) {
14689        res.getNotAvailable().add(parseHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject()));
14690      }
14691    };
14692    if (json.has("availabilityExceptions"))
14693      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
14694    if (json.has("_availabilityExceptions"))
14695      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
14696    if (json.has("endpoint")) {
14697      JsonArray array = json.getAsJsonArray("endpoint");
14698      for (int i = 0; i < array.size(); i++) {
14699        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
14700      }
14701    };
14702  }
14703
14704  protected HealthcareService.HealthcareServiceEligibilityComponent parseHealthcareServiceEligibilityComponent(JsonObject json) throws IOException, FHIRFormatError {
14705    HealthcareService.HealthcareServiceEligibilityComponent res = new HealthcareService.HealthcareServiceEligibilityComponent();
14706    parseHealthcareServiceEligibilityComponentProperties(json, res);
14707    return res;
14708  }
14709
14710  protected void parseHealthcareServiceEligibilityComponentProperties(JsonObject json, HealthcareService.HealthcareServiceEligibilityComponent res) throws IOException, FHIRFormatError {
14711    parseBackboneElementProperties(json, res);
14712    if (json.has("code"))
14713      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14714    if (json.has("comment"))
14715      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
14716    if (json.has("_comment"))
14717      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
14718  }
14719
14720  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceAvailableTimeComponent(JsonObject json) throws IOException, FHIRFormatError {
14721    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
14722    parseHealthcareServiceAvailableTimeComponentProperties(json, res);
14723    return res;
14724  }
14725
14726  protected void parseHealthcareServiceAvailableTimeComponentProperties(JsonObject json, HealthcareService.HealthcareServiceAvailableTimeComponent res) throws IOException, FHIRFormatError {
14727    parseBackboneElementProperties(json, res);
14728    if (json.has("daysOfWeek")) {
14729      JsonArray array = json.getAsJsonArray("daysOfWeek");
14730      for (int i = 0; i < array.size(); i++) {
14731        if (array.get(i).isJsonNull()) {
14732          res.getDaysOfWeek().add(new Enumeration<Enumerations.DaysOfWeek>(new Enumerations.DaysOfWeekEnumFactory(), Enumerations.DaysOfWeek.NULL));
14733        } else {;
14734          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
14735        }
14736      }
14737    };
14738    if (json.has("_daysOfWeek")) {
14739      JsonArray array = json.getAsJsonArray("_daysOfWeek");
14740      for (int i = 0; i < array.size(); i++) {
14741        if (i == res.getDaysOfWeek().size())
14742          res.getDaysOfWeek().add(parseEnumeration(null, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
14743        if (array.get(i) instanceof JsonObject) 
14744          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
14745      }
14746    };
14747    if (json.has("allDay"))
14748      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
14749    if (json.has("_allDay"))
14750      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
14751    if (json.has("availableStartTime"))
14752      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
14753    if (json.has("_availableStartTime"))
14754      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
14755    if (json.has("availableEndTime"))
14756      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
14757    if (json.has("_availableEndTime"))
14758      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
14759  }
14760
14761  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceNotAvailableComponent(JsonObject json) throws IOException, FHIRFormatError {
14762    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
14763    parseHealthcareServiceNotAvailableComponentProperties(json, res);
14764    return res;
14765  }
14766
14767  protected void parseHealthcareServiceNotAvailableComponentProperties(JsonObject json, HealthcareService.HealthcareServiceNotAvailableComponent res) throws IOException, FHIRFormatError {
14768    parseBackboneElementProperties(json, res);
14769    if (json.has("description"))
14770      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14771    if (json.has("_description"))
14772      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14773    if (json.has("during"))
14774      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
14775  }
14776
14777  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
14778    ImagingStudy res = new ImagingStudy();
14779    parseImagingStudyProperties(json, res);
14780    return res;
14781  }
14782
14783  protected void parseImagingStudyProperties(JsonObject json, ImagingStudy res) throws IOException, FHIRFormatError {
14784    parseDomainResourceProperties(json, res);
14785    if (json.has("identifier")) {
14786      JsonArray array = json.getAsJsonArray("identifier");
14787      for (int i = 0; i < array.size(); i++) {
14788        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14789      }
14790    };
14791    if (json.has("status"))
14792      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImagingStudy.ImagingStudyStatus.NULL, new ImagingStudy.ImagingStudyStatusEnumFactory()));
14793    if (json.has("_status"))
14794      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14795    if (json.has("modality")) {
14796      JsonArray array = json.getAsJsonArray("modality");
14797      for (int i = 0; i < array.size(); i++) {
14798        res.getModality().add(parseCoding(array.get(i).getAsJsonObject()));
14799      }
14800    };
14801    if (json.has("subject"))
14802      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14803    if (json.has("encounter"))
14804      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
14805    if (json.has("started"))
14806      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
14807    if (json.has("_started"))
14808      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
14809    if (json.has("basedOn")) {
14810      JsonArray array = json.getAsJsonArray("basedOn");
14811      for (int i = 0; i < array.size(); i++) {
14812        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
14813      }
14814    };
14815    if (json.has("referrer"))
14816      res.setReferrer(parseReference(json.getAsJsonObject("referrer")));
14817    if (json.has("interpreter")) {
14818      JsonArray array = json.getAsJsonArray("interpreter");
14819      for (int i = 0; i < array.size(); i++) {
14820        res.getInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
14821      }
14822    };
14823    if (json.has("endpoint")) {
14824      JsonArray array = json.getAsJsonArray("endpoint");
14825      for (int i = 0; i < array.size(); i++) {
14826        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
14827      }
14828    };
14829    if (json.has("numberOfSeries"))
14830      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
14831    if (json.has("_numberOfSeries"))
14832      parseElementProperties(json.getAsJsonObject("_numberOfSeries"), res.getNumberOfSeriesElement());
14833    if (json.has("numberOfInstances"))
14834      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
14835    if (json.has("_numberOfInstances"))
14836      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
14837    if (json.has("procedure")) {
14838      JsonArray array = json.getAsJsonArray("procedure");
14839      for (int i = 0; i < array.size(); i++) {
14840        res.getProcedure().add(parseImagingStudyProcedureComponent(array.get(i).getAsJsonObject()));
14841      }
14842    };
14843    if (json.has("location"))
14844      res.setLocation(parseReference(json.getAsJsonObject("location")));
14845    if (json.has("reason")) {
14846      JsonArray array = json.getAsJsonArray("reason");
14847      for (int i = 0; i < array.size(); i++) {
14848        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
14849      }
14850    };
14851    if (json.has("note")) {
14852      JsonArray array = json.getAsJsonArray("note");
14853      for (int i = 0; i < array.size(); i++) {
14854        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14855      }
14856    };
14857    if (json.has("description"))
14858      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14859    if (json.has("_description"))
14860      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14861    if (json.has("series")) {
14862      JsonArray array = json.getAsJsonArray("series");
14863      for (int i = 0; i < array.size(); i++) {
14864        res.getSeries().add(parseImagingStudySeriesComponent(array.get(i).getAsJsonObject()));
14865      }
14866    };
14867  }
14868
14869  protected ImagingStudy.ImagingStudyProcedureComponent parseImagingStudyProcedureComponent(JsonObject json) throws IOException, FHIRFormatError {
14870    ImagingStudy.ImagingStudyProcedureComponent res = new ImagingStudy.ImagingStudyProcedureComponent();
14871    parseImagingStudyProcedureComponentProperties(json, res);
14872    return res;
14873  }
14874
14875  protected void parseImagingStudyProcedureComponentProperties(JsonObject json, ImagingStudy.ImagingStudyProcedureComponent res) throws IOException, FHIRFormatError {
14876    parseBackboneElementProperties(json, res);
14877    DataType value = parseType("value", json);
14878    if (value != null)
14879      res.setValue(value);
14880  }
14881
14882  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudySeriesComponent(JsonObject json) throws IOException, FHIRFormatError {
14883    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
14884    parseImagingStudySeriesComponentProperties(json, res);
14885    return res;
14886  }
14887
14888  protected void parseImagingStudySeriesComponentProperties(JsonObject json, ImagingStudy.ImagingStudySeriesComponent res) throws IOException, FHIRFormatError {
14889    parseBackboneElementProperties(json, res);
14890    if (json.has("uid"))
14891      res.setUidElement(parseId(json.get("uid").getAsString()));
14892    if (json.has("_uid"))
14893      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
14894    if (json.has("number"))
14895      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
14896    if (json.has("_number"))
14897      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
14898    if (json.has("modality"))
14899      res.setModality(parseCoding(json.getAsJsonObject("modality")));
14900    if (json.has("description"))
14901      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14902    if (json.has("_description"))
14903      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14904    if (json.has("numberOfInstances"))
14905      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
14906    if (json.has("_numberOfInstances"))
14907      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
14908    if (json.has("endpoint")) {
14909      JsonArray array = json.getAsJsonArray("endpoint");
14910      for (int i = 0; i < array.size(); i++) {
14911        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
14912      }
14913    };
14914    if (json.has("bodySite"))
14915      res.setBodySite(parseCoding(json.getAsJsonObject("bodySite")));
14916    if (json.has("laterality"))
14917      res.setLaterality(parseCoding(json.getAsJsonObject("laterality")));
14918    if (json.has("specimen")) {
14919      JsonArray array = json.getAsJsonArray("specimen");
14920      for (int i = 0; i < array.size(); i++) {
14921        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
14922      }
14923    };
14924    if (json.has("started"))
14925      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
14926    if (json.has("_started"))
14927      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
14928    if (json.has("performer")) {
14929      JsonArray array = json.getAsJsonArray("performer");
14930      for (int i = 0; i < array.size(); i++) {
14931        res.getPerformer().add(parseImagingStudySeriesPerformerComponent(array.get(i).getAsJsonObject()));
14932      }
14933    };
14934    if (json.has("instance")) {
14935      JsonArray array = json.getAsJsonArray("instance");
14936      for (int i = 0; i < array.size(); i++) {
14937        res.getInstance().add(parseImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject()));
14938      }
14939    };
14940  }
14941
14942  protected ImagingStudy.ImagingStudySeriesPerformerComponent parseImagingStudySeriesPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
14943    ImagingStudy.ImagingStudySeriesPerformerComponent res = new ImagingStudy.ImagingStudySeriesPerformerComponent();
14944    parseImagingStudySeriesPerformerComponentProperties(json, res);
14945    return res;
14946  }
14947
14948  protected void parseImagingStudySeriesPerformerComponentProperties(JsonObject json, ImagingStudy.ImagingStudySeriesPerformerComponent res) throws IOException, FHIRFormatError {
14949    parseBackboneElementProperties(json, res);
14950    if (json.has("function"))
14951      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
14952    if (json.has("actor"))
14953      res.setActor(parseReference(json.getAsJsonObject("actor")));
14954  }
14955
14956  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudySeriesInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
14957    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
14958    parseImagingStudySeriesInstanceComponentProperties(json, res);
14959    return res;
14960  }
14961
14962  protected void parseImagingStudySeriesInstanceComponentProperties(JsonObject json, ImagingStudy.ImagingStudySeriesInstanceComponent res) throws IOException, FHIRFormatError {
14963    parseBackboneElementProperties(json, res);
14964    if (json.has("uid"))
14965      res.setUidElement(parseId(json.get("uid").getAsString()));
14966    if (json.has("_uid"))
14967      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
14968    if (json.has("sopClass"))
14969      res.setSopClass(parseCoding(json.getAsJsonObject("sopClass")));
14970    if (json.has("number"))
14971      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
14972    if (json.has("_number"))
14973      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
14974    if (json.has("title"))
14975      res.setTitleElement(parseString(json.get("title").getAsString()));
14976    if (json.has("_title"))
14977      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14978  }
14979
14980  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
14981    Immunization res = new Immunization();
14982    parseImmunizationProperties(json, res);
14983    return res;
14984  }
14985
14986  protected void parseImmunizationProperties(JsonObject json, Immunization res) throws IOException, FHIRFormatError {
14987    parseDomainResourceProperties(json, res);
14988    if (json.has("identifier")) {
14989      JsonArray array = json.getAsJsonArray("identifier");
14990      for (int i = 0; i < array.size(); i++) {
14991        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14992      }
14993    };
14994    if (json.has("status"))
14995      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Immunization.ImmunizationStatusCodes.NULL, new Immunization.ImmunizationStatusCodesEnumFactory()));
14996    if (json.has("_status"))
14997      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14998    if (json.has("statusReason"))
14999      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
15000    if (json.has("vaccineCode"))
15001      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
15002    if (json.has("patient"))
15003      res.setPatient(parseReference(json.getAsJsonObject("patient")));
15004    if (json.has("encounter"))
15005      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
15006    DataType occurrence = parseType("occurrence", json);
15007    if (occurrence != null)
15008      res.setOccurrence(occurrence);
15009    if (json.has("recorded"))
15010      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
15011    if (json.has("_recorded"))
15012      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
15013    if (json.has("primarySource"))
15014      res.setPrimarySourceElement(parseBoolean(json.get("primarySource").getAsBoolean()));
15015    if (json.has("_primarySource"))
15016      parseElementProperties(json.getAsJsonObject("_primarySource"), res.getPrimarySourceElement());
15017    DataType informationSource = parseType("informationSource", json);
15018    if (informationSource != null)
15019      res.setInformationSource(informationSource);
15020    if (json.has("location"))
15021      res.setLocation(parseReference(json.getAsJsonObject("location")));
15022    if (json.has("manufacturer"))
15023      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
15024    if (json.has("lotNumber"))
15025      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
15026    if (json.has("_lotNumber"))
15027      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
15028    if (json.has("expirationDate"))
15029      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
15030    if (json.has("_expirationDate"))
15031      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
15032    if (json.has("site"))
15033      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
15034    if (json.has("route"))
15035      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
15036    if (json.has("doseQuantity"))
15037      res.setDoseQuantity(parseQuantity(json.getAsJsonObject("doseQuantity")));
15038    if (json.has("performer")) {
15039      JsonArray array = json.getAsJsonArray("performer");
15040      for (int i = 0; i < array.size(); i++) {
15041        res.getPerformer().add(parseImmunizationPerformerComponent(array.get(i).getAsJsonObject()));
15042      }
15043    };
15044    if (json.has("note")) {
15045      JsonArray array = json.getAsJsonArray("note");
15046      for (int i = 0; i < array.size(); i++) {
15047        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15048      }
15049    };
15050    if (json.has("reason")) {
15051      JsonArray array = json.getAsJsonArray("reason");
15052      for (int i = 0; i < array.size(); i++) {
15053        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
15054      }
15055    };
15056    if (json.has("isSubpotent"))
15057      res.setIsSubpotentElement(parseBoolean(json.get("isSubpotent").getAsBoolean()));
15058    if (json.has("_isSubpotent"))
15059      parseElementProperties(json.getAsJsonObject("_isSubpotent"), res.getIsSubpotentElement());
15060    if (json.has("subpotentReason")) {
15061      JsonArray array = json.getAsJsonArray("subpotentReason");
15062      for (int i = 0; i < array.size(); i++) {
15063        res.getSubpotentReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15064      }
15065    };
15066    if (json.has("education")) {
15067      JsonArray array = json.getAsJsonArray("education");
15068      for (int i = 0; i < array.size(); i++) {
15069        res.getEducation().add(parseImmunizationEducationComponent(array.get(i).getAsJsonObject()));
15070      }
15071    };
15072    if (json.has("programEligibility")) {
15073      JsonArray array = json.getAsJsonArray("programEligibility");
15074      for (int i = 0; i < array.size(); i++) {
15075        res.getProgramEligibility().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15076      }
15077    };
15078    if (json.has("fundingSource"))
15079      res.setFundingSource(parseCodeableConcept(json.getAsJsonObject("fundingSource")));
15080    if (json.has("reaction")) {
15081      JsonArray array = json.getAsJsonArray("reaction");
15082      for (int i = 0; i < array.size(); i++) {
15083        res.getReaction().add(parseImmunizationReactionComponent(array.get(i).getAsJsonObject()));
15084      }
15085    };
15086    if (json.has("protocolApplied")) {
15087      JsonArray array = json.getAsJsonArray("protocolApplied");
15088      for (int i = 0; i < array.size(); i++) {
15089        res.getProtocolApplied().add(parseImmunizationProtocolAppliedComponent(array.get(i).getAsJsonObject()));
15090      }
15091    };
15092  }
15093
15094  protected Immunization.ImmunizationPerformerComponent parseImmunizationPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
15095    Immunization.ImmunizationPerformerComponent res = new Immunization.ImmunizationPerformerComponent();
15096    parseImmunizationPerformerComponentProperties(json, res);
15097    return res;
15098  }
15099
15100  protected void parseImmunizationPerformerComponentProperties(JsonObject json, Immunization.ImmunizationPerformerComponent res) throws IOException, FHIRFormatError {
15101    parseBackboneElementProperties(json, res);
15102    if (json.has("function"))
15103      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
15104    if (json.has("actor"))
15105      res.setActor(parseReference(json.getAsJsonObject("actor")));
15106  }
15107
15108  protected Immunization.ImmunizationEducationComponent parseImmunizationEducationComponent(JsonObject json) throws IOException, FHIRFormatError {
15109    Immunization.ImmunizationEducationComponent res = new Immunization.ImmunizationEducationComponent();
15110    parseImmunizationEducationComponentProperties(json, res);
15111    return res;
15112  }
15113
15114  protected void parseImmunizationEducationComponentProperties(JsonObject json, Immunization.ImmunizationEducationComponent res) throws IOException, FHIRFormatError {
15115    parseBackboneElementProperties(json, res);
15116    if (json.has("documentType"))
15117      res.setDocumentTypeElement(parseString(json.get("documentType").getAsString()));
15118    if (json.has("_documentType"))
15119      parseElementProperties(json.getAsJsonObject("_documentType"), res.getDocumentTypeElement());
15120    if (json.has("reference"))
15121      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
15122    if (json.has("_reference"))
15123      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
15124    if (json.has("publicationDate"))
15125      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
15126    if (json.has("_publicationDate"))
15127      parseElementProperties(json.getAsJsonObject("_publicationDate"), res.getPublicationDateElement());
15128    if (json.has("presentationDate"))
15129      res.setPresentationDateElement(parseDateTime(json.get("presentationDate").getAsString()));
15130    if (json.has("_presentationDate"))
15131      parseElementProperties(json.getAsJsonObject("_presentationDate"), res.getPresentationDateElement());
15132  }
15133
15134  protected Immunization.ImmunizationReactionComponent parseImmunizationReactionComponent(JsonObject json) throws IOException, FHIRFormatError {
15135    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
15136    parseImmunizationReactionComponentProperties(json, res);
15137    return res;
15138  }
15139
15140  protected void parseImmunizationReactionComponentProperties(JsonObject json, Immunization.ImmunizationReactionComponent res) throws IOException, FHIRFormatError {
15141    parseBackboneElementProperties(json, res);
15142    if (json.has("date"))
15143      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15144    if (json.has("_date"))
15145      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15146    if (json.has("detail"))
15147      res.setDetail(parseReference(json.getAsJsonObject("detail")));
15148    if (json.has("reported"))
15149      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
15150    if (json.has("_reported"))
15151      parseElementProperties(json.getAsJsonObject("_reported"), res.getReportedElement());
15152  }
15153
15154  protected Immunization.ImmunizationProtocolAppliedComponent parseImmunizationProtocolAppliedComponent(JsonObject json) throws IOException, FHIRFormatError {
15155    Immunization.ImmunizationProtocolAppliedComponent res = new Immunization.ImmunizationProtocolAppliedComponent();
15156    parseImmunizationProtocolAppliedComponentProperties(json, res);
15157    return res;
15158  }
15159
15160  protected void parseImmunizationProtocolAppliedComponentProperties(JsonObject json, Immunization.ImmunizationProtocolAppliedComponent res) throws IOException, FHIRFormatError {
15161    parseBackboneElementProperties(json, res);
15162    if (json.has("series"))
15163      res.setSeriesElement(parseString(json.get("series").getAsString()));
15164    if (json.has("_series"))
15165      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
15166    if (json.has("authority"))
15167      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
15168    if (json.has("targetDisease")) {
15169      JsonArray array = json.getAsJsonArray("targetDisease");
15170      for (int i = 0; i < array.size(); i++) {
15171        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15172      }
15173    };
15174    DataType doseNumber = parseType("doseNumber", json);
15175    if (doseNumber != null)
15176      res.setDoseNumber(doseNumber);
15177    DataType seriesDoses = parseType("seriesDoses", json);
15178    if (seriesDoses != null)
15179      res.setSeriesDoses(seriesDoses);
15180  }
15181
15182  protected ImmunizationEvaluation parseImmunizationEvaluation(JsonObject json) throws IOException, FHIRFormatError {
15183    ImmunizationEvaluation res = new ImmunizationEvaluation();
15184    parseImmunizationEvaluationProperties(json, res);
15185    return res;
15186  }
15187
15188  protected void parseImmunizationEvaluationProperties(JsonObject json, ImmunizationEvaluation res) throws IOException, FHIRFormatError {
15189    parseDomainResourceProperties(json, res);
15190    if (json.has("identifier")) {
15191      JsonArray array = json.getAsJsonArray("identifier");
15192      for (int i = 0; i < array.size(); i++) {
15193        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15194      }
15195    };
15196    if (json.has("status"))
15197      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImmunizationEvaluation.ImmunizationEvaluationStatusCodes.NULL, new ImmunizationEvaluation.ImmunizationEvaluationStatusCodesEnumFactory()));
15198    if (json.has("_status"))
15199      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15200    if (json.has("patient"))
15201      res.setPatient(parseReference(json.getAsJsonObject("patient")));
15202    if (json.has("date"))
15203      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15204    if (json.has("_date"))
15205      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15206    if (json.has("authority"))
15207      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
15208    if (json.has("targetDisease"))
15209      res.setTargetDisease(parseCodeableConcept(json.getAsJsonObject("targetDisease")));
15210    if (json.has("immunizationEvent"))
15211      res.setImmunizationEvent(parseReference(json.getAsJsonObject("immunizationEvent")));
15212    if (json.has("doseStatus"))
15213      res.setDoseStatus(parseCodeableConcept(json.getAsJsonObject("doseStatus")));
15214    if (json.has("doseStatusReason")) {
15215      JsonArray array = json.getAsJsonArray("doseStatusReason");
15216      for (int i = 0; i < array.size(); i++) {
15217        res.getDoseStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15218      }
15219    };
15220    if (json.has("description"))
15221      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15222    if (json.has("_description"))
15223      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15224    if (json.has("series"))
15225      res.setSeriesElement(parseString(json.get("series").getAsString()));
15226    if (json.has("_series"))
15227      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
15228    DataType doseNumber = parseType("doseNumber", json);
15229    if (doseNumber != null)
15230      res.setDoseNumber(doseNumber);
15231    DataType seriesDoses = parseType("seriesDoses", json);
15232    if (seriesDoses != null)
15233      res.setSeriesDoses(seriesDoses);
15234  }
15235
15236  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
15237    ImmunizationRecommendation res = new ImmunizationRecommendation();
15238    parseImmunizationRecommendationProperties(json, res);
15239    return res;
15240  }
15241
15242  protected void parseImmunizationRecommendationProperties(JsonObject json, ImmunizationRecommendation res) throws IOException, FHIRFormatError {
15243    parseDomainResourceProperties(json, res);
15244    if (json.has("identifier")) {
15245      JsonArray array = json.getAsJsonArray("identifier");
15246      for (int i = 0; i < array.size(); i++) {
15247        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15248      }
15249    };
15250    if (json.has("patient"))
15251      res.setPatient(parseReference(json.getAsJsonObject("patient")));
15252    if (json.has("date"))
15253      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15254    if (json.has("_date"))
15255      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15256    if (json.has("authority"))
15257      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
15258    if (json.has("recommendation")) {
15259      JsonArray array = json.getAsJsonArray("recommendation");
15260      for (int i = 0; i < array.size(); i++) {
15261        res.getRecommendation().add(parseImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject()));
15262      }
15263    };
15264  }
15265
15266  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationRecommendationComponent(JsonObject json) throws IOException, FHIRFormatError {
15267    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
15268    parseImmunizationRecommendationRecommendationComponentProperties(json, res);
15269    return res;
15270  }
15271
15272  protected void parseImmunizationRecommendationRecommendationComponentProperties(JsonObject json, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res) throws IOException, FHIRFormatError {
15273    parseBackboneElementProperties(json, res);
15274    if (json.has("vaccineCode")) {
15275      JsonArray array = json.getAsJsonArray("vaccineCode");
15276      for (int i = 0; i < array.size(); i++) {
15277        res.getVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15278      }
15279    };
15280    if (json.has("targetDisease")) {
15281      JsonArray array = json.getAsJsonArray("targetDisease");
15282      for (int i = 0; i < array.size(); i++) {
15283        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15284      }
15285    };
15286    if (json.has("contraindicatedVaccineCode")) {
15287      JsonArray array = json.getAsJsonArray("contraindicatedVaccineCode");
15288      for (int i = 0; i < array.size(); i++) {
15289        res.getContraindicatedVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15290      }
15291    };
15292    if (json.has("forecastStatus"))
15293      res.setForecastStatus(parseCodeableConcept(json.getAsJsonObject("forecastStatus")));
15294    if (json.has("forecastReason")) {
15295      JsonArray array = json.getAsJsonArray("forecastReason");
15296      for (int i = 0; i < array.size(); i++) {
15297        res.getForecastReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15298      }
15299    };
15300    if (json.has("dateCriterion")) {
15301      JsonArray array = json.getAsJsonArray("dateCriterion");
15302      for (int i = 0; i < array.size(); i++) {
15303        res.getDateCriterion().add(parseImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject()));
15304      }
15305    };
15306    if (json.has("description"))
15307      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15308    if (json.has("_description"))
15309      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15310    if (json.has("series"))
15311      res.setSeriesElement(parseString(json.get("series").getAsString()));
15312    if (json.has("_series"))
15313      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
15314    DataType doseNumber = parseType("doseNumber", json);
15315    if (doseNumber != null)
15316      res.setDoseNumber(doseNumber);
15317    DataType seriesDoses = parseType("seriesDoses", json);
15318    if (seriesDoses != null)
15319      res.setSeriesDoses(seriesDoses);
15320    if (json.has("supportingImmunization")) {
15321      JsonArray array = json.getAsJsonArray("supportingImmunization");
15322      for (int i = 0; i < array.size(); i++) {
15323        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
15324      }
15325    };
15326    if (json.has("supportingPatientInformation")) {
15327      JsonArray array = json.getAsJsonArray("supportingPatientInformation");
15328      for (int i = 0; i < array.size(); i++) {
15329        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
15330      }
15331    };
15332  }
15333
15334  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json) throws IOException, FHIRFormatError {
15335    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
15336    parseImmunizationRecommendationRecommendationDateCriterionComponentProperties(json, res);
15337    return res;
15338  }
15339
15340  protected void parseImmunizationRecommendationRecommendationDateCriterionComponentProperties(JsonObject json, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res) throws IOException, FHIRFormatError {
15341    parseBackboneElementProperties(json, res);
15342    if (json.has("code"))
15343      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15344    if (json.has("value"))
15345      res.setValueElement(parseDateTime(json.get("value").getAsString()));
15346    if (json.has("_value"))
15347      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
15348  }
15349
15350  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
15351    ImplementationGuide res = new ImplementationGuide();
15352    parseImplementationGuideProperties(json, res);
15353    return res;
15354  }
15355
15356  protected void parseImplementationGuideProperties(JsonObject json, ImplementationGuide res) throws IOException, FHIRFormatError {
15357    parseCanonicalResourceProperties(json, res);
15358    if (json.has("url"))
15359      res.setUrlElement(parseUri(json.get("url").getAsString()));
15360    if (json.has("_url"))
15361      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
15362    if (json.has("version"))
15363      res.setVersionElement(parseString(json.get("version").getAsString()));
15364    if (json.has("_version"))
15365      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
15366    if (json.has("name"))
15367      res.setNameElement(parseString(json.get("name").getAsString()));
15368    if (json.has("_name"))
15369      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15370    if (json.has("title"))
15371      res.setTitleElement(parseString(json.get("title").getAsString()));
15372    if (json.has("_title"))
15373      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
15374    if (json.has("status"))
15375      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15376    if (json.has("_status"))
15377      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15378    if (json.has("experimental"))
15379      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
15380    if (json.has("_experimental"))
15381      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
15382    if (json.has("date"))
15383      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15384    if (json.has("_date"))
15385      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15386    if (json.has("publisher"))
15387      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15388    if (json.has("_publisher"))
15389      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
15390    if (json.has("contact")) {
15391      JsonArray array = json.getAsJsonArray("contact");
15392      for (int i = 0; i < array.size(); i++) {
15393        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
15394      }
15395    };
15396    if (json.has("description"))
15397      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15398    if (json.has("_description"))
15399      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15400    if (json.has("useContext")) {
15401      JsonArray array = json.getAsJsonArray("useContext");
15402      for (int i = 0; i < array.size(); i++) {
15403        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
15404      }
15405    };
15406    if (json.has("jurisdiction")) {
15407      JsonArray array = json.getAsJsonArray("jurisdiction");
15408      for (int i = 0; i < array.size(); i++) {
15409        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15410      }
15411    };
15412    if (json.has("copyright"))
15413      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
15414    if (json.has("_copyright"))
15415      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
15416    if (json.has("packageId"))
15417      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
15418    if (json.has("_packageId"))
15419      parseElementProperties(json.getAsJsonObject("_packageId"), res.getPackageIdElement());
15420    if (json.has("license"))
15421      res.setLicenseElement(parseEnumeration(json.get("license").getAsString(), ImplementationGuide.SPDXLicense.NULL, new ImplementationGuide.SPDXLicenseEnumFactory()));
15422    if (json.has("_license"))
15423      parseElementProperties(json.getAsJsonObject("_license"), res.getLicenseElement());
15424    if (json.has("fhirVersion")) {
15425      JsonArray array = json.getAsJsonArray("fhirVersion");
15426      for (int i = 0; i < array.size(); i++) {
15427        if (array.get(i).isJsonNull()) {
15428          res.getFhirVersion().add(new Enumeration<Enumerations.FHIRVersion>(new Enumerations.FHIRVersionEnumFactory(), Enumerations.FHIRVersion.NULL));
15429        } else {;
15430          res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
15431        }
15432      }
15433    };
15434    if (json.has("_fhirVersion")) {
15435      JsonArray array = json.getAsJsonArray("_fhirVersion");
15436      for (int i = 0; i < array.size(); i++) {
15437        if (i == res.getFhirVersion().size())
15438          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
15439        if (array.get(i) instanceof JsonObject) 
15440          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
15441      }
15442    };
15443    if (json.has("dependsOn")) {
15444      JsonArray array = json.getAsJsonArray("dependsOn");
15445      for (int i = 0; i < array.size(); i++) {
15446        res.getDependsOn().add(parseImplementationGuideDependsOnComponent(array.get(i).getAsJsonObject()));
15447      }
15448    };
15449    if (json.has("global")) {
15450      JsonArray array = json.getAsJsonArray("global");
15451      for (int i = 0; i < array.size(); i++) {
15452        res.getGlobal().add(parseImplementationGuideGlobalComponent(array.get(i).getAsJsonObject()));
15453      }
15454    };
15455    if (json.has("definition"))
15456      res.setDefinition(parseImplementationGuideDefinitionComponent(json.getAsJsonObject("definition")));
15457    if (json.has("manifest"))
15458      res.setManifest(parseImplementationGuideManifestComponent(json.getAsJsonObject("manifest")));
15459  }
15460
15461  protected ImplementationGuide.ImplementationGuideDependsOnComponent parseImplementationGuideDependsOnComponent(JsonObject json) throws IOException, FHIRFormatError {
15462    ImplementationGuide.ImplementationGuideDependsOnComponent res = new ImplementationGuide.ImplementationGuideDependsOnComponent();
15463    parseImplementationGuideDependsOnComponentProperties(json, res);
15464    return res;
15465  }
15466
15467  protected void parseImplementationGuideDependsOnComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDependsOnComponent res) throws IOException, FHIRFormatError {
15468    parseBackboneElementProperties(json, res);
15469    if (json.has("uri"))
15470      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
15471    if (json.has("_uri"))
15472      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
15473    if (json.has("packageId"))
15474      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
15475    if (json.has("_packageId"))
15476      parseElementProperties(json.getAsJsonObject("_packageId"), res.getPackageIdElement());
15477    if (json.has("version"))
15478      res.setVersionElement(parseString(json.get("version").getAsString()));
15479    if (json.has("_version"))
15480      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
15481  }
15482
15483  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideGlobalComponent(JsonObject json) throws IOException, FHIRFormatError {
15484    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
15485    parseImplementationGuideGlobalComponentProperties(json, res);
15486    return res;
15487  }
15488
15489  protected void parseImplementationGuideGlobalComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideGlobalComponent res) throws IOException, FHIRFormatError {
15490    parseBackboneElementProperties(json, res);
15491    if (json.has("type"))
15492      res.setTypeElement(parseCode(json.get("type").getAsString()));
15493    if (json.has("_type"))
15494      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
15495    if (json.has("profile"))
15496      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
15497    if (json.has("_profile"))
15498      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
15499  }
15500
15501  protected ImplementationGuide.ImplementationGuideDefinitionComponent parseImplementationGuideDefinitionComponent(JsonObject json) throws IOException, FHIRFormatError {
15502    ImplementationGuide.ImplementationGuideDefinitionComponent res = new ImplementationGuide.ImplementationGuideDefinitionComponent();
15503    parseImplementationGuideDefinitionComponentProperties(json, res);
15504    return res;
15505  }
15506
15507  protected void parseImplementationGuideDefinitionComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionComponent res) throws IOException, FHIRFormatError {
15508    parseBackboneElementProperties(json, res);
15509    if (json.has("grouping")) {
15510      JsonArray array = json.getAsJsonArray("grouping");
15511      for (int i = 0; i < array.size(); i++) {
15512        res.getGrouping().add(parseImplementationGuideDefinitionGroupingComponent(array.get(i).getAsJsonObject()));
15513      }
15514    };
15515    if (json.has("resource")) {
15516      JsonArray array = json.getAsJsonArray("resource");
15517      for (int i = 0; i < array.size(); i++) {
15518        res.getResource().add(parseImplementationGuideDefinitionResourceComponent(array.get(i).getAsJsonObject()));
15519      }
15520    };
15521    if (json.has("page"))
15522      res.setPage(parseImplementationGuideDefinitionPageComponent(json.getAsJsonObject("page")));
15523    if (json.has("parameter")) {
15524      JsonArray array = json.getAsJsonArray("parameter");
15525      for (int i = 0; i < array.size(); i++) {
15526        res.getParameter().add(parseImplementationGuideDefinitionParameterComponent(array.get(i).getAsJsonObject()));
15527      }
15528    };
15529    if (json.has("template")) {
15530      JsonArray array = json.getAsJsonArray("template");
15531      for (int i = 0; i < array.size(); i++) {
15532        res.getTemplate().add(parseImplementationGuideDefinitionTemplateComponent(array.get(i).getAsJsonObject()));
15533      }
15534    };
15535  }
15536
15537  protected ImplementationGuide.ImplementationGuideDefinitionGroupingComponent parseImplementationGuideDefinitionGroupingComponent(JsonObject json) throws IOException, FHIRFormatError {
15538    ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res = new ImplementationGuide.ImplementationGuideDefinitionGroupingComponent();
15539    parseImplementationGuideDefinitionGroupingComponentProperties(json, res);
15540    return res;
15541  }
15542
15543  protected void parseImplementationGuideDefinitionGroupingComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res) throws IOException, FHIRFormatError {
15544    parseBackboneElementProperties(json, res);
15545    if (json.has("name"))
15546      res.setNameElement(parseString(json.get("name").getAsString()));
15547    if (json.has("_name"))
15548      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15549    if (json.has("description"))
15550      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15551    if (json.has("_description"))
15552      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15553  }
15554
15555  protected ImplementationGuide.ImplementationGuideDefinitionResourceComponent parseImplementationGuideDefinitionResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
15556    ImplementationGuide.ImplementationGuideDefinitionResourceComponent res = new ImplementationGuide.ImplementationGuideDefinitionResourceComponent();
15557    parseImplementationGuideDefinitionResourceComponentProperties(json, res);
15558    return res;
15559  }
15560
15561  protected void parseImplementationGuideDefinitionResourceComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionResourceComponent res) throws IOException, FHIRFormatError {
15562    parseBackboneElementProperties(json, res);
15563    if (json.has("reference"))
15564      res.setReference(parseReference(json.getAsJsonObject("reference")));
15565    if (json.has("fhirVersion")) {
15566      JsonArray array = json.getAsJsonArray("fhirVersion");
15567      for (int i = 0; i < array.size(); i++) {
15568        if (array.get(i).isJsonNull()) {
15569          res.getFhirVersion().add(new Enumeration<Enumerations.FHIRVersion>(new Enumerations.FHIRVersionEnumFactory(), Enumerations.FHIRVersion.NULL));
15570        } else {;
15571          res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
15572        }
15573      }
15574    };
15575    if (json.has("_fhirVersion")) {
15576      JsonArray array = json.getAsJsonArray("_fhirVersion");
15577      for (int i = 0; i < array.size(); i++) {
15578        if (i == res.getFhirVersion().size())
15579          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
15580        if (array.get(i) instanceof JsonObject) 
15581          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
15582      }
15583    };
15584    if (json.has("name"))
15585      res.setNameElement(parseString(json.get("name").getAsString()));
15586    if (json.has("_name"))
15587      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15588    if (json.has("description"))
15589      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15590    if (json.has("_description"))
15591      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15592    DataType example = parseType("example", json);
15593    if (example != null)
15594      res.setExample(example);
15595    if (json.has("groupingId"))
15596      res.setGroupingIdElement(parseId(json.get("groupingId").getAsString()));
15597    if (json.has("_groupingId"))
15598      parseElementProperties(json.getAsJsonObject("_groupingId"), res.getGroupingIdElement());
15599  }
15600
15601  protected ImplementationGuide.ImplementationGuideDefinitionPageComponent parseImplementationGuideDefinitionPageComponent(JsonObject json) throws IOException, FHIRFormatError {
15602    ImplementationGuide.ImplementationGuideDefinitionPageComponent res = new ImplementationGuide.ImplementationGuideDefinitionPageComponent();
15603    parseImplementationGuideDefinitionPageComponentProperties(json, res);
15604    return res;
15605  }
15606
15607  protected void parseImplementationGuideDefinitionPageComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionPageComponent res) throws IOException, FHIRFormatError {
15608    parseBackboneElementProperties(json, res);
15609    DataType name = parseType("name", json);
15610    if (name != null)
15611      res.setName(name);
15612    if (json.has("title"))
15613      res.setTitleElement(parseString(json.get("title").getAsString()));
15614    if (json.has("_title"))
15615      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
15616    if (json.has("generation"))
15617      res.setGenerationElement(parseEnumeration(json.get("generation").getAsString(), ImplementationGuide.GuidePageGeneration.NULL, new ImplementationGuide.GuidePageGenerationEnumFactory()));
15618    if (json.has("_generation"))
15619      parseElementProperties(json.getAsJsonObject("_generation"), res.getGenerationElement());
15620    if (json.has("page")) {
15621      JsonArray array = json.getAsJsonArray("page");
15622      for (int i = 0; i < array.size(); i++) {
15623        res.getPage().add(parseImplementationGuideDefinitionPageComponent(array.get(i).getAsJsonObject()));
15624      }
15625    };
15626  }
15627
15628  protected ImplementationGuide.ImplementationGuideDefinitionParameterComponent parseImplementationGuideDefinitionParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
15629    ImplementationGuide.ImplementationGuideDefinitionParameterComponent res = new ImplementationGuide.ImplementationGuideDefinitionParameterComponent();
15630    parseImplementationGuideDefinitionParameterComponentProperties(json, res);
15631    return res;
15632  }
15633
15634  protected void parseImplementationGuideDefinitionParameterComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws IOException, FHIRFormatError {
15635    parseBackboneElementProperties(json, res);
15636    if (json.has("code"))
15637      res.setCodeElement(parseString(json.get("code").getAsString()));
15638    if (json.has("_code"))
15639      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
15640    if (json.has("value"))
15641      res.setValueElement(parseString(json.get("value").getAsString()));
15642    if (json.has("_value"))
15643      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
15644  }
15645
15646  protected ImplementationGuide.ImplementationGuideDefinitionTemplateComponent parseImplementationGuideDefinitionTemplateComponent(JsonObject json) throws IOException, FHIRFormatError {
15647    ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res = new ImplementationGuide.ImplementationGuideDefinitionTemplateComponent();
15648    parseImplementationGuideDefinitionTemplateComponentProperties(json, res);
15649    return res;
15650  }
15651
15652  protected void parseImplementationGuideDefinitionTemplateComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res) throws IOException, FHIRFormatError {
15653    parseBackboneElementProperties(json, res);
15654    if (json.has("code"))
15655      res.setCodeElement(parseCode(json.get("code").getAsString()));
15656    if (json.has("_code"))
15657      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
15658    if (json.has("source"))
15659      res.setSourceElement(parseString(json.get("source").getAsString()));
15660    if (json.has("_source"))
15661      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
15662    if (json.has("scope"))
15663      res.setScopeElement(parseString(json.get("scope").getAsString()));
15664    if (json.has("_scope"))
15665      parseElementProperties(json.getAsJsonObject("_scope"), res.getScopeElement());
15666  }
15667
15668  protected ImplementationGuide.ImplementationGuideManifestComponent parseImplementationGuideManifestComponent(JsonObject json) throws IOException, FHIRFormatError {
15669    ImplementationGuide.ImplementationGuideManifestComponent res = new ImplementationGuide.ImplementationGuideManifestComponent();
15670    parseImplementationGuideManifestComponentProperties(json, res);
15671    return res;
15672  }
15673
15674  protected void parseImplementationGuideManifestComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideManifestComponent res) throws IOException, FHIRFormatError {
15675    parseBackboneElementProperties(json, res);
15676    if (json.has("rendering"))
15677      res.setRenderingElement(parseUrl(json.get("rendering").getAsString()));
15678    if (json.has("_rendering"))
15679      parseElementProperties(json.getAsJsonObject("_rendering"), res.getRenderingElement());
15680    if (json.has("resource")) {
15681      JsonArray array = json.getAsJsonArray("resource");
15682      for (int i = 0; i < array.size(); i++) {
15683        res.getResource().add(parseImplementationGuideManifestResourceComponent(array.get(i).getAsJsonObject()));
15684      }
15685    };
15686    if (json.has("page")) {
15687      JsonArray array = json.getAsJsonArray("page");
15688      for (int i = 0; i < array.size(); i++) {
15689        res.getPage().add(parseImplementationGuideManifestPageComponent(array.get(i).getAsJsonObject()));
15690      }
15691    };
15692    if (json.has("image")) {
15693      JsonArray array = json.getAsJsonArray("image");
15694      for (int i = 0; i < array.size(); i++) {
15695        if (array.get(i).isJsonNull()) {
15696          res.getImage().add(new StringType());
15697        } else {;
15698          res.getImage().add(parseString(array.get(i).getAsString()));
15699        }
15700      }
15701    };
15702    if (json.has("_image")) {
15703      JsonArray array = json.getAsJsonArray("_image");
15704      for (int i = 0; i < array.size(); i++) {
15705        if (i == res.getImage().size())
15706          res.getImage().add(parseString(null));
15707        if (array.get(i) instanceof JsonObject) 
15708          parseElementProperties(array.get(i).getAsJsonObject(), res.getImage().get(i));
15709      }
15710    };
15711    if (json.has("other")) {
15712      JsonArray array = json.getAsJsonArray("other");
15713      for (int i = 0; i < array.size(); i++) {
15714        if (array.get(i).isJsonNull()) {
15715          res.getOther().add(new StringType());
15716        } else {;
15717          res.getOther().add(parseString(array.get(i).getAsString()));
15718        }
15719      }
15720    };
15721    if (json.has("_other")) {
15722      JsonArray array = json.getAsJsonArray("_other");
15723      for (int i = 0; i < array.size(); i++) {
15724        if (i == res.getOther().size())
15725          res.getOther().add(parseString(null));
15726        if (array.get(i) instanceof JsonObject) 
15727          parseElementProperties(array.get(i).getAsJsonObject(), res.getOther().get(i));
15728      }
15729    };
15730  }
15731
15732  protected ImplementationGuide.ManifestResourceComponent parseImplementationGuideManifestResourceComponent(JsonObject json) throws IOException, FHIRFormatError {
15733    ImplementationGuide.ManifestResourceComponent res = new ImplementationGuide.ManifestResourceComponent();
15734    parseImplementationGuideManifestResourceComponentProperties(json, res);
15735    return res;
15736  }
15737
15738  protected void parseImplementationGuideManifestResourceComponentProperties(JsonObject json, ImplementationGuide.ManifestResourceComponent res) throws IOException, FHIRFormatError {
15739    parseBackboneElementProperties(json, res);
15740    if (json.has("reference"))
15741      res.setReference(parseReference(json.getAsJsonObject("reference")));
15742    DataType example = parseType("example", json);
15743    if (example != null)
15744      res.setExample(example);
15745    if (json.has("relativePath"))
15746      res.setRelativePathElement(parseUrl(json.get("relativePath").getAsString()));
15747    if (json.has("_relativePath"))
15748      parseElementProperties(json.getAsJsonObject("_relativePath"), res.getRelativePathElement());
15749  }
15750
15751  protected ImplementationGuide.ManifestPageComponent parseImplementationGuideManifestPageComponent(JsonObject json) throws IOException, FHIRFormatError {
15752    ImplementationGuide.ManifestPageComponent res = new ImplementationGuide.ManifestPageComponent();
15753    parseImplementationGuideManifestPageComponentProperties(json, res);
15754    return res;
15755  }
15756
15757  protected void parseImplementationGuideManifestPageComponentProperties(JsonObject json, ImplementationGuide.ManifestPageComponent res) throws IOException, FHIRFormatError {
15758    parseBackboneElementProperties(json, res);
15759    if (json.has("name"))
15760      res.setNameElement(parseString(json.get("name").getAsString()));
15761    if (json.has("_name"))
15762      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15763    if (json.has("title"))
15764      res.setTitleElement(parseString(json.get("title").getAsString()));
15765    if (json.has("_title"))
15766      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
15767    if (json.has("anchor")) {
15768      JsonArray array = json.getAsJsonArray("anchor");
15769      for (int i = 0; i < array.size(); i++) {
15770        if (array.get(i).isJsonNull()) {
15771          res.getAnchor().add(new StringType());
15772        } else {;
15773          res.getAnchor().add(parseString(array.get(i).getAsString()));
15774        }
15775      }
15776    };
15777    if (json.has("_anchor")) {
15778      JsonArray array = json.getAsJsonArray("_anchor");
15779      for (int i = 0; i < array.size(); i++) {
15780        if (i == res.getAnchor().size())
15781          res.getAnchor().add(parseString(null));
15782        if (array.get(i) instanceof JsonObject) 
15783          parseElementProperties(array.get(i).getAsJsonObject(), res.getAnchor().get(i));
15784      }
15785    };
15786  }
15787
15788  protected Ingredient parseIngredient(JsonObject json) throws IOException, FHIRFormatError {
15789    Ingredient res = new Ingredient();
15790    parseIngredientProperties(json, res);
15791    return res;
15792  }
15793
15794  protected void parseIngredientProperties(JsonObject json, Ingredient res) throws IOException, FHIRFormatError {
15795    parseDomainResourceProperties(json, res);
15796    if (json.has("identifier"))
15797      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
15798    if (json.has("role"))
15799      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
15800    if (json.has("allergenicIndicator"))
15801      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
15802    if (json.has("_allergenicIndicator"))
15803      parseElementProperties(json.getAsJsonObject("_allergenicIndicator"), res.getAllergenicIndicatorElement());
15804    if (json.has("manufacturer")) {
15805      JsonArray array = json.getAsJsonArray("manufacturer");
15806      for (int i = 0; i < array.size(); i++) {
15807        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
15808      }
15809    };
15810    if (json.has("specifiedSubstance")) {
15811      JsonArray array = json.getAsJsonArray("specifiedSubstance");
15812      for (int i = 0; i < array.size(); i++) {
15813        res.getSpecifiedSubstance().add(parseIngredientSpecifiedSubstanceComponent(array.get(i).getAsJsonObject()));
15814      }
15815    };
15816    if (json.has("substance"))
15817      res.setSubstance(parseIngredientSubstanceComponent(json.getAsJsonObject("substance")));
15818  }
15819
15820  protected Ingredient.IngredientSpecifiedSubstanceComponent parseIngredientSpecifiedSubstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
15821    Ingredient.IngredientSpecifiedSubstanceComponent res = new Ingredient.IngredientSpecifiedSubstanceComponent();
15822    parseIngredientSpecifiedSubstanceComponentProperties(json, res);
15823    return res;
15824  }
15825
15826  protected void parseIngredientSpecifiedSubstanceComponentProperties(JsonObject json, Ingredient.IngredientSpecifiedSubstanceComponent res) throws IOException, FHIRFormatError {
15827    parseBackboneElementProperties(json, res);
15828    DataType code = parseType("code", json);
15829    if (code != null)
15830      res.setCode(code);
15831    if (json.has("group"))
15832      res.setGroup(parseCodeableConcept(json.getAsJsonObject("group")));
15833    if (json.has("confidentiality"))
15834      res.setConfidentiality(parseCodeableConcept(json.getAsJsonObject("confidentiality")));
15835    if (json.has("strength")) {
15836      JsonArray array = json.getAsJsonArray("strength");
15837      for (int i = 0; i < array.size(); i++) {
15838        res.getStrength().add(parseIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject()));
15839      }
15840    };
15841  }
15842
15843  protected Ingredient.IngredientSpecifiedSubstanceStrengthComponent parseIngredientSpecifiedSubstanceStrengthComponent(JsonObject json) throws IOException, FHIRFormatError {
15844    Ingredient.IngredientSpecifiedSubstanceStrengthComponent res = new Ingredient.IngredientSpecifiedSubstanceStrengthComponent();
15845    parseIngredientSpecifiedSubstanceStrengthComponentProperties(json, res);
15846    return res;
15847  }
15848
15849  protected void parseIngredientSpecifiedSubstanceStrengthComponentProperties(JsonObject json, Ingredient.IngredientSpecifiedSubstanceStrengthComponent res) throws IOException, FHIRFormatError {
15850    parseBackboneElementProperties(json, res);
15851    if (json.has("presentation"))
15852      res.setPresentation(parseRatio(json.getAsJsonObject("presentation")));
15853    if (json.has("presentationHighLimit"))
15854      res.setPresentationHighLimit(parseRatio(json.getAsJsonObject("presentationHighLimit")));
15855    if (json.has("concentration"))
15856      res.setConcentration(parseRatio(json.getAsJsonObject("concentration")));
15857    if (json.has("concentrationHighLimit"))
15858      res.setConcentrationHighLimit(parseRatio(json.getAsJsonObject("concentrationHighLimit")));
15859    if (json.has("measurementPoint"))
15860      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
15861    if (json.has("_measurementPoint"))
15862      parseElementProperties(json.getAsJsonObject("_measurementPoint"), res.getMeasurementPointElement());
15863    if (json.has("country")) {
15864      JsonArray array = json.getAsJsonArray("country");
15865      for (int i = 0; i < array.size(); i++) {
15866        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15867      }
15868    };
15869    if (json.has("referenceStrength")) {
15870      JsonArray array = json.getAsJsonArray("referenceStrength");
15871      for (int i = 0; i < array.size(); i++) {
15872        res.getReferenceStrength().add(parseIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(array.get(i).getAsJsonObject()));
15873      }
15874    };
15875  }
15876
15877  protected Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent parseIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(JsonObject json) throws IOException, FHIRFormatError {
15878    Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res = new Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent();
15879    parseIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(json, res);
15880    return res;
15881  }
15882
15883  protected void parseIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(JsonObject json, Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res) throws IOException, FHIRFormatError {
15884    parseBackboneElementProperties(json, res);
15885    DataType substance = parseType("substance", json);
15886    if (substance != null)
15887      res.setSubstance(substance);
15888    if (json.has("strength"))
15889      res.setStrength(parseRatio(json.getAsJsonObject("strength")));
15890    if (json.has("strengthHighLimit"))
15891      res.setStrengthHighLimit(parseRatio(json.getAsJsonObject("strengthHighLimit")));
15892    if (json.has("measurementPoint"))
15893      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
15894    if (json.has("_measurementPoint"))
15895      parseElementProperties(json.getAsJsonObject("_measurementPoint"), res.getMeasurementPointElement());
15896    if (json.has("country")) {
15897      JsonArray array = json.getAsJsonArray("country");
15898      for (int i = 0; i < array.size(); i++) {
15899        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15900      }
15901    };
15902  }
15903
15904  protected Ingredient.IngredientSubstanceComponent parseIngredientSubstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
15905    Ingredient.IngredientSubstanceComponent res = new Ingredient.IngredientSubstanceComponent();
15906    parseIngredientSubstanceComponentProperties(json, res);
15907    return res;
15908  }
15909
15910  protected void parseIngredientSubstanceComponentProperties(JsonObject json, Ingredient.IngredientSubstanceComponent res) throws IOException, FHIRFormatError {
15911    parseBackboneElementProperties(json, res);
15912    DataType code = parseType("code", json);
15913    if (code != null)
15914      res.setCode(code);
15915    if (json.has("strength")) {
15916      JsonArray array = json.getAsJsonArray("strength");
15917      for (int i = 0; i < array.size(); i++) {
15918        res.getStrength().add(parseIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject()));
15919      }
15920    };
15921  }
15922
15923  protected InsurancePlan parseInsurancePlan(JsonObject json) throws IOException, FHIRFormatError {
15924    InsurancePlan res = new InsurancePlan();
15925    parseInsurancePlanProperties(json, res);
15926    return res;
15927  }
15928
15929  protected void parseInsurancePlanProperties(JsonObject json, InsurancePlan res) throws IOException, FHIRFormatError {
15930    parseDomainResourceProperties(json, res);
15931    if (json.has("identifier")) {
15932      JsonArray array = json.getAsJsonArray("identifier");
15933      for (int i = 0; i < array.size(); i++) {
15934        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15935      }
15936    };
15937    if (json.has("status"))
15938      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15939    if (json.has("_status"))
15940      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15941    if (json.has("type")) {
15942      JsonArray array = json.getAsJsonArray("type");
15943      for (int i = 0; i < array.size(); i++) {
15944        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15945      }
15946    };
15947    if (json.has("name"))
15948      res.setNameElement(parseString(json.get("name").getAsString()));
15949    if (json.has("_name"))
15950      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15951    if (json.has("alias")) {
15952      JsonArray array = json.getAsJsonArray("alias");
15953      for (int i = 0; i < array.size(); i++) {
15954        if (array.get(i).isJsonNull()) {
15955          res.getAlias().add(new StringType());
15956        } else {;
15957          res.getAlias().add(parseString(array.get(i).getAsString()));
15958        }
15959      }
15960    };
15961    if (json.has("_alias")) {
15962      JsonArray array = json.getAsJsonArray("_alias");
15963      for (int i = 0; i < array.size(); i++) {
15964        if (i == res.getAlias().size())
15965          res.getAlias().add(parseString(null));
15966        if (array.get(i) instanceof JsonObject) 
15967          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
15968      }
15969    };
15970    if (json.has("period"))
15971      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
15972    if (json.has("ownedBy"))
15973      res.setOwnedBy(parseReference(json.getAsJsonObject("ownedBy")));
15974    if (json.has("administeredBy"))
15975      res.setAdministeredBy(parseReference(json.getAsJsonObject("administeredBy")));
15976    if (json.has("coverageArea")) {
15977      JsonArray array = json.getAsJsonArray("coverageArea");
15978      for (int i = 0; i < array.size(); i++) {
15979        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
15980      }
15981    };
15982    if (json.has("contact")) {
15983      JsonArray array = json.getAsJsonArray("contact");
15984      for (int i = 0; i < array.size(); i++) {
15985        res.getContact().add(parseInsurancePlanContactComponent(array.get(i).getAsJsonObject()));
15986      }
15987    };
15988    if (json.has("endpoint")) {
15989      JsonArray array = json.getAsJsonArray("endpoint");
15990      for (int i = 0; i < array.size(); i++) {
15991        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
15992      }
15993    };
15994    if (json.has("network")) {
15995      JsonArray array = json.getAsJsonArray("network");
15996      for (int i = 0; i < array.size(); i++) {
15997        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
15998      }
15999    };
16000    if (json.has("coverage")) {
16001      JsonArray array = json.getAsJsonArray("coverage");
16002      for (int i = 0; i < array.size(); i++) {
16003        res.getCoverage().add(parseInsurancePlanCoverageComponent(array.get(i).getAsJsonObject()));
16004      }
16005    };
16006    if (json.has("plan")) {
16007      JsonArray array = json.getAsJsonArray("plan");
16008      for (int i = 0; i < array.size(); i++) {
16009        res.getPlan().add(parseInsurancePlanPlanComponent(array.get(i).getAsJsonObject()));
16010      }
16011    };
16012  }
16013
16014  protected InsurancePlan.InsurancePlanContactComponent parseInsurancePlanContactComponent(JsonObject json) throws IOException, FHIRFormatError {
16015    InsurancePlan.InsurancePlanContactComponent res = new InsurancePlan.InsurancePlanContactComponent();
16016    parseInsurancePlanContactComponentProperties(json, res);
16017    return res;
16018  }
16019
16020  protected void parseInsurancePlanContactComponentProperties(JsonObject json, InsurancePlan.InsurancePlanContactComponent res) throws IOException, FHIRFormatError {
16021    parseBackboneElementProperties(json, res);
16022    if (json.has("purpose"))
16023      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
16024    if (json.has("name"))
16025      res.setName(parseHumanName(json.getAsJsonObject("name")));
16026    if (json.has("telecom")) {
16027      JsonArray array = json.getAsJsonArray("telecom");
16028      for (int i = 0; i < array.size(); i++) {
16029        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
16030      }
16031    };
16032    if (json.has("address"))
16033      res.setAddress(parseAddress(json.getAsJsonObject("address")));
16034  }
16035
16036  protected InsurancePlan.InsurancePlanCoverageComponent parseInsurancePlanCoverageComponent(JsonObject json) throws IOException, FHIRFormatError {
16037    InsurancePlan.InsurancePlanCoverageComponent res = new InsurancePlan.InsurancePlanCoverageComponent();
16038    parseInsurancePlanCoverageComponentProperties(json, res);
16039    return res;
16040  }
16041
16042  protected void parseInsurancePlanCoverageComponentProperties(JsonObject json, InsurancePlan.InsurancePlanCoverageComponent res) throws IOException, FHIRFormatError {
16043    parseBackboneElementProperties(json, res);
16044    if (json.has("type"))
16045      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16046    if (json.has("network")) {
16047      JsonArray array = json.getAsJsonArray("network");
16048      for (int i = 0; i < array.size(); i++) {
16049        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
16050      }
16051    };
16052    if (json.has("benefit")) {
16053      JsonArray array = json.getAsJsonArray("benefit");
16054      for (int i = 0; i < array.size(); i++) {
16055        res.getBenefit().add(parseInsurancePlanCoverageBenefitComponent(array.get(i).getAsJsonObject()));
16056      }
16057    };
16058  }
16059
16060  protected InsurancePlan.CoverageBenefitComponent parseInsurancePlanCoverageBenefitComponent(JsonObject json) throws IOException, FHIRFormatError {
16061    InsurancePlan.CoverageBenefitComponent res = new InsurancePlan.CoverageBenefitComponent();
16062    parseInsurancePlanCoverageBenefitComponentProperties(json, res);
16063    return res;
16064  }
16065
16066  protected void parseInsurancePlanCoverageBenefitComponentProperties(JsonObject json, InsurancePlan.CoverageBenefitComponent res) throws IOException, FHIRFormatError {
16067    parseBackboneElementProperties(json, res);
16068    if (json.has("type"))
16069      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16070    if (json.has("requirement"))
16071      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
16072    if (json.has("_requirement"))
16073      parseElementProperties(json.getAsJsonObject("_requirement"), res.getRequirementElement());
16074    if (json.has("limit")) {
16075      JsonArray array = json.getAsJsonArray("limit");
16076      for (int i = 0; i < array.size(); i++) {
16077        res.getLimit().add(parseInsurancePlanCoverageBenefitLimitComponent(array.get(i).getAsJsonObject()));
16078      }
16079    };
16080  }
16081
16082  protected InsurancePlan.CoverageBenefitLimitComponent parseInsurancePlanCoverageBenefitLimitComponent(JsonObject json) throws IOException, FHIRFormatError {
16083    InsurancePlan.CoverageBenefitLimitComponent res = new InsurancePlan.CoverageBenefitLimitComponent();
16084    parseInsurancePlanCoverageBenefitLimitComponentProperties(json, res);
16085    return res;
16086  }
16087
16088  protected void parseInsurancePlanCoverageBenefitLimitComponentProperties(JsonObject json, InsurancePlan.CoverageBenefitLimitComponent res) throws IOException, FHIRFormatError {
16089    parseBackboneElementProperties(json, res);
16090    if (json.has("value"))
16091      res.setValue(parseQuantity(json.getAsJsonObject("value")));
16092    if (json.has("code"))
16093      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16094  }
16095
16096  protected InsurancePlan.InsurancePlanPlanComponent parseInsurancePlanPlanComponent(JsonObject json) throws IOException, FHIRFormatError {
16097    InsurancePlan.InsurancePlanPlanComponent res = new InsurancePlan.InsurancePlanPlanComponent();
16098    parseInsurancePlanPlanComponentProperties(json, res);
16099    return res;
16100  }
16101
16102  protected void parseInsurancePlanPlanComponentProperties(JsonObject json, InsurancePlan.InsurancePlanPlanComponent res) throws IOException, FHIRFormatError {
16103    parseBackboneElementProperties(json, res);
16104    if (json.has("identifier")) {
16105      JsonArray array = json.getAsJsonArray("identifier");
16106      for (int i = 0; i < array.size(); i++) {
16107        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16108      }
16109    };
16110    if (json.has("type"))
16111      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16112    if (json.has("coverageArea")) {
16113      JsonArray array = json.getAsJsonArray("coverageArea");
16114      for (int i = 0; i < array.size(); i++) {
16115        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
16116      }
16117    };
16118    if (json.has("network")) {
16119      JsonArray array = json.getAsJsonArray("network");
16120      for (int i = 0; i < array.size(); i++) {
16121        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
16122      }
16123    };
16124    if (json.has("generalCost")) {
16125      JsonArray array = json.getAsJsonArray("generalCost");
16126      for (int i = 0; i < array.size(); i++) {
16127        res.getGeneralCost().add(parseInsurancePlanPlanGeneralCostComponent(array.get(i).getAsJsonObject()));
16128      }
16129    };
16130    if (json.has("specificCost")) {
16131      JsonArray array = json.getAsJsonArray("specificCost");
16132      for (int i = 0; i < array.size(); i++) {
16133        res.getSpecificCost().add(parseInsurancePlanPlanSpecificCostComponent(array.get(i).getAsJsonObject()));
16134      }
16135    };
16136  }
16137
16138  protected InsurancePlan.InsurancePlanPlanGeneralCostComponent parseInsurancePlanPlanGeneralCostComponent(JsonObject json) throws IOException, FHIRFormatError {
16139    InsurancePlan.InsurancePlanPlanGeneralCostComponent res = new InsurancePlan.InsurancePlanPlanGeneralCostComponent();
16140    parseInsurancePlanPlanGeneralCostComponentProperties(json, res);
16141    return res;
16142  }
16143
16144  protected void parseInsurancePlanPlanGeneralCostComponentProperties(JsonObject json, InsurancePlan.InsurancePlanPlanGeneralCostComponent res) throws IOException, FHIRFormatError {
16145    parseBackboneElementProperties(json, res);
16146    if (json.has("type"))
16147      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16148    if (json.has("groupSize"))
16149      res.setGroupSizeElement(parsePositiveInt(json.get("groupSize").getAsString()));
16150    if (json.has("_groupSize"))
16151      parseElementProperties(json.getAsJsonObject("_groupSize"), res.getGroupSizeElement());
16152    if (json.has("cost"))
16153      res.setCost(parseMoney(json.getAsJsonObject("cost")));
16154    if (json.has("comment"))
16155      res.setCommentElement(parseString(json.get("comment").getAsString()));
16156    if (json.has("_comment"))
16157      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
16158  }
16159
16160  protected InsurancePlan.InsurancePlanPlanSpecificCostComponent parseInsurancePlanPlanSpecificCostComponent(JsonObject json) throws IOException, FHIRFormatError {
16161    InsurancePlan.InsurancePlanPlanSpecificCostComponent res = new InsurancePlan.InsurancePlanPlanSpecificCostComponent();
16162    parseInsurancePlanPlanSpecificCostComponentProperties(json, res);
16163    return res;
16164  }
16165
16166  protected void parseInsurancePlanPlanSpecificCostComponentProperties(JsonObject json, InsurancePlan.InsurancePlanPlanSpecificCostComponent res) throws IOException, FHIRFormatError {
16167    parseBackboneElementProperties(json, res);
16168    if (json.has("category"))
16169      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
16170    if (json.has("benefit")) {
16171      JsonArray array = json.getAsJsonArray("benefit");
16172      for (int i = 0; i < array.size(); i++) {
16173        res.getBenefit().add(parseInsurancePlanPlanBenefitComponent(array.get(i).getAsJsonObject()));
16174      }
16175    };
16176  }
16177
16178  protected InsurancePlan.PlanBenefitComponent parseInsurancePlanPlanBenefitComponent(JsonObject json) throws IOException, FHIRFormatError {
16179    InsurancePlan.PlanBenefitComponent res = new InsurancePlan.PlanBenefitComponent();
16180    parseInsurancePlanPlanBenefitComponentProperties(json, res);
16181    return res;
16182  }
16183
16184  protected void parseInsurancePlanPlanBenefitComponentProperties(JsonObject json, InsurancePlan.PlanBenefitComponent res) throws IOException, FHIRFormatError {
16185    parseBackboneElementProperties(json, res);
16186    if (json.has("type"))
16187      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16188    if (json.has("cost")) {
16189      JsonArray array = json.getAsJsonArray("cost");
16190      for (int i = 0; i < array.size(); i++) {
16191        res.getCost().add(parseInsurancePlanPlanBenefitCostComponent(array.get(i).getAsJsonObject()));
16192      }
16193    };
16194  }
16195
16196  protected InsurancePlan.PlanBenefitCostComponent parseInsurancePlanPlanBenefitCostComponent(JsonObject json) throws IOException, FHIRFormatError {
16197    InsurancePlan.PlanBenefitCostComponent res = new InsurancePlan.PlanBenefitCostComponent();
16198    parseInsurancePlanPlanBenefitCostComponentProperties(json, res);
16199    return res;
16200  }
16201
16202  protected void parseInsurancePlanPlanBenefitCostComponentProperties(JsonObject json, InsurancePlan.PlanBenefitCostComponent res) throws IOException, FHIRFormatError {
16203    parseBackboneElementProperties(json, res);
16204    if (json.has("type"))
16205      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16206    if (json.has("applicability"))
16207      res.setApplicability(parseCodeableConcept(json.getAsJsonObject("applicability")));
16208    if (json.has("qualifiers")) {
16209      JsonArray array = json.getAsJsonArray("qualifiers");
16210      for (int i = 0; i < array.size(); i++) {
16211        res.getQualifiers().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16212      }
16213    };
16214    if (json.has("value"))
16215      res.setValue(parseQuantity(json.getAsJsonObject("value")));
16216  }
16217
16218  protected Invoice parseInvoice(JsonObject json) throws IOException, FHIRFormatError {
16219    Invoice res = new Invoice();
16220    parseInvoiceProperties(json, res);
16221    return res;
16222  }
16223
16224  protected void parseInvoiceProperties(JsonObject json, Invoice res) throws IOException, FHIRFormatError {
16225    parseDomainResourceProperties(json, res);
16226    if (json.has("identifier")) {
16227      JsonArray array = json.getAsJsonArray("identifier");
16228      for (int i = 0; i < array.size(); i++) {
16229        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16230      }
16231    };
16232    if (json.has("status"))
16233      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Invoice.InvoiceStatus.NULL, new Invoice.InvoiceStatusEnumFactory()));
16234    if (json.has("_status"))
16235      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16236    if (json.has("cancelledReason"))
16237      res.setCancelledReasonElement(parseString(json.get("cancelledReason").getAsString()));
16238    if (json.has("_cancelledReason"))
16239      parseElementProperties(json.getAsJsonObject("_cancelledReason"), res.getCancelledReasonElement());
16240    if (json.has("type"))
16241      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16242    if (json.has("subject"))
16243      res.setSubject(parseReference(json.getAsJsonObject("subject")));
16244    if (json.has("recipient"))
16245      res.setRecipient(parseReference(json.getAsJsonObject("recipient")));
16246    if (json.has("date"))
16247      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16248    if (json.has("_date"))
16249      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16250    if (json.has("participant")) {
16251      JsonArray array = json.getAsJsonArray("participant");
16252      for (int i = 0; i < array.size(); i++) {
16253        res.getParticipant().add(parseInvoiceParticipantComponent(array.get(i).getAsJsonObject()));
16254      }
16255    };
16256    if (json.has("issuer"))
16257      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
16258    if (json.has("account"))
16259      res.setAccount(parseReference(json.getAsJsonObject("account")));
16260    if (json.has("lineItem")) {
16261      JsonArray array = json.getAsJsonArray("lineItem");
16262      for (int i = 0; i < array.size(); i++) {
16263        res.getLineItem().add(parseInvoiceLineItemComponent(array.get(i).getAsJsonObject()));
16264      }
16265    };
16266    if (json.has("totalPriceComponent")) {
16267      JsonArray array = json.getAsJsonArray("totalPriceComponent");
16268      for (int i = 0; i < array.size(); i++) {
16269        res.getTotalPriceComponent().add(parseInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject()));
16270      }
16271    };
16272    if (json.has("totalNet"))
16273      res.setTotalNet(parseMoney(json.getAsJsonObject("totalNet")));
16274    if (json.has("totalGross"))
16275      res.setTotalGross(parseMoney(json.getAsJsonObject("totalGross")));
16276    if (json.has("paymentTerms"))
16277      res.setPaymentTermsElement(parseMarkdown(json.get("paymentTerms").getAsString()));
16278    if (json.has("_paymentTerms"))
16279      parseElementProperties(json.getAsJsonObject("_paymentTerms"), res.getPaymentTermsElement());
16280    if (json.has("note")) {
16281      JsonArray array = json.getAsJsonArray("note");
16282      for (int i = 0; i < array.size(); i++) {
16283        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16284      }
16285    };
16286  }
16287
16288  protected Invoice.InvoiceParticipantComponent parseInvoiceParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
16289    Invoice.InvoiceParticipantComponent res = new Invoice.InvoiceParticipantComponent();
16290    parseInvoiceParticipantComponentProperties(json, res);
16291    return res;
16292  }
16293
16294  protected void parseInvoiceParticipantComponentProperties(JsonObject json, Invoice.InvoiceParticipantComponent res) throws IOException, FHIRFormatError {
16295    parseBackboneElementProperties(json, res);
16296    if (json.has("role"))
16297      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
16298    if (json.has("actor"))
16299      res.setActor(parseReference(json.getAsJsonObject("actor")));
16300  }
16301
16302  protected Invoice.InvoiceLineItemComponent parseInvoiceLineItemComponent(JsonObject json) throws IOException, FHIRFormatError {
16303    Invoice.InvoiceLineItemComponent res = new Invoice.InvoiceLineItemComponent();
16304    parseInvoiceLineItemComponentProperties(json, res);
16305    return res;
16306  }
16307
16308  protected void parseInvoiceLineItemComponentProperties(JsonObject json, Invoice.InvoiceLineItemComponent res) throws IOException, FHIRFormatError {
16309    parseBackboneElementProperties(json, res);
16310    if (json.has("sequence"))
16311      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
16312    if (json.has("_sequence"))
16313      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
16314    DataType chargeItem = parseType("chargeItem", json);
16315    if (chargeItem != null)
16316      res.setChargeItem(chargeItem);
16317    if (json.has("priceComponent")) {
16318      JsonArray array = json.getAsJsonArray("priceComponent");
16319      for (int i = 0; i < array.size(); i++) {
16320        res.getPriceComponent().add(parseInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject()));
16321      }
16322    };
16323  }
16324
16325  protected Invoice.InvoiceLineItemPriceComponentComponent parseInvoiceLineItemPriceComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
16326    Invoice.InvoiceLineItemPriceComponentComponent res = new Invoice.InvoiceLineItemPriceComponentComponent();
16327    parseInvoiceLineItemPriceComponentComponentProperties(json, res);
16328    return res;
16329  }
16330
16331  protected void parseInvoiceLineItemPriceComponentComponentProperties(JsonObject json, Invoice.InvoiceLineItemPriceComponentComponent res) throws IOException, FHIRFormatError {
16332    parseBackboneElementProperties(json, res);
16333    if (json.has("type"))
16334      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.InvoicePriceComponentType.NULL, new Enumerations.InvoicePriceComponentTypeEnumFactory()));
16335    if (json.has("_type"))
16336      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16337    if (json.has("code"))
16338      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16339    if (json.has("factor"))
16340      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
16341    if (json.has("_factor"))
16342      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
16343    if (json.has("amount"))
16344      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
16345  }
16346
16347  protected Library parseLibrary(JsonObject json) throws IOException, FHIRFormatError {
16348    Library res = new Library();
16349    parseLibraryProperties(json, res);
16350    return res;
16351  }
16352
16353  protected void parseLibraryProperties(JsonObject json, Library res) throws IOException, FHIRFormatError {
16354    parseMetadataResourceProperties(json, res);
16355    if (json.has("url"))
16356      res.setUrlElement(parseUri(json.get("url").getAsString()));
16357    if (json.has("_url"))
16358      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
16359    if (json.has("identifier")) {
16360      JsonArray array = json.getAsJsonArray("identifier");
16361      for (int i = 0; i < array.size(); i++) {
16362        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16363      }
16364    };
16365    if (json.has("version"))
16366      res.setVersionElement(parseString(json.get("version").getAsString()));
16367    if (json.has("_version"))
16368      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
16369    if (json.has("name"))
16370      res.setNameElement(parseString(json.get("name").getAsString()));
16371    if (json.has("_name"))
16372      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16373    if (json.has("title"))
16374      res.setTitleElement(parseString(json.get("title").getAsString()));
16375    if (json.has("_title"))
16376      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
16377    if (json.has("subtitle"))
16378      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
16379    if (json.has("_subtitle"))
16380      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
16381    if (json.has("status"))
16382      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
16383    if (json.has("_status"))
16384      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16385    if (json.has("experimental"))
16386      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
16387    if (json.has("_experimental"))
16388      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
16389    if (json.has("type"))
16390      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16391    DataType subject = parseType("subject", json);
16392    if (subject != null)
16393      res.setSubject(subject);
16394    if (json.has("date"))
16395      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16396    if (json.has("_date"))
16397      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16398    if (json.has("publisher"))
16399      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
16400    if (json.has("_publisher"))
16401      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
16402    if (json.has("contact")) {
16403      JsonArray array = json.getAsJsonArray("contact");
16404      for (int i = 0; i < array.size(); i++) {
16405        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
16406      }
16407    };
16408    if (json.has("description"))
16409      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
16410    if (json.has("_description"))
16411      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16412    if (json.has("useContext")) {
16413      JsonArray array = json.getAsJsonArray("useContext");
16414      for (int i = 0; i < array.size(); i++) {
16415        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
16416      }
16417    };
16418    if (json.has("jurisdiction")) {
16419      JsonArray array = json.getAsJsonArray("jurisdiction");
16420      for (int i = 0; i < array.size(); i++) {
16421        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16422      }
16423    };
16424    if (json.has("purpose"))
16425      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
16426    if (json.has("_purpose"))
16427      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
16428    if (json.has("usage"))
16429      res.setUsageElement(parseString(json.get("usage").getAsString()));
16430    if (json.has("_usage"))
16431      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
16432    if (json.has("copyright"))
16433      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
16434    if (json.has("_copyright"))
16435      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
16436    if (json.has("approvalDate"))
16437      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
16438    if (json.has("_approvalDate"))
16439      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
16440    if (json.has("lastReviewDate"))
16441      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
16442    if (json.has("_lastReviewDate"))
16443      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
16444    if (json.has("effectivePeriod"))
16445      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
16446    if (json.has("topic")) {
16447      JsonArray array = json.getAsJsonArray("topic");
16448      for (int i = 0; i < array.size(); i++) {
16449        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16450      }
16451    };
16452    if (json.has("author")) {
16453      JsonArray array = json.getAsJsonArray("author");
16454      for (int i = 0; i < array.size(); i++) {
16455        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
16456      }
16457    };
16458    if (json.has("editor")) {
16459      JsonArray array = json.getAsJsonArray("editor");
16460      for (int i = 0; i < array.size(); i++) {
16461        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
16462      }
16463    };
16464    if (json.has("reviewer")) {
16465      JsonArray array = json.getAsJsonArray("reviewer");
16466      for (int i = 0; i < array.size(); i++) {
16467        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
16468      }
16469    };
16470    if (json.has("endorser")) {
16471      JsonArray array = json.getAsJsonArray("endorser");
16472      for (int i = 0; i < array.size(); i++) {
16473        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
16474      }
16475    };
16476    if (json.has("relatedArtifact")) {
16477      JsonArray array = json.getAsJsonArray("relatedArtifact");
16478      for (int i = 0; i < array.size(); i++) {
16479        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
16480      }
16481    };
16482    if (json.has("parameter")) {
16483      JsonArray array = json.getAsJsonArray("parameter");
16484      for (int i = 0; i < array.size(); i++) {
16485        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
16486      }
16487    };
16488    if (json.has("dataRequirement")) {
16489      JsonArray array = json.getAsJsonArray("dataRequirement");
16490      for (int i = 0; i < array.size(); i++) {
16491        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
16492      }
16493    };
16494    if (json.has("content")) {
16495      JsonArray array = json.getAsJsonArray("content");
16496      for (int i = 0; i < array.size(); i++) {
16497        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
16498      }
16499    };
16500  }
16501
16502  protected Linkage parseLinkage(JsonObject json) throws IOException, FHIRFormatError {
16503    Linkage res = new Linkage();
16504    parseLinkageProperties(json, res);
16505    return res;
16506  }
16507
16508  protected void parseLinkageProperties(JsonObject json, Linkage res) throws IOException, FHIRFormatError {
16509    parseDomainResourceProperties(json, res);
16510    if (json.has("active"))
16511      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
16512    if (json.has("_active"))
16513      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
16514    if (json.has("author"))
16515      res.setAuthor(parseReference(json.getAsJsonObject("author")));
16516    if (json.has("item")) {
16517      JsonArray array = json.getAsJsonArray("item");
16518      for (int i = 0; i < array.size(); i++) {
16519        res.getItem().add(parseLinkageItemComponent(array.get(i).getAsJsonObject()));
16520      }
16521    };
16522  }
16523
16524  protected Linkage.LinkageItemComponent parseLinkageItemComponent(JsonObject json) throws IOException, FHIRFormatError {
16525    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
16526    parseLinkageItemComponentProperties(json, res);
16527    return res;
16528  }
16529
16530  protected void parseLinkageItemComponentProperties(JsonObject json, Linkage.LinkageItemComponent res) throws IOException, FHIRFormatError {
16531    parseBackboneElementProperties(json, res);
16532    if (json.has("type"))
16533      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Linkage.LinkageType.NULL, new Linkage.LinkageTypeEnumFactory()));
16534    if (json.has("_type"))
16535      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16536    if (json.has("resource"))
16537      res.setResource(parseReference(json.getAsJsonObject("resource")));
16538  }
16539
16540  protected ListResource parseListResource(JsonObject json) throws IOException, FHIRFormatError {
16541    ListResource res = new ListResource();
16542    parseListResourceProperties(json, res);
16543    return res;
16544  }
16545
16546  protected void parseListResourceProperties(JsonObject json, ListResource res) throws IOException, FHIRFormatError {
16547    parseDomainResourceProperties(json, res);
16548    if (json.has("identifier")) {
16549      JsonArray array = json.getAsJsonArray("identifier");
16550      for (int i = 0; i < array.size(); i++) {
16551        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16552      }
16553    };
16554    if (json.has("status"))
16555      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ListResource.ListStatus.NULL, new ListResource.ListStatusEnumFactory()));
16556    if (json.has("_status"))
16557      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16558    if (json.has("mode"))
16559      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Enumerations.ListMode.NULL, new Enumerations.ListModeEnumFactory()));
16560    if (json.has("_mode"))
16561      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
16562    if (json.has("title"))
16563      res.setTitleElement(parseString(json.get("title").getAsString()));
16564    if (json.has("_title"))
16565      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
16566    if (json.has("code"))
16567      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16568    if (json.has("subject"))
16569      res.setSubject(parseReference(json.getAsJsonObject("subject")));
16570    if (json.has("encounter"))
16571      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
16572    if (json.has("date"))
16573      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16574    if (json.has("_date"))
16575      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16576    if (json.has("source"))
16577      res.setSource(parseReference(json.getAsJsonObject("source")));
16578    if (json.has("orderedBy"))
16579      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
16580    if (json.has("note")) {
16581      JsonArray array = json.getAsJsonArray("note");
16582      for (int i = 0; i < array.size(); i++) {
16583        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16584      }
16585    };
16586    if (json.has("entry")) {
16587      JsonArray array = json.getAsJsonArray("entry");
16588      for (int i = 0; i < array.size(); i++) {
16589        res.getEntry().add(parseListResourceEntryComponent(array.get(i).getAsJsonObject()));
16590      }
16591    };
16592    if (json.has("emptyReason"))
16593      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
16594  }
16595
16596  protected ListResource.ListResourceEntryComponent parseListResourceEntryComponent(JsonObject json) throws IOException, FHIRFormatError {
16597    ListResource.ListResourceEntryComponent res = new ListResource.ListResourceEntryComponent();
16598    parseListResourceEntryComponentProperties(json, res);
16599    return res;
16600  }
16601
16602  protected void parseListResourceEntryComponentProperties(JsonObject json, ListResource.ListResourceEntryComponent res) throws IOException, FHIRFormatError {
16603    parseBackboneElementProperties(json, res);
16604    if (json.has("flag"))
16605      res.setFlag(parseCodeableConcept(json.getAsJsonObject("flag")));
16606    if (json.has("deleted"))
16607      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
16608    if (json.has("_deleted"))
16609      parseElementProperties(json.getAsJsonObject("_deleted"), res.getDeletedElement());
16610    if (json.has("date"))
16611      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16612    if (json.has("_date"))
16613      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16614    if (json.has("item"))
16615      res.setItem(parseReference(json.getAsJsonObject("item")));
16616  }
16617
16618  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
16619    Location res = new Location();
16620    parseLocationProperties(json, res);
16621    return res;
16622  }
16623
16624  protected void parseLocationProperties(JsonObject json, Location res) throws IOException, FHIRFormatError {
16625    parseDomainResourceProperties(json, res);
16626    if (json.has("identifier")) {
16627      JsonArray array = json.getAsJsonArray("identifier");
16628      for (int i = 0; i < array.size(); i++) {
16629        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16630      }
16631    };
16632    if (json.has("status"))
16633      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
16634    if (json.has("_status"))
16635      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16636    if (json.has("operationalStatus"))
16637      res.setOperationalStatus(parseCoding(json.getAsJsonObject("operationalStatus")));
16638    if (json.has("name"))
16639      res.setNameElement(parseString(json.get("name").getAsString()));
16640    if (json.has("_name"))
16641      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16642    if (json.has("alias")) {
16643      JsonArray array = json.getAsJsonArray("alias");
16644      for (int i = 0; i < array.size(); i++) {
16645        if (array.get(i).isJsonNull()) {
16646          res.getAlias().add(new StringType());
16647        } else {;
16648          res.getAlias().add(parseString(array.get(i).getAsString()));
16649        }
16650      }
16651    };
16652    if (json.has("_alias")) {
16653      JsonArray array = json.getAsJsonArray("_alias");
16654      for (int i = 0; i < array.size(); i++) {
16655        if (i == res.getAlias().size())
16656          res.getAlias().add(parseString(null));
16657        if (array.get(i) instanceof JsonObject) 
16658          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
16659      }
16660    };
16661    if (json.has("description"))
16662      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16663    if (json.has("_description"))
16664      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16665    if (json.has("mode"))
16666      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
16667    if (json.has("_mode"))
16668      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
16669    if (json.has("type")) {
16670      JsonArray array = json.getAsJsonArray("type");
16671      for (int i = 0; i < array.size(); i++) {
16672        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16673      }
16674    };
16675    if (json.has("telecom")) {
16676      JsonArray array = json.getAsJsonArray("telecom");
16677      for (int i = 0; i < array.size(); i++) {
16678        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
16679      }
16680    };
16681    if (json.has("address"))
16682      res.setAddress(parseAddress(json.getAsJsonObject("address")));
16683    if (json.has("physicalType"))
16684      res.setPhysicalType(parseCodeableConcept(json.getAsJsonObject("physicalType")));
16685    if (json.has("position"))
16686      res.setPosition(parseLocationPositionComponent(json.getAsJsonObject("position")));
16687    if (json.has("managingOrganization"))
16688      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
16689    if (json.has("partOf"))
16690      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
16691    if (json.has("hoursOfOperation")) {
16692      JsonArray array = json.getAsJsonArray("hoursOfOperation");
16693      for (int i = 0; i < array.size(); i++) {
16694        res.getHoursOfOperation().add(parseLocationHoursOfOperationComponent(array.get(i).getAsJsonObject()));
16695      }
16696    };
16697    if (json.has("availabilityExceptions"))
16698      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
16699    if (json.has("_availabilityExceptions"))
16700      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
16701    if (json.has("endpoint")) {
16702      JsonArray array = json.getAsJsonArray("endpoint");
16703      for (int i = 0; i < array.size(); i++) {
16704        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
16705      }
16706    };
16707  }
16708
16709  protected Location.LocationPositionComponent parseLocationPositionComponent(JsonObject json) throws IOException, FHIRFormatError {
16710    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
16711    parseLocationPositionComponentProperties(json, res);
16712    return res;
16713  }
16714
16715  protected void parseLocationPositionComponentProperties(JsonObject json, Location.LocationPositionComponent res) throws IOException, FHIRFormatError {
16716    parseBackboneElementProperties(json, res);
16717    if (json.has("longitude"))
16718      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
16719    if (json.has("_longitude"))
16720      parseElementProperties(json.getAsJsonObject("_longitude"), res.getLongitudeElement());
16721    if (json.has("latitude"))
16722      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
16723    if (json.has("_latitude"))
16724      parseElementProperties(json.getAsJsonObject("_latitude"), res.getLatitudeElement());
16725    if (json.has("altitude"))
16726      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
16727    if (json.has("_altitude"))
16728      parseElementProperties(json.getAsJsonObject("_altitude"), res.getAltitudeElement());
16729  }
16730
16731  protected Location.LocationHoursOfOperationComponent parseLocationHoursOfOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
16732    Location.LocationHoursOfOperationComponent res = new Location.LocationHoursOfOperationComponent();
16733    parseLocationHoursOfOperationComponentProperties(json, res);
16734    return res;
16735  }
16736
16737  protected void parseLocationHoursOfOperationComponentProperties(JsonObject json, Location.LocationHoursOfOperationComponent res) throws IOException, FHIRFormatError {
16738    parseBackboneElementProperties(json, res);
16739    if (json.has("daysOfWeek")) {
16740      JsonArray array = json.getAsJsonArray("daysOfWeek");
16741      for (int i = 0; i < array.size(); i++) {
16742        if (array.get(i).isJsonNull()) {
16743          res.getDaysOfWeek().add(new Enumeration<Enumerations.DaysOfWeek>(new Enumerations.DaysOfWeekEnumFactory(), Enumerations.DaysOfWeek.NULL));
16744        } else {;
16745          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
16746        }
16747      }
16748    };
16749    if (json.has("_daysOfWeek")) {
16750      JsonArray array = json.getAsJsonArray("_daysOfWeek");
16751      for (int i = 0; i < array.size(); i++) {
16752        if (i == res.getDaysOfWeek().size())
16753          res.getDaysOfWeek().add(parseEnumeration(null, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
16754        if (array.get(i) instanceof JsonObject) 
16755          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
16756      }
16757    };
16758    if (json.has("allDay"))
16759      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
16760    if (json.has("_allDay"))
16761      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
16762    if (json.has("openingTime"))
16763      res.setOpeningTimeElement(parseTime(json.get("openingTime").getAsString()));
16764    if (json.has("_openingTime"))
16765      parseElementProperties(json.getAsJsonObject("_openingTime"), res.getOpeningTimeElement());
16766    if (json.has("closingTime"))
16767      res.setClosingTimeElement(parseTime(json.get("closingTime").getAsString()));
16768    if (json.has("_closingTime"))
16769      parseElementProperties(json.getAsJsonObject("_closingTime"), res.getClosingTimeElement());
16770  }
16771
16772  protected ManufacturedItemDefinition parseManufacturedItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
16773    ManufacturedItemDefinition res = new ManufacturedItemDefinition();
16774    parseManufacturedItemDefinitionProperties(json, res);
16775    return res;
16776  }
16777
16778  protected void parseManufacturedItemDefinitionProperties(JsonObject json, ManufacturedItemDefinition res) throws IOException, FHIRFormatError {
16779    parseDomainResourceProperties(json, res);
16780    if (json.has("identifier")) {
16781      JsonArray array = json.getAsJsonArray("identifier");
16782      for (int i = 0; i < array.size(); i++) {
16783        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16784      }
16785    };
16786    if (json.has("manufacturedDoseForm"))
16787      res.setManufacturedDoseForm(parseCodeableConcept(json.getAsJsonObject("manufacturedDoseForm")));
16788    if (json.has("unitOfPresentation"))
16789      res.setUnitOfPresentation(parseCodeableConcept(json.getAsJsonObject("unitOfPresentation")));
16790    if (json.has("manufacturer")) {
16791      JsonArray array = json.getAsJsonArray("manufacturer");
16792      for (int i = 0; i < array.size(); i++) {
16793        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
16794      }
16795    };
16796    if (json.has("ingredient")) {
16797      JsonArray array = json.getAsJsonArray("ingredient");
16798      for (int i = 0; i < array.size(); i++) {
16799        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
16800      }
16801    };
16802    if (json.has("characteristic")) {
16803      JsonArray array = json.getAsJsonArray("characteristic");
16804      for (int i = 0; i < array.size(); i++) {
16805        res.getCharacteristic().add(parseManufacturedItemDefinitionCharacteristicComponent(array.get(i).getAsJsonObject()));
16806      }
16807    };
16808  }
16809
16810  protected ManufacturedItemDefinition.ManufacturedItemDefinitionCharacteristicComponent parseManufacturedItemDefinitionCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
16811    ManufacturedItemDefinition.ManufacturedItemDefinitionCharacteristicComponent res = new ManufacturedItemDefinition.ManufacturedItemDefinitionCharacteristicComponent();
16812    parseManufacturedItemDefinitionCharacteristicComponentProperties(json, res);
16813    return res;
16814  }
16815
16816  protected void parseManufacturedItemDefinitionCharacteristicComponentProperties(JsonObject json, ManufacturedItemDefinition.ManufacturedItemDefinitionCharacteristicComponent res) throws IOException, FHIRFormatError {
16817    parseBackboneElementProperties(json, res);
16818    if (json.has("code"))
16819      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16820    DataType value = parseType("value", json);
16821    if (value != null)
16822      res.setValue(value);
16823  }
16824
16825  protected Measure parseMeasure(JsonObject json) throws IOException, FHIRFormatError {
16826    Measure res = new Measure();
16827    parseMeasureProperties(json, res);
16828    return res;
16829  }
16830
16831  protected void parseMeasureProperties(JsonObject json, Measure res) throws IOException, FHIRFormatError {
16832    parseMetadataResourceProperties(json, res);
16833    if (json.has("url"))
16834      res.setUrlElement(parseUri(json.get("url").getAsString()));
16835    if (json.has("_url"))
16836      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
16837    if (json.has("identifier")) {
16838      JsonArray array = json.getAsJsonArray("identifier");
16839      for (int i = 0; i < array.size(); i++) {
16840        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16841      }
16842    };
16843    if (json.has("version"))
16844      res.setVersionElement(parseString(json.get("version").getAsString()));
16845    if (json.has("_version"))
16846      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
16847    if (json.has("name"))
16848      res.setNameElement(parseString(json.get("name").getAsString()));
16849    if (json.has("_name"))
16850      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16851    if (json.has("title"))
16852      res.setTitleElement(parseString(json.get("title").getAsString()));
16853    if (json.has("_title"))
16854      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
16855    if (json.has("subtitle"))
16856      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
16857    if (json.has("_subtitle"))
16858      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
16859    if (json.has("status"))
16860      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
16861    if (json.has("_status"))
16862      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16863    if (json.has("experimental"))
16864      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
16865    if (json.has("_experimental"))
16866      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
16867    DataType subject = parseType("subject", json);
16868    if (subject != null)
16869      res.setSubject(subject);
16870    if (json.has("date"))
16871      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16872    if (json.has("_date"))
16873      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16874    if (json.has("publisher"))
16875      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
16876    if (json.has("_publisher"))
16877      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
16878    if (json.has("contact")) {
16879      JsonArray array = json.getAsJsonArray("contact");
16880      for (int i = 0; i < array.size(); i++) {
16881        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
16882      }
16883    };
16884    if (json.has("description"))
16885      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
16886    if (json.has("_description"))
16887      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16888    if (json.has("useContext")) {
16889      JsonArray array = json.getAsJsonArray("useContext");
16890      for (int i = 0; i < array.size(); i++) {
16891        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
16892      }
16893    };
16894    if (json.has("jurisdiction")) {
16895      JsonArray array = json.getAsJsonArray("jurisdiction");
16896      for (int i = 0; i < array.size(); i++) {
16897        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16898      }
16899    };
16900    if (json.has("purpose"))
16901      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
16902    if (json.has("_purpose"))
16903      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
16904    if (json.has("usage"))
16905      res.setUsageElement(parseString(json.get("usage").getAsString()));
16906    if (json.has("_usage"))
16907      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
16908    if (json.has("copyright"))
16909      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
16910    if (json.has("_copyright"))
16911      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
16912    if (json.has("approvalDate"))
16913      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
16914    if (json.has("_approvalDate"))
16915      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
16916    if (json.has("lastReviewDate"))
16917      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
16918    if (json.has("_lastReviewDate"))
16919      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
16920    if (json.has("effectivePeriod"))
16921      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
16922    if (json.has("topic")) {
16923      JsonArray array = json.getAsJsonArray("topic");
16924      for (int i = 0; i < array.size(); i++) {
16925        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16926      }
16927    };
16928    if (json.has("author")) {
16929      JsonArray array = json.getAsJsonArray("author");
16930      for (int i = 0; i < array.size(); i++) {
16931        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
16932      }
16933    };
16934    if (json.has("editor")) {
16935      JsonArray array = json.getAsJsonArray("editor");
16936      for (int i = 0; i < array.size(); i++) {
16937        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
16938      }
16939    };
16940    if (json.has("reviewer")) {
16941      JsonArray array = json.getAsJsonArray("reviewer");
16942      for (int i = 0; i < array.size(); i++) {
16943        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
16944      }
16945    };
16946    if (json.has("endorser")) {
16947      JsonArray array = json.getAsJsonArray("endorser");
16948      for (int i = 0; i < array.size(); i++) {
16949        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
16950      }
16951    };
16952    if (json.has("relatedArtifact")) {
16953      JsonArray array = json.getAsJsonArray("relatedArtifact");
16954      for (int i = 0; i < array.size(); i++) {
16955        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
16956      }
16957    };
16958    if (json.has("library")) {
16959      JsonArray array = json.getAsJsonArray("library");
16960      for (int i = 0; i < array.size(); i++) {
16961        if (array.get(i).isJsonNull()) {
16962          res.getLibrary().add(new CanonicalType());
16963        } else {;
16964          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
16965        }
16966      }
16967    };
16968    if (json.has("_library")) {
16969      JsonArray array = json.getAsJsonArray("_library");
16970      for (int i = 0; i < array.size(); i++) {
16971        if (i == res.getLibrary().size())
16972          res.getLibrary().add(parseCanonical(null));
16973        if (array.get(i) instanceof JsonObject) 
16974          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
16975      }
16976    };
16977    if (json.has("disclaimer"))
16978      res.setDisclaimerElement(parseMarkdown(json.get("disclaimer").getAsString()));
16979    if (json.has("_disclaimer"))
16980      parseElementProperties(json.getAsJsonObject("_disclaimer"), res.getDisclaimerElement());
16981    if (json.has("scoring"))
16982      res.setScoring(parseCodeableConcept(json.getAsJsonObject("scoring")));
16983    if (json.has("compositeScoring"))
16984      res.setCompositeScoring(parseCodeableConcept(json.getAsJsonObject("compositeScoring")));
16985    if (json.has("type")) {
16986      JsonArray array = json.getAsJsonArray("type");
16987      for (int i = 0; i < array.size(); i++) {
16988        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16989      }
16990    };
16991    if (json.has("riskAdjustment"))
16992      res.setRiskAdjustmentElement(parseString(json.get("riskAdjustment").getAsString()));
16993    if (json.has("_riskAdjustment"))
16994      parseElementProperties(json.getAsJsonObject("_riskAdjustment"), res.getRiskAdjustmentElement());
16995    if (json.has("rateAggregation"))
16996      res.setRateAggregationElement(parseString(json.get("rateAggregation").getAsString()));
16997    if (json.has("_rateAggregation"))
16998      parseElementProperties(json.getAsJsonObject("_rateAggregation"), res.getRateAggregationElement());
16999    if (json.has("rationale"))
17000      res.setRationaleElement(parseMarkdown(json.get("rationale").getAsString()));
17001    if (json.has("_rationale"))
17002      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
17003    if (json.has("clinicalRecommendationStatement"))
17004      res.setClinicalRecommendationStatementElement(parseMarkdown(json.get("clinicalRecommendationStatement").getAsString()));
17005    if (json.has("_clinicalRecommendationStatement"))
17006      parseElementProperties(json.getAsJsonObject("_clinicalRecommendationStatement"), res.getClinicalRecommendationStatementElement());
17007    if (json.has("improvementNotation"))
17008      res.setImprovementNotation(parseCodeableConcept(json.getAsJsonObject("improvementNotation")));
17009    if (json.has("definition")) {
17010      JsonArray array = json.getAsJsonArray("definition");
17011      for (int i = 0; i < array.size(); i++) {
17012        if (array.get(i).isJsonNull()) {
17013          res.getDefinition().add(new MarkdownType());
17014        } else {;
17015          res.getDefinition().add(parseMarkdown(array.get(i).getAsString()));
17016        }
17017      }
17018    };
17019    if (json.has("_definition")) {
17020      JsonArray array = json.getAsJsonArray("_definition");
17021      for (int i = 0; i < array.size(); i++) {
17022        if (i == res.getDefinition().size())
17023          res.getDefinition().add(parseMarkdown(null));
17024        if (array.get(i) instanceof JsonObject) 
17025          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
17026      }
17027    };
17028    if (json.has("guidance"))
17029      res.setGuidanceElement(parseMarkdown(json.get("guidance").getAsString()));
17030    if (json.has("_guidance"))
17031      parseElementProperties(json.getAsJsonObject("_guidance"), res.getGuidanceElement());
17032    if (json.has("group")) {
17033      JsonArray array = json.getAsJsonArray("group");
17034      for (int i = 0; i < array.size(); i++) {
17035        res.getGroup().add(parseMeasureGroupComponent(array.get(i).getAsJsonObject()));
17036      }
17037    };
17038    if (json.has("supplementalData")) {
17039      JsonArray array = json.getAsJsonArray("supplementalData");
17040      for (int i = 0; i < array.size(); i++) {
17041        res.getSupplementalData().add(parseMeasureSupplementalDataComponent(array.get(i).getAsJsonObject()));
17042      }
17043    };
17044  }
17045
17046  protected Measure.MeasureGroupComponent parseMeasureGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
17047    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
17048    parseMeasureGroupComponentProperties(json, res);
17049    return res;
17050  }
17051
17052  protected void parseMeasureGroupComponentProperties(JsonObject json, Measure.MeasureGroupComponent res) throws IOException, FHIRFormatError {
17053    parseBackboneElementProperties(json, res);
17054    if (json.has("code"))
17055      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17056    if (json.has("description"))
17057      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17058    if (json.has("_description"))
17059      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17060    if (json.has("population")) {
17061      JsonArray array = json.getAsJsonArray("population");
17062      for (int i = 0; i < array.size(); i++) {
17063        res.getPopulation().add(parseMeasureGroupPopulationComponent(array.get(i).getAsJsonObject()));
17064      }
17065    };
17066    if (json.has("stratifier")) {
17067      JsonArray array = json.getAsJsonArray("stratifier");
17068      for (int i = 0; i < array.size(); i++) {
17069        res.getStratifier().add(parseMeasureGroupStratifierComponent(array.get(i).getAsJsonObject()));
17070      }
17071    };
17072  }
17073
17074  protected Measure.MeasureGroupPopulationComponent parseMeasureGroupPopulationComponent(JsonObject json) throws IOException, FHIRFormatError {
17075    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
17076    parseMeasureGroupPopulationComponentProperties(json, res);
17077    return res;
17078  }
17079
17080  protected void parseMeasureGroupPopulationComponentProperties(JsonObject json, Measure.MeasureGroupPopulationComponent res) throws IOException, FHIRFormatError {
17081    parseBackboneElementProperties(json, res);
17082    if (json.has("code"))
17083      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17084    if (json.has("description"))
17085      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17086    if (json.has("_description"))
17087      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17088    if (json.has("criteria"))
17089      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
17090  }
17091
17092  protected Measure.MeasureGroupStratifierComponent parseMeasureGroupStratifierComponent(JsonObject json) throws IOException, FHIRFormatError {
17093    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
17094    parseMeasureGroupStratifierComponentProperties(json, res);
17095    return res;
17096  }
17097
17098  protected void parseMeasureGroupStratifierComponentProperties(JsonObject json, Measure.MeasureGroupStratifierComponent res) throws IOException, FHIRFormatError {
17099    parseBackboneElementProperties(json, res);
17100    if (json.has("code"))
17101      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17102    if (json.has("description"))
17103      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17104    if (json.has("_description"))
17105      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17106    if (json.has("criteria"))
17107      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
17108    if (json.has("component")) {
17109      JsonArray array = json.getAsJsonArray("component");
17110      for (int i = 0; i < array.size(); i++) {
17111        res.getComponent().add(parseMeasureGroupStratifierComponentComponent(array.get(i).getAsJsonObject()));
17112      }
17113    };
17114  }
17115
17116  protected Measure.MeasureGroupStratifierComponentComponent parseMeasureGroupStratifierComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
17117    Measure.MeasureGroupStratifierComponentComponent res = new Measure.MeasureGroupStratifierComponentComponent();
17118    parseMeasureGroupStratifierComponentComponentProperties(json, res);
17119    return res;
17120  }
17121
17122  protected void parseMeasureGroupStratifierComponentComponentProperties(JsonObject json, Measure.MeasureGroupStratifierComponentComponent res) throws IOException, FHIRFormatError {
17123    parseBackboneElementProperties(json, res);
17124    if (json.has("code"))
17125      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17126    if (json.has("description"))
17127      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17128    if (json.has("_description"))
17129      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17130    if (json.has("criteria"))
17131      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
17132  }
17133
17134  protected Measure.MeasureSupplementalDataComponent parseMeasureSupplementalDataComponent(JsonObject json) throws IOException, FHIRFormatError {
17135    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
17136    parseMeasureSupplementalDataComponentProperties(json, res);
17137    return res;
17138  }
17139
17140  protected void parseMeasureSupplementalDataComponentProperties(JsonObject json, Measure.MeasureSupplementalDataComponent res) throws IOException, FHIRFormatError {
17141    parseBackboneElementProperties(json, res);
17142    if (json.has("code"))
17143      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17144    if (json.has("usage")) {
17145      JsonArray array = json.getAsJsonArray("usage");
17146      for (int i = 0; i < array.size(); i++) {
17147        res.getUsage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17148      }
17149    };
17150    if (json.has("description"))
17151      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17152    if (json.has("_description"))
17153      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17154    if (json.has("criteria"))
17155      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
17156  }
17157
17158  protected MeasureReport parseMeasureReport(JsonObject json) throws IOException, FHIRFormatError {
17159    MeasureReport res = new MeasureReport();
17160    parseMeasureReportProperties(json, res);
17161    return res;
17162  }
17163
17164  protected void parseMeasureReportProperties(JsonObject json, MeasureReport res) throws IOException, FHIRFormatError {
17165    parseDomainResourceProperties(json, res);
17166    if (json.has("identifier")) {
17167      JsonArray array = json.getAsJsonArray("identifier");
17168      for (int i = 0; i < array.size(); i++) {
17169        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17170      }
17171    };
17172    if (json.has("status"))
17173      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MeasureReport.MeasureReportStatus.NULL, new MeasureReport.MeasureReportStatusEnumFactory()));
17174    if (json.has("_status"))
17175      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17176    if (json.has("type"))
17177      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MeasureReport.MeasureReportType.NULL, new MeasureReport.MeasureReportTypeEnumFactory()));
17178    if (json.has("_type"))
17179      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
17180    if (json.has("measure"))
17181      res.setMeasureElement(parseCanonical(json.get("measure").getAsString()));
17182    if (json.has("_measure"))
17183      parseElementProperties(json.getAsJsonObject("_measure"), res.getMeasureElement());
17184    if (json.has("subject"))
17185      res.setSubject(parseReference(json.getAsJsonObject("subject")));
17186    if (json.has("date"))
17187      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17188    if (json.has("_date"))
17189      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
17190    if (json.has("reporter"))
17191      res.setReporter(parseReference(json.getAsJsonObject("reporter")));
17192    if (json.has("period"))
17193      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
17194    if (json.has("improvementNotation"))
17195      res.setImprovementNotation(parseCodeableConcept(json.getAsJsonObject("improvementNotation")));
17196    if (json.has("group")) {
17197      JsonArray array = json.getAsJsonArray("group");
17198      for (int i = 0; i < array.size(); i++) {
17199        res.getGroup().add(parseMeasureReportGroupComponent(array.get(i).getAsJsonObject()));
17200      }
17201    };
17202    if (json.has("evaluatedResource")) {
17203      JsonArray array = json.getAsJsonArray("evaluatedResource");
17204      for (int i = 0; i < array.size(); i++) {
17205        res.getEvaluatedResource().add(parseReference(array.get(i).getAsJsonObject()));
17206      }
17207    };
17208  }
17209
17210  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
17211    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
17212    parseMeasureReportGroupComponentProperties(json, res);
17213    return res;
17214  }
17215
17216  protected void parseMeasureReportGroupComponentProperties(JsonObject json, MeasureReport.MeasureReportGroupComponent res) throws IOException, FHIRFormatError {
17217    parseBackboneElementProperties(json, res);
17218    if (json.has("code"))
17219      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17220    if (json.has("population")) {
17221      JsonArray array = json.getAsJsonArray("population");
17222      for (int i = 0; i < array.size(); i++) {
17223        res.getPopulation().add(parseMeasureReportGroupPopulationComponent(array.get(i).getAsJsonObject()));
17224      }
17225    };
17226    if (json.has("measureScore"))
17227      res.setMeasureScore(parseQuantity(json.getAsJsonObject("measureScore")));
17228    if (json.has("stratifier")) {
17229      JsonArray array = json.getAsJsonArray("stratifier");
17230      for (int i = 0; i < array.size(); i++) {
17231        res.getStratifier().add(parseMeasureReportGroupStratifierComponent(array.get(i).getAsJsonObject()));
17232      }
17233    };
17234  }
17235
17236  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportGroupPopulationComponent(JsonObject json) throws IOException, FHIRFormatError {
17237    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
17238    parseMeasureReportGroupPopulationComponentProperties(json, res);
17239    return res;
17240  }
17241
17242  protected void parseMeasureReportGroupPopulationComponentProperties(JsonObject json, MeasureReport.MeasureReportGroupPopulationComponent res) throws IOException, FHIRFormatError {
17243    parseBackboneElementProperties(json, res);
17244    if (json.has("code"))
17245      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17246    if (json.has("count"))
17247      res.setCountElement(parseInteger(json.get("count").getAsLong()));
17248    if (json.has("_count"))
17249      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
17250    if (json.has("subjectResults"))
17251      res.setSubjectResults(parseReference(json.getAsJsonObject("subjectResults")));
17252  }
17253
17254  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportGroupStratifierComponent(JsonObject json) throws IOException, FHIRFormatError {
17255    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
17256    parseMeasureReportGroupStratifierComponentProperties(json, res);
17257    return res;
17258  }
17259
17260  protected void parseMeasureReportGroupStratifierComponentProperties(JsonObject json, MeasureReport.MeasureReportGroupStratifierComponent res) throws IOException, FHIRFormatError {
17261    parseBackboneElementProperties(json, res);
17262    if (json.has("code")) {
17263      JsonArray array = json.getAsJsonArray("code");
17264      for (int i = 0; i < array.size(); i++) {
17265        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17266      }
17267    };
17268    if (json.has("stratum")) {
17269      JsonArray array = json.getAsJsonArray("stratum");
17270      for (int i = 0; i < array.size(); i++) {
17271        res.getStratum().add(parseMeasureReportStratifierGroupComponent(array.get(i).getAsJsonObject()));
17272      }
17273    };
17274  }
17275
17276  protected MeasureReport.StratifierGroupComponent parseMeasureReportStratifierGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
17277    MeasureReport.StratifierGroupComponent res = new MeasureReport.StratifierGroupComponent();
17278    parseMeasureReportStratifierGroupComponentProperties(json, res);
17279    return res;
17280  }
17281
17282  protected void parseMeasureReportStratifierGroupComponentProperties(JsonObject json, MeasureReport.StratifierGroupComponent res) throws IOException, FHIRFormatError {
17283    parseBackboneElementProperties(json, res);
17284    if (json.has("value"))
17285      res.setValue(parseCodeableConcept(json.getAsJsonObject("value")));
17286    if (json.has("component")) {
17287      JsonArray array = json.getAsJsonArray("component");
17288      for (int i = 0; i < array.size(); i++) {
17289        res.getComponent().add(parseMeasureReportStratifierGroupComponentComponent(array.get(i).getAsJsonObject()));
17290      }
17291    };
17292    if (json.has("population")) {
17293      JsonArray array = json.getAsJsonArray("population");
17294      for (int i = 0; i < array.size(); i++) {
17295        res.getPopulation().add(parseMeasureReportStratifierGroupPopulationComponent(array.get(i).getAsJsonObject()));
17296      }
17297    };
17298    if (json.has("measureScore"))
17299      res.setMeasureScore(parseQuantity(json.getAsJsonObject("measureScore")));
17300  }
17301
17302  protected MeasureReport.StratifierGroupComponentComponent parseMeasureReportStratifierGroupComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
17303    MeasureReport.StratifierGroupComponentComponent res = new MeasureReport.StratifierGroupComponentComponent();
17304    parseMeasureReportStratifierGroupComponentComponentProperties(json, res);
17305    return res;
17306  }
17307
17308  protected void parseMeasureReportStratifierGroupComponentComponentProperties(JsonObject json, MeasureReport.StratifierGroupComponentComponent res) throws IOException, FHIRFormatError {
17309    parseBackboneElementProperties(json, res);
17310    if (json.has("code"))
17311      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17312    if (json.has("value"))
17313      res.setValue(parseCodeableConcept(json.getAsJsonObject("value")));
17314  }
17315
17316  protected MeasureReport.StratifierGroupPopulationComponent parseMeasureReportStratifierGroupPopulationComponent(JsonObject json) throws IOException, FHIRFormatError {
17317    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
17318    parseMeasureReportStratifierGroupPopulationComponentProperties(json, res);
17319    return res;
17320  }
17321
17322  protected void parseMeasureReportStratifierGroupPopulationComponentProperties(JsonObject json, MeasureReport.StratifierGroupPopulationComponent res) throws IOException, FHIRFormatError {
17323    parseBackboneElementProperties(json, res);
17324    if (json.has("code"))
17325      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17326    if (json.has("count"))
17327      res.setCountElement(parseInteger(json.get("count").getAsLong()));
17328    if (json.has("_count"))
17329      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
17330    if (json.has("subjectResults"))
17331      res.setSubjectResults(parseReference(json.getAsJsonObject("subjectResults")));
17332  }
17333
17334  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
17335    Medication res = new Medication();
17336    parseMedicationProperties(json, res);
17337    return res;
17338  }
17339
17340  protected void parseMedicationProperties(JsonObject json, Medication res) throws IOException, FHIRFormatError {
17341    parseDomainResourceProperties(json, res);
17342    if (json.has("identifier")) {
17343      JsonArray array = json.getAsJsonArray("identifier");
17344      for (int i = 0; i < array.size(); i++) {
17345        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17346      }
17347    };
17348    if (json.has("code"))
17349      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17350    if (json.has("status"))
17351      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Medication.MedicationStatusCodes.NULL, new Medication.MedicationStatusCodesEnumFactory()));
17352    if (json.has("_status"))
17353      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17354    if (json.has("manufacturer"))
17355      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
17356    if (json.has("doseForm"))
17357      res.setDoseForm(parseCodeableConcept(json.getAsJsonObject("doseForm")));
17358    if (json.has("amount"))
17359      res.setAmount(parseRatio(json.getAsJsonObject("amount")));
17360    if (json.has("ingredient")) {
17361      JsonArray array = json.getAsJsonArray("ingredient");
17362      for (int i = 0; i < array.size(); i++) {
17363        res.getIngredient().add(parseMedicationIngredientComponent(array.get(i).getAsJsonObject()));
17364      }
17365    };
17366    if (json.has("batch"))
17367      res.setBatch(parseMedicationBatchComponent(json.getAsJsonObject("batch")));
17368  }
17369
17370  protected Medication.MedicationIngredientComponent parseMedicationIngredientComponent(JsonObject json) throws IOException, FHIRFormatError {
17371    Medication.MedicationIngredientComponent res = new Medication.MedicationIngredientComponent();
17372    parseMedicationIngredientComponentProperties(json, res);
17373    return res;
17374  }
17375
17376  protected void parseMedicationIngredientComponentProperties(JsonObject json, Medication.MedicationIngredientComponent res) throws IOException, FHIRFormatError {
17377    parseBackboneElementProperties(json, res);
17378    DataType item = parseType("item", json);
17379    if (item != null)
17380      res.setItem(item);
17381    if (json.has("isActive"))
17382      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
17383    if (json.has("_isActive"))
17384      parseElementProperties(json.getAsJsonObject("_isActive"), res.getIsActiveElement());
17385    DataType strength = parseType("strength", json);
17386    if (strength != null)
17387      res.setStrength(strength);
17388  }
17389
17390  protected Medication.MedicationBatchComponent parseMedicationBatchComponent(JsonObject json) throws IOException, FHIRFormatError {
17391    Medication.MedicationBatchComponent res = new Medication.MedicationBatchComponent();
17392    parseMedicationBatchComponentProperties(json, res);
17393    return res;
17394  }
17395
17396  protected void parseMedicationBatchComponentProperties(JsonObject json, Medication.MedicationBatchComponent res) throws IOException, FHIRFormatError {
17397    parseBackboneElementProperties(json, res);
17398    if (json.has("lotNumber"))
17399      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
17400    if (json.has("_lotNumber"))
17401      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
17402    if (json.has("expirationDate"))
17403      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
17404    if (json.has("_expirationDate"))
17405      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
17406  }
17407
17408  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
17409    MedicationAdministration res = new MedicationAdministration();
17410    parseMedicationAdministrationProperties(json, res);
17411    return res;
17412  }
17413
17414  protected void parseMedicationAdministrationProperties(JsonObject json, MedicationAdministration res) throws IOException, FHIRFormatError {
17415    parseDomainResourceProperties(json, res);
17416    if (json.has("identifier")) {
17417      JsonArray array = json.getAsJsonArray("identifier");
17418      for (int i = 0; i < array.size(); i++) {
17419        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17420      }
17421    };
17422    if (json.has("instantiatesCanonical")) {
17423      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
17424      for (int i = 0; i < array.size(); i++) {
17425        if (array.get(i).isJsonNull()) {
17426          res.getInstantiatesCanonical().add(new CanonicalType());
17427        } else {;
17428          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
17429        }
17430      }
17431    };
17432    if (json.has("_instantiatesCanonical")) {
17433      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
17434      for (int i = 0; i < array.size(); i++) {
17435        if (i == res.getInstantiatesCanonical().size())
17436          res.getInstantiatesCanonical().add(parseCanonical(null));
17437        if (array.get(i) instanceof JsonObject) 
17438          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
17439      }
17440    };
17441    if (json.has("instantiatesUri")) {
17442      JsonArray array = json.getAsJsonArray("instantiatesUri");
17443      for (int i = 0; i < array.size(); i++) {
17444        if (array.get(i).isJsonNull()) {
17445          res.getInstantiatesUri().add(new UriType());
17446        } else {;
17447          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
17448        }
17449      }
17450    };
17451    if (json.has("_instantiatesUri")) {
17452      JsonArray array = json.getAsJsonArray("_instantiatesUri");
17453      for (int i = 0; i < array.size(); i++) {
17454        if (i == res.getInstantiatesUri().size())
17455          res.getInstantiatesUri().add(parseUri(null));
17456        if (array.get(i) instanceof JsonObject) 
17457          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
17458      }
17459    };
17460    if (json.has("basedOn")) {
17461      JsonArray array = json.getAsJsonArray("basedOn");
17462      for (int i = 0; i < array.size(); i++) {
17463        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
17464      }
17465    };
17466    if (json.has("partOf")) {
17467      JsonArray array = json.getAsJsonArray("partOf");
17468      for (int i = 0; i < array.size(); i++) {
17469        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
17470      }
17471    };
17472    if (json.has("status"))
17473      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationAdministration.MedicationAdministrationStatusCodes.NULL, new MedicationAdministration.MedicationAdministrationStatusCodesEnumFactory()));
17474    if (json.has("_status"))
17475      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17476    if (json.has("statusReason")) {
17477      JsonArray array = json.getAsJsonArray("statusReason");
17478      for (int i = 0; i < array.size(); i++) {
17479        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17480      }
17481    };
17482    if (json.has("category")) {
17483      JsonArray array = json.getAsJsonArray("category");
17484      for (int i = 0; i < array.size(); i++) {
17485        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17486      }
17487    };
17488    DataType medication = parseType("medication", json);
17489    if (medication != null)
17490      res.setMedication(medication);
17491    if (json.has("subject"))
17492      res.setSubject(parseReference(json.getAsJsonObject("subject")));
17493    if (json.has("encounter"))
17494      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
17495    if (json.has("supportingInformation")) {
17496      JsonArray array = json.getAsJsonArray("supportingInformation");
17497      for (int i = 0; i < array.size(); i++) {
17498        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
17499      }
17500    };
17501    DataType occurence = parseType("occurence", json);
17502    if (occurence != null)
17503      res.setOccurence(occurence);
17504    if (json.has("recorded"))
17505      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
17506    if (json.has("_recorded"))
17507      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
17508    if (json.has("performer")) {
17509      JsonArray array = json.getAsJsonArray("performer");
17510      for (int i = 0; i < array.size(); i++) {
17511        res.getPerformer().add(parseMedicationAdministrationPerformerComponent(array.get(i).getAsJsonObject()));
17512      }
17513    };
17514    if (json.has("reason")) {
17515      JsonArray array = json.getAsJsonArray("reason");
17516      for (int i = 0; i < array.size(); i++) {
17517        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
17518      }
17519    };
17520    if (json.has("request"))
17521      res.setRequest(parseReference(json.getAsJsonObject("request")));
17522    if (json.has("device")) {
17523      JsonArray array = json.getAsJsonArray("device");
17524      for (int i = 0; i < array.size(); i++) {
17525        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
17526      }
17527    };
17528    if (json.has("note")) {
17529      JsonArray array = json.getAsJsonArray("note");
17530      for (int i = 0; i < array.size(); i++) {
17531        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17532      }
17533    };
17534    if (json.has("dosage"))
17535      res.setDosage(parseMedicationAdministrationDosageComponent(json.getAsJsonObject("dosage")));
17536    if (json.has("eventHistory")) {
17537      JsonArray array = json.getAsJsonArray("eventHistory");
17538      for (int i = 0; i < array.size(); i++) {
17539        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
17540      }
17541    };
17542  }
17543
17544  protected MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationPerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
17545    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
17546    parseMedicationAdministrationPerformerComponentProperties(json, res);
17547    return res;
17548  }
17549
17550  protected void parseMedicationAdministrationPerformerComponentProperties(JsonObject json, MedicationAdministration.MedicationAdministrationPerformerComponent res) throws IOException, FHIRFormatError {
17551    parseBackboneElementProperties(json, res);
17552    if (json.has("function"))
17553      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
17554    if (json.has("actor"))
17555      res.setActor(parseReference(json.getAsJsonObject("actor")));
17556  }
17557
17558  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationDosageComponent(JsonObject json) throws IOException, FHIRFormatError {
17559    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
17560    parseMedicationAdministrationDosageComponentProperties(json, res);
17561    return res;
17562  }
17563
17564  protected void parseMedicationAdministrationDosageComponentProperties(JsonObject json, MedicationAdministration.MedicationAdministrationDosageComponent res) throws IOException, FHIRFormatError {
17565    parseBackboneElementProperties(json, res);
17566    if (json.has("text"))
17567      res.setTextElement(parseString(json.get("text").getAsString()));
17568    if (json.has("_text"))
17569      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
17570    if (json.has("site"))
17571      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
17572    if (json.has("route"))
17573      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
17574    if (json.has("method"))
17575      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
17576    if (json.has("dose"))
17577      res.setDose(parseQuantity(json.getAsJsonObject("dose")));
17578    DataType rate = parseType("rate", json);
17579    if (rate != null)
17580      res.setRate(rate);
17581  }
17582
17583  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
17584    MedicationDispense res = new MedicationDispense();
17585    parseMedicationDispenseProperties(json, res);
17586    return res;
17587  }
17588
17589  protected void parseMedicationDispenseProperties(JsonObject json, MedicationDispense res) throws IOException, FHIRFormatError {
17590    parseDomainResourceProperties(json, res);
17591    if (json.has("identifier")) {
17592      JsonArray array = json.getAsJsonArray("identifier");
17593      for (int i = 0; i < array.size(); i++) {
17594        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17595      }
17596    };
17597    if (json.has("basedOn")) {
17598      JsonArray array = json.getAsJsonArray("basedOn");
17599      for (int i = 0; i < array.size(); i++) {
17600        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
17601      }
17602    };
17603    if (json.has("partOf")) {
17604      JsonArray array = json.getAsJsonArray("partOf");
17605      for (int i = 0; i < array.size(); i++) {
17606        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
17607      }
17608    };
17609    if (json.has("status"))
17610      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationDispense.MedicationDispenseStatusCodes.NULL, new MedicationDispense.MedicationDispenseStatusCodesEnumFactory()));
17611    if (json.has("_status"))
17612      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17613    DataType statusReason = parseType("statusReason", json);
17614    if (statusReason != null)
17615      res.setStatusReason(statusReason);
17616    if (json.has("category")) {
17617      JsonArray array = json.getAsJsonArray("category");
17618      for (int i = 0; i < array.size(); i++) {
17619        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17620      }
17621    };
17622    DataType medication = parseType("medication", json);
17623    if (medication != null)
17624      res.setMedication(medication);
17625    if (json.has("subject"))
17626      res.setSubject(parseReference(json.getAsJsonObject("subject")));
17627    if (json.has("encounter"))
17628      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
17629    if (json.has("supportingInformation")) {
17630      JsonArray array = json.getAsJsonArray("supportingInformation");
17631      for (int i = 0; i < array.size(); i++) {
17632        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
17633      }
17634    };
17635    if (json.has("performer")) {
17636      JsonArray array = json.getAsJsonArray("performer");
17637      for (int i = 0; i < array.size(); i++) {
17638        res.getPerformer().add(parseMedicationDispensePerformerComponent(array.get(i).getAsJsonObject()));
17639      }
17640    };
17641    if (json.has("location"))
17642      res.setLocation(parseReference(json.getAsJsonObject("location")));
17643    if (json.has("authorizingPrescription")) {
17644      JsonArray array = json.getAsJsonArray("authorizingPrescription");
17645      for (int i = 0; i < array.size(); i++) {
17646        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
17647      }
17648    };
17649    if (json.has("type"))
17650      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17651    if (json.has("quantity"))
17652      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17653    if (json.has("daysSupply"))
17654      res.setDaysSupply(parseQuantity(json.getAsJsonObject("daysSupply")));
17655    if (json.has("whenPrepared"))
17656      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
17657    if (json.has("_whenPrepared"))
17658      parseElementProperties(json.getAsJsonObject("_whenPrepared"), res.getWhenPreparedElement());
17659    if (json.has("whenHandedOver"))
17660      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
17661    if (json.has("_whenHandedOver"))
17662      parseElementProperties(json.getAsJsonObject("_whenHandedOver"), res.getWhenHandedOverElement());
17663    if (json.has("destination"))
17664      res.setDestination(parseReference(json.getAsJsonObject("destination")));
17665    if (json.has("receiver")) {
17666      JsonArray array = json.getAsJsonArray("receiver");
17667      for (int i = 0; i < array.size(); i++) {
17668        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
17669      }
17670    };
17671    if (json.has("note")) {
17672      JsonArray array = json.getAsJsonArray("note");
17673      for (int i = 0; i < array.size(); i++) {
17674        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17675      }
17676    };
17677    if (json.has("renderedDosageInstruction"))
17678      res.setRenderedDosageInstructionElement(parseString(json.get("renderedDosageInstruction").getAsString()));
17679    if (json.has("_renderedDosageInstruction"))
17680      parseElementProperties(json.getAsJsonObject("_renderedDosageInstruction"), res.getRenderedDosageInstructionElement());
17681    if (json.has("dosageInstruction")) {
17682      JsonArray array = json.getAsJsonArray("dosageInstruction");
17683      for (int i = 0; i < array.size(); i++) {
17684        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
17685      }
17686    };
17687    if (json.has("substitution"))
17688      res.setSubstitution(parseMedicationDispenseSubstitutionComponent(json.getAsJsonObject("substitution")));
17689    if (json.has("detectedIssue")) {
17690      JsonArray array = json.getAsJsonArray("detectedIssue");
17691      for (int i = 0; i < array.size(); i++) {
17692        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
17693      }
17694    };
17695    if (json.has("eventHistory")) {
17696      JsonArray array = json.getAsJsonArray("eventHistory");
17697      for (int i = 0; i < array.size(); i++) {
17698        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
17699      }
17700    };
17701  }
17702
17703  protected MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispensePerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
17704    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
17705    parseMedicationDispensePerformerComponentProperties(json, res);
17706    return res;
17707  }
17708
17709  protected void parseMedicationDispensePerformerComponentProperties(JsonObject json, MedicationDispense.MedicationDispensePerformerComponent res) throws IOException, FHIRFormatError {
17710    parseBackboneElementProperties(json, res);
17711    if (json.has("function"))
17712      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
17713    if (json.has("actor"))
17714      res.setActor(parseReference(json.getAsJsonObject("actor")));
17715  }
17716
17717  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseSubstitutionComponent(JsonObject json) throws IOException, FHIRFormatError {
17718    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
17719    parseMedicationDispenseSubstitutionComponentProperties(json, res);
17720    return res;
17721  }
17722
17723  protected void parseMedicationDispenseSubstitutionComponentProperties(JsonObject json, MedicationDispense.MedicationDispenseSubstitutionComponent res) throws IOException, FHIRFormatError {
17724    parseBackboneElementProperties(json, res);
17725    if (json.has("wasSubstituted"))
17726      res.setWasSubstitutedElement(parseBoolean(json.get("wasSubstituted").getAsBoolean()));
17727    if (json.has("_wasSubstituted"))
17728      parseElementProperties(json.getAsJsonObject("_wasSubstituted"), res.getWasSubstitutedElement());
17729    if (json.has("type"))
17730      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17731    if (json.has("reason")) {
17732      JsonArray array = json.getAsJsonArray("reason");
17733      for (int i = 0; i < array.size(); i++) {
17734        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17735      }
17736    };
17737    if (json.has("responsibleParty"))
17738      res.setResponsibleParty(parseReference(json.getAsJsonObject("responsibleParty")));
17739  }
17740
17741  protected MedicationKnowledge parseMedicationKnowledge(JsonObject json) throws IOException, FHIRFormatError {
17742    MedicationKnowledge res = new MedicationKnowledge();
17743    parseMedicationKnowledgeProperties(json, res);
17744    return res;
17745  }
17746
17747  protected void parseMedicationKnowledgeProperties(JsonObject json, MedicationKnowledge res) throws IOException, FHIRFormatError {
17748    parseDomainResourceProperties(json, res);
17749    if (json.has("identifier")) {
17750      JsonArray array = json.getAsJsonArray("identifier");
17751      for (int i = 0; i < array.size(); i++) {
17752        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17753      }
17754    };
17755    if (json.has("code"))
17756      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17757    if (json.has("status"))
17758      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationKnowledge.MedicationKnowledgeStatusCodes.NULL, new MedicationKnowledge.MedicationKnowledgeStatusCodesEnumFactory()));
17759    if (json.has("_status"))
17760      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17761    if (json.has("manufacturer"))
17762      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
17763    if (json.has("doseForm"))
17764      res.setDoseForm(parseCodeableConcept(json.getAsJsonObject("doseForm")));
17765    if (json.has("amount"))
17766      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
17767    if (json.has("synonym")) {
17768      JsonArray array = json.getAsJsonArray("synonym");
17769      for (int i = 0; i < array.size(); i++) {
17770        if (array.get(i).isJsonNull()) {
17771          res.getSynonym().add(new StringType());
17772        } else {;
17773          res.getSynonym().add(parseString(array.get(i).getAsString()));
17774        }
17775      }
17776    };
17777    if (json.has("_synonym")) {
17778      JsonArray array = json.getAsJsonArray("_synonym");
17779      for (int i = 0; i < array.size(); i++) {
17780        if (i == res.getSynonym().size())
17781          res.getSynonym().add(parseString(null));
17782        if (array.get(i) instanceof JsonObject) 
17783          parseElementProperties(array.get(i).getAsJsonObject(), res.getSynonym().get(i));
17784      }
17785    };
17786    if (json.has("relatedMedicationKnowledge")) {
17787      JsonArray array = json.getAsJsonArray("relatedMedicationKnowledge");
17788      for (int i = 0; i < array.size(); i++) {
17789        res.getRelatedMedicationKnowledge().add(parseMedicationKnowledgeRelatedMedicationKnowledgeComponent(array.get(i).getAsJsonObject()));
17790      }
17791    };
17792    if (json.has("associatedMedication")) {
17793      JsonArray array = json.getAsJsonArray("associatedMedication");
17794      for (int i = 0; i < array.size(); i++) {
17795        res.getAssociatedMedication().add(parseReference(array.get(i).getAsJsonObject()));
17796      }
17797    };
17798    if (json.has("productType")) {
17799      JsonArray array = json.getAsJsonArray("productType");
17800      for (int i = 0; i < array.size(); i++) {
17801        res.getProductType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17802      }
17803    };
17804    if (json.has("monograph")) {
17805      JsonArray array = json.getAsJsonArray("monograph");
17806      for (int i = 0; i < array.size(); i++) {
17807        res.getMonograph().add(parseMedicationKnowledgeMonographComponent(array.get(i).getAsJsonObject()));
17808      }
17809    };
17810    if (json.has("ingredient")) {
17811      JsonArray array = json.getAsJsonArray("ingredient");
17812      for (int i = 0; i < array.size(); i++) {
17813        res.getIngredient().add(parseMedicationKnowledgeIngredientComponent(array.get(i).getAsJsonObject()));
17814      }
17815    };
17816    if (json.has("device")) {
17817      JsonArray array = json.getAsJsonArray("device");
17818      for (int i = 0; i < array.size(); i++) {
17819        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
17820      }
17821    };
17822    if (json.has("preparationInstruction"))
17823      res.setPreparationInstructionElement(parseMarkdown(json.get("preparationInstruction").getAsString()));
17824    if (json.has("_preparationInstruction"))
17825      parseElementProperties(json.getAsJsonObject("_preparationInstruction"), res.getPreparationInstructionElement());
17826    if (json.has("intendedRoute")) {
17827      JsonArray array = json.getAsJsonArray("intendedRoute");
17828      for (int i = 0; i < array.size(); i++) {
17829        res.getIntendedRoute().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17830      }
17831    };
17832    if (json.has("cost")) {
17833      JsonArray array = json.getAsJsonArray("cost");
17834      for (int i = 0; i < array.size(); i++) {
17835        res.getCost().add(parseMedicationKnowledgeCostComponent(array.get(i).getAsJsonObject()));
17836      }
17837    };
17838    if (json.has("monitoringProgram")) {
17839      JsonArray array = json.getAsJsonArray("monitoringProgram");
17840      for (int i = 0; i < array.size(); i++) {
17841        res.getMonitoringProgram().add(parseMedicationKnowledgeMonitoringProgramComponent(array.get(i).getAsJsonObject()));
17842      }
17843    };
17844    if (json.has("administrationGuideline")) {
17845      JsonArray array = json.getAsJsonArray("administrationGuideline");
17846      for (int i = 0; i < array.size(); i++) {
17847        res.getAdministrationGuideline().add(parseMedicationKnowledgeAdministrationGuidelineComponent(array.get(i).getAsJsonObject()));
17848      }
17849    };
17850    if (json.has("medicineClassification")) {
17851      JsonArray array = json.getAsJsonArray("medicineClassification");
17852      for (int i = 0; i < array.size(); i++) {
17853        res.getMedicineClassification().add(parseMedicationKnowledgeMedicineClassificationComponent(array.get(i).getAsJsonObject()));
17854      }
17855    };
17856    if (json.has("packaging"))
17857      res.setPackaging(parseMedicationKnowledgePackagingComponent(json.getAsJsonObject("packaging")));
17858    if (json.has("drugCharacteristic")) {
17859      JsonArray array = json.getAsJsonArray("drugCharacteristic");
17860      for (int i = 0; i < array.size(); i++) {
17861        res.getDrugCharacteristic().add(parseMedicationKnowledgeDrugCharacteristicComponent(array.get(i).getAsJsonObject()));
17862      }
17863    };
17864    if (json.has("clinicalUseIssue")) {
17865      JsonArray array = json.getAsJsonArray("clinicalUseIssue");
17866      for (int i = 0; i < array.size(); i++) {
17867        res.getClinicalUseIssue().add(parseReference(array.get(i).getAsJsonObject()));
17868      }
17869    };
17870    if (json.has("regulatory")) {
17871      JsonArray array = json.getAsJsonArray("regulatory");
17872      for (int i = 0; i < array.size(); i++) {
17873        res.getRegulatory().add(parseMedicationKnowledgeRegulatoryComponent(array.get(i).getAsJsonObject()));
17874      }
17875    };
17876    if (json.has("kineticCharacteristic")) {
17877      JsonArray array = json.getAsJsonArray("kineticCharacteristic");
17878      for (int i = 0; i < array.size(); i++) {
17879        res.getKineticCharacteristic().add(parseMedicationKnowledgeKineticCharacteristicComponent(array.get(i).getAsJsonObject()));
17880      }
17881    };
17882  }
17883
17884  protected MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent parseMedicationKnowledgeRelatedMedicationKnowledgeComponent(JsonObject json) throws IOException, FHIRFormatError {
17885    MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res = new MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent();
17886    parseMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(json, res);
17887    return res;
17888  }
17889
17890  protected void parseMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res) throws IOException, FHIRFormatError {
17891    parseBackboneElementProperties(json, res);
17892    if (json.has("type"))
17893      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17894    if (json.has("reference")) {
17895      JsonArray array = json.getAsJsonArray("reference");
17896      for (int i = 0; i < array.size(); i++) {
17897        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
17898      }
17899    };
17900  }
17901
17902  protected MedicationKnowledge.MedicationKnowledgeMonographComponent parseMedicationKnowledgeMonographComponent(JsonObject json) throws IOException, FHIRFormatError {
17903    MedicationKnowledge.MedicationKnowledgeMonographComponent res = new MedicationKnowledge.MedicationKnowledgeMonographComponent();
17904    parseMedicationKnowledgeMonographComponentProperties(json, res);
17905    return res;
17906  }
17907
17908  protected void parseMedicationKnowledgeMonographComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeMonographComponent res) throws IOException, FHIRFormatError {
17909    parseBackboneElementProperties(json, res);
17910    if (json.has("type"))
17911      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17912    if (json.has("source"))
17913      res.setSource(parseReference(json.getAsJsonObject("source")));
17914  }
17915
17916  protected MedicationKnowledge.MedicationKnowledgeIngredientComponent parseMedicationKnowledgeIngredientComponent(JsonObject json) throws IOException, FHIRFormatError {
17917    MedicationKnowledge.MedicationKnowledgeIngredientComponent res = new MedicationKnowledge.MedicationKnowledgeIngredientComponent();
17918    parseMedicationKnowledgeIngredientComponentProperties(json, res);
17919    return res;
17920  }
17921
17922  protected void parseMedicationKnowledgeIngredientComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeIngredientComponent res) throws IOException, FHIRFormatError {
17923    parseBackboneElementProperties(json, res);
17924    DataType item = parseType("item", json);
17925    if (item != null)
17926      res.setItem(item);
17927    if (json.has("isActive"))
17928      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
17929    if (json.has("_isActive"))
17930      parseElementProperties(json.getAsJsonObject("_isActive"), res.getIsActiveElement());
17931    DataType strength = parseType("strength", json);
17932    if (strength != null)
17933      res.setStrength(strength);
17934  }
17935
17936  protected MedicationKnowledge.MedicationKnowledgeCostComponent parseMedicationKnowledgeCostComponent(JsonObject json) throws IOException, FHIRFormatError {
17937    MedicationKnowledge.MedicationKnowledgeCostComponent res = new MedicationKnowledge.MedicationKnowledgeCostComponent();
17938    parseMedicationKnowledgeCostComponentProperties(json, res);
17939    return res;
17940  }
17941
17942  protected void parseMedicationKnowledgeCostComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeCostComponent res) throws IOException, FHIRFormatError {
17943    parseBackboneElementProperties(json, res);
17944    if (json.has("type"))
17945      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17946    if (json.has("source"))
17947      res.setSourceElement(parseString(json.get("source").getAsString()));
17948    if (json.has("_source"))
17949      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
17950    if (json.has("cost"))
17951      res.setCost(parseMoney(json.getAsJsonObject("cost")));
17952  }
17953
17954  protected MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent parseMedicationKnowledgeMonitoringProgramComponent(JsonObject json) throws IOException, FHIRFormatError {
17955    MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res = new MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent();
17956    parseMedicationKnowledgeMonitoringProgramComponentProperties(json, res);
17957    return res;
17958  }
17959
17960  protected void parseMedicationKnowledgeMonitoringProgramComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res) throws IOException, FHIRFormatError {
17961    parseBackboneElementProperties(json, res);
17962    if (json.has("type"))
17963      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17964    if (json.has("name"))
17965      res.setNameElement(parseString(json.get("name").getAsString()));
17966    if (json.has("_name"))
17967      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17968  }
17969
17970  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent parseMedicationKnowledgeAdministrationGuidelineComponent(JsonObject json) throws IOException, FHIRFormatError {
17971    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent();
17972    parseMedicationKnowledgeAdministrationGuidelineComponentProperties(json, res);
17973    return res;
17974  }
17975
17976  protected void parseMedicationKnowledgeAdministrationGuidelineComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent res) throws IOException, FHIRFormatError {
17977    parseBackboneElementProperties(json, res);
17978    if (json.has("dosage")) {
17979      JsonArray array = json.getAsJsonArray("dosage");
17980      for (int i = 0; i < array.size(); i++) {
17981        res.getDosage().add(parseMedicationKnowledgeAdministrationGuidelineDosageComponent(array.get(i).getAsJsonObject()));
17982      }
17983    };
17984    DataType indication = parseType("indication", json);
17985    if (indication != null)
17986      res.setIndication(indication);
17987    if (json.has("patientCharacteristic")) {
17988      JsonArray array = json.getAsJsonArray("patientCharacteristic");
17989      for (int i = 0; i < array.size(); i++) {
17990        res.getPatientCharacteristic().add(parseMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent(array.get(i).getAsJsonObject()));
17991      }
17992    };
17993  }
17994
17995  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent parseMedicationKnowledgeAdministrationGuidelineDosageComponent(JsonObject json) throws IOException, FHIRFormatError {
17996    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent();
17997    parseMedicationKnowledgeAdministrationGuidelineDosageComponentProperties(json, res);
17998    return res;
17999  }
18000
18001  protected void parseMedicationKnowledgeAdministrationGuidelineDosageComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent res) throws IOException, FHIRFormatError {
18002    parseBackboneElementProperties(json, res);
18003    if (json.has("type"))
18004      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18005    if (json.has("dosage")) {
18006      JsonArray array = json.getAsJsonArray("dosage");
18007      for (int i = 0; i < array.size(); i++) {
18008        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
18009      }
18010    };
18011  }
18012
18013  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent parseMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
18014    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent();
18015    parseMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponentProperties(json, res);
18016    return res;
18017  }
18018
18019  protected void parseMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent res) throws IOException, FHIRFormatError {
18020    parseBackboneElementProperties(json, res);
18021    DataType characteristic = parseType("characteristic", json);
18022    if (characteristic != null)
18023      res.setCharacteristic(characteristic);
18024    if (json.has("value")) {
18025      JsonArray array = json.getAsJsonArray("value");
18026      for (int i = 0; i < array.size(); i++) {
18027        if (array.get(i).isJsonNull()) {
18028          res.getValue().add(new StringType());
18029        } else {;
18030          res.getValue().add(parseString(array.get(i).getAsString()));
18031        }
18032      }
18033    };
18034    if (json.has("_value")) {
18035      JsonArray array = json.getAsJsonArray("_value");
18036      for (int i = 0; i < array.size(); i++) {
18037        if (i == res.getValue().size())
18038          res.getValue().add(parseString(null));
18039        if (array.get(i) instanceof JsonObject) 
18040          parseElementProperties(array.get(i).getAsJsonObject(), res.getValue().get(i));
18041      }
18042    };
18043  }
18044
18045  protected MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent parseMedicationKnowledgeMedicineClassificationComponent(JsonObject json) throws IOException, FHIRFormatError {
18046    MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res = new MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent();
18047    parseMedicationKnowledgeMedicineClassificationComponentProperties(json, res);
18048    return res;
18049  }
18050
18051  protected void parseMedicationKnowledgeMedicineClassificationComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res) throws IOException, FHIRFormatError {
18052    parseBackboneElementProperties(json, res);
18053    if (json.has("type"))
18054      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18055    if (json.has("classification")) {
18056      JsonArray array = json.getAsJsonArray("classification");
18057      for (int i = 0; i < array.size(); i++) {
18058        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18059      }
18060    };
18061  }
18062
18063  protected MedicationKnowledge.MedicationKnowledgePackagingComponent parseMedicationKnowledgePackagingComponent(JsonObject json) throws IOException, FHIRFormatError {
18064    MedicationKnowledge.MedicationKnowledgePackagingComponent res = new MedicationKnowledge.MedicationKnowledgePackagingComponent();
18065    parseMedicationKnowledgePackagingComponentProperties(json, res);
18066    return res;
18067  }
18068
18069  protected void parseMedicationKnowledgePackagingComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgePackagingComponent res) throws IOException, FHIRFormatError {
18070    parseBackboneElementProperties(json, res);
18071    if (json.has("type"))
18072      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18073    if (json.has("quantity"))
18074      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
18075    if (json.has("device"))
18076      res.setDevice(parseReference(json.getAsJsonObject("device")));
18077    if (json.has("material"))
18078      res.setMaterial(parseCodeableConcept(json.getAsJsonObject("material")));
18079    if (json.has("packaging")) {
18080      JsonArray array = json.getAsJsonArray("packaging");
18081      for (int i = 0; i < array.size(); i++) {
18082        res.getPackaging().add(parseMedicationKnowledgePackagingComponent(array.get(i).getAsJsonObject()));
18083      }
18084    };
18085  }
18086
18087  protected MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent parseMedicationKnowledgeDrugCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
18088    MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent();
18089    parseMedicationKnowledgeDrugCharacteristicComponentProperties(json, res);
18090    return res;
18091  }
18092
18093  protected void parseMedicationKnowledgeDrugCharacteristicComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res) throws IOException, FHIRFormatError {
18094    parseBackboneElementProperties(json, res);
18095    if (json.has("type"))
18096      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18097    DataType value = parseType("value", json);
18098    if (value != null)
18099      res.setValue(value);
18100  }
18101
18102  protected MedicationKnowledge.MedicationKnowledgeRegulatoryComponent parseMedicationKnowledgeRegulatoryComponent(JsonObject json) throws IOException, FHIRFormatError {
18103    MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryComponent();
18104    parseMedicationKnowledgeRegulatoryComponentProperties(json, res);
18105    return res;
18106  }
18107
18108  protected void parseMedicationKnowledgeRegulatoryComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res) throws IOException, FHIRFormatError {
18109    parseBackboneElementProperties(json, res);
18110    if (json.has("regulatoryAuthority"))
18111      res.setRegulatoryAuthority(parseReference(json.getAsJsonObject("regulatoryAuthority")));
18112    if (json.has("substitution")) {
18113      JsonArray array = json.getAsJsonArray("substitution");
18114      for (int i = 0; i < array.size(); i++) {
18115        res.getSubstitution().add(parseMedicationKnowledgeRegulatorySubstitutionComponent(array.get(i).getAsJsonObject()));
18116      }
18117    };
18118    if (json.has("schedule")) {
18119      JsonArray array = json.getAsJsonArray("schedule");
18120      for (int i = 0; i < array.size(); i++) {
18121        res.getSchedule().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18122      }
18123    };
18124    if (json.has("maxDispense"))
18125      res.setMaxDispense(parseMedicationKnowledgeRegulatoryMaxDispenseComponent(json.getAsJsonObject("maxDispense")));
18126  }
18127
18128  protected MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent parseMedicationKnowledgeRegulatorySubstitutionComponent(JsonObject json) throws IOException, FHIRFormatError {
18129    MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent();
18130    parseMedicationKnowledgeRegulatorySubstitutionComponentProperties(json, res);
18131    return res;
18132  }
18133
18134  protected void parseMedicationKnowledgeRegulatorySubstitutionComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res) throws IOException, FHIRFormatError {
18135    parseBackboneElementProperties(json, res);
18136    if (json.has("type"))
18137      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18138    if (json.has("allowed"))
18139      res.setAllowedElement(parseBoolean(json.get("allowed").getAsBoolean()));
18140    if (json.has("_allowed"))
18141      parseElementProperties(json.getAsJsonObject("_allowed"), res.getAllowedElement());
18142  }
18143
18144  protected MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent parseMedicationKnowledgeRegulatoryMaxDispenseComponent(JsonObject json) throws IOException, FHIRFormatError {
18145    MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent();
18146    parseMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(json, res);
18147    return res;
18148  }
18149
18150  protected void parseMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res) throws IOException, FHIRFormatError {
18151    parseBackboneElementProperties(json, res);
18152    if (json.has("quantity"))
18153      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
18154    if (json.has("period"))
18155      res.setPeriod(parseDuration(json.getAsJsonObject("period")));
18156  }
18157
18158  protected MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent parseMedicationKnowledgeKineticCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
18159    MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent();
18160    parseMedicationKnowledgeKineticCharacteristicComponentProperties(json, res);
18161    return res;
18162  }
18163
18164  protected void parseMedicationKnowledgeKineticCharacteristicComponentProperties(JsonObject json, MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent res) throws IOException, FHIRFormatError {
18165    parseBackboneElementProperties(json, res);
18166    if (json.has("type"))
18167      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18168    DataType value = parseType("value", json);
18169    if (value != null)
18170      res.setValue(value);
18171  }
18172
18173  protected MedicationRequest parseMedicationRequest(JsonObject json) throws IOException, FHIRFormatError {
18174    MedicationRequest res = new MedicationRequest();
18175    parseMedicationRequestProperties(json, res);
18176    return res;
18177  }
18178
18179  protected void parseMedicationRequestProperties(JsonObject json, MedicationRequest res) throws IOException, FHIRFormatError {
18180    parseDomainResourceProperties(json, res);
18181    if (json.has("identifier")) {
18182      JsonArray array = json.getAsJsonArray("identifier");
18183      for (int i = 0; i < array.size(); i++) {
18184        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18185      }
18186    };
18187    if (json.has("status"))
18188      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationRequest.MedicationrequestStatus.NULL, new MedicationRequest.MedicationrequestStatusEnumFactory()));
18189    if (json.has("_status"))
18190      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18191    if (json.has("statusReason"))
18192      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
18193    if (json.has("intent"))
18194      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), MedicationRequest.MedicationRequestIntent.NULL, new MedicationRequest.MedicationRequestIntentEnumFactory()));
18195    if (json.has("_intent"))
18196      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
18197    if (json.has("category")) {
18198      JsonArray array = json.getAsJsonArray("category");
18199      for (int i = 0; i < array.size(); i++) {
18200        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18201      }
18202    };
18203    if (json.has("priority"))
18204      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
18205    if (json.has("_priority"))
18206      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
18207    if (json.has("doNotPerform"))
18208      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
18209    if (json.has("_doNotPerform"))
18210      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
18211    if (json.has("reported"))
18212      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
18213    if (json.has("_reported"))
18214      parseElementProperties(json.getAsJsonObject("_reported"), res.getReportedElement());
18215    if (json.has("informationSource"))
18216      res.setInformationSource(parseReference(json.getAsJsonObject("informationSource")));
18217    DataType medication = parseType("medication", json);
18218    if (medication != null)
18219      res.setMedication(medication);
18220    if (json.has("subject"))
18221      res.setSubject(parseReference(json.getAsJsonObject("subject")));
18222    if (json.has("encounter"))
18223      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
18224    if (json.has("supportingInformation")) {
18225      JsonArray array = json.getAsJsonArray("supportingInformation");
18226      for (int i = 0; i < array.size(); i++) {
18227        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
18228      }
18229    };
18230    if (json.has("authoredOn"))
18231      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
18232    if (json.has("_authoredOn"))
18233      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
18234    if (json.has("requester"))
18235      res.setRequester(parseReference(json.getAsJsonObject("requester")));
18236    if (json.has("performer"))
18237      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
18238    if (json.has("performerType"))
18239      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
18240    if (json.has("recorder"))
18241      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
18242    if (json.has("reason")) {
18243      JsonArray array = json.getAsJsonArray("reason");
18244      for (int i = 0; i < array.size(); i++) {
18245        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
18246      }
18247    };
18248    if (json.has("instantiatesCanonical")) {
18249      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
18250      for (int i = 0; i < array.size(); i++) {
18251        if (array.get(i).isJsonNull()) {
18252          res.getInstantiatesCanonical().add(new CanonicalType());
18253        } else {;
18254          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
18255        }
18256      }
18257    };
18258    if (json.has("_instantiatesCanonical")) {
18259      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
18260      for (int i = 0; i < array.size(); i++) {
18261        if (i == res.getInstantiatesCanonical().size())
18262          res.getInstantiatesCanonical().add(parseCanonical(null));
18263        if (array.get(i) instanceof JsonObject) 
18264          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
18265      }
18266    };
18267    if (json.has("instantiatesUri")) {
18268      JsonArray array = json.getAsJsonArray("instantiatesUri");
18269      for (int i = 0; i < array.size(); i++) {
18270        if (array.get(i).isJsonNull()) {
18271          res.getInstantiatesUri().add(new UriType());
18272        } else {;
18273          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
18274        }
18275      }
18276    };
18277    if (json.has("_instantiatesUri")) {
18278      JsonArray array = json.getAsJsonArray("_instantiatesUri");
18279      for (int i = 0; i < array.size(); i++) {
18280        if (i == res.getInstantiatesUri().size())
18281          res.getInstantiatesUri().add(parseUri(null));
18282        if (array.get(i) instanceof JsonObject) 
18283          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
18284      }
18285    };
18286    if (json.has("basedOn")) {
18287      JsonArray array = json.getAsJsonArray("basedOn");
18288      for (int i = 0; i < array.size(); i++) {
18289        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18290      }
18291    };
18292    if (json.has("groupIdentifier"))
18293      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
18294    if (json.has("courseOfTherapyType"))
18295      res.setCourseOfTherapyType(parseCodeableConcept(json.getAsJsonObject("courseOfTherapyType")));
18296    if (json.has("insurance")) {
18297      JsonArray array = json.getAsJsonArray("insurance");
18298      for (int i = 0; i < array.size(); i++) {
18299        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
18300      }
18301    };
18302    if (json.has("note")) {
18303      JsonArray array = json.getAsJsonArray("note");
18304      for (int i = 0; i < array.size(); i++) {
18305        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18306      }
18307    };
18308    if (json.has("renderedDosageInstruction"))
18309      res.setRenderedDosageInstructionElement(parseString(json.get("renderedDosageInstruction").getAsString()));
18310    if (json.has("_renderedDosageInstruction"))
18311      parseElementProperties(json.getAsJsonObject("_renderedDosageInstruction"), res.getRenderedDosageInstructionElement());
18312    if (json.has("dosageInstruction")) {
18313      JsonArray array = json.getAsJsonArray("dosageInstruction");
18314      for (int i = 0; i < array.size(); i++) {
18315        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
18316      }
18317    };
18318    if (json.has("dispenseRequest"))
18319      res.setDispenseRequest(parseMedicationRequestDispenseRequestComponent(json.getAsJsonObject("dispenseRequest")));
18320    if (json.has("substitution"))
18321      res.setSubstitution(parseMedicationRequestSubstitutionComponent(json.getAsJsonObject("substitution")));
18322    if (json.has("priorPrescription"))
18323      res.setPriorPrescription(parseReference(json.getAsJsonObject("priorPrescription")));
18324    if (json.has("detectedIssue")) {
18325      JsonArray array = json.getAsJsonArray("detectedIssue");
18326      for (int i = 0; i < array.size(); i++) {
18327        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
18328      }
18329    };
18330    if (json.has("eventHistory")) {
18331      JsonArray array = json.getAsJsonArray("eventHistory");
18332      for (int i = 0; i < array.size(); i++) {
18333        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
18334      }
18335    };
18336  }
18337
18338  protected MedicationRequest.MedicationRequestDispenseRequestComponent parseMedicationRequestDispenseRequestComponent(JsonObject json) throws IOException, FHIRFormatError {
18339    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
18340    parseMedicationRequestDispenseRequestComponentProperties(json, res);
18341    return res;
18342  }
18343
18344  protected void parseMedicationRequestDispenseRequestComponentProperties(JsonObject json, MedicationRequest.MedicationRequestDispenseRequestComponent res) throws IOException, FHIRFormatError {
18345    parseBackboneElementProperties(json, res);
18346    if (json.has("initialFill"))
18347      res.setInitialFill(parseMedicationRequestDispenseRequestInitialFillComponent(json.getAsJsonObject("initialFill")));
18348    if (json.has("dispenseInterval"))
18349      res.setDispenseInterval(parseDuration(json.getAsJsonObject("dispenseInterval")));
18350    if (json.has("validityPeriod"))
18351      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
18352    if (json.has("numberOfRepeatsAllowed"))
18353      res.setNumberOfRepeatsAllowedElement(parseUnsignedInt(json.get("numberOfRepeatsAllowed").getAsString()));
18354    if (json.has("_numberOfRepeatsAllowed"))
18355      parseElementProperties(json.getAsJsonObject("_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
18356    if (json.has("quantity"))
18357      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
18358    if (json.has("expectedSupplyDuration"))
18359      res.setExpectedSupplyDuration(parseDuration(json.getAsJsonObject("expectedSupplyDuration")));
18360    if (json.has("dispenser"))
18361      res.setDispenser(parseReference(json.getAsJsonObject("dispenser")));
18362  }
18363
18364  protected MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent parseMedicationRequestDispenseRequestInitialFillComponent(JsonObject json) throws IOException, FHIRFormatError {
18365    MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res = new MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent();
18366    parseMedicationRequestDispenseRequestInitialFillComponentProperties(json, res);
18367    return res;
18368  }
18369
18370  protected void parseMedicationRequestDispenseRequestInitialFillComponentProperties(JsonObject json, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res) throws IOException, FHIRFormatError {
18371    parseBackboneElementProperties(json, res);
18372    if (json.has("quantity"))
18373      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
18374    if (json.has("duration"))
18375      res.setDuration(parseDuration(json.getAsJsonObject("duration")));
18376  }
18377
18378  protected MedicationRequest.MedicationRequestSubstitutionComponent parseMedicationRequestSubstitutionComponent(JsonObject json) throws IOException, FHIRFormatError {
18379    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
18380    parseMedicationRequestSubstitutionComponentProperties(json, res);
18381    return res;
18382  }
18383
18384  protected void parseMedicationRequestSubstitutionComponentProperties(JsonObject json, MedicationRequest.MedicationRequestSubstitutionComponent res) throws IOException, FHIRFormatError {
18385    parseBackboneElementProperties(json, res);
18386    DataType allowed = parseType("allowed", json);
18387    if (allowed != null)
18388      res.setAllowed(allowed);
18389    if (json.has("reason"))
18390      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
18391  }
18392
18393  protected MedicationUsage parseMedicationUsage(JsonObject json) throws IOException, FHIRFormatError {
18394    MedicationUsage res = new MedicationUsage();
18395    parseMedicationUsageProperties(json, res);
18396    return res;
18397  }
18398
18399  protected void parseMedicationUsageProperties(JsonObject json, MedicationUsage res) throws IOException, FHIRFormatError {
18400    parseDomainResourceProperties(json, res);
18401    if (json.has("identifier")) {
18402      JsonArray array = json.getAsJsonArray("identifier");
18403      for (int i = 0; i < array.size(); i++) {
18404        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18405      }
18406    };
18407    if (json.has("basedOn")) {
18408      JsonArray array = json.getAsJsonArray("basedOn");
18409      for (int i = 0; i < array.size(); i++) {
18410        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18411      }
18412    };
18413    if (json.has("partOf")) {
18414      JsonArray array = json.getAsJsonArray("partOf");
18415      for (int i = 0; i < array.size(); i++) {
18416        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
18417      }
18418    };
18419    if (json.has("status"))
18420      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationUsage.MedicationUsageStatusCodes.NULL, new MedicationUsage.MedicationUsageStatusCodesEnumFactory()));
18421    if (json.has("_status"))
18422      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18423    if (json.has("statusReason")) {
18424      JsonArray array = json.getAsJsonArray("statusReason");
18425      for (int i = 0; i < array.size(); i++) {
18426        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18427      }
18428    };
18429    if (json.has("category")) {
18430      JsonArray array = json.getAsJsonArray("category");
18431      for (int i = 0; i < array.size(); i++) {
18432        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18433      }
18434    };
18435    DataType medication = parseType("medication", json);
18436    if (medication != null)
18437      res.setMedication(medication);
18438    if (json.has("subject"))
18439      res.setSubject(parseReference(json.getAsJsonObject("subject")));
18440    if (json.has("encounter"))
18441      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
18442    DataType effective = parseType("effective", json);
18443    if (effective != null)
18444      res.setEffective(effective);
18445    if (json.has("dateAsserted"))
18446      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
18447    if (json.has("_dateAsserted"))
18448      parseElementProperties(json.getAsJsonObject("_dateAsserted"), res.getDateAssertedElement());
18449    if (json.has("informationSource"))
18450      res.setInformationSource(parseReference(json.getAsJsonObject("informationSource")));
18451    if (json.has("derivedFrom")) {
18452      JsonArray array = json.getAsJsonArray("derivedFrom");
18453      for (int i = 0; i < array.size(); i++) {
18454        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
18455      }
18456    };
18457    if (json.has("reason")) {
18458      JsonArray array = json.getAsJsonArray("reason");
18459      for (int i = 0; i < array.size(); i++) {
18460        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
18461      }
18462    };
18463    if (json.has("note")) {
18464      JsonArray array = json.getAsJsonArray("note");
18465      for (int i = 0; i < array.size(); i++) {
18466        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18467      }
18468    };
18469    if (json.has("renderedDosageInstruction"))
18470      res.setRenderedDosageInstructionElement(parseString(json.get("renderedDosageInstruction").getAsString()));
18471    if (json.has("_renderedDosageInstruction"))
18472      parseElementProperties(json.getAsJsonObject("_renderedDosageInstruction"), res.getRenderedDosageInstructionElement());
18473    if (json.has("dosage")) {
18474      JsonArray array = json.getAsJsonArray("dosage");
18475      for (int i = 0; i < array.size(); i++) {
18476        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
18477      }
18478    };
18479    if (json.has("takenAsOrdered"))
18480      res.setTakenAsOrderedElement(parseBoolean(json.get("takenAsOrdered").getAsBoolean()));
18481    if (json.has("_takenAsOrdered"))
18482      parseElementProperties(json.getAsJsonObject("_takenAsOrdered"), res.getTakenAsOrderedElement());
18483  }
18484
18485  protected MedicinalProductDefinition parseMedicinalProductDefinition(JsonObject json) throws IOException, FHIRFormatError {
18486    MedicinalProductDefinition res = new MedicinalProductDefinition();
18487    parseMedicinalProductDefinitionProperties(json, res);
18488    return res;
18489  }
18490
18491  protected void parseMedicinalProductDefinitionProperties(JsonObject json, MedicinalProductDefinition res) throws IOException, FHIRFormatError {
18492    parseDomainResourceProperties(json, res);
18493    if (json.has("identifier")) {
18494      JsonArray array = json.getAsJsonArray("identifier");
18495      for (int i = 0; i < array.size(); i++) {
18496        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18497      }
18498    };
18499    if (json.has("type"))
18500      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18501    if (json.has("domain"))
18502      res.setDomain(parseCoding(json.getAsJsonObject("domain")));
18503    if (json.has("version"))
18504      res.setVersionElement(parseString(json.get("version").getAsString()));
18505    if (json.has("_version"))
18506      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
18507    if (json.has("status"))
18508      res.setStatus(parseCoding(json.getAsJsonObject("status")));
18509    if (json.has("description"))
18510      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18511    if (json.has("_description"))
18512      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18513    if (json.has("combinedPharmaceuticalDoseForm"))
18514      res.setCombinedPharmaceuticalDoseForm(parseCodeableConcept(json.getAsJsonObject("combinedPharmaceuticalDoseForm")));
18515    if (json.has("indication"))
18516      res.setIndicationElement(parseMarkdown(json.get("indication").getAsString()));
18517    if (json.has("_indication"))
18518      parseElementProperties(json.getAsJsonObject("_indication"), res.getIndicationElement());
18519    if (json.has("legalStatusOfSupply"))
18520      res.setLegalStatusOfSupply(parseCodeableConcept(json.getAsJsonObject("legalStatusOfSupply")));
18521    if (json.has("additionalMonitoringIndicator"))
18522      res.setAdditionalMonitoringIndicator(parseCodeableConcept(json.getAsJsonObject("additionalMonitoringIndicator")));
18523    if (json.has("specialMeasures")) {
18524      JsonArray array = json.getAsJsonArray("specialMeasures");
18525      for (int i = 0; i < array.size(); i++) {
18526        res.getSpecialMeasures().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18527      }
18528    };
18529    if (json.has("paediatricUseIndicator"))
18530      res.setPaediatricUseIndicator(parseCodeableConcept(json.getAsJsonObject("paediatricUseIndicator")));
18531    if (json.has("productClassification")) {
18532      JsonArray array = json.getAsJsonArray("productClassification");
18533      for (int i = 0; i < array.size(); i++) {
18534        res.getProductClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18535      }
18536    };
18537    if (json.has("marketingStatus")) {
18538      JsonArray array = json.getAsJsonArray("marketingStatus");
18539      for (int i = 0; i < array.size(); i++) {
18540        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
18541      }
18542    };
18543    if (json.has("pharmaceuticalProduct")) {
18544      JsonArray array = json.getAsJsonArray("pharmaceuticalProduct");
18545      for (int i = 0; i < array.size(); i++) {
18546        res.getPharmaceuticalProduct().add(parseReference(array.get(i).getAsJsonObject()));
18547      }
18548    };
18549    if (json.has("packagedMedicinalProduct")) {
18550      JsonArray array = json.getAsJsonArray("packagedMedicinalProduct");
18551      for (int i = 0; i < array.size(); i++) {
18552        res.getPackagedMedicinalProduct().add(parseReference(array.get(i).getAsJsonObject()));
18553      }
18554    };
18555    if (json.has("ingredient")) {
18556      JsonArray array = json.getAsJsonArray("ingredient");
18557      for (int i = 0; i < array.size(); i++) {
18558        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
18559      }
18560    };
18561    if (json.has("attachedDocument")) {
18562      JsonArray array = json.getAsJsonArray("attachedDocument");
18563      for (int i = 0; i < array.size(); i++) {
18564        res.getAttachedDocument().add(parseReference(array.get(i).getAsJsonObject()));
18565      }
18566    };
18567    if (json.has("masterFile")) {
18568      JsonArray array = json.getAsJsonArray("masterFile");
18569      for (int i = 0; i < array.size(); i++) {
18570        res.getMasterFile().add(parseReference(array.get(i).getAsJsonObject()));
18571      }
18572    };
18573    if (json.has("contact")) {
18574      JsonArray array = json.getAsJsonArray("contact");
18575      for (int i = 0; i < array.size(); i++) {
18576        res.getContact().add(parseMedicinalProductDefinitionContactComponent(array.get(i).getAsJsonObject()));
18577      }
18578    };
18579    if (json.has("clinicalTrial")) {
18580      JsonArray array = json.getAsJsonArray("clinicalTrial");
18581      for (int i = 0; i < array.size(); i++) {
18582        res.getClinicalTrial().add(parseReference(array.get(i).getAsJsonObject()));
18583      }
18584    };
18585    if (json.has("name")) {
18586      JsonArray array = json.getAsJsonArray("name");
18587      for (int i = 0; i < array.size(); i++) {
18588        res.getName().add(parseMedicinalProductDefinitionNameComponent(array.get(i).getAsJsonObject()));
18589      }
18590    };
18591    if (json.has("crossReference")) {
18592      JsonArray array = json.getAsJsonArray("crossReference");
18593      for (int i = 0; i < array.size(); i++) {
18594        res.getCrossReference().add(parseMedicinalProductDefinitionCrossReferenceComponent(array.get(i).getAsJsonObject()));
18595      }
18596    };
18597    if (json.has("manufacturingBusinessOperation")) {
18598      JsonArray array = json.getAsJsonArray("manufacturingBusinessOperation");
18599      for (int i = 0; i < array.size(); i++) {
18600        res.getManufacturingBusinessOperation().add(parseMedicinalProductDefinitionManufacturingBusinessOperationComponent(array.get(i).getAsJsonObject()));
18601      }
18602    };
18603  }
18604
18605  protected MedicinalProductDefinition.MedicinalProductDefinitionContactComponent parseMedicinalProductDefinitionContactComponent(JsonObject json) throws IOException, FHIRFormatError {
18606    MedicinalProductDefinition.MedicinalProductDefinitionContactComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionContactComponent();
18607    parseMedicinalProductDefinitionContactComponentProperties(json, res);
18608    return res;
18609  }
18610
18611  protected void parseMedicinalProductDefinitionContactComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionContactComponent res) throws IOException, FHIRFormatError {
18612    parseBackboneElementProperties(json, res);
18613    if (json.has("type"))
18614      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18615    if (json.has("contact"))
18616      res.setContact(parseReference(json.getAsJsonObject("contact")));
18617  }
18618
18619  protected MedicinalProductDefinition.MedicinalProductDefinitionNameComponent parseMedicinalProductDefinitionNameComponent(JsonObject json) throws IOException, FHIRFormatError {
18620    MedicinalProductDefinition.MedicinalProductDefinitionNameComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionNameComponent();
18621    parseMedicinalProductDefinitionNameComponentProperties(json, res);
18622    return res;
18623  }
18624
18625  protected void parseMedicinalProductDefinitionNameComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionNameComponent res) throws IOException, FHIRFormatError {
18626    parseBackboneElementProperties(json, res);
18627    if (json.has("productName"))
18628      res.setProductNameElement(parseString(json.get("productName").getAsString()));
18629    if (json.has("_productName"))
18630      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
18631    if (json.has("type"))
18632      res.setType(parseCoding(json.getAsJsonObject("type")));
18633    if (json.has("namePart")) {
18634      JsonArray array = json.getAsJsonArray("namePart");
18635      for (int i = 0; i < array.size(); i++) {
18636        res.getNamePart().add(parseMedicinalProductDefinitionNameNamePartComponent(array.get(i).getAsJsonObject()));
18637      }
18638    };
18639    if (json.has("countryLanguage")) {
18640      JsonArray array = json.getAsJsonArray("countryLanguage");
18641      for (int i = 0; i < array.size(); i++) {
18642        res.getCountryLanguage().add(parseMedicinalProductDefinitionNameCountryLanguageComponent(array.get(i).getAsJsonObject()));
18643      }
18644    };
18645  }
18646
18647  protected MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent parseMedicinalProductDefinitionNameNamePartComponent(JsonObject json) throws IOException, FHIRFormatError {
18648    MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent();
18649    parseMedicinalProductDefinitionNameNamePartComponentProperties(json, res);
18650    return res;
18651  }
18652
18653  protected void parseMedicinalProductDefinitionNameNamePartComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent res) throws IOException, FHIRFormatError {
18654    parseBackboneElementProperties(json, res);
18655    if (json.has("part"))
18656      res.setPartElement(parseString(json.get("part").getAsString()));
18657    if (json.has("_part"))
18658      parseElementProperties(json.getAsJsonObject("_part"), res.getPartElement());
18659    if (json.has("type"))
18660      res.setType(parseCoding(json.getAsJsonObject("type")));
18661  }
18662
18663  protected MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent parseMedicinalProductDefinitionNameCountryLanguageComponent(JsonObject json) throws IOException, FHIRFormatError {
18664    MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent();
18665    parseMedicinalProductDefinitionNameCountryLanguageComponentProperties(json, res);
18666    return res;
18667  }
18668
18669  protected void parseMedicinalProductDefinitionNameCountryLanguageComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent res) throws IOException, FHIRFormatError {
18670    parseBackboneElementProperties(json, res);
18671    if (json.has("country"))
18672      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
18673    if (json.has("jurisdiction"))
18674      res.setJurisdiction(parseCodeableConcept(json.getAsJsonObject("jurisdiction")));
18675    if (json.has("language"))
18676      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
18677  }
18678
18679  protected MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent parseMedicinalProductDefinitionCrossReferenceComponent(JsonObject json) throws IOException, FHIRFormatError {
18680    MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent();
18681    parseMedicinalProductDefinitionCrossReferenceComponentProperties(json, res);
18682    return res;
18683  }
18684
18685  protected void parseMedicinalProductDefinitionCrossReferenceComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent res) throws IOException, FHIRFormatError {
18686    parseBackboneElementProperties(json, res);
18687    DataType product = parseType("product", json);
18688    if (product != null)
18689      res.setProduct(product);
18690    if (json.has("type"))
18691      res.setType(parseCoding(json.getAsJsonObject("type")));
18692  }
18693
18694  protected MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent parseMedicinalProductDefinitionManufacturingBusinessOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
18695    MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent();
18696    parseMedicinalProductDefinitionManufacturingBusinessOperationComponentProperties(json, res);
18697    return res;
18698  }
18699
18700  protected void parseMedicinalProductDefinitionManufacturingBusinessOperationComponentProperties(JsonObject json, MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent res) throws IOException, FHIRFormatError {
18701    parseBackboneElementProperties(json, res);
18702    DataType type = parseType("type", json);
18703    if (type != null)
18704      res.setType(type);
18705    if (json.has("effectiveDate"))
18706      res.setEffectiveDate(parsePeriod(json.getAsJsonObject("effectiveDate")));
18707    if (json.has("manufacturer")) {
18708      JsonArray array = json.getAsJsonArray("manufacturer");
18709      for (int i = 0; i < array.size(); i++) {
18710        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
18711      }
18712    };
18713    if (json.has("authorization"))
18714      res.setAuthorization(parseReference(json.getAsJsonObject("authorization")));
18715    if (json.has("confidentialityIndicator"))
18716      res.setConfidentialityIndicator(parseCodeableConcept(json.getAsJsonObject("confidentialityIndicator")));
18717  }
18718
18719  protected MessageDefinition parseMessageDefinition(JsonObject json) throws IOException, FHIRFormatError {
18720    MessageDefinition res = new MessageDefinition();
18721    parseMessageDefinitionProperties(json, res);
18722    return res;
18723  }
18724
18725  protected void parseMessageDefinitionProperties(JsonObject json, MessageDefinition res) throws IOException, FHIRFormatError {
18726    parseCanonicalResourceProperties(json, res);
18727    if (json.has("url"))
18728      res.setUrlElement(parseUri(json.get("url").getAsString()));
18729    if (json.has("_url"))
18730      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
18731    if (json.has("identifier")) {
18732      JsonArray array = json.getAsJsonArray("identifier");
18733      for (int i = 0; i < array.size(); i++) {
18734        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18735      }
18736    };
18737    if (json.has("version"))
18738      res.setVersionElement(parseString(json.get("version").getAsString()));
18739    if (json.has("_version"))
18740      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
18741    if (json.has("name"))
18742      res.setNameElement(parseString(json.get("name").getAsString()));
18743    if (json.has("_name"))
18744      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18745    if (json.has("title"))
18746      res.setTitleElement(parseString(json.get("title").getAsString()));
18747    if (json.has("_title"))
18748      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
18749    if (json.has("replaces")) {
18750      JsonArray array = json.getAsJsonArray("replaces");
18751      for (int i = 0; i < array.size(); i++) {
18752        if (array.get(i).isJsonNull()) {
18753          res.getReplaces().add(new CanonicalType());
18754        } else {;
18755          res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
18756        }
18757      }
18758    };
18759    if (json.has("_replaces")) {
18760      JsonArray array = json.getAsJsonArray("_replaces");
18761      for (int i = 0; i < array.size(); i++) {
18762        if (i == res.getReplaces().size())
18763          res.getReplaces().add(parseCanonical(null));
18764        if (array.get(i) instanceof JsonObject) 
18765          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
18766      }
18767    };
18768    if (json.has("status"))
18769      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
18770    if (json.has("_status"))
18771      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18772    if (json.has("experimental"))
18773      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
18774    if (json.has("_experimental"))
18775      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
18776    if (json.has("date"))
18777      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18778    if (json.has("_date"))
18779      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
18780    if (json.has("publisher"))
18781      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
18782    if (json.has("_publisher"))
18783      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
18784    if (json.has("contact")) {
18785      JsonArray array = json.getAsJsonArray("contact");
18786      for (int i = 0; i < array.size(); i++) {
18787        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
18788      }
18789    };
18790    if (json.has("description"))
18791      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18792    if (json.has("_description"))
18793      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18794    if (json.has("useContext")) {
18795      JsonArray array = json.getAsJsonArray("useContext");
18796      for (int i = 0; i < array.size(); i++) {
18797        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
18798      }
18799    };
18800    if (json.has("jurisdiction")) {
18801      JsonArray array = json.getAsJsonArray("jurisdiction");
18802      for (int i = 0; i < array.size(); i++) {
18803        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18804      }
18805    };
18806    if (json.has("purpose"))
18807      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
18808    if (json.has("_purpose"))
18809      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
18810    if (json.has("copyright"))
18811      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
18812    if (json.has("_copyright"))
18813      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
18814    if (json.has("base"))
18815      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
18816    if (json.has("_base"))
18817      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
18818    if (json.has("parent")) {
18819      JsonArray array = json.getAsJsonArray("parent");
18820      for (int i = 0; i < array.size(); i++) {
18821        if (array.get(i).isJsonNull()) {
18822          res.getParent().add(new CanonicalType());
18823        } else {;
18824          res.getParent().add(parseCanonical(array.get(i).getAsString()));
18825        }
18826      }
18827    };
18828    if (json.has("_parent")) {
18829      JsonArray array = json.getAsJsonArray("_parent");
18830      for (int i = 0; i < array.size(); i++) {
18831        if (i == res.getParent().size())
18832          res.getParent().add(parseCanonical(null));
18833        if (array.get(i) instanceof JsonObject) 
18834          parseElementProperties(array.get(i).getAsJsonObject(), res.getParent().get(i));
18835      }
18836    };
18837    DataType event = parseType("event", json);
18838    if (event != null)
18839      res.setEvent(event);
18840    if (json.has("category"))
18841      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), MessageDefinition.MessageSignificanceCategory.NULL, new MessageDefinition.MessageSignificanceCategoryEnumFactory()));
18842    if (json.has("_category"))
18843      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
18844    if (json.has("focus")) {
18845      JsonArray array = json.getAsJsonArray("focus");
18846      for (int i = 0; i < array.size(); i++) {
18847        res.getFocus().add(parseMessageDefinitionFocusComponent(array.get(i).getAsJsonObject()));
18848      }
18849    };
18850    if (json.has("responseRequired"))
18851      res.setResponseRequiredElement(parseEnumeration(json.get("responseRequired").getAsString(), MessageDefinition.MessageheaderResponseRequest.NULL, new MessageDefinition.MessageheaderResponseRequestEnumFactory()));
18852    if (json.has("_responseRequired"))
18853      parseElementProperties(json.getAsJsonObject("_responseRequired"), res.getResponseRequiredElement());
18854    if (json.has("allowedResponse")) {
18855      JsonArray array = json.getAsJsonArray("allowedResponse");
18856      for (int i = 0; i < array.size(); i++) {
18857        res.getAllowedResponse().add(parseMessageDefinitionAllowedResponseComponent(array.get(i).getAsJsonObject()));
18858      }
18859    };
18860    if (json.has("graph")) {
18861      JsonArray array = json.getAsJsonArray("graph");
18862      for (int i = 0; i < array.size(); i++) {
18863        if (array.get(i).isJsonNull()) {
18864          res.getGraph().add(new CanonicalType());
18865        } else {;
18866          res.getGraph().add(parseCanonical(array.get(i).getAsString()));
18867        }
18868      }
18869    };
18870    if (json.has("_graph")) {
18871      JsonArray array = json.getAsJsonArray("_graph");
18872      for (int i = 0; i < array.size(); i++) {
18873        if (i == res.getGraph().size())
18874          res.getGraph().add(parseCanonical(null));
18875        if (array.get(i) instanceof JsonObject) 
18876          parseElementProperties(array.get(i).getAsJsonObject(), res.getGraph().get(i));
18877      }
18878    };
18879  }
18880
18881  protected MessageDefinition.MessageDefinitionFocusComponent parseMessageDefinitionFocusComponent(JsonObject json) throws IOException, FHIRFormatError {
18882    MessageDefinition.MessageDefinitionFocusComponent res = new MessageDefinition.MessageDefinitionFocusComponent();
18883    parseMessageDefinitionFocusComponentProperties(json, res);
18884    return res;
18885  }
18886
18887  protected void parseMessageDefinitionFocusComponentProperties(JsonObject json, MessageDefinition.MessageDefinitionFocusComponent res) throws IOException, FHIRFormatError {
18888    parseBackboneElementProperties(json, res);
18889    if (json.has("code"))
18890      res.setCodeElement(parseCode(json.get("code").getAsString()));
18891    if (json.has("_code"))
18892      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
18893    if (json.has("profile"))
18894      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
18895    if (json.has("_profile"))
18896      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
18897    if (json.has("min"))
18898      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
18899    if (json.has("_min"))
18900      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
18901    if (json.has("max"))
18902      res.setMaxElement(parseString(json.get("max").getAsString()));
18903    if (json.has("_max"))
18904      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
18905  }
18906
18907  protected MessageDefinition.MessageDefinitionAllowedResponseComponent parseMessageDefinitionAllowedResponseComponent(JsonObject json) throws IOException, FHIRFormatError {
18908    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
18909    parseMessageDefinitionAllowedResponseComponentProperties(json, res);
18910    return res;
18911  }
18912
18913  protected void parseMessageDefinitionAllowedResponseComponentProperties(JsonObject json, MessageDefinition.MessageDefinitionAllowedResponseComponent res) throws IOException, FHIRFormatError {
18914    parseBackboneElementProperties(json, res);
18915    if (json.has("message"))
18916      res.setMessageElement(parseCanonical(json.get("message").getAsString()));
18917    if (json.has("_message"))
18918      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
18919    if (json.has("situation"))
18920      res.setSituationElement(parseMarkdown(json.get("situation").getAsString()));
18921    if (json.has("_situation"))
18922      parseElementProperties(json.getAsJsonObject("_situation"), res.getSituationElement());
18923  }
18924
18925  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
18926    MessageHeader res = new MessageHeader();
18927    parseMessageHeaderProperties(json, res);
18928    return res;
18929  }
18930
18931  protected void parseMessageHeaderProperties(JsonObject json, MessageHeader res) throws IOException, FHIRFormatError {
18932    parseDomainResourceProperties(json, res);
18933    DataType event = parseType("event", json);
18934    if (event != null)
18935      res.setEvent(event);
18936    if (json.has("destination")) {
18937      JsonArray array = json.getAsJsonArray("destination");
18938      for (int i = 0; i < array.size(); i++) {
18939        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject()));
18940      }
18941    };
18942    if (json.has("sender"))
18943      res.setSender(parseReference(json.getAsJsonObject("sender")));
18944    if (json.has("enterer"))
18945      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
18946    if (json.has("author"))
18947      res.setAuthor(parseReference(json.getAsJsonObject("author")));
18948    if (json.has("source"))
18949      res.setSource(parseMessageHeaderMessageSourceComponent(json.getAsJsonObject("source")));
18950    if (json.has("responsible"))
18951      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
18952    if (json.has("reason"))
18953      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
18954    if (json.has("response"))
18955      res.setResponse(parseMessageHeaderResponseComponent(json.getAsJsonObject("response")));
18956    if (json.has("focus")) {
18957      JsonArray array = json.getAsJsonArray("focus");
18958      for (int i = 0; i < array.size(); i++) {
18959        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
18960      }
18961    };
18962    if (json.has("definition"))
18963      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
18964    if (json.has("_definition"))
18965      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
18966  }
18967
18968  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json) throws IOException, FHIRFormatError {
18969    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
18970    parseMessageHeaderMessageDestinationComponentProperties(json, res);
18971    return res;
18972  }
18973
18974  protected void parseMessageHeaderMessageDestinationComponentProperties(JsonObject json, MessageHeader.MessageDestinationComponent res) throws IOException, FHIRFormatError {
18975    parseBackboneElementProperties(json, res);
18976    if (json.has("name"))
18977      res.setNameElement(parseString(json.get("name").getAsString()));
18978    if (json.has("_name"))
18979      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18980    if (json.has("target"))
18981      res.setTarget(parseReference(json.getAsJsonObject("target")));
18982    if (json.has("endpoint"))
18983      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
18984    if (json.has("_endpoint"))
18985      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
18986    if (json.has("receiver"))
18987      res.setReceiver(parseReference(json.getAsJsonObject("receiver")));
18988  }
18989
18990  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json) throws IOException, FHIRFormatError {
18991    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
18992    parseMessageHeaderMessageSourceComponentProperties(json, res);
18993    return res;
18994  }
18995
18996  protected void parseMessageHeaderMessageSourceComponentProperties(JsonObject json, MessageHeader.MessageSourceComponent res) throws IOException, FHIRFormatError {
18997    parseBackboneElementProperties(json, res);
18998    if (json.has("name"))
18999      res.setNameElement(parseString(json.get("name").getAsString()));
19000    if (json.has("_name"))
19001      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19002    if (json.has("software"))
19003      res.setSoftwareElement(parseString(json.get("software").getAsString()));
19004    if (json.has("_software"))
19005      parseElementProperties(json.getAsJsonObject("_software"), res.getSoftwareElement());
19006    if (json.has("version"))
19007      res.setVersionElement(parseString(json.get("version").getAsString()));
19008    if (json.has("_version"))
19009      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
19010    if (json.has("contact"))
19011      res.setContact(parseContactPoint(json.getAsJsonObject("contact")));
19012    if (json.has("endpoint"))
19013      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
19014    if (json.has("_endpoint"))
19015      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
19016  }
19017
19018  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderResponseComponent(JsonObject json) throws IOException, FHIRFormatError {
19019    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
19020    parseMessageHeaderResponseComponentProperties(json, res);
19021    return res;
19022  }
19023
19024  protected void parseMessageHeaderResponseComponentProperties(JsonObject json, MessageHeader.MessageHeaderResponseComponent res) throws IOException, FHIRFormatError {
19025    parseBackboneElementProperties(json, res);
19026    if (json.has("identifier"))
19027      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
19028    if (json.has("_identifier"))
19029      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
19030    if (json.has("code"))
19031      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
19032    if (json.has("_code"))
19033      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
19034    if (json.has("details"))
19035      res.setDetails(parseReference(json.getAsJsonObject("details")));
19036  }
19037
19038  protected MolecularSequence parseMolecularSequence(JsonObject json) throws IOException, FHIRFormatError {
19039    MolecularSequence res = new MolecularSequence();
19040    parseMolecularSequenceProperties(json, res);
19041    return res;
19042  }
19043
19044  protected void parseMolecularSequenceProperties(JsonObject json, MolecularSequence res) throws IOException, FHIRFormatError {
19045    parseDomainResourceProperties(json, res);
19046    if (json.has("identifier")) {
19047      JsonArray array = json.getAsJsonArray("identifier");
19048      for (int i = 0; i < array.size(); i++) {
19049        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19050      }
19051    };
19052    if (json.has("type"))
19053      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.SequenceType.NULL, new MolecularSequence.SequenceTypeEnumFactory()));
19054    if (json.has("_type"))
19055      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19056    if (json.has("coordinateSystem"))
19057      res.setCoordinateSystemElement(parseInteger(json.get("coordinateSystem").getAsLong()));
19058    if (json.has("_coordinateSystem"))
19059      parseElementProperties(json.getAsJsonObject("_coordinateSystem"), res.getCoordinateSystemElement());
19060    if (json.has("patient"))
19061      res.setPatient(parseReference(json.getAsJsonObject("patient")));
19062    if (json.has("specimen"))
19063      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
19064    if (json.has("device"))
19065      res.setDevice(parseReference(json.getAsJsonObject("device")));
19066    if (json.has("performer"))
19067      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
19068    if (json.has("quantity"))
19069      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
19070    if (json.has("referenceSeq"))
19071      res.setReferenceSeq(parseMolecularSequenceReferenceSeqComponent(json.getAsJsonObject("referenceSeq")));
19072    if (json.has("variant")) {
19073      JsonArray array = json.getAsJsonArray("variant");
19074      for (int i = 0; i < array.size(); i++) {
19075        res.getVariant().add(parseMolecularSequenceVariantComponent(array.get(i).getAsJsonObject()));
19076      }
19077    };
19078    if (json.has("observedSeq"))
19079      res.setObservedSeqElement(parseString(json.get("observedSeq").getAsString()));
19080    if (json.has("_observedSeq"))
19081      parseElementProperties(json.getAsJsonObject("_observedSeq"), res.getObservedSeqElement());
19082    if (json.has("quality")) {
19083      JsonArray array = json.getAsJsonArray("quality");
19084      for (int i = 0; i < array.size(); i++) {
19085        res.getQuality().add(parseMolecularSequenceQualityComponent(array.get(i).getAsJsonObject()));
19086      }
19087    };
19088    if (json.has("readCoverage"))
19089      res.setReadCoverageElement(parseInteger(json.get("readCoverage").getAsLong()));
19090    if (json.has("_readCoverage"))
19091      parseElementProperties(json.getAsJsonObject("_readCoverage"), res.getReadCoverageElement());
19092    if (json.has("repository")) {
19093      JsonArray array = json.getAsJsonArray("repository");
19094      for (int i = 0; i < array.size(); i++) {
19095        res.getRepository().add(parseMolecularSequenceRepositoryComponent(array.get(i).getAsJsonObject()));
19096      }
19097    };
19098    if (json.has("pointer")) {
19099      JsonArray array = json.getAsJsonArray("pointer");
19100      for (int i = 0; i < array.size(); i++) {
19101        res.getPointer().add(parseReference(array.get(i).getAsJsonObject()));
19102      }
19103    };
19104    if (json.has("structureVariant")) {
19105      JsonArray array = json.getAsJsonArray("structureVariant");
19106      for (int i = 0; i < array.size(); i++) {
19107        res.getStructureVariant().add(parseMolecularSequenceStructureVariantComponent(array.get(i).getAsJsonObject()));
19108      }
19109    };
19110  }
19111
19112  protected MolecularSequence.MolecularSequenceReferenceSeqComponent parseMolecularSequenceReferenceSeqComponent(JsonObject json) throws IOException, FHIRFormatError {
19113    MolecularSequence.MolecularSequenceReferenceSeqComponent res = new MolecularSequence.MolecularSequenceReferenceSeqComponent();
19114    parseMolecularSequenceReferenceSeqComponentProperties(json, res);
19115    return res;
19116  }
19117
19118  protected void parseMolecularSequenceReferenceSeqComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceReferenceSeqComponent res) throws IOException, FHIRFormatError {
19119    parseBackboneElementProperties(json, res);
19120    if (json.has("chromosome"))
19121      res.setChromosome(parseCodeableConcept(json.getAsJsonObject("chromosome")));
19122    if (json.has("genomeBuild"))
19123      res.setGenomeBuildElement(parseString(json.get("genomeBuild").getAsString()));
19124    if (json.has("_genomeBuild"))
19125      parseElementProperties(json.getAsJsonObject("_genomeBuild"), res.getGenomeBuildElement());
19126    if (json.has("orientation"))
19127      res.setOrientationElement(parseEnumeration(json.get("orientation").getAsString(), MolecularSequence.OrientationType.NULL, new MolecularSequence.OrientationTypeEnumFactory()));
19128    if (json.has("_orientation"))
19129      parseElementProperties(json.getAsJsonObject("_orientation"), res.getOrientationElement());
19130    if (json.has("referenceSeqId"))
19131      res.setReferenceSeqId(parseCodeableConcept(json.getAsJsonObject("referenceSeqId")));
19132    if (json.has("referenceSeqPointer"))
19133      res.setReferenceSeqPointer(parseReference(json.getAsJsonObject("referenceSeqPointer")));
19134    if (json.has("referenceSeqString"))
19135      res.setReferenceSeqStringElement(parseString(json.get("referenceSeqString").getAsString()));
19136    if (json.has("_referenceSeqString"))
19137      parseElementProperties(json.getAsJsonObject("_referenceSeqString"), res.getReferenceSeqStringElement());
19138    if (json.has("strand"))
19139      res.setStrandElement(parseEnumeration(json.get("strand").getAsString(), MolecularSequence.StrandType.NULL, new MolecularSequence.StrandTypeEnumFactory()));
19140    if (json.has("_strand"))
19141      parseElementProperties(json.getAsJsonObject("_strand"), res.getStrandElement());
19142    if (json.has("windowStart"))
19143      res.setWindowStartElement(parseInteger(json.get("windowStart").getAsLong()));
19144    if (json.has("_windowStart"))
19145      parseElementProperties(json.getAsJsonObject("_windowStart"), res.getWindowStartElement());
19146    if (json.has("windowEnd"))
19147      res.setWindowEndElement(parseInteger(json.get("windowEnd").getAsLong()));
19148    if (json.has("_windowEnd"))
19149      parseElementProperties(json.getAsJsonObject("_windowEnd"), res.getWindowEndElement());
19150  }
19151
19152  protected MolecularSequence.MolecularSequenceVariantComponent parseMolecularSequenceVariantComponent(JsonObject json) throws IOException, FHIRFormatError {
19153    MolecularSequence.MolecularSequenceVariantComponent res = new MolecularSequence.MolecularSequenceVariantComponent();
19154    parseMolecularSequenceVariantComponentProperties(json, res);
19155    return res;
19156  }
19157
19158  protected void parseMolecularSequenceVariantComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceVariantComponent res) throws IOException, FHIRFormatError {
19159    parseBackboneElementProperties(json, res);
19160    if (json.has("start"))
19161      res.setStartElement(parseInteger(json.get("start").getAsLong()));
19162    if (json.has("_start"))
19163      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
19164    if (json.has("end"))
19165      res.setEndElement(parseInteger(json.get("end").getAsLong()));
19166    if (json.has("_end"))
19167      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
19168    if (json.has("observedAllele"))
19169      res.setObservedAlleleElement(parseString(json.get("observedAllele").getAsString()));
19170    if (json.has("_observedAllele"))
19171      parseElementProperties(json.getAsJsonObject("_observedAllele"), res.getObservedAlleleElement());
19172    if (json.has("referenceAllele"))
19173      res.setReferenceAlleleElement(parseString(json.get("referenceAllele").getAsString()));
19174    if (json.has("_referenceAllele"))
19175      parseElementProperties(json.getAsJsonObject("_referenceAllele"), res.getReferenceAlleleElement());
19176    if (json.has("cigar"))
19177      res.setCigarElement(parseString(json.get("cigar").getAsString()));
19178    if (json.has("_cigar"))
19179      parseElementProperties(json.getAsJsonObject("_cigar"), res.getCigarElement());
19180    if (json.has("variantPointer"))
19181      res.setVariantPointer(parseReference(json.getAsJsonObject("variantPointer")));
19182  }
19183
19184  protected MolecularSequence.MolecularSequenceQualityComponent parseMolecularSequenceQualityComponent(JsonObject json) throws IOException, FHIRFormatError {
19185    MolecularSequence.MolecularSequenceQualityComponent res = new MolecularSequence.MolecularSequenceQualityComponent();
19186    parseMolecularSequenceQualityComponentProperties(json, res);
19187    return res;
19188  }
19189
19190  protected void parseMolecularSequenceQualityComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceQualityComponent res) throws IOException, FHIRFormatError {
19191    parseBackboneElementProperties(json, res);
19192    if (json.has("type"))
19193      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.QualityType.NULL, new MolecularSequence.QualityTypeEnumFactory()));
19194    if (json.has("_type"))
19195      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19196    if (json.has("standardSequence"))
19197      res.setStandardSequence(parseCodeableConcept(json.getAsJsonObject("standardSequence")));
19198    if (json.has("start"))
19199      res.setStartElement(parseInteger(json.get("start").getAsLong()));
19200    if (json.has("_start"))
19201      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
19202    if (json.has("end"))
19203      res.setEndElement(parseInteger(json.get("end").getAsLong()));
19204    if (json.has("_end"))
19205      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
19206    if (json.has("score"))
19207      res.setScore(parseQuantity(json.getAsJsonObject("score")));
19208    if (json.has("method"))
19209      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
19210    if (json.has("truthTP"))
19211      res.setTruthTPElement(parseDecimal(json.get("truthTP").getAsBigDecimal()));
19212    if (json.has("_truthTP"))
19213      parseElementProperties(json.getAsJsonObject("_truthTP"), res.getTruthTPElement());
19214    if (json.has("queryTP"))
19215      res.setQueryTPElement(parseDecimal(json.get("queryTP").getAsBigDecimal()));
19216    if (json.has("_queryTP"))
19217      parseElementProperties(json.getAsJsonObject("_queryTP"), res.getQueryTPElement());
19218    if (json.has("truthFN"))
19219      res.setTruthFNElement(parseDecimal(json.get("truthFN").getAsBigDecimal()));
19220    if (json.has("_truthFN"))
19221      parseElementProperties(json.getAsJsonObject("_truthFN"), res.getTruthFNElement());
19222    if (json.has("queryFP"))
19223      res.setQueryFPElement(parseDecimal(json.get("queryFP").getAsBigDecimal()));
19224    if (json.has("_queryFP"))
19225      parseElementProperties(json.getAsJsonObject("_queryFP"), res.getQueryFPElement());
19226    if (json.has("gtFP"))
19227      res.setGtFPElement(parseDecimal(json.get("gtFP").getAsBigDecimal()));
19228    if (json.has("_gtFP"))
19229      parseElementProperties(json.getAsJsonObject("_gtFP"), res.getGtFPElement());
19230    if (json.has("precision"))
19231      res.setPrecisionElement(parseDecimal(json.get("precision").getAsBigDecimal()));
19232    if (json.has("_precision"))
19233      parseElementProperties(json.getAsJsonObject("_precision"), res.getPrecisionElement());
19234    if (json.has("recall"))
19235      res.setRecallElement(parseDecimal(json.get("recall").getAsBigDecimal()));
19236    if (json.has("_recall"))
19237      parseElementProperties(json.getAsJsonObject("_recall"), res.getRecallElement());
19238    if (json.has("fScore"))
19239      res.setFScoreElement(parseDecimal(json.get("fScore").getAsBigDecimal()));
19240    if (json.has("_fScore"))
19241      parseElementProperties(json.getAsJsonObject("_fScore"), res.getFScoreElement());
19242    if (json.has("roc"))
19243      res.setRoc(parseMolecularSequenceQualityRocComponent(json.getAsJsonObject("roc")));
19244  }
19245
19246  protected MolecularSequence.MolecularSequenceQualityRocComponent parseMolecularSequenceQualityRocComponent(JsonObject json) throws IOException, FHIRFormatError {
19247    MolecularSequence.MolecularSequenceQualityRocComponent res = new MolecularSequence.MolecularSequenceQualityRocComponent();
19248    parseMolecularSequenceQualityRocComponentProperties(json, res);
19249    return res;
19250  }
19251
19252  protected void parseMolecularSequenceQualityRocComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceQualityRocComponent res) throws IOException, FHIRFormatError {
19253    parseBackboneElementProperties(json, res);
19254    if (json.has("score")) {
19255      JsonArray array = json.getAsJsonArray("score");
19256      for (int i = 0; i < array.size(); i++) {
19257        if (array.get(i).isJsonNull()) {
19258          res.getScore().add(new IntegerType());
19259        } else {;
19260          res.getScore().add(parseInteger(array.get(i).getAsLong()));
19261        }
19262      }
19263    };
19264    if (json.has("_score")) {
19265      JsonArray array = json.getAsJsonArray("_score");
19266      for (int i = 0; i < array.size(); i++) {
19267        if (i == res.getScore().size())
19268          res.getScore().add(parseInteger(null));
19269        if (array.get(i) instanceof JsonObject) 
19270          parseElementProperties(array.get(i).getAsJsonObject(), res.getScore().get(i));
19271      }
19272    };
19273    if (json.has("numTP")) {
19274      JsonArray array = json.getAsJsonArray("numTP");
19275      for (int i = 0; i < array.size(); i++) {
19276        if (array.get(i).isJsonNull()) {
19277          res.getNumTP().add(new IntegerType());
19278        } else {;
19279          res.getNumTP().add(parseInteger(array.get(i).getAsLong()));
19280        }
19281      }
19282    };
19283    if (json.has("_numTP")) {
19284      JsonArray array = json.getAsJsonArray("_numTP");
19285      for (int i = 0; i < array.size(); i++) {
19286        if (i == res.getNumTP().size())
19287          res.getNumTP().add(parseInteger(null));
19288        if (array.get(i) instanceof JsonObject) 
19289          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumTP().get(i));
19290      }
19291    };
19292    if (json.has("numFP")) {
19293      JsonArray array = json.getAsJsonArray("numFP");
19294      for (int i = 0; i < array.size(); i++) {
19295        if (array.get(i).isJsonNull()) {
19296          res.getNumFP().add(new IntegerType());
19297        } else {;
19298          res.getNumFP().add(parseInteger(array.get(i).getAsLong()));
19299        }
19300      }
19301    };
19302    if (json.has("_numFP")) {
19303      JsonArray array = json.getAsJsonArray("_numFP");
19304      for (int i = 0; i < array.size(); i++) {
19305        if (i == res.getNumFP().size())
19306          res.getNumFP().add(parseInteger(null));
19307        if (array.get(i) instanceof JsonObject) 
19308          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFP().get(i));
19309      }
19310    };
19311    if (json.has("numFN")) {
19312      JsonArray array = json.getAsJsonArray("numFN");
19313      for (int i = 0; i < array.size(); i++) {
19314        if (array.get(i).isJsonNull()) {
19315          res.getNumFN().add(new IntegerType());
19316        } else {;
19317          res.getNumFN().add(parseInteger(array.get(i).getAsLong()));
19318        }
19319      }
19320    };
19321    if (json.has("_numFN")) {
19322      JsonArray array = json.getAsJsonArray("_numFN");
19323      for (int i = 0; i < array.size(); i++) {
19324        if (i == res.getNumFN().size())
19325          res.getNumFN().add(parseInteger(null));
19326        if (array.get(i) instanceof JsonObject) 
19327          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFN().get(i));
19328      }
19329    };
19330    if (json.has("precision")) {
19331      JsonArray array = json.getAsJsonArray("precision");
19332      for (int i = 0; i < array.size(); i++) {
19333        if (array.get(i).isJsonNull()) {
19334          res.getPrecision().add(new DecimalType());
19335        } else {;
19336          res.getPrecision().add(parseDecimal(array.get(i).getAsBigDecimal()));
19337        }
19338      }
19339    };
19340    if (json.has("_precision")) {
19341      JsonArray array = json.getAsJsonArray("_precision");
19342      for (int i = 0; i < array.size(); i++) {
19343        if (i == res.getPrecision().size())
19344          res.getPrecision().add(parseDecimal(null));
19345        if (array.get(i) instanceof JsonObject) 
19346          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrecision().get(i));
19347      }
19348    };
19349    if (json.has("sensitivity")) {
19350      JsonArray array = json.getAsJsonArray("sensitivity");
19351      for (int i = 0; i < array.size(); i++) {
19352        if (array.get(i).isJsonNull()) {
19353          res.getSensitivity().add(new DecimalType());
19354        } else {;
19355          res.getSensitivity().add(parseDecimal(array.get(i).getAsBigDecimal()));
19356        }
19357      }
19358    };
19359    if (json.has("_sensitivity")) {
19360      JsonArray array = json.getAsJsonArray("_sensitivity");
19361      for (int i = 0; i < array.size(); i++) {
19362        if (i == res.getSensitivity().size())
19363          res.getSensitivity().add(parseDecimal(null));
19364        if (array.get(i) instanceof JsonObject) 
19365          parseElementProperties(array.get(i).getAsJsonObject(), res.getSensitivity().get(i));
19366      }
19367    };
19368    if (json.has("fMeasure")) {
19369      JsonArray array = json.getAsJsonArray("fMeasure");
19370      for (int i = 0; i < array.size(); i++) {
19371        if (array.get(i).isJsonNull()) {
19372          res.getFMeasure().add(new DecimalType());
19373        } else {;
19374          res.getFMeasure().add(parseDecimal(array.get(i).getAsBigDecimal()));
19375        }
19376      }
19377    };
19378    if (json.has("_fMeasure")) {
19379      JsonArray array = json.getAsJsonArray("_fMeasure");
19380      for (int i = 0; i < array.size(); i++) {
19381        if (i == res.getFMeasure().size())
19382          res.getFMeasure().add(parseDecimal(null));
19383        if (array.get(i) instanceof JsonObject) 
19384          parseElementProperties(array.get(i).getAsJsonObject(), res.getFMeasure().get(i));
19385      }
19386    };
19387  }
19388
19389  protected MolecularSequence.MolecularSequenceRepositoryComponent parseMolecularSequenceRepositoryComponent(JsonObject json) throws IOException, FHIRFormatError {
19390    MolecularSequence.MolecularSequenceRepositoryComponent res = new MolecularSequence.MolecularSequenceRepositoryComponent();
19391    parseMolecularSequenceRepositoryComponentProperties(json, res);
19392    return res;
19393  }
19394
19395  protected void parseMolecularSequenceRepositoryComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceRepositoryComponent res) throws IOException, FHIRFormatError {
19396    parseBackboneElementProperties(json, res);
19397    if (json.has("type"))
19398      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.RepositoryType.NULL, new MolecularSequence.RepositoryTypeEnumFactory()));
19399    if (json.has("_type"))
19400      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19401    if (json.has("url"))
19402      res.setUrlElement(parseUri(json.get("url").getAsString()));
19403    if (json.has("_url"))
19404      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
19405    if (json.has("name"))
19406      res.setNameElement(parseString(json.get("name").getAsString()));
19407    if (json.has("_name"))
19408      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19409    if (json.has("datasetId"))
19410      res.setDatasetIdElement(parseString(json.get("datasetId").getAsString()));
19411    if (json.has("_datasetId"))
19412      parseElementProperties(json.getAsJsonObject("_datasetId"), res.getDatasetIdElement());
19413    if (json.has("variantsetId"))
19414      res.setVariantsetIdElement(parseString(json.get("variantsetId").getAsString()));
19415    if (json.has("_variantsetId"))
19416      parseElementProperties(json.getAsJsonObject("_variantsetId"), res.getVariantsetIdElement());
19417    if (json.has("readsetId"))
19418      res.setReadsetIdElement(parseString(json.get("readsetId").getAsString()));
19419    if (json.has("_readsetId"))
19420      parseElementProperties(json.getAsJsonObject("_readsetId"), res.getReadsetIdElement());
19421  }
19422
19423  protected MolecularSequence.MolecularSequenceStructureVariantComponent parseMolecularSequenceStructureVariantComponent(JsonObject json) throws IOException, FHIRFormatError {
19424    MolecularSequence.MolecularSequenceStructureVariantComponent res = new MolecularSequence.MolecularSequenceStructureVariantComponent();
19425    parseMolecularSequenceStructureVariantComponentProperties(json, res);
19426    return res;
19427  }
19428
19429  protected void parseMolecularSequenceStructureVariantComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceStructureVariantComponent res) throws IOException, FHIRFormatError {
19430    parseBackboneElementProperties(json, res);
19431    if (json.has("variantType"))
19432      res.setVariantType(parseCodeableConcept(json.getAsJsonObject("variantType")));
19433    if (json.has("exact"))
19434      res.setExactElement(parseBoolean(json.get("exact").getAsBoolean()));
19435    if (json.has("_exact"))
19436      parseElementProperties(json.getAsJsonObject("_exact"), res.getExactElement());
19437    if (json.has("length"))
19438      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
19439    if (json.has("_length"))
19440      parseElementProperties(json.getAsJsonObject("_length"), res.getLengthElement());
19441    if (json.has("outer"))
19442      res.setOuter(parseMolecularSequenceStructureVariantOuterComponent(json.getAsJsonObject("outer")));
19443    if (json.has("inner"))
19444      res.setInner(parseMolecularSequenceStructureVariantInnerComponent(json.getAsJsonObject("inner")));
19445  }
19446
19447  protected MolecularSequence.MolecularSequenceStructureVariantOuterComponent parseMolecularSequenceStructureVariantOuterComponent(JsonObject json) throws IOException, FHIRFormatError {
19448    MolecularSequence.MolecularSequenceStructureVariantOuterComponent res = new MolecularSequence.MolecularSequenceStructureVariantOuterComponent();
19449    parseMolecularSequenceStructureVariantOuterComponentProperties(json, res);
19450    return res;
19451  }
19452
19453  protected void parseMolecularSequenceStructureVariantOuterComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceStructureVariantOuterComponent res) throws IOException, FHIRFormatError {
19454    parseBackboneElementProperties(json, res);
19455    if (json.has("start"))
19456      res.setStartElement(parseInteger(json.get("start").getAsLong()));
19457    if (json.has("_start"))
19458      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
19459    if (json.has("end"))
19460      res.setEndElement(parseInteger(json.get("end").getAsLong()));
19461    if (json.has("_end"))
19462      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
19463  }
19464
19465  protected MolecularSequence.MolecularSequenceStructureVariantInnerComponent parseMolecularSequenceStructureVariantInnerComponent(JsonObject json) throws IOException, FHIRFormatError {
19466    MolecularSequence.MolecularSequenceStructureVariantInnerComponent res = new MolecularSequence.MolecularSequenceStructureVariantInnerComponent();
19467    parseMolecularSequenceStructureVariantInnerComponentProperties(json, res);
19468    return res;
19469  }
19470
19471  protected void parseMolecularSequenceStructureVariantInnerComponentProperties(JsonObject json, MolecularSequence.MolecularSequenceStructureVariantInnerComponent res) throws IOException, FHIRFormatError {
19472    parseBackboneElementProperties(json, res);
19473    if (json.has("start"))
19474      res.setStartElement(parseInteger(json.get("start").getAsLong()));
19475    if (json.has("_start"))
19476      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
19477    if (json.has("end"))
19478      res.setEndElement(parseInteger(json.get("end").getAsLong()));
19479    if (json.has("_end"))
19480      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
19481  }
19482
19483  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
19484    NamingSystem res = new NamingSystem();
19485    parseNamingSystemProperties(json, res);
19486    return res;
19487  }
19488
19489  protected void parseNamingSystemProperties(JsonObject json, NamingSystem res) throws IOException, FHIRFormatError {
19490    parseCanonicalResourceProperties(json, res);
19491    if (json.has("url"))
19492      res.setUrlElement(parseUri(json.get("url").getAsString()));
19493    if (json.has("_url"))
19494      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
19495    if (json.has("version"))
19496      res.setVersionElement(parseString(json.get("version").getAsString()));
19497    if (json.has("_version"))
19498      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
19499    if (json.has("name"))
19500      res.setNameElement(parseString(json.get("name").getAsString()));
19501    if (json.has("_name"))
19502      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19503    if (json.has("status"))
19504      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19505    if (json.has("_status"))
19506      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19507    if (json.has("kind"))
19508      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
19509    if (json.has("_kind"))
19510      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
19511    if (json.has("date"))
19512      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19513    if (json.has("_date"))
19514      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
19515    if (json.has("publisher"))
19516      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
19517    if (json.has("_publisher"))
19518      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
19519    if (json.has("contact")) {
19520      JsonArray array = json.getAsJsonArray("contact");
19521      for (int i = 0; i < array.size(); i++) {
19522        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19523      }
19524    };
19525    if (json.has("responsible"))
19526      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
19527    if (json.has("_responsible"))
19528      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
19529    if (json.has("type"))
19530      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19531    if (json.has("description"))
19532      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19533    if (json.has("_description"))
19534      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19535    if (json.has("useContext")) {
19536      JsonArray array = json.getAsJsonArray("useContext");
19537      for (int i = 0; i < array.size(); i++) {
19538        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19539      }
19540    };
19541    if (json.has("jurisdiction")) {
19542      JsonArray array = json.getAsJsonArray("jurisdiction");
19543      for (int i = 0; i < array.size(); i++) {
19544        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19545      }
19546    };
19547    if (json.has("usage"))
19548      res.setUsageElement(parseString(json.get("usage").getAsString()));
19549    if (json.has("_usage"))
19550      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
19551    if (json.has("uniqueId")) {
19552      JsonArray array = json.getAsJsonArray("uniqueId");
19553      for (int i = 0; i < array.size(); i++) {
19554        res.getUniqueId().add(parseNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject()));
19555      }
19556    };
19557  }
19558
19559  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemUniqueIdComponent(JsonObject json) throws IOException, FHIRFormatError {
19560    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
19561    parseNamingSystemUniqueIdComponentProperties(json, res);
19562    return res;
19563  }
19564
19565  protected void parseNamingSystemUniqueIdComponentProperties(JsonObject json, NamingSystem.NamingSystemUniqueIdComponent res) throws IOException, FHIRFormatError {
19566    parseBackboneElementProperties(json, res);
19567    if (json.has("type"))
19568      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
19569    if (json.has("_type"))
19570      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19571    if (json.has("value"))
19572      res.setValueElement(parseString(json.get("value").getAsString()));
19573    if (json.has("_value"))
19574      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
19575    if (json.has("preferred"))
19576      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
19577    if (json.has("_preferred"))
19578      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
19579    if (json.has("comment"))
19580      res.setCommentElement(parseString(json.get("comment").getAsString()));
19581    if (json.has("_comment"))
19582      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
19583    if (json.has("period"))
19584      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
19585  }
19586
19587  protected NutritionIntake parseNutritionIntake(JsonObject json) throws IOException, FHIRFormatError {
19588    NutritionIntake res = new NutritionIntake();
19589    parseNutritionIntakeProperties(json, res);
19590    return res;
19591  }
19592
19593  protected void parseNutritionIntakeProperties(JsonObject json, NutritionIntake res) throws IOException, FHIRFormatError {
19594    parseDomainResourceProperties(json, res);
19595    if (json.has("identifier")) {
19596      JsonArray array = json.getAsJsonArray("identifier");
19597      for (int i = 0; i < array.size(); i++) {
19598        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19599      }
19600    };
19601    if (json.has("basedOn")) {
19602      JsonArray array = json.getAsJsonArray("basedOn");
19603      for (int i = 0; i < array.size(); i++) {
19604        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
19605      }
19606    };
19607    if (json.has("partOf")) {
19608      JsonArray array = json.getAsJsonArray("partOf");
19609      for (int i = 0; i < array.size(); i++) {
19610        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
19611      }
19612    };
19613    if (json.has("status"))
19614      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionIntake.NutritionIntakeStatusCodes.NULL, new NutritionIntake.NutritionIntakeStatusCodesEnumFactory()));
19615    if (json.has("_status"))
19616      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19617    if (json.has("statusReason")) {
19618      JsonArray array = json.getAsJsonArray("statusReason");
19619      for (int i = 0; i < array.size(); i++) {
19620        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19621      }
19622    };
19623    if (json.has("category")) {
19624      JsonArray array = json.getAsJsonArray("category");
19625      for (int i = 0; i < array.size(); i++) {
19626        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19627      }
19628    };
19629    if (json.has("consumedItem")) {
19630      JsonArray array = json.getAsJsonArray("consumedItem");
19631      for (int i = 0; i < array.size(); i++) {
19632        res.getConsumedItem().add(parseNutritionIntakeConsumedItemComponent(array.get(i).getAsJsonObject()));
19633      }
19634    };
19635    if (json.has("ingredientLabel")) {
19636      JsonArray array = json.getAsJsonArray("ingredientLabel");
19637      for (int i = 0; i < array.size(); i++) {
19638        res.getIngredientLabel().add(parseNutritionIntakeIngredientLabelComponent(array.get(i).getAsJsonObject()));
19639      }
19640    };
19641    if (json.has("subject"))
19642      res.setSubject(parseReference(json.getAsJsonObject("subject")));
19643    if (json.has("encounter"))
19644      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
19645    DataType effective = parseType("effective", json);
19646    if (effective != null)
19647      res.setEffective(effective);
19648    if (json.has("dateAsserted"))
19649      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
19650    if (json.has("_dateAsserted"))
19651      parseElementProperties(json.getAsJsonObject("_dateAsserted"), res.getDateAssertedElement());
19652    if (json.has("informationSource"))
19653      res.setInformationSource(parseReference(json.getAsJsonObject("informationSource")));
19654    if (json.has("derivedFrom")) {
19655      JsonArray array = json.getAsJsonArray("derivedFrom");
19656      for (int i = 0; i < array.size(); i++) {
19657        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
19658      }
19659    };
19660    if (json.has("reasonCode")) {
19661      JsonArray array = json.getAsJsonArray("reasonCode");
19662      for (int i = 0; i < array.size(); i++) {
19663        res.getReasonCode().add(parseCodeableReference(array.get(i).getAsJsonObject()));
19664      }
19665    };
19666    if (json.has("note")) {
19667      JsonArray array = json.getAsJsonArray("note");
19668      for (int i = 0; i < array.size(); i++) {
19669        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19670      }
19671    };
19672  }
19673
19674  protected NutritionIntake.NutritionIntakeConsumedItemComponent parseNutritionIntakeConsumedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
19675    NutritionIntake.NutritionIntakeConsumedItemComponent res = new NutritionIntake.NutritionIntakeConsumedItemComponent();
19676    parseNutritionIntakeConsumedItemComponentProperties(json, res);
19677    return res;
19678  }
19679
19680  protected void parseNutritionIntakeConsumedItemComponentProperties(JsonObject json, NutritionIntake.NutritionIntakeConsumedItemComponent res) throws IOException, FHIRFormatError {
19681    parseBackboneElementProperties(json, res);
19682    if (json.has("type"))
19683      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19684    if (json.has("nutritionProduct"))
19685      res.setNutritionProduct(parseCodeableConcept(json.getAsJsonObject("nutritionProduct")));
19686    if (json.has("schedule"))
19687      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
19688    if (json.has("amount"))
19689      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
19690    if (json.has("rate"))
19691      res.setRate(parseQuantity(json.getAsJsonObject("rate")));
19692    if (json.has("notConsumed"))
19693      res.setNotConsumedElement(parseBoolean(json.get("notConsumed").getAsBoolean()));
19694    if (json.has("_notConsumed"))
19695      parseElementProperties(json.getAsJsonObject("_notConsumed"), res.getNotConsumedElement());
19696    if (json.has("notConsumedReason"))
19697      res.setNotConsumedReason(parseCodeableConcept(json.getAsJsonObject("notConsumedReason")));
19698  }
19699
19700  protected NutritionIntake.NutritionIntakeIngredientLabelComponent parseNutritionIntakeIngredientLabelComponent(JsonObject json) throws IOException, FHIRFormatError {
19701    NutritionIntake.NutritionIntakeIngredientLabelComponent res = new NutritionIntake.NutritionIntakeIngredientLabelComponent();
19702    parseNutritionIntakeIngredientLabelComponentProperties(json, res);
19703    return res;
19704  }
19705
19706  protected void parseNutritionIntakeIngredientLabelComponentProperties(JsonObject json, NutritionIntake.NutritionIntakeIngredientLabelComponent res) throws IOException, FHIRFormatError {
19707    parseBackboneElementProperties(json, res);
19708    if (json.has("nutrient"))
19709      res.setNutrient(parseCodeableConcept(json.getAsJsonObject("nutrient")));
19710    if (json.has("amount"))
19711      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
19712  }
19713
19714  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
19715    NutritionOrder res = new NutritionOrder();
19716    parseNutritionOrderProperties(json, res);
19717    return res;
19718  }
19719
19720  protected void parseNutritionOrderProperties(JsonObject json, NutritionOrder res) throws IOException, FHIRFormatError {
19721    parseDomainResourceProperties(json, res);
19722    if (json.has("identifier")) {
19723      JsonArray array = json.getAsJsonArray("identifier");
19724      for (int i = 0; i < array.size(); i++) {
19725        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19726      }
19727    };
19728    if (json.has("instantiatesCanonical")) {
19729      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
19730      for (int i = 0; i < array.size(); i++) {
19731        if (array.get(i).isJsonNull()) {
19732          res.getInstantiatesCanonical().add(new CanonicalType());
19733        } else {;
19734          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
19735        }
19736      }
19737    };
19738    if (json.has("_instantiatesCanonical")) {
19739      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
19740      for (int i = 0; i < array.size(); i++) {
19741        if (i == res.getInstantiatesCanonical().size())
19742          res.getInstantiatesCanonical().add(parseCanonical(null));
19743        if (array.get(i) instanceof JsonObject) 
19744          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
19745      }
19746    };
19747    if (json.has("instantiatesUri")) {
19748      JsonArray array = json.getAsJsonArray("instantiatesUri");
19749      for (int i = 0; i < array.size(); i++) {
19750        if (array.get(i).isJsonNull()) {
19751          res.getInstantiatesUri().add(new UriType());
19752        } else {;
19753          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
19754        }
19755      }
19756    };
19757    if (json.has("_instantiatesUri")) {
19758      JsonArray array = json.getAsJsonArray("_instantiatesUri");
19759      for (int i = 0; i < array.size(); i++) {
19760        if (i == res.getInstantiatesUri().size())
19761          res.getInstantiatesUri().add(parseUri(null));
19762        if (array.get(i) instanceof JsonObject) 
19763          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
19764      }
19765    };
19766    if (json.has("instantiates")) {
19767      JsonArray array = json.getAsJsonArray("instantiates");
19768      for (int i = 0; i < array.size(); i++) {
19769        if (array.get(i).isJsonNull()) {
19770          res.getInstantiates().add(new UriType());
19771        } else {;
19772          res.getInstantiates().add(parseUri(array.get(i).getAsString()));
19773        }
19774      }
19775    };
19776    if (json.has("_instantiates")) {
19777      JsonArray array = json.getAsJsonArray("_instantiates");
19778      for (int i = 0; i < array.size(); i++) {
19779        if (i == res.getInstantiates().size())
19780          res.getInstantiates().add(parseUri(null));
19781        if (array.get(i) instanceof JsonObject) 
19782          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
19783      }
19784    };
19785    if (json.has("status"))
19786      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
19787    if (json.has("_status"))
19788      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19789    if (json.has("intent"))
19790      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
19791    if (json.has("_intent"))
19792      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
19793    if (json.has("patient"))
19794      res.setPatient(parseReference(json.getAsJsonObject("patient")));
19795    if (json.has("encounter"))
19796      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
19797    if (json.has("dateTime"))
19798      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
19799    if (json.has("_dateTime"))
19800      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
19801    if (json.has("orderer"))
19802      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
19803    if (json.has("allergyIntolerance")) {
19804      JsonArray array = json.getAsJsonArray("allergyIntolerance");
19805      for (int i = 0; i < array.size(); i++) {
19806        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
19807      }
19808    };
19809    if (json.has("foodPreferenceModifier")) {
19810      JsonArray array = json.getAsJsonArray("foodPreferenceModifier");
19811      for (int i = 0; i < array.size(); i++) {
19812        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19813      }
19814    };
19815    if (json.has("excludeFoodModifier")) {
19816      JsonArray array = json.getAsJsonArray("excludeFoodModifier");
19817      for (int i = 0; i < array.size(); i++) {
19818        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19819      }
19820    };
19821    if (json.has("oralDiet"))
19822      res.setOralDiet(parseNutritionOrderOralDietComponent(json.getAsJsonObject("oralDiet")));
19823    if (json.has("supplement")) {
19824      JsonArray array = json.getAsJsonArray("supplement");
19825      for (int i = 0; i < array.size(); i++) {
19826        res.getSupplement().add(parseNutritionOrderSupplementComponent(array.get(i).getAsJsonObject()));
19827      }
19828    };
19829    if (json.has("enteralFormula"))
19830      res.setEnteralFormula(parseNutritionOrderEnteralFormulaComponent(json.getAsJsonObject("enteralFormula")));
19831    if (json.has("note")) {
19832      JsonArray array = json.getAsJsonArray("note");
19833      for (int i = 0; i < array.size(); i++) {
19834        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19835      }
19836    };
19837  }
19838
19839  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderOralDietComponent(JsonObject json) throws IOException, FHIRFormatError {
19840    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
19841    parseNutritionOrderOralDietComponentProperties(json, res);
19842    return res;
19843  }
19844
19845  protected void parseNutritionOrderOralDietComponentProperties(JsonObject json, NutritionOrder.NutritionOrderOralDietComponent res) throws IOException, FHIRFormatError {
19846    parseBackboneElementProperties(json, res);
19847    if (json.has("type")) {
19848      JsonArray array = json.getAsJsonArray("type");
19849      for (int i = 0; i < array.size(); i++) {
19850        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19851      }
19852    };
19853    if (json.has("schedule")) {
19854      JsonArray array = json.getAsJsonArray("schedule");
19855      for (int i = 0; i < array.size(); i++) {
19856        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
19857      }
19858    };
19859    if (json.has("nutrient")) {
19860      JsonArray array = json.getAsJsonArray("nutrient");
19861      for (int i = 0; i < array.size(); i++) {
19862        res.getNutrient().add(parseNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject()));
19863      }
19864    };
19865    if (json.has("texture")) {
19866      JsonArray array = json.getAsJsonArray("texture");
19867      for (int i = 0; i < array.size(); i++) {
19868        res.getTexture().add(parseNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject()));
19869      }
19870    };
19871    if (json.has("fluidConsistencyType")) {
19872      JsonArray array = json.getAsJsonArray("fluidConsistencyType");
19873      for (int i = 0; i < array.size(); i++) {
19874        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19875      }
19876    };
19877    if (json.has("instruction"))
19878      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
19879    if (json.has("_instruction"))
19880      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
19881  }
19882
19883  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderOralDietNutrientComponent(JsonObject json) throws IOException, FHIRFormatError {
19884    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
19885    parseNutritionOrderOralDietNutrientComponentProperties(json, res);
19886    return res;
19887  }
19888
19889  protected void parseNutritionOrderOralDietNutrientComponentProperties(JsonObject json, NutritionOrder.NutritionOrderOralDietNutrientComponent res) throws IOException, FHIRFormatError {
19890    parseBackboneElementProperties(json, res);
19891    if (json.has("modifier"))
19892      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
19893    if (json.has("amount"))
19894      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
19895  }
19896
19897  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderOralDietTextureComponent(JsonObject json) throws IOException, FHIRFormatError {
19898    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
19899    parseNutritionOrderOralDietTextureComponentProperties(json, res);
19900    return res;
19901  }
19902
19903  protected void parseNutritionOrderOralDietTextureComponentProperties(JsonObject json, NutritionOrder.NutritionOrderOralDietTextureComponent res) throws IOException, FHIRFormatError {
19904    parseBackboneElementProperties(json, res);
19905    if (json.has("modifier"))
19906      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
19907    if (json.has("foodType"))
19908      res.setFoodType(parseCodeableConcept(json.getAsJsonObject("foodType")));
19909  }
19910
19911  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderSupplementComponent(JsonObject json) throws IOException, FHIRFormatError {
19912    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
19913    parseNutritionOrderSupplementComponentProperties(json, res);
19914    return res;
19915  }
19916
19917  protected void parseNutritionOrderSupplementComponentProperties(JsonObject json, NutritionOrder.NutritionOrderSupplementComponent res) throws IOException, FHIRFormatError {
19918    parseBackboneElementProperties(json, res);
19919    if (json.has("type"))
19920      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19921    if (json.has("productName"))
19922      res.setProductNameElement(parseString(json.get("productName").getAsString()));
19923    if (json.has("_productName"))
19924      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
19925    if (json.has("schedule")) {
19926      JsonArray array = json.getAsJsonArray("schedule");
19927      for (int i = 0; i < array.size(); i++) {
19928        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
19929      }
19930    };
19931    if (json.has("quantity"))
19932      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
19933    if (json.has("instruction"))
19934      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
19935    if (json.has("_instruction"))
19936      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
19937  }
19938
19939  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderEnteralFormulaComponent(JsonObject json) throws IOException, FHIRFormatError {
19940    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
19941    parseNutritionOrderEnteralFormulaComponentProperties(json, res);
19942    return res;
19943  }
19944
19945  protected void parseNutritionOrderEnteralFormulaComponentProperties(JsonObject json, NutritionOrder.NutritionOrderEnteralFormulaComponent res) throws IOException, FHIRFormatError {
19946    parseBackboneElementProperties(json, res);
19947    if (json.has("baseFormulaType"))
19948      res.setBaseFormulaType(parseCodeableConcept(json.getAsJsonObject("baseFormulaType")));
19949    if (json.has("baseFormulaProductName"))
19950      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
19951    if (json.has("_baseFormulaProductName"))
19952      parseElementProperties(json.getAsJsonObject("_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
19953    if (json.has("additiveType"))
19954      res.setAdditiveType(parseCodeableConcept(json.getAsJsonObject("additiveType")));
19955    if (json.has("additiveProductName"))
19956      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
19957    if (json.has("_additiveProductName"))
19958      parseElementProperties(json.getAsJsonObject("_additiveProductName"), res.getAdditiveProductNameElement());
19959    if (json.has("caloricDensity"))
19960      res.setCaloricDensity(parseQuantity(json.getAsJsonObject("caloricDensity")));
19961    if (json.has("routeofAdministration"))
19962      res.setRouteofAdministration(parseCodeableConcept(json.getAsJsonObject("routeofAdministration")));
19963    if (json.has("administration")) {
19964      JsonArray array = json.getAsJsonArray("administration");
19965      for (int i = 0; i < array.size(); i++) {
19966        res.getAdministration().add(parseNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject()));
19967      }
19968    };
19969    if (json.has("maxVolumeToDeliver"))
19970      res.setMaxVolumeToDeliver(parseQuantity(json.getAsJsonObject("maxVolumeToDeliver")));
19971    if (json.has("administrationInstruction"))
19972      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
19973    if (json.has("_administrationInstruction"))
19974      parseElementProperties(json.getAsJsonObject("_administrationInstruction"), res.getAdministrationInstructionElement());
19975  }
19976
19977  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json) throws IOException, FHIRFormatError {
19978    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
19979    parseNutritionOrderEnteralFormulaAdministrationComponentProperties(json, res);
19980    return res;
19981  }
19982
19983  protected void parseNutritionOrderEnteralFormulaAdministrationComponentProperties(JsonObject json, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res) throws IOException, FHIRFormatError {
19984    parseBackboneElementProperties(json, res);
19985    if (json.has("schedule"))
19986      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
19987    if (json.has("quantity"))
19988      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
19989    DataType rate = parseType("rate", json);
19990    if (rate != null)
19991      res.setRate(rate);
19992  }
19993
19994  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
19995    Observation res = new Observation();
19996    parseObservationProperties(json, res);
19997    return res;
19998  }
19999
20000  protected void parseObservationProperties(JsonObject json, Observation res) throws IOException, FHIRFormatError {
20001    parseDomainResourceProperties(json, res);
20002    if (json.has("identifier")) {
20003      JsonArray array = json.getAsJsonArray("identifier");
20004      for (int i = 0; i < array.size(); i++) {
20005        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20006      }
20007    };
20008    if (json.has("basedOn")) {
20009      JsonArray array = json.getAsJsonArray("basedOn");
20010      for (int i = 0; i < array.size(); i++) {
20011        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
20012      }
20013    };
20014    if (json.has("partOf")) {
20015      JsonArray array = json.getAsJsonArray("partOf");
20016      for (int i = 0; i < array.size(); i++) {
20017        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
20018      }
20019    };
20020    if (json.has("status"))
20021      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ObservationStatus.NULL, new Enumerations.ObservationStatusEnumFactory()));
20022    if (json.has("_status"))
20023      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20024    if (json.has("category")) {
20025      JsonArray array = json.getAsJsonArray("category");
20026      for (int i = 0; i < array.size(); i++) {
20027        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20028      }
20029    };
20030    if (json.has("code"))
20031      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
20032    if (json.has("subject"))
20033      res.setSubject(parseReference(json.getAsJsonObject("subject")));
20034    if (json.has("focus")) {
20035      JsonArray array = json.getAsJsonArray("focus");
20036      for (int i = 0; i < array.size(); i++) {
20037        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
20038      }
20039    };
20040    if (json.has("encounter"))
20041      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
20042    DataType effective = parseType("effective", json);
20043    if (effective != null)
20044      res.setEffective(effective);
20045    if (json.has("issued"))
20046      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
20047    if (json.has("_issued"))
20048      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
20049    if (json.has("performer")) {
20050      JsonArray array = json.getAsJsonArray("performer");
20051      for (int i = 0; i < array.size(); i++) {
20052        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
20053      }
20054    };
20055    DataType value = parseType("value", json);
20056    if (value != null)
20057      res.setValue(value);
20058    if (json.has("dataAbsentReason"))
20059      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
20060    if (json.has("interpretation")) {
20061      JsonArray array = json.getAsJsonArray("interpretation");
20062      for (int i = 0; i < array.size(); i++) {
20063        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20064      }
20065    };
20066    if (json.has("note")) {
20067      JsonArray array = json.getAsJsonArray("note");
20068      for (int i = 0; i < array.size(); i++) {
20069        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
20070      }
20071    };
20072    if (json.has("bodySite"))
20073      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
20074    if (json.has("method"))
20075      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
20076    if (json.has("specimen"))
20077      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
20078    if (json.has("device"))
20079      res.setDevice(parseReference(json.getAsJsonObject("device")));
20080    if (json.has("referenceRange")) {
20081      JsonArray array = json.getAsJsonArray("referenceRange");
20082      for (int i = 0; i < array.size(); i++) {
20083        res.getReferenceRange().add(parseObservationReferenceRangeComponent(array.get(i).getAsJsonObject()));
20084      }
20085    };
20086    if (json.has("hasMember")) {
20087      JsonArray array = json.getAsJsonArray("hasMember");
20088      for (int i = 0; i < array.size(); i++) {
20089        res.getHasMember().add(parseReference(array.get(i).getAsJsonObject()));
20090      }
20091    };
20092    if (json.has("derivedFrom")) {
20093      JsonArray array = json.getAsJsonArray("derivedFrom");
20094      for (int i = 0; i < array.size(); i++) {
20095        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
20096      }
20097    };
20098    if (json.has("component")) {
20099      JsonArray array = json.getAsJsonArray("component");
20100      for (int i = 0; i < array.size(); i++) {
20101        res.getComponent().add(parseObservationComponentComponent(array.get(i).getAsJsonObject()));
20102      }
20103    };
20104  }
20105
20106  protected Observation.ObservationReferenceRangeComponent parseObservationReferenceRangeComponent(JsonObject json) throws IOException, FHIRFormatError {
20107    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
20108    parseObservationReferenceRangeComponentProperties(json, res);
20109    return res;
20110  }
20111
20112  protected void parseObservationReferenceRangeComponentProperties(JsonObject json, Observation.ObservationReferenceRangeComponent res) throws IOException, FHIRFormatError {
20113    parseBackboneElementProperties(json, res);
20114    if (json.has("low"))
20115      res.setLow(parseQuantity(json.getAsJsonObject("low")));
20116    if (json.has("high"))
20117      res.setHigh(parseQuantity(json.getAsJsonObject("high")));
20118    if (json.has("type"))
20119      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
20120    if (json.has("appliesTo")) {
20121      JsonArray array = json.getAsJsonArray("appliesTo");
20122      for (int i = 0; i < array.size(); i++) {
20123        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20124      }
20125    };
20126    if (json.has("age"))
20127      res.setAge(parseRange(json.getAsJsonObject("age")));
20128    if (json.has("text"))
20129      res.setTextElement(parseString(json.get("text").getAsString()));
20130    if (json.has("_text"))
20131      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
20132  }
20133
20134  protected Observation.ObservationComponentComponent parseObservationComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
20135    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
20136    parseObservationComponentComponentProperties(json, res);
20137    return res;
20138  }
20139
20140  protected void parseObservationComponentComponentProperties(JsonObject json, Observation.ObservationComponentComponent res) throws IOException, FHIRFormatError {
20141    parseBackboneElementProperties(json, res);
20142    if (json.has("code"))
20143      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
20144    DataType value = parseType("value", json);
20145    if (value != null)
20146      res.setValue(value);
20147    if (json.has("dataAbsentReason"))
20148      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
20149    if (json.has("interpretation")) {
20150      JsonArray array = json.getAsJsonArray("interpretation");
20151      for (int i = 0; i < array.size(); i++) {
20152        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20153      }
20154    };
20155    if (json.has("referenceRange")) {
20156      JsonArray array = json.getAsJsonArray("referenceRange");
20157      for (int i = 0; i < array.size(); i++) {
20158        res.getReferenceRange().add(parseObservationReferenceRangeComponent(array.get(i).getAsJsonObject()));
20159      }
20160    };
20161  }
20162
20163  protected ObservationDefinition parseObservationDefinition(JsonObject json) throws IOException, FHIRFormatError {
20164    ObservationDefinition res = new ObservationDefinition();
20165    parseObservationDefinitionProperties(json, res);
20166    return res;
20167  }
20168
20169  protected void parseObservationDefinitionProperties(JsonObject json, ObservationDefinition res) throws IOException, FHIRFormatError {
20170    parseDomainResourceProperties(json, res);
20171    if (json.has("url"))
20172      res.setUrlElement(parseUri(json.get("url").getAsString()));
20173    if (json.has("_url"))
20174      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
20175    if (json.has("identifier"))
20176      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
20177    if (json.has("version"))
20178      res.setVersionElement(parseString(json.get("version").getAsString()));
20179    if (json.has("_version"))
20180      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
20181    if (json.has("title"))
20182      res.setTitleElement(parseString(json.get("title").getAsString()));
20183    if (json.has("_title"))
20184      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
20185    if (json.has("derivedFromCanonical")) {
20186      JsonArray array = json.getAsJsonArray("derivedFromCanonical");
20187      for (int i = 0; i < array.size(); i++) {
20188        if (array.get(i).isJsonNull()) {
20189          res.getDerivedFromCanonical().add(new CanonicalType());
20190        } else {;
20191          res.getDerivedFromCanonical().add(parseCanonical(array.get(i).getAsString()));
20192        }
20193      }
20194    };
20195    if (json.has("_derivedFromCanonical")) {
20196      JsonArray array = json.getAsJsonArray("_derivedFromCanonical");
20197      for (int i = 0; i < array.size(); i++) {
20198        if (i == res.getDerivedFromCanonical().size())
20199          res.getDerivedFromCanonical().add(parseCanonical(null));
20200        if (array.get(i) instanceof JsonObject) 
20201          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromCanonical().get(i));
20202      }
20203    };
20204    if (json.has("derivedFromUri")) {
20205      JsonArray array = json.getAsJsonArray("derivedFromUri");
20206      for (int i = 0; i < array.size(); i++) {
20207        if (array.get(i).isJsonNull()) {
20208          res.getDerivedFromUri().add(new UriType());
20209        } else {;
20210          res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
20211        }
20212      }
20213    };
20214    if (json.has("_derivedFromUri")) {
20215      JsonArray array = json.getAsJsonArray("_derivedFromUri");
20216      for (int i = 0; i < array.size(); i++) {
20217        if (i == res.getDerivedFromUri().size())
20218          res.getDerivedFromUri().add(parseUri(null));
20219        if (array.get(i) instanceof JsonObject) 
20220          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
20221      }
20222    };
20223    if (json.has("status"))
20224      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
20225    if (json.has("_status"))
20226      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20227    if (json.has("experimental"))
20228      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
20229    if (json.has("_experimental"))
20230      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
20231    DataType subject = parseType("subject", json);
20232    if (subject != null)
20233      res.setSubject(subject);
20234    if (json.has("date"))
20235      res.setDateElement(parseDateTime(json.get("date").getAsString()));
20236    if (json.has("_date"))
20237      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
20238    if (json.has("publisher"))
20239      res.setPublisher(parseReference(json.getAsJsonObject("publisher")));
20240    if (json.has("contact")) {
20241      JsonArray array = json.getAsJsonArray("contact");
20242      for (int i = 0; i < array.size(); i++) {
20243        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
20244      }
20245    };
20246    if (json.has("description"))
20247      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20248    if (json.has("_description"))
20249      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20250    if (json.has("useContext")) {
20251      JsonArray array = json.getAsJsonArray("useContext");
20252      for (int i = 0; i < array.size(); i++) {
20253        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
20254      }
20255    };
20256    if (json.has("jurisdiction")) {
20257      JsonArray array = json.getAsJsonArray("jurisdiction");
20258      for (int i = 0; i < array.size(); i++) {
20259        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20260      }
20261    };
20262    if (json.has("purpose"))
20263      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
20264    if (json.has("_purpose"))
20265      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
20266    if (json.has("copyright"))
20267      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
20268    if (json.has("_copyright"))
20269      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
20270    if (json.has("approvalDate"))
20271      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
20272    if (json.has("_approvalDate"))
20273      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
20274    if (json.has("lastReviewDate"))
20275      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
20276    if (json.has("_lastReviewDate"))
20277      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
20278    if (json.has("effectivePeriod"))
20279      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
20280    if (json.has("performerType"))
20281      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
20282    if (json.has("category")) {
20283      JsonArray array = json.getAsJsonArray("category");
20284      for (int i = 0; i < array.size(); i++) {
20285        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20286      }
20287    };
20288    if (json.has("code"))
20289      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
20290    if (json.has("permittedDataType")) {
20291      JsonArray array = json.getAsJsonArray("permittedDataType");
20292      for (int i = 0; i < array.size(); i++) {
20293        if (array.get(i).isJsonNull()) {
20294          res.getPermittedDataType().add(new Enumeration<ObservationDefinition.ObservationDataType>(new ObservationDefinition.ObservationDataTypeEnumFactory(), ObservationDefinition.ObservationDataType.NULL));
20295        } else {;
20296          res.getPermittedDataType().add(parseEnumeration(array.get(i).getAsString(), ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
20297        }
20298      }
20299    };
20300    if (json.has("_permittedDataType")) {
20301      JsonArray array = json.getAsJsonArray("_permittedDataType");
20302      for (int i = 0; i < array.size(); i++) {
20303        if (i == res.getPermittedDataType().size())
20304          res.getPermittedDataType().add(parseEnumeration(null, ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
20305        if (array.get(i) instanceof JsonObject) 
20306          parseElementProperties(array.get(i).getAsJsonObject(), res.getPermittedDataType().get(i));
20307      }
20308    };
20309    if (json.has("multipleResultsAllowed"))
20310      res.setMultipleResultsAllowedElement(parseBoolean(json.get("multipleResultsAllowed").getAsBoolean()));
20311    if (json.has("_multipleResultsAllowed"))
20312      parseElementProperties(json.getAsJsonObject("_multipleResultsAllowed"), res.getMultipleResultsAllowedElement());
20313    if (json.has("bodySite"))
20314      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
20315    if (json.has("method"))
20316      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
20317    if (json.has("specimen"))
20318      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
20319    if (json.has("device"))
20320      res.setDevice(parseReference(json.getAsJsonObject("device")));
20321    if (json.has("preferredReportName"))
20322      res.setPreferredReportNameElement(parseString(json.get("preferredReportName").getAsString()));
20323    if (json.has("_preferredReportName"))
20324      parseElementProperties(json.getAsJsonObject("_preferredReportName"), res.getPreferredReportNameElement());
20325    if (json.has("quantitativeDetails"))
20326      res.setQuantitativeDetails(parseObservationDefinitionQuantitativeDetailsComponent(json.getAsJsonObject("quantitativeDetails")));
20327    if (json.has("qualifiedInterval")) {
20328      JsonArray array = json.getAsJsonArray("qualifiedInterval");
20329      for (int i = 0; i < array.size(); i++) {
20330        res.getQualifiedInterval().add(parseObservationDefinitionQualifiedIntervalComponent(array.get(i).getAsJsonObject()));
20331      }
20332    };
20333    if (json.has("validCodedValueSet"))
20334      res.setValidCodedValueSet(parseReference(json.getAsJsonObject("validCodedValueSet")));
20335    if (json.has("normalCodedValueSet"))
20336      res.setNormalCodedValueSet(parseReference(json.getAsJsonObject("normalCodedValueSet")));
20337    if (json.has("abnormalCodedValueSet"))
20338      res.setAbnormalCodedValueSet(parseReference(json.getAsJsonObject("abnormalCodedValueSet")));
20339    if (json.has("criticalCodedValueSet"))
20340      res.setCriticalCodedValueSet(parseReference(json.getAsJsonObject("criticalCodedValueSet")));
20341    if (json.has("hasMember")) {
20342      JsonArray array = json.getAsJsonArray("hasMember");
20343      for (int i = 0; i < array.size(); i++) {
20344        res.getHasMember().add(parseReference(array.get(i).getAsJsonObject()));
20345      }
20346    };
20347    if (json.has("component")) {
20348      JsonArray array = json.getAsJsonArray("component");
20349      for (int i = 0; i < array.size(); i++) {
20350        res.getComponent().add(parseObservationDefinitionComponentComponent(array.get(i).getAsJsonObject()));
20351      }
20352    };
20353  }
20354
20355  protected ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent parseObservationDefinitionQuantitativeDetailsComponent(JsonObject json) throws IOException, FHIRFormatError {
20356    ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res = new ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent();
20357    parseObservationDefinitionQuantitativeDetailsComponentProperties(json, res);
20358    return res;
20359  }
20360
20361  protected void parseObservationDefinitionQuantitativeDetailsComponentProperties(JsonObject json, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res) throws IOException, FHIRFormatError {
20362    parseBackboneElementProperties(json, res);
20363    if (json.has("customaryUnit"))
20364      res.setCustomaryUnit(parseCodeableConcept(json.getAsJsonObject("customaryUnit")));
20365    if (json.has("unit"))
20366      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
20367    if (json.has("conversionFactor"))
20368      res.setConversionFactorElement(parseDecimal(json.get("conversionFactor").getAsBigDecimal()));
20369    if (json.has("_conversionFactor"))
20370      parseElementProperties(json.getAsJsonObject("_conversionFactor"), res.getConversionFactorElement());
20371    if (json.has("decimalPrecision"))
20372      res.setDecimalPrecisionElement(parseInteger(json.get("decimalPrecision").getAsLong()));
20373    if (json.has("_decimalPrecision"))
20374      parseElementProperties(json.getAsJsonObject("_decimalPrecision"), res.getDecimalPrecisionElement());
20375  }
20376
20377  protected ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent parseObservationDefinitionQualifiedIntervalComponent(JsonObject json) throws IOException, FHIRFormatError {
20378    ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res = new ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
20379    parseObservationDefinitionQualifiedIntervalComponentProperties(json, res);
20380    return res;
20381  }
20382
20383  protected void parseObservationDefinitionQualifiedIntervalComponentProperties(JsonObject json, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res) throws IOException, FHIRFormatError {
20384    parseBackboneElementProperties(json, res);
20385    if (json.has("category"))
20386      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), ObservationDefinition.ObservationRangeCategory.NULL, new ObservationDefinition.ObservationRangeCategoryEnumFactory()));
20387    if (json.has("_category"))
20388      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
20389    if (json.has("range"))
20390      res.setRange(parseRange(json.getAsJsonObject("range")));
20391    if (json.has("context"))
20392      res.setContext(parseCodeableConcept(json.getAsJsonObject("context")));
20393    if (json.has("appliesTo")) {
20394      JsonArray array = json.getAsJsonArray("appliesTo");
20395      for (int i = 0; i < array.size(); i++) {
20396        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20397      }
20398    };
20399    if (json.has("gender"))
20400      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
20401    if (json.has("_gender"))
20402      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
20403    if (json.has("age"))
20404      res.setAge(parseRange(json.getAsJsonObject("age")));
20405    if (json.has("gestationalAge"))
20406      res.setGestationalAge(parseRange(json.getAsJsonObject("gestationalAge")));
20407    if (json.has("condition"))
20408      res.setConditionElement(parseString(json.get("condition").getAsString()));
20409    if (json.has("_condition"))
20410      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
20411  }
20412
20413  protected ObservationDefinition.ObservationDefinitionComponentComponent parseObservationDefinitionComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
20414    ObservationDefinition.ObservationDefinitionComponentComponent res = new ObservationDefinition.ObservationDefinitionComponentComponent();
20415    parseObservationDefinitionComponentComponentProperties(json, res);
20416    return res;
20417  }
20418
20419  protected void parseObservationDefinitionComponentComponentProperties(JsonObject json, ObservationDefinition.ObservationDefinitionComponentComponent res) throws IOException, FHIRFormatError {
20420    parseBackboneElementProperties(json, res);
20421    if (json.has("code"))
20422      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
20423    if (json.has("permittedDataType")) {
20424      JsonArray array = json.getAsJsonArray("permittedDataType");
20425      for (int i = 0; i < array.size(); i++) {
20426        if (array.get(i).isJsonNull()) {
20427          res.getPermittedDataType().add(new Enumeration<ObservationDefinition.ObservationDataType>(new ObservationDefinition.ObservationDataTypeEnumFactory(), ObservationDefinition.ObservationDataType.NULL));
20428        } else {;
20429          res.getPermittedDataType().add(parseEnumeration(array.get(i).getAsString(), ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
20430        }
20431      }
20432    };
20433    if (json.has("_permittedDataType")) {
20434      JsonArray array = json.getAsJsonArray("_permittedDataType");
20435      for (int i = 0; i < array.size(); i++) {
20436        if (i == res.getPermittedDataType().size())
20437          res.getPermittedDataType().add(parseEnumeration(null, ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
20438        if (array.get(i) instanceof JsonObject) 
20439          parseElementProperties(array.get(i).getAsJsonObject(), res.getPermittedDataType().get(i));
20440      }
20441    };
20442    if (json.has("quantitativeDetails"))
20443      res.setQuantitativeDetails(parseObservationDefinitionQuantitativeDetailsComponent(json.getAsJsonObject("quantitativeDetails")));
20444    if (json.has("qualifiedInterval")) {
20445      JsonArray array = json.getAsJsonArray("qualifiedInterval");
20446      for (int i = 0; i < array.size(); i++) {
20447        res.getQualifiedInterval().add(parseObservationDefinitionQualifiedIntervalComponent(array.get(i).getAsJsonObject()));
20448      }
20449    };
20450  }
20451
20452  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
20453    OperationDefinition res = new OperationDefinition();
20454    parseOperationDefinitionProperties(json, res);
20455    return res;
20456  }
20457
20458  protected void parseOperationDefinitionProperties(JsonObject json, OperationDefinition res) throws IOException, FHIRFormatError {
20459    parseCanonicalResourceProperties(json, res);
20460    if (json.has("url"))
20461      res.setUrlElement(parseUri(json.get("url").getAsString()));
20462    if (json.has("_url"))
20463      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
20464    if (json.has("version"))
20465      res.setVersionElement(parseString(json.get("version").getAsString()));
20466    if (json.has("_version"))
20467      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
20468    if (json.has("name"))
20469      res.setNameElement(parseString(json.get("name").getAsString()));
20470    if (json.has("_name"))
20471      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
20472    if (json.has("title"))
20473      res.setTitleElement(parseString(json.get("title").getAsString()));
20474    if (json.has("_title"))
20475      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
20476    if (json.has("status"))
20477      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
20478    if (json.has("_status"))
20479      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20480    if (json.has("kind"))
20481      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
20482    if (json.has("_kind"))
20483      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
20484    if (json.has("experimental"))
20485      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
20486    if (json.has("_experimental"))
20487      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
20488    if (json.has("date"))
20489      res.setDateElement(parseDateTime(json.get("date").getAsString()));
20490    if (json.has("_date"))
20491      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
20492    if (json.has("publisher"))
20493      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
20494    if (json.has("_publisher"))
20495      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
20496    if (json.has("contact")) {
20497      JsonArray array = json.getAsJsonArray("contact");
20498      for (int i = 0; i < array.size(); i++) {
20499        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
20500      }
20501    };
20502    if (json.has("description"))
20503      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20504    if (json.has("_description"))
20505      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20506    if (json.has("useContext")) {
20507      JsonArray array = json.getAsJsonArray("useContext");
20508      for (int i = 0; i < array.size(); i++) {
20509        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
20510      }
20511    };
20512    if (json.has("jurisdiction")) {
20513      JsonArray array = json.getAsJsonArray("jurisdiction");
20514      for (int i = 0; i < array.size(); i++) {
20515        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20516      }
20517    };
20518    if (json.has("purpose"))
20519      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
20520    if (json.has("_purpose"))
20521      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
20522    if (json.has("affectsState"))
20523      res.setAffectsStateElement(parseBoolean(json.get("affectsState").getAsBoolean()));
20524    if (json.has("_affectsState"))
20525      parseElementProperties(json.getAsJsonObject("_affectsState"), res.getAffectsStateElement());
20526    if (json.has("code"))
20527      res.setCodeElement(parseCode(json.get("code").getAsString()));
20528    if (json.has("_code"))
20529      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
20530    if (json.has("comment"))
20531      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
20532    if (json.has("_comment"))
20533      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
20534    if (json.has("base"))
20535      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
20536    if (json.has("_base"))
20537      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
20538    if (json.has("resource")) {
20539      JsonArray array = json.getAsJsonArray("resource");
20540      for (int i = 0; i < array.size(); i++) {
20541        if (array.get(i).isJsonNull()) {
20542          res.getResource().add(new CodeType());
20543        } else {;
20544          res.getResource().add(parseCode(array.get(i).getAsString()));
20545        }
20546      }
20547    };
20548    if (json.has("_resource")) {
20549      JsonArray array = json.getAsJsonArray("_resource");
20550      for (int i = 0; i < array.size(); i++) {
20551        if (i == res.getResource().size())
20552          res.getResource().add(parseCode(null));
20553        if (array.get(i) instanceof JsonObject) 
20554          parseElementProperties(array.get(i).getAsJsonObject(), res.getResource().get(i));
20555      }
20556    };
20557    if (json.has("system"))
20558      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
20559    if (json.has("_system"))
20560      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
20561    if (json.has("type"))
20562      res.setTypeElement(parseBoolean(json.get("type").getAsBoolean()));
20563    if (json.has("_type"))
20564      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
20565    if (json.has("instance"))
20566      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
20567    if (json.has("_instance"))
20568      parseElementProperties(json.getAsJsonObject("_instance"), res.getInstanceElement());
20569    if (json.has("inputProfile"))
20570      res.setInputProfileElement(parseCanonical(json.get("inputProfile").getAsString()));
20571    if (json.has("_inputProfile"))
20572      parseElementProperties(json.getAsJsonObject("_inputProfile"), res.getInputProfileElement());
20573    if (json.has("outputProfile"))
20574      res.setOutputProfileElement(parseCanonical(json.get("outputProfile").getAsString()));
20575    if (json.has("_outputProfile"))
20576      parseElementProperties(json.getAsJsonObject("_outputProfile"), res.getOutputProfileElement());
20577    if (json.has("parameter")) {
20578      JsonArray array = json.getAsJsonArray("parameter");
20579      for (int i = 0; i < array.size(); i++) {
20580        res.getParameter().add(parseOperationDefinitionParameterComponent(array.get(i).getAsJsonObject()));
20581      }
20582    };
20583    if (json.has("overload")) {
20584      JsonArray array = json.getAsJsonArray("overload");
20585      for (int i = 0; i < array.size(); i++) {
20586        res.getOverload().add(parseOperationDefinitionOverloadComponent(array.get(i).getAsJsonObject()));
20587      }
20588    };
20589  }
20590
20591  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
20592    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
20593    parseOperationDefinitionParameterComponentProperties(json, res);
20594    return res;
20595  }
20596
20597  protected void parseOperationDefinitionParameterComponentProperties(JsonObject json, OperationDefinition.OperationDefinitionParameterComponent res) throws IOException, FHIRFormatError {
20598    parseBackboneElementProperties(json, res);
20599    if (json.has("name"))
20600      res.setNameElement(parseCode(json.get("name").getAsString()));
20601    if (json.has("_name"))
20602      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
20603    if (json.has("use"))
20604      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Enumerations.OperationParameterUse.NULL, new Enumerations.OperationParameterUseEnumFactory()));
20605    if (json.has("_use"))
20606      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
20607    if (json.has("min"))
20608      res.setMinElement(parseInteger(json.get("min").getAsLong()));
20609    if (json.has("_min"))
20610      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
20611    if (json.has("max"))
20612      res.setMaxElement(parseString(json.get("max").getAsString()));
20613    if (json.has("_max"))
20614      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
20615    if (json.has("documentation"))
20616      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
20617    if (json.has("_documentation"))
20618      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
20619    if (json.has("type"))
20620      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.FHIRAllTypes.NULL, new Enumerations.FHIRAllTypesEnumFactory()));
20621    if (json.has("_type"))
20622      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
20623    if (json.has("targetProfile")) {
20624      JsonArray array = json.getAsJsonArray("targetProfile");
20625      for (int i = 0; i < array.size(); i++) {
20626        if (array.get(i).isJsonNull()) {
20627          res.getTargetProfile().add(new CanonicalType());
20628        } else {;
20629          res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
20630        }
20631      }
20632    };
20633    if (json.has("_targetProfile")) {
20634      JsonArray array = json.getAsJsonArray("_targetProfile");
20635      for (int i = 0; i < array.size(); i++) {
20636        if (i == res.getTargetProfile().size())
20637          res.getTargetProfile().add(parseCanonical(null));
20638        if (array.get(i) instanceof JsonObject) 
20639          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
20640      }
20641    };
20642    if (json.has("searchType"))
20643      res.setSearchTypeElement(parseEnumeration(json.get("searchType").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
20644    if (json.has("_searchType"))
20645      parseElementProperties(json.getAsJsonObject("_searchType"), res.getSearchTypeElement());
20646    if (json.has("binding"))
20647      res.setBinding(parseOperationDefinitionParameterBindingComponent(json.getAsJsonObject("binding")));
20648    if (json.has("referencedFrom")) {
20649      JsonArray array = json.getAsJsonArray("referencedFrom");
20650      for (int i = 0; i < array.size(); i++) {
20651        res.getReferencedFrom().add(parseOperationDefinitionParameterReferencedFromComponent(array.get(i).getAsJsonObject()));
20652      }
20653    };
20654    if (json.has("part")) {
20655      JsonArray array = json.getAsJsonArray("part");
20656      for (int i = 0; i < array.size(); i++) {
20657        res.getPart().add(parseOperationDefinitionParameterComponent(array.get(i).getAsJsonObject()));
20658      }
20659    };
20660  }
20661
20662  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionParameterBindingComponent(JsonObject json) throws IOException, FHIRFormatError {
20663    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
20664    parseOperationDefinitionParameterBindingComponentProperties(json, res);
20665    return res;
20666  }
20667
20668  protected void parseOperationDefinitionParameterBindingComponentProperties(JsonObject json, OperationDefinition.OperationDefinitionParameterBindingComponent res) throws IOException, FHIRFormatError {
20669    parseBackboneElementProperties(json, res);
20670    if (json.has("strength"))
20671      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
20672    if (json.has("_strength"))
20673      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
20674    if (json.has("valueSet"))
20675      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
20676    if (json.has("_valueSet"))
20677      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
20678  }
20679
20680  protected OperationDefinition.OperationDefinitionParameterReferencedFromComponent parseOperationDefinitionParameterReferencedFromComponent(JsonObject json) throws IOException, FHIRFormatError {
20681    OperationDefinition.OperationDefinitionParameterReferencedFromComponent res = new OperationDefinition.OperationDefinitionParameterReferencedFromComponent();
20682    parseOperationDefinitionParameterReferencedFromComponentProperties(json, res);
20683    return res;
20684  }
20685
20686  protected void parseOperationDefinitionParameterReferencedFromComponentProperties(JsonObject json, OperationDefinition.OperationDefinitionParameterReferencedFromComponent res) throws IOException, FHIRFormatError {
20687    parseBackboneElementProperties(json, res);
20688    if (json.has("source"))
20689      res.setSourceElement(parseString(json.get("source").getAsString()));
20690    if (json.has("_source"))
20691      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
20692    if (json.has("sourceId"))
20693      res.setSourceIdElement(parseString(json.get("sourceId").getAsString()));
20694    if (json.has("_sourceId"))
20695      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
20696  }
20697
20698  protected OperationDefinition.OperationDefinitionOverloadComponent parseOperationDefinitionOverloadComponent(JsonObject json) throws IOException, FHIRFormatError {
20699    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
20700    parseOperationDefinitionOverloadComponentProperties(json, res);
20701    return res;
20702  }
20703
20704  protected void parseOperationDefinitionOverloadComponentProperties(JsonObject json, OperationDefinition.OperationDefinitionOverloadComponent res) throws IOException, FHIRFormatError {
20705    parseBackboneElementProperties(json, res);
20706    if (json.has("parameterName")) {
20707      JsonArray array = json.getAsJsonArray("parameterName");
20708      for (int i = 0; i < array.size(); i++) {
20709        if (array.get(i).isJsonNull()) {
20710          res.getParameterName().add(new StringType());
20711        } else {;
20712          res.getParameterName().add(parseString(array.get(i).getAsString()));
20713        }
20714      }
20715    };
20716    if (json.has("_parameterName")) {
20717      JsonArray array = json.getAsJsonArray("_parameterName");
20718      for (int i = 0; i < array.size(); i++) {
20719        if (i == res.getParameterName().size())
20720          res.getParameterName().add(parseString(null));
20721        if (array.get(i) instanceof JsonObject) 
20722          parseElementProperties(array.get(i).getAsJsonObject(), res.getParameterName().get(i));
20723      }
20724    };
20725    if (json.has("comment"))
20726      res.setCommentElement(parseString(json.get("comment").getAsString()));
20727    if (json.has("_comment"))
20728      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
20729  }
20730
20731  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
20732    OperationOutcome res = new OperationOutcome();
20733    parseOperationOutcomeProperties(json, res);
20734    return res;
20735  }
20736
20737  protected void parseOperationOutcomeProperties(JsonObject json, OperationOutcome res) throws IOException, FHIRFormatError {
20738    parseDomainResourceProperties(json, res);
20739    if (json.has("issue")) {
20740      JsonArray array = json.getAsJsonArray("issue");
20741      for (int i = 0; i < array.size(); i++) {
20742        res.getIssue().add(parseOperationOutcomeIssueComponent(array.get(i).getAsJsonObject()));
20743      }
20744    };
20745  }
20746
20747  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeIssueComponent(JsonObject json) throws IOException, FHIRFormatError {
20748    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
20749    parseOperationOutcomeIssueComponentProperties(json, res);
20750    return res;
20751  }
20752
20753  protected void parseOperationOutcomeIssueComponentProperties(JsonObject json, OperationOutcome.OperationOutcomeIssueComponent res) throws IOException, FHIRFormatError {
20754    parseBackboneElementProperties(json, res);
20755    if (json.has("severity"))
20756      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
20757    if (json.has("_severity"))
20758      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
20759    if (json.has("code"))
20760      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
20761    if (json.has("_code"))
20762      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
20763    if (json.has("details"))
20764      res.setDetails(parseCodeableConcept(json.getAsJsonObject("details")));
20765    if (json.has("diagnostics"))
20766      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
20767    if (json.has("_diagnostics"))
20768      parseElementProperties(json.getAsJsonObject("_diagnostics"), res.getDiagnosticsElement());
20769    if (json.has("location")) {
20770      JsonArray array = json.getAsJsonArray("location");
20771      for (int i = 0; i < array.size(); i++) {
20772        if (array.get(i).isJsonNull()) {
20773          res.getLocation().add(new StringType());
20774        } else {;
20775          res.getLocation().add(parseString(array.get(i).getAsString()));
20776        }
20777      }
20778    };
20779    if (json.has("_location")) {
20780      JsonArray array = json.getAsJsonArray("_location");
20781      for (int i = 0; i < array.size(); i++) {
20782        if (i == res.getLocation().size())
20783          res.getLocation().add(parseString(null));
20784        if (array.get(i) instanceof JsonObject) 
20785          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
20786      }
20787    };
20788    if (json.has("expression")) {
20789      JsonArray array = json.getAsJsonArray("expression");
20790      for (int i = 0; i < array.size(); i++) {
20791        if (array.get(i).isJsonNull()) {
20792          res.getExpression().add(new StringType());
20793        } else {;
20794          res.getExpression().add(parseString(array.get(i).getAsString()));
20795        }
20796      }
20797    };
20798    if (json.has("_expression")) {
20799      JsonArray array = json.getAsJsonArray("_expression");
20800      for (int i = 0; i < array.size(); i++) {
20801        if (i == res.getExpression().size())
20802          res.getExpression().add(parseString(null));
20803        if (array.get(i) instanceof JsonObject) 
20804          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
20805      }
20806    };
20807  }
20808
20809  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
20810    Organization res = new Organization();
20811    parseOrganizationProperties(json, res);
20812    return res;
20813  }
20814
20815  protected void parseOrganizationProperties(JsonObject json, Organization res) throws IOException, FHIRFormatError {
20816    parseDomainResourceProperties(json, res);
20817    if (json.has("identifier")) {
20818      JsonArray array = json.getAsJsonArray("identifier");
20819      for (int i = 0; i < array.size(); i++) {
20820        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20821      }
20822    };
20823    if (json.has("active"))
20824      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20825    if (json.has("_active"))
20826      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
20827    if (json.has("type")) {
20828      JsonArray array = json.getAsJsonArray("type");
20829      for (int i = 0; i < array.size(); i++) {
20830        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20831      }
20832    };
20833    if (json.has("name"))
20834      res.setNameElement(parseString(json.get("name").getAsString()));
20835    if (json.has("_name"))
20836      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
20837    if (json.has("alias")) {
20838      JsonArray array = json.getAsJsonArray("alias");
20839      for (int i = 0; i < array.size(); i++) {
20840        if (array.get(i).isJsonNull()) {
20841          res.getAlias().add(new StringType());
20842        } else {;
20843          res.getAlias().add(parseString(array.get(i).getAsString()));
20844        }
20845      }
20846    };
20847    if (json.has("_alias")) {
20848      JsonArray array = json.getAsJsonArray("_alias");
20849      for (int i = 0; i < array.size(); i++) {
20850        if (i == res.getAlias().size())
20851          res.getAlias().add(parseString(null));
20852        if (array.get(i) instanceof JsonObject) 
20853          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
20854      }
20855    };
20856    if (json.has("telecom")) {
20857      JsonArray array = json.getAsJsonArray("telecom");
20858      for (int i = 0; i < array.size(); i++) {
20859        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20860      }
20861    };
20862    if (json.has("address")) {
20863      JsonArray array = json.getAsJsonArray("address");
20864      for (int i = 0; i < array.size(); i++) {
20865        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
20866      }
20867    };
20868    if (json.has("partOf"))
20869      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
20870    if (json.has("contact")) {
20871      JsonArray array = json.getAsJsonArray("contact");
20872      for (int i = 0; i < array.size(); i++) {
20873        res.getContact().add(parseOrganizationContactComponent(array.get(i).getAsJsonObject()));
20874      }
20875    };
20876    if (json.has("endpoint")) {
20877      JsonArray array = json.getAsJsonArray("endpoint");
20878      for (int i = 0; i < array.size(); i++) {
20879        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
20880      }
20881    };
20882  }
20883
20884  protected Organization.OrganizationContactComponent parseOrganizationContactComponent(JsonObject json) throws IOException, FHIRFormatError {
20885    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
20886    parseOrganizationContactComponentProperties(json, res);
20887    return res;
20888  }
20889
20890  protected void parseOrganizationContactComponentProperties(JsonObject json, Organization.OrganizationContactComponent res) throws IOException, FHIRFormatError {
20891    parseBackboneElementProperties(json, res);
20892    if (json.has("purpose"))
20893      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
20894    if (json.has("name"))
20895      res.setName(parseHumanName(json.getAsJsonObject("name")));
20896    if (json.has("telecom")) {
20897      JsonArray array = json.getAsJsonArray("telecom");
20898      for (int i = 0; i < array.size(); i++) {
20899        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20900      }
20901    };
20902    if (json.has("address"))
20903      res.setAddress(parseAddress(json.getAsJsonObject("address")));
20904  }
20905
20906  protected OrganizationAffiliation parseOrganizationAffiliation(JsonObject json) throws IOException, FHIRFormatError {
20907    OrganizationAffiliation res = new OrganizationAffiliation();
20908    parseOrganizationAffiliationProperties(json, res);
20909    return res;
20910  }
20911
20912  protected void parseOrganizationAffiliationProperties(JsonObject json, OrganizationAffiliation res) throws IOException, FHIRFormatError {
20913    parseDomainResourceProperties(json, res);
20914    if (json.has("identifier")) {
20915      JsonArray array = json.getAsJsonArray("identifier");
20916      for (int i = 0; i < array.size(); i++) {
20917        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20918      }
20919    };
20920    if (json.has("active"))
20921      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20922    if (json.has("_active"))
20923      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
20924    if (json.has("period"))
20925      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
20926    if (json.has("organization"))
20927      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
20928    if (json.has("participatingOrganization"))
20929      res.setParticipatingOrganization(parseReference(json.getAsJsonObject("participatingOrganization")));
20930    if (json.has("network")) {
20931      JsonArray array = json.getAsJsonArray("network");
20932      for (int i = 0; i < array.size(); i++) {
20933        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
20934      }
20935    };
20936    if (json.has("code")) {
20937      JsonArray array = json.getAsJsonArray("code");
20938      for (int i = 0; i < array.size(); i++) {
20939        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20940      }
20941    };
20942    if (json.has("specialty")) {
20943      JsonArray array = json.getAsJsonArray("specialty");
20944      for (int i = 0; i < array.size(); i++) {
20945        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20946      }
20947    };
20948    if (json.has("location")) {
20949      JsonArray array = json.getAsJsonArray("location");
20950      for (int i = 0; i < array.size(); i++) {
20951        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
20952      }
20953    };
20954    if (json.has("healthcareService")) {
20955      JsonArray array = json.getAsJsonArray("healthcareService");
20956      for (int i = 0; i < array.size(); i++) {
20957        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
20958      }
20959    };
20960    if (json.has("telecom")) {
20961      JsonArray array = json.getAsJsonArray("telecom");
20962      for (int i = 0; i < array.size(); i++) {
20963        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20964      }
20965    };
20966    if (json.has("endpoint")) {
20967      JsonArray array = json.getAsJsonArray("endpoint");
20968      for (int i = 0; i < array.size(); i++) {
20969        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
20970      }
20971    };
20972  }
20973
20974  protected PackagedProductDefinition parsePackagedProductDefinition(JsonObject json) throws IOException, FHIRFormatError {
20975    PackagedProductDefinition res = new PackagedProductDefinition();
20976    parsePackagedProductDefinitionProperties(json, res);
20977    return res;
20978  }
20979
20980  protected void parsePackagedProductDefinitionProperties(JsonObject json, PackagedProductDefinition res) throws IOException, FHIRFormatError {
20981    parseDomainResourceProperties(json, res);
20982    if (json.has("identifier")) {
20983      JsonArray array = json.getAsJsonArray("identifier");
20984      for (int i = 0; i < array.size(); i++) {
20985        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20986      }
20987    };
20988    if (json.has("subject")) {
20989      JsonArray array = json.getAsJsonArray("subject");
20990      for (int i = 0; i < array.size(); i++) {
20991        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
20992      }
20993    };
20994    if (json.has("description"))
20995      res.setDescriptionElement(parseString(json.get("description").getAsString()));
20996    if (json.has("_description"))
20997      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20998    if (json.has("legalStatusOfSupply"))
20999      res.setLegalStatusOfSupply(parseCodeableConcept(json.getAsJsonObject("legalStatusOfSupply")));
21000    if (json.has("marketingStatus")) {
21001      JsonArray array = json.getAsJsonArray("marketingStatus");
21002      for (int i = 0; i < array.size(); i++) {
21003        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
21004      }
21005    };
21006    if (json.has("copackagedIndicator"))
21007      res.setCopackagedIndicatorElement(parseBoolean(json.get("copackagedIndicator").getAsBoolean()));
21008    if (json.has("_copackagedIndicator"))
21009      parseElementProperties(json.getAsJsonObject("_copackagedIndicator"), res.getCopackagedIndicatorElement());
21010    if (json.has("marketingAuthorization"))
21011      res.setMarketingAuthorization(parseReference(json.getAsJsonObject("marketingAuthorization")));
21012    if (json.has("manufacturer")) {
21013      JsonArray array = json.getAsJsonArray("manufacturer");
21014      for (int i = 0; i < array.size(); i++) {
21015        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
21016      }
21017    };
21018    if (json.has("batchIdentifier")) {
21019      JsonArray array = json.getAsJsonArray("batchIdentifier");
21020      for (int i = 0; i < array.size(); i++) {
21021        res.getBatchIdentifier().add(parsePackagedProductDefinitionBatchIdentifierComponent(array.get(i).getAsJsonObject()));
21022      }
21023    };
21024    if (json.has("package")) {
21025      JsonArray array = json.getAsJsonArray("package");
21026      for (int i = 0; i < array.size(); i++) {
21027        res.getPackage().add(parsePackagedProductDefinitionPackageComponent(array.get(i).getAsJsonObject()));
21028      }
21029    };
21030  }
21031
21032  protected PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent parsePackagedProductDefinitionBatchIdentifierComponent(JsonObject json) throws IOException, FHIRFormatError {
21033    PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent res = new PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent();
21034    parsePackagedProductDefinitionBatchIdentifierComponentProperties(json, res);
21035    return res;
21036  }
21037
21038  protected void parsePackagedProductDefinitionBatchIdentifierComponentProperties(JsonObject json, PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent res) throws IOException, FHIRFormatError {
21039    parseBackboneElementProperties(json, res);
21040    if (json.has("outerPackaging"))
21041      res.setOuterPackaging(parseIdentifier(json.getAsJsonObject("outerPackaging")));
21042    if (json.has("immediatePackaging"))
21043      res.setImmediatePackaging(parseIdentifier(json.getAsJsonObject("immediatePackaging")));
21044  }
21045
21046  protected PackagedProductDefinition.PackagedProductDefinitionPackageComponent parsePackagedProductDefinitionPackageComponent(JsonObject json) throws IOException, FHIRFormatError {
21047    PackagedProductDefinition.PackagedProductDefinitionPackageComponent res = new PackagedProductDefinition.PackagedProductDefinitionPackageComponent();
21048    parsePackagedProductDefinitionPackageComponentProperties(json, res);
21049    return res;
21050  }
21051
21052  protected void parsePackagedProductDefinitionPackageComponentProperties(JsonObject json, PackagedProductDefinition.PackagedProductDefinitionPackageComponent res) throws IOException, FHIRFormatError {
21053    parseBackboneElementProperties(json, res);
21054    if (json.has("identifier")) {
21055      JsonArray array = json.getAsJsonArray("identifier");
21056      for (int i = 0; i < array.size(); i++) {
21057        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21058      }
21059    };
21060    if (json.has("type"))
21061      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21062    if (json.has("quantity"))
21063      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
21064    if (json.has("material")) {
21065      JsonArray array = json.getAsJsonArray("material");
21066      for (int i = 0; i < array.size(); i++) {
21067        res.getMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21068      }
21069    };
21070    if (json.has("alternateMaterial")) {
21071      JsonArray array = json.getAsJsonArray("alternateMaterial");
21072      for (int i = 0; i < array.size(); i++) {
21073        res.getAlternateMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21074      }
21075    };
21076    if (json.has("shelfLifeStorage")) {
21077      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
21078      for (int i = 0; i < array.size(); i++) {
21079        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
21080      }
21081    };
21082    if (json.has("manufacturer")) {
21083      JsonArray array = json.getAsJsonArray("manufacturer");
21084      for (int i = 0; i < array.size(); i++) {
21085        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
21086      }
21087    };
21088    if (json.has("characteristic")) {
21089      JsonArray array = json.getAsJsonArray("characteristic");
21090      for (int i = 0; i < array.size(); i++) {
21091        res.getCharacteristic().add(parsePackagedProductDefinitionPackageCharacteristicComponent(array.get(i).getAsJsonObject()));
21092      }
21093    };
21094    if (json.has("containedItem")) {
21095      JsonArray array = json.getAsJsonArray("containedItem");
21096      for (int i = 0; i < array.size(); i++) {
21097        res.getContainedItem().add(parsePackagedProductDefinitionPackageContainedItemComponent(array.get(i).getAsJsonObject()));
21098      }
21099    };
21100    if (json.has("package")) {
21101      JsonArray array = json.getAsJsonArray("package");
21102      for (int i = 0; i < array.size(); i++) {
21103        res.getPackage().add(parsePackagedProductDefinitionPackageComponent(array.get(i).getAsJsonObject()));
21104      }
21105    };
21106  }
21107
21108  protected PackagedProductDefinition.PackagedProductDefinitionPackageCharacteristicComponent parsePackagedProductDefinitionPackageCharacteristicComponent(JsonObject json) throws IOException, FHIRFormatError {
21109    PackagedProductDefinition.PackagedProductDefinitionPackageCharacteristicComponent res = new PackagedProductDefinition.PackagedProductDefinitionPackageCharacteristicComponent();
21110    parsePackagedProductDefinitionPackageCharacteristicComponentProperties(json, res);
21111    return res;
21112  }
21113
21114  protected void parsePackagedProductDefinitionPackageCharacteristicComponentProperties(JsonObject json, PackagedProductDefinition.PackagedProductDefinitionPackageCharacteristicComponent res) throws IOException, FHIRFormatError {
21115    parseBackboneElementProperties(json, res);
21116    if (json.has("code"))
21117      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
21118    DataType value = parseType("value", json);
21119    if (value != null)
21120      res.setValue(value);
21121  }
21122
21123  protected PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent parsePackagedProductDefinitionPackageContainedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
21124    PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent res = new PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent();
21125    parsePackagedProductDefinitionPackageContainedItemComponentProperties(json, res);
21126    return res;
21127  }
21128
21129  protected void parsePackagedProductDefinitionPackageContainedItemComponentProperties(JsonObject json, PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent res) throws IOException, FHIRFormatError {
21130    parseBackboneElementProperties(json, res);
21131    if (json.has("item")) {
21132      JsonArray array = json.getAsJsonArray("item");
21133      for (int i = 0; i < array.size(); i++) {
21134        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
21135      }
21136    };
21137    DataType amount = parseType("amount", json);
21138    if (amount != null)
21139      res.setAmount(amount);
21140  }
21141
21142  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
21143    Parameters res = new Parameters();
21144    parseParametersProperties(json, res);
21145    return res;
21146  }
21147
21148  protected void parseParametersProperties(JsonObject json, Parameters res) throws IOException, FHIRFormatError {
21149    parseResourceProperties(json, res);
21150    if (json.has("parameter")) {
21151      JsonArray array = json.getAsJsonArray("parameter");
21152      for (int i = 0; i < array.size(); i++) {
21153        res.getParameter().add(parseParametersParameterComponent(array.get(i).getAsJsonObject()));
21154      }
21155    };
21156  }
21157
21158  protected Parameters.ParametersParameterComponent parseParametersParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
21159    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
21160    parseParametersParameterComponentProperties(json, res);
21161    return res;
21162  }
21163
21164  protected void parseParametersParameterComponentProperties(JsonObject json, Parameters.ParametersParameterComponent res) throws IOException, FHIRFormatError {
21165    parseBackboneElementProperties(json, res);
21166    if (json.has("name"))
21167      res.setNameElement(parseString(json.get("name").getAsString()));
21168    if (json.has("_name"))
21169      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21170    DataType value = parseType("value", json);
21171    if (value != null)
21172      res.setValue(value);
21173    if (json.has("resource"))
21174      res.setResource(parseResource(json.getAsJsonObject("resource")));
21175    if (json.has("part")) {
21176      JsonArray array = json.getAsJsonArray("part");
21177      for (int i = 0; i < array.size(); i++) {
21178        res.getPart().add(parseParametersParameterComponent(array.get(i).getAsJsonObject()));
21179      }
21180    };
21181  }
21182
21183  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
21184    Patient res = new Patient();
21185    parsePatientProperties(json, res);
21186    return res;
21187  }
21188
21189  protected void parsePatientProperties(JsonObject json, Patient res) throws IOException, FHIRFormatError {
21190    parseDomainResourceProperties(json, res);
21191    if (json.has("identifier")) {
21192      JsonArray array = json.getAsJsonArray("identifier");
21193      for (int i = 0; i < array.size(); i++) {
21194        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21195      }
21196    };
21197    if (json.has("active"))
21198      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
21199    if (json.has("_active"))
21200      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
21201    if (json.has("name")) {
21202      JsonArray array = json.getAsJsonArray("name");
21203      for (int i = 0; i < array.size(); i++) {
21204        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
21205      }
21206    };
21207    if (json.has("telecom")) {
21208      JsonArray array = json.getAsJsonArray("telecom");
21209      for (int i = 0; i < array.size(); i++) {
21210        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
21211      }
21212    };
21213    if (json.has("gender"))
21214      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
21215    if (json.has("_gender"))
21216      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
21217    if (json.has("birthDate"))
21218      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
21219    if (json.has("_birthDate"))
21220      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
21221    DataType deceased = parseType("deceased", json);
21222    if (deceased != null)
21223      res.setDeceased(deceased);
21224    if (json.has("address")) {
21225      JsonArray array = json.getAsJsonArray("address");
21226      for (int i = 0; i < array.size(); i++) {
21227        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
21228      }
21229    };
21230    if (json.has("maritalStatus"))
21231      res.setMaritalStatus(parseCodeableConcept(json.getAsJsonObject("maritalStatus")));
21232    DataType multipleBirth = parseType("multipleBirth", json);
21233    if (multipleBirth != null)
21234      res.setMultipleBirth(multipleBirth);
21235    if (json.has("photo")) {
21236      JsonArray array = json.getAsJsonArray("photo");
21237      for (int i = 0; i < array.size(); i++) {
21238        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
21239      }
21240    };
21241    if (json.has("contact")) {
21242      JsonArray array = json.getAsJsonArray("contact");
21243      for (int i = 0; i < array.size(); i++) {
21244        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject()));
21245      }
21246    };
21247    if (json.has("communication")) {
21248      JsonArray array = json.getAsJsonArray("communication");
21249      for (int i = 0; i < array.size(); i++) {
21250        res.getCommunication().add(parsePatientCommunicationComponent(array.get(i).getAsJsonObject()));
21251      }
21252    };
21253    if (json.has("generalPractitioner")) {
21254      JsonArray array = json.getAsJsonArray("generalPractitioner");
21255      for (int i = 0; i < array.size(); i++) {
21256        res.getGeneralPractitioner().add(parseReference(array.get(i).getAsJsonObject()));
21257      }
21258    };
21259    if (json.has("managingOrganization"))
21260      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
21261    if (json.has("link")) {
21262      JsonArray array = json.getAsJsonArray("link");
21263      for (int i = 0; i < array.size(); i++) {
21264        res.getLink().add(parsePatientLinkComponent(array.get(i).getAsJsonObject()));
21265      }
21266    };
21267  }
21268
21269  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json) throws IOException, FHIRFormatError {
21270    Patient.ContactComponent res = new Patient.ContactComponent();
21271    parsePatientContactComponentProperties(json, res);
21272    return res;
21273  }
21274
21275  protected void parsePatientContactComponentProperties(JsonObject json, Patient.ContactComponent res) throws IOException, FHIRFormatError {
21276    parseBackboneElementProperties(json, res);
21277    if (json.has("relationship")) {
21278      JsonArray array = json.getAsJsonArray("relationship");
21279      for (int i = 0; i < array.size(); i++) {
21280        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21281      }
21282    };
21283    if (json.has("name"))
21284      res.setName(parseHumanName(json.getAsJsonObject("name")));
21285    if (json.has("telecom")) {
21286      JsonArray array = json.getAsJsonArray("telecom");
21287      for (int i = 0; i < array.size(); i++) {
21288        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
21289      }
21290    };
21291    if (json.has("address"))
21292      res.setAddress(parseAddress(json.getAsJsonObject("address")));
21293    if (json.has("gender"))
21294      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
21295    if (json.has("_gender"))
21296      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
21297    if (json.has("organization"))
21298      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
21299    if (json.has("period"))
21300      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
21301  }
21302
21303  protected Patient.PatientCommunicationComponent parsePatientCommunicationComponent(JsonObject json) throws IOException, FHIRFormatError {
21304    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
21305    parsePatientCommunicationComponentProperties(json, res);
21306    return res;
21307  }
21308
21309  protected void parsePatientCommunicationComponentProperties(JsonObject json, Patient.PatientCommunicationComponent res) throws IOException, FHIRFormatError {
21310    parseBackboneElementProperties(json, res);
21311    if (json.has("language"))
21312      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
21313    if (json.has("preferred"))
21314      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
21315    if (json.has("_preferred"))
21316      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
21317  }
21318
21319  protected Patient.PatientLinkComponent parsePatientLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
21320    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
21321    parsePatientLinkComponentProperties(json, res);
21322    return res;
21323  }
21324
21325  protected void parsePatientLinkComponentProperties(JsonObject json, Patient.PatientLinkComponent res) throws IOException, FHIRFormatError {
21326    parseBackboneElementProperties(json, res);
21327    if (json.has("other"))
21328      res.setOther(parseReference(json.getAsJsonObject("other")));
21329    if (json.has("type"))
21330      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
21331    if (json.has("_type"))
21332      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
21333  }
21334
21335  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
21336    PaymentNotice res = new PaymentNotice();
21337    parsePaymentNoticeProperties(json, res);
21338    return res;
21339  }
21340
21341  protected void parsePaymentNoticeProperties(JsonObject json, PaymentNotice res) throws IOException, FHIRFormatError {
21342    parseDomainResourceProperties(json, res);
21343    if (json.has("identifier")) {
21344      JsonArray array = json.getAsJsonArray("identifier");
21345      for (int i = 0; i < array.size(); i++) {
21346        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21347      }
21348    };
21349    if (json.has("status"))
21350      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
21351    if (json.has("_status"))
21352      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21353    if (json.has("request"))
21354      res.setRequest(parseReference(json.getAsJsonObject("request")));
21355    if (json.has("response"))
21356      res.setResponse(parseReference(json.getAsJsonObject("response")));
21357    if (json.has("created"))
21358      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
21359    if (json.has("_created"))
21360      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
21361    if (json.has("provider"))
21362      res.setProvider(parseReference(json.getAsJsonObject("provider")));
21363    if (json.has("payment"))
21364      res.setPayment(parseReference(json.getAsJsonObject("payment")));
21365    if (json.has("paymentDate"))
21366      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
21367    if (json.has("_paymentDate"))
21368      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
21369    if (json.has("payee"))
21370      res.setPayee(parseReference(json.getAsJsonObject("payee")));
21371    if (json.has("recipient"))
21372      res.setRecipient(parseReference(json.getAsJsonObject("recipient")));
21373    if (json.has("amount"))
21374      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
21375    if (json.has("paymentStatus"))
21376      res.setPaymentStatus(parseCodeableConcept(json.getAsJsonObject("paymentStatus")));
21377  }
21378
21379  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
21380    PaymentReconciliation res = new PaymentReconciliation();
21381    parsePaymentReconciliationProperties(json, res);
21382    return res;
21383  }
21384
21385  protected void parsePaymentReconciliationProperties(JsonObject json, PaymentReconciliation res) throws IOException, FHIRFormatError {
21386    parseDomainResourceProperties(json, res);
21387    if (json.has("identifier")) {
21388      JsonArray array = json.getAsJsonArray("identifier");
21389      for (int i = 0; i < array.size(); i++) {
21390        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21391      }
21392    };
21393    if (json.has("status"))
21394      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
21395    if (json.has("_status"))
21396      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21397    if (json.has("period"))
21398      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
21399    if (json.has("created"))
21400      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
21401    if (json.has("_created"))
21402      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
21403    if (json.has("paymentIssuer"))
21404      res.setPaymentIssuer(parseReference(json.getAsJsonObject("paymentIssuer")));
21405    if (json.has("request"))
21406      res.setRequest(parseReference(json.getAsJsonObject("request")));
21407    if (json.has("requestor"))
21408      res.setRequestor(parseReference(json.getAsJsonObject("requestor")));
21409    if (json.has("outcome"))
21410      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.ClaimProcessingCodes.NULL, new Enumerations.ClaimProcessingCodesEnumFactory()));
21411    if (json.has("_outcome"))
21412      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
21413    if (json.has("disposition"))
21414      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
21415    if (json.has("_disposition"))
21416      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
21417    if (json.has("paymentDate"))
21418      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
21419    if (json.has("_paymentDate"))
21420      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
21421    if (json.has("paymentAmount"))
21422      res.setPaymentAmount(parseMoney(json.getAsJsonObject("paymentAmount")));
21423    if (json.has("paymentIdentifier"))
21424      res.setPaymentIdentifier(parseIdentifier(json.getAsJsonObject("paymentIdentifier")));
21425    if (json.has("detail")) {
21426      JsonArray array = json.getAsJsonArray("detail");
21427      for (int i = 0; i < array.size(); i++) {
21428        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject()));
21429      }
21430    };
21431    if (json.has("formCode"))
21432      res.setFormCode(parseCodeableConcept(json.getAsJsonObject("formCode")));
21433    if (json.has("processNote")) {
21434      JsonArray array = json.getAsJsonArray("processNote");
21435      for (int i = 0; i < array.size(); i++) {
21436        res.getProcessNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject()));
21437      }
21438    };
21439  }
21440
21441  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json) throws IOException, FHIRFormatError {
21442    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
21443    parsePaymentReconciliationDetailsComponentProperties(json, res);
21444    return res;
21445  }
21446
21447  protected void parsePaymentReconciliationDetailsComponentProperties(JsonObject json, PaymentReconciliation.DetailsComponent res) throws IOException, FHIRFormatError {
21448    parseBackboneElementProperties(json, res);
21449    if (json.has("identifier"))
21450      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
21451    if (json.has("predecessor"))
21452      res.setPredecessor(parseIdentifier(json.getAsJsonObject("predecessor")));
21453    if (json.has("type"))
21454      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21455    if (json.has("request"))
21456      res.setRequest(parseReference(json.getAsJsonObject("request")));
21457    if (json.has("submitter"))
21458      res.setSubmitter(parseReference(json.getAsJsonObject("submitter")));
21459    if (json.has("response"))
21460      res.setResponse(parseReference(json.getAsJsonObject("response")));
21461    if (json.has("date"))
21462      res.setDateElement(parseDate(json.get("date").getAsString()));
21463    if (json.has("_date"))
21464      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
21465    if (json.has("responsible"))
21466      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
21467    if (json.has("payee"))
21468      res.setPayee(parseReference(json.getAsJsonObject("payee")));
21469    if (json.has("amount"))
21470      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
21471  }
21472
21473  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json) throws IOException, FHIRFormatError {
21474    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
21475    parsePaymentReconciliationNotesComponentProperties(json, res);
21476    return res;
21477  }
21478
21479  protected void parsePaymentReconciliationNotesComponentProperties(JsonObject json, PaymentReconciliation.NotesComponent res) throws IOException, FHIRFormatError {
21480    parseBackboneElementProperties(json, res);
21481    if (json.has("type"))
21482      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
21483    if (json.has("_type"))
21484      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
21485    if (json.has("text"))
21486      res.setTextElement(parseString(json.get("text").getAsString()));
21487    if (json.has("_text"))
21488      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
21489  }
21490
21491  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
21492    Person res = new Person();
21493    parsePersonProperties(json, res);
21494    return res;
21495  }
21496
21497  protected void parsePersonProperties(JsonObject json, Person res) throws IOException, FHIRFormatError {
21498    parseDomainResourceProperties(json, res);
21499    if (json.has("identifier")) {
21500      JsonArray array = json.getAsJsonArray("identifier");
21501      for (int i = 0; i < array.size(); i++) {
21502        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21503      }
21504    };
21505    if (json.has("name")) {
21506      JsonArray array = json.getAsJsonArray("name");
21507      for (int i = 0; i < array.size(); i++) {
21508        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
21509      }
21510    };
21511    if (json.has("telecom")) {
21512      JsonArray array = json.getAsJsonArray("telecom");
21513      for (int i = 0; i < array.size(); i++) {
21514        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
21515      }
21516    };
21517    if (json.has("gender"))
21518      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
21519    if (json.has("_gender"))
21520      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
21521    if (json.has("birthDate"))
21522      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
21523    if (json.has("_birthDate"))
21524      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
21525    if (json.has("address")) {
21526      JsonArray array = json.getAsJsonArray("address");
21527      for (int i = 0; i < array.size(); i++) {
21528        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
21529      }
21530    };
21531    if (json.has("photo"))
21532      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
21533    if (json.has("managingOrganization"))
21534      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
21535    if (json.has("active"))
21536      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
21537    if (json.has("_active"))
21538      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
21539    if (json.has("link")) {
21540      JsonArray array = json.getAsJsonArray("link");
21541      for (int i = 0; i < array.size(); i++) {
21542        res.getLink().add(parsePersonLinkComponent(array.get(i).getAsJsonObject()));
21543      }
21544    };
21545  }
21546
21547  protected Person.PersonLinkComponent parsePersonLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
21548    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
21549    parsePersonLinkComponentProperties(json, res);
21550    return res;
21551  }
21552
21553  protected void parsePersonLinkComponentProperties(JsonObject json, Person.PersonLinkComponent res) throws IOException, FHIRFormatError {
21554    parseBackboneElementProperties(json, res);
21555    if (json.has("target"))
21556      res.setTarget(parseReference(json.getAsJsonObject("target")));
21557    if (json.has("assurance"))
21558      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
21559    if (json.has("_assurance"))
21560      parseElementProperties(json.getAsJsonObject("_assurance"), res.getAssuranceElement());
21561  }
21562
21563  protected PlanDefinition parsePlanDefinition(JsonObject json) throws IOException, FHIRFormatError {
21564    PlanDefinition res = new PlanDefinition();
21565    parsePlanDefinitionProperties(json, res);
21566    return res;
21567  }
21568
21569  protected void parsePlanDefinitionProperties(JsonObject json, PlanDefinition res) throws IOException, FHIRFormatError {
21570    parseMetadataResourceProperties(json, res);
21571    if (json.has("url"))
21572      res.setUrlElement(parseUri(json.get("url").getAsString()));
21573    if (json.has("_url"))
21574      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
21575    if (json.has("identifier")) {
21576      JsonArray array = json.getAsJsonArray("identifier");
21577      for (int i = 0; i < array.size(); i++) {
21578        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21579      }
21580    };
21581    if (json.has("version"))
21582      res.setVersionElement(parseString(json.get("version").getAsString()));
21583    if (json.has("_version"))
21584      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
21585    if (json.has("name"))
21586      res.setNameElement(parseString(json.get("name").getAsString()));
21587    if (json.has("_name"))
21588      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21589    if (json.has("title"))
21590      res.setTitleElement(parseString(json.get("title").getAsString()));
21591    if (json.has("_title"))
21592      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
21593    if (json.has("subtitle"))
21594      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
21595    if (json.has("_subtitle"))
21596      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
21597    if (json.has("type"))
21598      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21599    if (json.has("status"))
21600      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
21601    if (json.has("_status"))
21602      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21603    if (json.has("experimental"))
21604      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
21605    if (json.has("_experimental"))
21606      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
21607    DataType subject = parseType("subject", json);
21608    if (subject != null)
21609      res.setSubject(subject);
21610    if (json.has("date"))
21611      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21612    if (json.has("_date"))
21613      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
21614    if (json.has("publisher"))
21615      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21616    if (json.has("_publisher"))
21617      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
21618    if (json.has("contact")) {
21619      JsonArray array = json.getAsJsonArray("contact");
21620      for (int i = 0; i < array.size(); i++) {
21621        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21622      }
21623    };
21624    if (json.has("description"))
21625      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21626    if (json.has("_description"))
21627      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21628    if (json.has("useContext")) {
21629      JsonArray array = json.getAsJsonArray("useContext");
21630      for (int i = 0; i < array.size(); i++) {
21631        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21632      }
21633    };
21634    if (json.has("jurisdiction")) {
21635      JsonArray array = json.getAsJsonArray("jurisdiction");
21636      for (int i = 0; i < array.size(); i++) {
21637        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21638      }
21639    };
21640    if (json.has("purpose"))
21641      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
21642    if (json.has("_purpose"))
21643      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
21644    if (json.has("usage"))
21645      res.setUsageElement(parseString(json.get("usage").getAsString()));
21646    if (json.has("_usage"))
21647      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
21648    if (json.has("copyright"))
21649      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
21650    if (json.has("_copyright"))
21651      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
21652    if (json.has("approvalDate"))
21653      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
21654    if (json.has("_approvalDate"))
21655      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
21656    if (json.has("lastReviewDate"))
21657      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
21658    if (json.has("_lastReviewDate"))
21659      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
21660    if (json.has("effectivePeriod"))
21661      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
21662    if (json.has("topic")) {
21663      JsonArray array = json.getAsJsonArray("topic");
21664      for (int i = 0; i < array.size(); i++) {
21665        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21666      }
21667    };
21668    if (json.has("author")) {
21669      JsonArray array = json.getAsJsonArray("author");
21670      for (int i = 0; i < array.size(); i++) {
21671        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
21672      }
21673    };
21674    if (json.has("editor")) {
21675      JsonArray array = json.getAsJsonArray("editor");
21676      for (int i = 0; i < array.size(); i++) {
21677        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
21678      }
21679    };
21680    if (json.has("reviewer")) {
21681      JsonArray array = json.getAsJsonArray("reviewer");
21682      for (int i = 0; i < array.size(); i++) {
21683        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
21684      }
21685    };
21686    if (json.has("endorser")) {
21687      JsonArray array = json.getAsJsonArray("endorser");
21688      for (int i = 0; i < array.size(); i++) {
21689        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
21690      }
21691    };
21692    if (json.has("relatedArtifact")) {
21693      JsonArray array = json.getAsJsonArray("relatedArtifact");
21694      for (int i = 0; i < array.size(); i++) {
21695        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
21696      }
21697    };
21698    if (json.has("library")) {
21699      JsonArray array = json.getAsJsonArray("library");
21700      for (int i = 0; i < array.size(); i++) {
21701        if (array.get(i).isJsonNull()) {
21702          res.getLibrary().add(new CanonicalType());
21703        } else {;
21704          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
21705        }
21706      }
21707    };
21708    if (json.has("_library")) {
21709      JsonArray array = json.getAsJsonArray("_library");
21710      for (int i = 0; i < array.size(); i++) {
21711        if (i == res.getLibrary().size())
21712          res.getLibrary().add(parseCanonical(null));
21713        if (array.get(i) instanceof JsonObject) 
21714          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
21715      }
21716    };
21717    if (json.has("goal")) {
21718      JsonArray array = json.getAsJsonArray("goal");
21719      for (int i = 0; i < array.size(); i++) {
21720        res.getGoal().add(parsePlanDefinitionGoalComponent(array.get(i).getAsJsonObject()));
21721      }
21722    };
21723    if (json.has("action")) {
21724      JsonArray array = json.getAsJsonArray("action");
21725      for (int i = 0; i < array.size(); i++) {
21726        res.getAction().add(parsePlanDefinitionActionComponent(array.get(i).getAsJsonObject()));
21727      }
21728    };
21729  }
21730
21731  protected PlanDefinition.PlanDefinitionGoalComponent parsePlanDefinitionGoalComponent(JsonObject json) throws IOException, FHIRFormatError {
21732    PlanDefinition.PlanDefinitionGoalComponent res = new PlanDefinition.PlanDefinitionGoalComponent();
21733    parsePlanDefinitionGoalComponentProperties(json, res);
21734    return res;
21735  }
21736
21737  protected void parsePlanDefinitionGoalComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionGoalComponent res) throws IOException, FHIRFormatError {
21738    parseBackboneElementProperties(json, res);
21739    if (json.has("category"))
21740      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
21741    if (json.has("description"))
21742      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
21743    if (json.has("priority"))
21744      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
21745    if (json.has("start"))
21746      res.setStart(parseCodeableConcept(json.getAsJsonObject("start")));
21747    if (json.has("addresses")) {
21748      JsonArray array = json.getAsJsonArray("addresses");
21749      for (int i = 0; i < array.size(); i++) {
21750        res.getAddresses().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21751      }
21752    };
21753    if (json.has("documentation")) {
21754      JsonArray array = json.getAsJsonArray("documentation");
21755      for (int i = 0; i < array.size(); i++) {
21756        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
21757      }
21758    };
21759    if (json.has("target")) {
21760      JsonArray array = json.getAsJsonArray("target");
21761      for (int i = 0; i < array.size(); i++) {
21762        res.getTarget().add(parsePlanDefinitionGoalTargetComponent(array.get(i).getAsJsonObject()));
21763      }
21764    };
21765  }
21766
21767  protected PlanDefinition.PlanDefinitionGoalTargetComponent parsePlanDefinitionGoalTargetComponent(JsonObject json) throws IOException, FHIRFormatError {
21768    PlanDefinition.PlanDefinitionGoalTargetComponent res = new PlanDefinition.PlanDefinitionGoalTargetComponent();
21769    parsePlanDefinitionGoalTargetComponentProperties(json, res);
21770    return res;
21771  }
21772
21773  protected void parsePlanDefinitionGoalTargetComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionGoalTargetComponent res) throws IOException, FHIRFormatError {
21774    parseBackboneElementProperties(json, res);
21775    if (json.has("measure"))
21776      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
21777    DataType detail = parseType("detail", json);
21778    if (detail != null)
21779      res.setDetail(detail);
21780    if (json.has("due"))
21781      res.setDue(parseDuration(json.getAsJsonObject("due")));
21782  }
21783
21784  protected PlanDefinition.PlanDefinitionActionComponent parsePlanDefinitionActionComponent(JsonObject json) throws IOException, FHIRFormatError {
21785    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
21786    parsePlanDefinitionActionComponentProperties(json, res);
21787    return res;
21788  }
21789
21790  protected void parsePlanDefinitionActionComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionComponent res) throws IOException, FHIRFormatError {
21791    parseBackboneElementProperties(json, res);
21792    if (json.has("prefix"))
21793      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
21794    if (json.has("_prefix"))
21795      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
21796    if (json.has("title"))
21797      res.setTitleElement(parseString(json.get("title").getAsString()));
21798    if (json.has("_title"))
21799      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
21800    if (json.has("description"))
21801      res.setDescriptionElement(parseString(json.get("description").getAsString()));
21802    if (json.has("_description"))
21803      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21804    if (json.has("textEquivalent"))
21805      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
21806    if (json.has("_textEquivalent"))
21807      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
21808    if (json.has("priority"))
21809      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
21810    if (json.has("_priority"))
21811      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
21812    if (json.has("code")) {
21813      JsonArray array = json.getAsJsonArray("code");
21814      for (int i = 0; i < array.size(); i++) {
21815        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21816      }
21817    };
21818    if (json.has("reason")) {
21819      JsonArray array = json.getAsJsonArray("reason");
21820      for (int i = 0; i < array.size(); i++) {
21821        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21822      }
21823    };
21824    if (json.has("documentation")) {
21825      JsonArray array = json.getAsJsonArray("documentation");
21826      for (int i = 0; i < array.size(); i++) {
21827        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
21828      }
21829    };
21830    if (json.has("goalId")) {
21831      JsonArray array = json.getAsJsonArray("goalId");
21832      for (int i = 0; i < array.size(); i++) {
21833        if (array.get(i).isJsonNull()) {
21834          res.getGoalId().add(new IdType());
21835        } else {;
21836          res.getGoalId().add(parseId(array.get(i).getAsString()));
21837        }
21838      }
21839    };
21840    if (json.has("_goalId")) {
21841      JsonArray array = json.getAsJsonArray("_goalId");
21842      for (int i = 0; i < array.size(); i++) {
21843        if (i == res.getGoalId().size())
21844          res.getGoalId().add(parseId(null));
21845        if (array.get(i) instanceof JsonObject) 
21846          parseElementProperties(array.get(i).getAsJsonObject(), res.getGoalId().get(i));
21847      }
21848    };
21849    DataType subject = parseType("subject", json);
21850    if (subject != null)
21851      res.setSubject(subject);
21852    if (json.has("trigger")) {
21853      JsonArray array = json.getAsJsonArray("trigger");
21854      for (int i = 0; i < array.size(); i++) {
21855        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
21856      }
21857    };
21858    if (json.has("condition")) {
21859      JsonArray array = json.getAsJsonArray("condition");
21860      for (int i = 0; i < array.size(); i++) {
21861        res.getCondition().add(parsePlanDefinitionActionConditionComponent(array.get(i).getAsJsonObject()));
21862      }
21863    };
21864    if (json.has("input")) {
21865      JsonArray array = json.getAsJsonArray("input");
21866      for (int i = 0; i < array.size(); i++) {
21867        res.getInput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
21868      }
21869    };
21870    if (json.has("output")) {
21871      JsonArray array = json.getAsJsonArray("output");
21872      for (int i = 0; i < array.size(); i++) {
21873        res.getOutput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
21874      }
21875    };
21876    if (json.has("relatedAction")) {
21877      JsonArray array = json.getAsJsonArray("relatedAction");
21878      for (int i = 0; i < array.size(); i++) {
21879        res.getRelatedAction().add(parsePlanDefinitionActionRelatedActionComponent(array.get(i).getAsJsonObject()));
21880      }
21881    };
21882    DataType timing = parseType("timing", json);
21883    if (timing != null)
21884      res.setTiming(timing);
21885    if (json.has("participant")) {
21886      JsonArray array = json.getAsJsonArray("participant");
21887      for (int i = 0; i < array.size(); i++) {
21888        res.getParticipant().add(parsePlanDefinitionActionParticipantComponent(array.get(i).getAsJsonObject()));
21889      }
21890    };
21891    if (json.has("type"))
21892      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21893    if (json.has("groupingBehavior"))
21894      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), Enumerations.ActionGroupingBehavior.NULL, new Enumerations.ActionGroupingBehaviorEnumFactory()));
21895    if (json.has("_groupingBehavior"))
21896      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
21897    if (json.has("selectionBehavior"))
21898      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), Enumerations.ActionSelectionBehavior.NULL, new Enumerations.ActionSelectionBehaviorEnumFactory()));
21899    if (json.has("_selectionBehavior"))
21900      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
21901    if (json.has("requiredBehavior"))
21902      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), Enumerations.ActionRequiredBehavior.NULL, new Enumerations.ActionRequiredBehaviorEnumFactory()));
21903    if (json.has("_requiredBehavior"))
21904      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
21905    if (json.has("precheckBehavior"))
21906      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), Enumerations.ActionPrecheckBehavior.NULL, new Enumerations.ActionPrecheckBehaviorEnumFactory()));
21907    if (json.has("_precheckBehavior"))
21908      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
21909    if (json.has("cardinalityBehavior"))
21910      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), Enumerations.ActionCardinalityBehavior.NULL, new Enumerations.ActionCardinalityBehaviorEnumFactory()));
21911    if (json.has("_cardinalityBehavior"))
21912      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
21913    DataType definition = parseType("definition", json);
21914    if (definition != null)
21915      res.setDefinition(definition);
21916    if (json.has("transform"))
21917      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
21918    if (json.has("_transform"))
21919      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
21920    if (json.has("dynamicValue")) {
21921      JsonArray array = json.getAsJsonArray("dynamicValue");
21922      for (int i = 0; i < array.size(); i++) {
21923        res.getDynamicValue().add(parsePlanDefinitionActionDynamicValueComponent(array.get(i).getAsJsonObject()));
21924      }
21925    };
21926    if (json.has("action")) {
21927      JsonArray array = json.getAsJsonArray("action");
21928      for (int i = 0; i < array.size(); i++) {
21929        res.getAction().add(parsePlanDefinitionActionComponent(array.get(i).getAsJsonObject()));
21930      }
21931    };
21932  }
21933
21934  protected PlanDefinition.PlanDefinitionActionConditionComponent parsePlanDefinitionActionConditionComponent(JsonObject json) throws IOException, FHIRFormatError {
21935    PlanDefinition.PlanDefinitionActionConditionComponent res = new PlanDefinition.PlanDefinitionActionConditionComponent();
21936    parsePlanDefinitionActionConditionComponentProperties(json, res);
21937    return res;
21938  }
21939
21940  protected void parsePlanDefinitionActionConditionComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionConditionComponent res) throws IOException, FHIRFormatError {
21941    parseBackboneElementProperties(json, res);
21942    if (json.has("kind"))
21943      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.ActionConditionKind.NULL, new Enumerations.ActionConditionKindEnumFactory()));
21944    if (json.has("_kind"))
21945      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
21946    if (json.has("expression"))
21947      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
21948  }
21949
21950  protected PlanDefinition.PlanDefinitionActionRelatedActionComponent parsePlanDefinitionActionRelatedActionComponent(JsonObject json) throws IOException, FHIRFormatError {
21951    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
21952    parsePlanDefinitionActionRelatedActionComponentProperties(json, res);
21953    return res;
21954  }
21955
21956  protected void parsePlanDefinitionActionRelatedActionComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionRelatedActionComponent res) throws IOException, FHIRFormatError {
21957    parseBackboneElementProperties(json, res);
21958    if (json.has("actionId"))
21959      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
21960    if (json.has("_actionId"))
21961      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
21962    if (json.has("relationship"))
21963      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), Enumerations.ActionRelationshipType.NULL, new Enumerations.ActionRelationshipTypeEnumFactory()));
21964    if (json.has("_relationship"))
21965      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
21966    DataType offset = parseType("offset", json);
21967    if (offset != null)
21968      res.setOffset(offset);
21969  }
21970
21971  protected PlanDefinition.PlanDefinitionActionParticipantComponent parsePlanDefinitionActionParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
21972    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
21973    parsePlanDefinitionActionParticipantComponentProperties(json, res);
21974    return res;
21975  }
21976
21977  protected void parsePlanDefinitionActionParticipantComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionParticipantComponent res) throws IOException, FHIRFormatError {
21978    parseBackboneElementProperties(json, res);
21979    if (json.has("type"))
21980      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.ActionParticipantType.NULL, new Enumerations.ActionParticipantTypeEnumFactory()));
21981    if (json.has("_type"))
21982      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
21983    if (json.has("role"))
21984      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
21985  }
21986
21987  protected PlanDefinition.PlanDefinitionActionDynamicValueComponent parsePlanDefinitionActionDynamicValueComponent(JsonObject json) throws IOException, FHIRFormatError {
21988    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
21989    parsePlanDefinitionActionDynamicValueComponentProperties(json, res);
21990    return res;
21991  }
21992
21993  protected void parsePlanDefinitionActionDynamicValueComponentProperties(JsonObject json, PlanDefinition.PlanDefinitionActionDynamicValueComponent res) throws IOException, FHIRFormatError {
21994    parseBackboneElementProperties(json, res);
21995    if (json.has("path"))
21996      res.setPathElement(parseString(json.get("path").getAsString()));
21997    if (json.has("_path"))
21998      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
21999    if (json.has("expression"))
22000      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
22001  }
22002
22003  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
22004    Practitioner res = new Practitioner();
22005    parsePractitionerProperties(json, res);
22006    return res;
22007  }
22008
22009  protected void parsePractitionerProperties(JsonObject json, Practitioner res) throws IOException, FHIRFormatError {
22010    parseDomainResourceProperties(json, res);
22011    if (json.has("identifier")) {
22012      JsonArray array = json.getAsJsonArray("identifier");
22013      for (int i = 0; i < array.size(); i++) {
22014        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22015      }
22016    };
22017    if (json.has("active"))
22018      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
22019    if (json.has("_active"))
22020      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
22021    if (json.has("name")) {
22022      JsonArray array = json.getAsJsonArray("name");
22023      for (int i = 0; i < array.size(); i++) {
22024        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
22025      }
22026    };
22027    if (json.has("telecom")) {
22028      JsonArray array = json.getAsJsonArray("telecom");
22029      for (int i = 0; i < array.size(); i++) {
22030        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
22031      }
22032    };
22033    if (json.has("address")) {
22034      JsonArray array = json.getAsJsonArray("address");
22035      for (int i = 0; i < array.size(); i++) {
22036        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
22037      }
22038    };
22039    if (json.has("gender"))
22040      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
22041    if (json.has("_gender"))
22042      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
22043    if (json.has("birthDate"))
22044      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
22045    if (json.has("_birthDate"))
22046      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
22047    if (json.has("photo")) {
22048      JsonArray array = json.getAsJsonArray("photo");
22049      for (int i = 0; i < array.size(); i++) {
22050        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
22051      }
22052    };
22053    if (json.has("qualification")) {
22054      JsonArray array = json.getAsJsonArray("qualification");
22055      for (int i = 0; i < array.size(); i++) {
22056        res.getQualification().add(parsePractitionerQualificationComponent(array.get(i).getAsJsonObject()));
22057      }
22058    };
22059    if (json.has("communication")) {
22060      JsonArray array = json.getAsJsonArray("communication");
22061      for (int i = 0; i < array.size(); i++) {
22062        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22063      }
22064    };
22065  }
22066
22067  protected Practitioner.PractitionerQualificationComponent parsePractitionerQualificationComponent(JsonObject json) throws IOException, FHIRFormatError {
22068    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
22069    parsePractitionerQualificationComponentProperties(json, res);
22070    return res;
22071  }
22072
22073  protected void parsePractitionerQualificationComponentProperties(JsonObject json, Practitioner.PractitionerQualificationComponent res) throws IOException, FHIRFormatError {
22074    parseBackboneElementProperties(json, res);
22075    if (json.has("identifier")) {
22076      JsonArray array = json.getAsJsonArray("identifier");
22077      for (int i = 0; i < array.size(); i++) {
22078        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22079      }
22080    };
22081    if (json.has("code"))
22082      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
22083    if (json.has("period"))
22084      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
22085    if (json.has("issuer"))
22086      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
22087  }
22088
22089  protected PractitionerRole parsePractitionerRole(JsonObject json) throws IOException, FHIRFormatError {
22090    PractitionerRole res = new PractitionerRole();
22091    parsePractitionerRoleProperties(json, res);
22092    return res;
22093  }
22094
22095  protected void parsePractitionerRoleProperties(JsonObject json, PractitionerRole res) throws IOException, FHIRFormatError {
22096    parseDomainResourceProperties(json, res);
22097    if (json.has("identifier")) {
22098      JsonArray array = json.getAsJsonArray("identifier");
22099      for (int i = 0; i < array.size(); i++) {
22100        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22101      }
22102    };
22103    if (json.has("active"))
22104      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
22105    if (json.has("_active"))
22106      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
22107    if (json.has("period"))
22108      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
22109    if (json.has("practitioner"))
22110      res.setPractitioner(parseReference(json.getAsJsonObject("practitioner")));
22111    if (json.has("organization"))
22112      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
22113    if (json.has("code")) {
22114      JsonArray array = json.getAsJsonArray("code");
22115      for (int i = 0; i < array.size(); i++) {
22116        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22117      }
22118    };
22119    if (json.has("specialty")) {
22120      JsonArray array = json.getAsJsonArray("specialty");
22121      for (int i = 0; i < array.size(); i++) {
22122        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22123      }
22124    };
22125    if (json.has("location")) {
22126      JsonArray array = json.getAsJsonArray("location");
22127      for (int i = 0; i < array.size(); i++) {
22128        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
22129      }
22130    };
22131    if (json.has("healthcareService")) {
22132      JsonArray array = json.getAsJsonArray("healthcareService");
22133      for (int i = 0; i < array.size(); i++) {
22134        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
22135      }
22136    };
22137    if (json.has("telecom")) {
22138      JsonArray array = json.getAsJsonArray("telecom");
22139      for (int i = 0; i < array.size(); i++) {
22140        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
22141      }
22142    };
22143    if (json.has("availableTime")) {
22144      JsonArray array = json.getAsJsonArray("availableTime");
22145      for (int i = 0; i < array.size(); i++) {
22146        res.getAvailableTime().add(parsePractitionerRoleAvailableTimeComponent(array.get(i).getAsJsonObject()));
22147      }
22148    };
22149    if (json.has("notAvailable")) {
22150      JsonArray array = json.getAsJsonArray("notAvailable");
22151      for (int i = 0; i < array.size(); i++) {
22152        res.getNotAvailable().add(parsePractitionerRoleNotAvailableComponent(array.get(i).getAsJsonObject()));
22153      }
22154    };
22155    if (json.has("availabilityExceptions"))
22156      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
22157    if (json.has("_availabilityExceptions"))
22158      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
22159    if (json.has("endpoint")) {
22160      JsonArray array = json.getAsJsonArray("endpoint");
22161      for (int i = 0; i < array.size(); i++) {
22162        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
22163      }
22164    };
22165  }
22166
22167  protected PractitionerRole.PractitionerRoleAvailableTimeComponent parsePractitionerRoleAvailableTimeComponent(JsonObject json) throws IOException, FHIRFormatError {
22168    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
22169    parsePractitionerRoleAvailableTimeComponentProperties(json, res);
22170    return res;
22171  }
22172
22173  protected void parsePractitionerRoleAvailableTimeComponentProperties(JsonObject json, PractitionerRole.PractitionerRoleAvailableTimeComponent res) throws IOException, FHIRFormatError {
22174    parseBackboneElementProperties(json, res);
22175    if (json.has("daysOfWeek")) {
22176      JsonArray array = json.getAsJsonArray("daysOfWeek");
22177      for (int i = 0; i < array.size(); i++) {
22178        if (array.get(i).isJsonNull()) {
22179          res.getDaysOfWeek().add(new Enumeration<Enumerations.DaysOfWeek>(new Enumerations.DaysOfWeekEnumFactory(), Enumerations.DaysOfWeek.NULL));
22180        } else {;
22181          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
22182        }
22183      }
22184    };
22185    if (json.has("_daysOfWeek")) {
22186      JsonArray array = json.getAsJsonArray("_daysOfWeek");
22187      for (int i = 0; i < array.size(); i++) {
22188        if (i == res.getDaysOfWeek().size())
22189          res.getDaysOfWeek().add(parseEnumeration(null, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
22190        if (array.get(i) instanceof JsonObject) 
22191          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
22192      }
22193    };
22194    if (json.has("allDay"))
22195      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
22196    if (json.has("_allDay"))
22197      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
22198    if (json.has("availableStartTime"))
22199      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
22200    if (json.has("_availableStartTime"))
22201      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
22202    if (json.has("availableEndTime"))
22203      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
22204    if (json.has("_availableEndTime"))
22205      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
22206  }
22207
22208  protected PractitionerRole.PractitionerRoleNotAvailableComponent parsePractitionerRoleNotAvailableComponent(JsonObject json) throws IOException, FHIRFormatError {
22209    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
22210    parsePractitionerRoleNotAvailableComponentProperties(json, res);
22211    return res;
22212  }
22213
22214  protected void parsePractitionerRoleNotAvailableComponentProperties(JsonObject json, PractitionerRole.PractitionerRoleNotAvailableComponent res) throws IOException, FHIRFormatError {
22215    parseBackboneElementProperties(json, res);
22216    if (json.has("description"))
22217      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22218    if (json.has("_description"))
22219      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22220    if (json.has("during"))
22221      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
22222  }
22223
22224  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
22225    Procedure res = new Procedure();
22226    parseProcedureProperties(json, res);
22227    return res;
22228  }
22229
22230  protected void parseProcedureProperties(JsonObject json, Procedure res) throws IOException, FHIRFormatError {
22231    parseDomainResourceProperties(json, res);
22232    if (json.has("identifier")) {
22233      JsonArray array = json.getAsJsonArray("identifier");
22234      for (int i = 0; i < array.size(); i++) {
22235        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22236      }
22237    };
22238    if (json.has("instantiatesCanonical")) {
22239      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
22240      for (int i = 0; i < array.size(); i++) {
22241        if (array.get(i).isJsonNull()) {
22242          res.getInstantiatesCanonical().add(new CanonicalType());
22243        } else {;
22244          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
22245        }
22246      }
22247    };
22248    if (json.has("_instantiatesCanonical")) {
22249      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
22250      for (int i = 0; i < array.size(); i++) {
22251        if (i == res.getInstantiatesCanonical().size())
22252          res.getInstantiatesCanonical().add(parseCanonical(null));
22253        if (array.get(i) instanceof JsonObject) 
22254          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
22255      }
22256    };
22257    if (json.has("instantiatesUri")) {
22258      JsonArray array = json.getAsJsonArray("instantiatesUri");
22259      for (int i = 0; i < array.size(); i++) {
22260        if (array.get(i).isJsonNull()) {
22261          res.getInstantiatesUri().add(new UriType());
22262        } else {;
22263          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
22264        }
22265      }
22266    };
22267    if (json.has("_instantiatesUri")) {
22268      JsonArray array = json.getAsJsonArray("_instantiatesUri");
22269      for (int i = 0; i < array.size(); i++) {
22270        if (i == res.getInstantiatesUri().size())
22271          res.getInstantiatesUri().add(parseUri(null));
22272        if (array.get(i) instanceof JsonObject) 
22273          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
22274      }
22275    };
22276    if (json.has("basedOn")) {
22277      JsonArray array = json.getAsJsonArray("basedOn");
22278      for (int i = 0; i < array.size(); i++) {
22279        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
22280      }
22281    };
22282    if (json.has("partOf")) {
22283      JsonArray array = json.getAsJsonArray("partOf");
22284      for (int i = 0; i < array.size(); i++) {
22285        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
22286      }
22287    };
22288    if (json.has("status"))
22289      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
22290    if (json.has("_status"))
22291      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22292    if (json.has("statusReason"))
22293      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
22294    if (json.has("category")) {
22295      JsonArray array = json.getAsJsonArray("category");
22296      for (int i = 0; i < array.size(); i++) {
22297        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22298      }
22299    };
22300    if (json.has("code"))
22301      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
22302    if (json.has("subject"))
22303      res.setSubject(parseReference(json.getAsJsonObject("subject")));
22304    if (json.has("encounter"))
22305      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
22306    DataType occurrence = parseType("occurrence", json);
22307    if (occurrence != null)
22308      res.setOccurrence(occurrence);
22309    if (json.has("recorded"))
22310      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
22311    if (json.has("_recorded"))
22312      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
22313    if (json.has("recorder"))
22314      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
22315    DataType reported = parseType("reported", json);
22316    if (reported != null)
22317      res.setReported(reported);
22318    if (json.has("performer")) {
22319      JsonArray array = json.getAsJsonArray("performer");
22320      for (int i = 0; i < array.size(); i++) {
22321        res.getPerformer().add(parseProcedurePerformerComponent(array.get(i).getAsJsonObject()));
22322      }
22323    };
22324    if (json.has("location"))
22325      res.setLocation(parseReference(json.getAsJsonObject("location")));
22326    if (json.has("reason")) {
22327      JsonArray array = json.getAsJsonArray("reason");
22328      for (int i = 0; i < array.size(); i++) {
22329        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
22330      }
22331    };
22332    if (json.has("bodySite")) {
22333      JsonArray array = json.getAsJsonArray("bodySite");
22334      for (int i = 0; i < array.size(); i++) {
22335        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22336      }
22337    };
22338    if (json.has("outcome"))
22339      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
22340    if (json.has("report")) {
22341      JsonArray array = json.getAsJsonArray("report");
22342      for (int i = 0; i < array.size(); i++) {
22343        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
22344      }
22345    };
22346    if (json.has("complication")) {
22347      JsonArray array = json.getAsJsonArray("complication");
22348      for (int i = 0; i < array.size(); i++) {
22349        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22350      }
22351    };
22352    if (json.has("complicationDetail")) {
22353      JsonArray array = json.getAsJsonArray("complicationDetail");
22354      for (int i = 0; i < array.size(); i++) {
22355        res.getComplicationDetail().add(parseReference(array.get(i).getAsJsonObject()));
22356      }
22357    };
22358    if (json.has("followUp")) {
22359      JsonArray array = json.getAsJsonArray("followUp");
22360      for (int i = 0; i < array.size(); i++) {
22361        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22362      }
22363    };
22364    if (json.has("note")) {
22365      JsonArray array = json.getAsJsonArray("note");
22366      for (int i = 0; i < array.size(); i++) {
22367        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22368      }
22369    };
22370    if (json.has("focalDevice")) {
22371      JsonArray array = json.getAsJsonArray("focalDevice");
22372      for (int i = 0; i < array.size(); i++) {
22373        res.getFocalDevice().add(parseProcedureFocalDeviceComponent(array.get(i).getAsJsonObject()));
22374      }
22375    };
22376    if (json.has("used")) {
22377      JsonArray array = json.getAsJsonArray("used");
22378      for (int i = 0; i < array.size(); i++) {
22379        res.getUsed().add(parseCodeableReference(array.get(i).getAsJsonObject()));
22380      }
22381    };
22382  }
22383
22384  protected Procedure.ProcedurePerformerComponent parseProcedurePerformerComponent(JsonObject json) throws IOException, FHIRFormatError {
22385    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
22386    parseProcedurePerformerComponentProperties(json, res);
22387    return res;
22388  }
22389
22390  protected void parseProcedurePerformerComponentProperties(JsonObject json, Procedure.ProcedurePerformerComponent res) throws IOException, FHIRFormatError {
22391    parseBackboneElementProperties(json, res);
22392    if (json.has("function"))
22393      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
22394    if (json.has("actor"))
22395      res.setActor(parseReference(json.getAsJsonObject("actor")));
22396    if (json.has("onBehalfOf"))
22397      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
22398  }
22399
22400  protected Procedure.ProcedureFocalDeviceComponent parseProcedureFocalDeviceComponent(JsonObject json) throws IOException, FHIRFormatError {
22401    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
22402    parseProcedureFocalDeviceComponentProperties(json, res);
22403    return res;
22404  }
22405
22406  protected void parseProcedureFocalDeviceComponentProperties(JsonObject json, Procedure.ProcedureFocalDeviceComponent res) throws IOException, FHIRFormatError {
22407    parseBackboneElementProperties(json, res);
22408    if (json.has("action"))
22409      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
22410    if (json.has("manipulated"))
22411      res.setManipulated(parseReference(json.getAsJsonObject("manipulated")));
22412  }
22413
22414  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
22415    Provenance res = new Provenance();
22416    parseProvenanceProperties(json, res);
22417    return res;
22418  }
22419
22420  protected void parseProvenanceProperties(JsonObject json, Provenance res) throws IOException, FHIRFormatError {
22421    parseDomainResourceProperties(json, res);
22422    if (json.has("target")) {
22423      JsonArray array = json.getAsJsonArray("target");
22424      for (int i = 0; i < array.size(); i++) {
22425        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
22426      }
22427    };
22428    DataType occurred = parseType("occurred", json);
22429    if (occurred != null)
22430      res.setOccurred(occurred);
22431    if (json.has("recorded"))
22432      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
22433    if (json.has("_recorded"))
22434      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
22435    if (json.has("policy")) {
22436      JsonArray array = json.getAsJsonArray("policy");
22437      for (int i = 0; i < array.size(); i++) {
22438        if (array.get(i).isJsonNull()) {
22439          res.getPolicy().add(new UriType());
22440        } else {;
22441          res.getPolicy().add(parseUri(array.get(i).getAsString()));
22442        }
22443      }
22444    };
22445    if (json.has("_policy")) {
22446      JsonArray array = json.getAsJsonArray("_policy");
22447      for (int i = 0; i < array.size(); i++) {
22448        if (i == res.getPolicy().size())
22449          res.getPolicy().add(parseUri(null));
22450        if (array.get(i) instanceof JsonObject) 
22451          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
22452      }
22453    };
22454    if (json.has("location"))
22455      res.setLocation(parseReference(json.getAsJsonObject("location")));
22456    if (json.has("reason")) {
22457      JsonArray array = json.getAsJsonArray("reason");
22458      for (int i = 0; i < array.size(); i++) {
22459        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22460      }
22461    };
22462    if (json.has("activity"))
22463      res.setActivity(parseCodeableConcept(json.getAsJsonObject("activity")));
22464    if (json.has("agent")) {
22465      JsonArray array = json.getAsJsonArray("agent");
22466      for (int i = 0; i < array.size(); i++) {
22467        res.getAgent().add(parseProvenanceAgentComponent(array.get(i).getAsJsonObject()));
22468      }
22469    };
22470    if (json.has("entity")) {
22471      JsonArray array = json.getAsJsonArray("entity");
22472      for (int i = 0; i < array.size(); i++) {
22473        res.getEntity().add(parseProvenanceEntityComponent(array.get(i).getAsJsonObject()));
22474      }
22475    };
22476    if (json.has("signature")) {
22477      JsonArray array = json.getAsJsonArray("signature");
22478      for (int i = 0; i < array.size(); i++) {
22479        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
22480      }
22481    };
22482  }
22483
22484  protected Provenance.ProvenanceAgentComponent parseProvenanceAgentComponent(JsonObject json) throws IOException, FHIRFormatError {
22485    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
22486    parseProvenanceAgentComponentProperties(json, res);
22487    return res;
22488  }
22489
22490  protected void parseProvenanceAgentComponentProperties(JsonObject json, Provenance.ProvenanceAgentComponent res) throws IOException, FHIRFormatError {
22491    parseBackboneElementProperties(json, res);
22492    if (json.has("type"))
22493      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22494    if (json.has("role")) {
22495      JsonArray array = json.getAsJsonArray("role");
22496      for (int i = 0; i < array.size(); i++) {
22497        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22498      }
22499    };
22500    if (json.has("who"))
22501      res.setWho(parseReference(json.getAsJsonObject("who")));
22502    if (json.has("onBehalfOf"))
22503      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
22504  }
22505
22506  protected Provenance.ProvenanceEntityComponent parseProvenanceEntityComponent(JsonObject json) throws IOException, FHIRFormatError {
22507    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
22508    parseProvenanceEntityComponentProperties(json, res);
22509    return res;
22510  }
22511
22512  protected void parseProvenanceEntityComponentProperties(JsonObject json, Provenance.ProvenanceEntityComponent res) throws IOException, FHIRFormatError {
22513    parseBackboneElementProperties(json, res);
22514    if (json.has("role"))
22515      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
22516    if (json.has("_role"))
22517      parseElementProperties(json.getAsJsonObject("_role"), res.getRoleElement());
22518    if (json.has("what"))
22519      res.setWhat(parseReference(json.getAsJsonObject("what")));
22520    if (json.has("agent")) {
22521      JsonArray array = json.getAsJsonArray("agent");
22522      for (int i = 0; i < array.size(); i++) {
22523        res.getAgent().add(parseProvenanceAgentComponent(array.get(i).getAsJsonObject()));
22524      }
22525    };
22526  }
22527
22528  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
22529    Questionnaire res = new Questionnaire();
22530    parseQuestionnaireProperties(json, res);
22531    return res;
22532  }
22533
22534  protected void parseQuestionnaireProperties(JsonObject json, Questionnaire res) throws IOException, FHIRFormatError {
22535    parseMetadataResourceProperties(json, res);
22536    if (json.has("url"))
22537      res.setUrlElement(parseUri(json.get("url").getAsString()));
22538    if (json.has("_url"))
22539      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
22540    if (json.has("identifier")) {
22541      JsonArray array = json.getAsJsonArray("identifier");
22542      for (int i = 0; i < array.size(); i++) {
22543        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22544      }
22545    };
22546    if (json.has("version"))
22547      res.setVersionElement(parseString(json.get("version").getAsString()));
22548    if (json.has("_version"))
22549      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
22550    if (json.has("name"))
22551      res.setNameElement(parseString(json.get("name").getAsString()));
22552    if (json.has("_name"))
22553      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22554    if (json.has("title"))
22555      res.setTitleElement(parseString(json.get("title").getAsString()));
22556    if (json.has("_title"))
22557      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
22558    if (json.has("derivedFrom")) {
22559      JsonArray array = json.getAsJsonArray("derivedFrom");
22560      for (int i = 0; i < array.size(); i++) {
22561        if (array.get(i).isJsonNull()) {
22562          res.getDerivedFrom().add(new CanonicalType());
22563        } else {;
22564          res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
22565        }
22566      }
22567    };
22568    if (json.has("_derivedFrom")) {
22569      JsonArray array = json.getAsJsonArray("_derivedFrom");
22570      for (int i = 0; i < array.size(); i++) {
22571        if (i == res.getDerivedFrom().size())
22572          res.getDerivedFrom().add(parseCanonical(null));
22573        if (array.get(i) instanceof JsonObject) 
22574          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
22575      }
22576    };
22577    if (json.has("status"))
22578      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
22579    if (json.has("_status"))
22580      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22581    if (json.has("experimental"))
22582      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
22583    if (json.has("_experimental"))
22584      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
22585    if (json.has("subjectType")) {
22586      JsonArray array = json.getAsJsonArray("subjectType");
22587      for (int i = 0; i < array.size(); i++) {
22588        if (array.get(i).isJsonNull()) {
22589          res.getSubjectType().add(new CodeType());
22590        } else {;
22591          res.getSubjectType().add(parseCode(array.get(i).getAsString()));
22592        }
22593      }
22594    };
22595    if (json.has("_subjectType")) {
22596      JsonArray array = json.getAsJsonArray("_subjectType");
22597      for (int i = 0; i < array.size(); i++) {
22598        if (i == res.getSubjectType().size())
22599          res.getSubjectType().add(parseCode(null));
22600        if (array.get(i) instanceof JsonObject) 
22601          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
22602      }
22603    };
22604    if (json.has("date"))
22605      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22606    if (json.has("_date"))
22607      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
22608    if (json.has("publisher"))
22609      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22610    if (json.has("_publisher"))
22611      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
22612    if (json.has("contact")) {
22613      JsonArray array = json.getAsJsonArray("contact");
22614      for (int i = 0; i < array.size(); i++) {
22615        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22616      }
22617    };
22618    if (json.has("description"))
22619      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22620    if (json.has("_description"))
22621      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22622    if (json.has("useContext")) {
22623      JsonArray array = json.getAsJsonArray("useContext");
22624      for (int i = 0; i < array.size(); i++) {
22625        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22626      }
22627    };
22628    if (json.has("jurisdiction")) {
22629      JsonArray array = json.getAsJsonArray("jurisdiction");
22630      for (int i = 0; i < array.size(); i++) {
22631        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22632      }
22633    };
22634    if (json.has("purpose"))
22635      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
22636    if (json.has("_purpose"))
22637      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
22638    if (json.has("copyright"))
22639      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
22640    if (json.has("_copyright"))
22641      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
22642    if (json.has("approvalDate"))
22643      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
22644    if (json.has("_approvalDate"))
22645      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
22646    if (json.has("lastReviewDate"))
22647      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
22648    if (json.has("_lastReviewDate"))
22649      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
22650    if (json.has("effectivePeriod"))
22651      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
22652    if (json.has("code")) {
22653      JsonArray array = json.getAsJsonArray("code");
22654      for (int i = 0; i < array.size(); i++) {
22655        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
22656      }
22657    };
22658    if (json.has("item")) {
22659      JsonArray array = json.getAsJsonArray("item");
22660      for (int i = 0; i < array.size(); i++) {
22661        res.getItem().add(parseQuestionnaireItemComponent(array.get(i).getAsJsonObject()));
22662      }
22663    };
22664  }
22665
22666  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireItemComponent(JsonObject json) throws IOException, FHIRFormatError {
22667    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
22668    parseQuestionnaireItemComponentProperties(json, res);
22669    return res;
22670  }
22671
22672  protected void parseQuestionnaireItemComponentProperties(JsonObject json, Questionnaire.QuestionnaireItemComponent res) throws IOException, FHIRFormatError {
22673    parseBackboneElementProperties(json, res);
22674    if (json.has("linkId"))
22675      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
22676    if (json.has("_linkId"))
22677      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
22678    if (json.has("definition"))
22679      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
22680    if (json.has("_definition"))
22681      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
22682    if (json.has("code")) {
22683      JsonArray array = json.getAsJsonArray("code");
22684      for (int i = 0; i < array.size(); i++) {
22685        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
22686      }
22687    };
22688    if (json.has("prefix"))
22689      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
22690    if (json.has("_prefix"))
22691      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
22692    if (json.has("text"))
22693      res.setTextElement(parseString(json.get("text").getAsString()));
22694    if (json.has("_text"))
22695      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
22696    if (json.has("type"))
22697      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.QuestionnaireItemType.NULL, new Questionnaire.QuestionnaireItemTypeEnumFactory()));
22698    if (json.has("_type"))
22699      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
22700    if (json.has("enableWhen")) {
22701      JsonArray array = json.getAsJsonArray("enableWhen");
22702      for (int i = 0; i < array.size(); i++) {
22703        res.getEnableWhen().add(parseQuestionnaireItemEnableWhenComponent(array.get(i).getAsJsonObject()));
22704      }
22705    };
22706    if (json.has("enableBehavior"))
22707      res.setEnableBehaviorElement(parseEnumeration(json.get("enableBehavior").getAsString(), Questionnaire.EnableWhenBehavior.NULL, new Questionnaire.EnableWhenBehaviorEnumFactory()));
22708    if (json.has("_enableBehavior"))
22709      parseElementProperties(json.getAsJsonObject("_enableBehavior"), res.getEnableBehaviorElement());
22710    if (json.has("required"))
22711      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
22712    if (json.has("_required"))
22713      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
22714    if (json.has("repeats"))
22715      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
22716    if (json.has("_repeats"))
22717      parseElementProperties(json.getAsJsonObject("_repeats"), res.getRepeatsElement());
22718    if (json.has("readOnly"))
22719      res.setReadOnlyElement(parseBoolean(json.get("readOnly").getAsBoolean()));
22720    if (json.has("_readOnly"))
22721      parseElementProperties(json.getAsJsonObject("_readOnly"), res.getReadOnlyElement());
22722    if (json.has("maxLength"))
22723      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
22724    if (json.has("_maxLength"))
22725      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
22726    if (json.has("answerValueSet"))
22727      res.setAnswerValueSetElement(parseCanonical(json.get("answerValueSet").getAsString()));
22728    if (json.has("_answerValueSet"))
22729      parseElementProperties(json.getAsJsonObject("_answerValueSet"), res.getAnswerValueSetElement());
22730    if (json.has("answerOption")) {
22731      JsonArray array = json.getAsJsonArray("answerOption");
22732      for (int i = 0; i < array.size(); i++) {
22733        res.getAnswerOption().add(parseQuestionnaireItemAnswerOptionComponent(array.get(i).getAsJsonObject()));
22734      }
22735    };
22736    if (json.has("initial")) {
22737      JsonArray array = json.getAsJsonArray("initial");
22738      for (int i = 0; i < array.size(); i++) {
22739        res.getInitial().add(parseQuestionnaireItemInitialComponent(array.get(i).getAsJsonObject()));
22740      }
22741    };
22742    if (json.has("item")) {
22743      JsonArray array = json.getAsJsonArray("item");
22744      for (int i = 0; i < array.size(); i++) {
22745        res.getItem().add(parseQuestionnaireItemComponent(array.get(i).getAsJsonObject()));
22746      }
22747    };
22748  }
22749
22750  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireItemEnableWhenComponent(JsonObject json) throws IOException, FHIRFormatError {
22751    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
22752    parseQuestionnaireItemEnableWhenComponentProperties(json, res);
22753    return res;
22754  }
22755
22756  protected void parseQuestionnaireItemEnableWhenComponentProperties(JsonObject json, Questionnaire.QuestionnaireItemEnableWhenComponent res) throws IOException, FHIRFormatError {
22757    parseBackboneElementProperties(json, res);
22758    if (json.has("question"))
22759      res.setQuestionElement(parseString(json.get("question").getAsString()));
22760    if (json.has("_question"))
22761      parseElementProperties(json.getAsJsonObject("_question"), res.getQuestionElement());
22762    if (json.has("operator"))
22763      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), Questionnaire.QuestionnaireItemOperator.NULL, new Questionnaire.QuestionnaireItemOperatorEnumFactory()));
22764    if (json.has("_operator"))
22765      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
22766    DataType answer = parseType("answer", json);
22767    if (answer != null)
22768      res.setAnswer(answer);
22769  }
22770
22771  protected Questionnaire.QuestionnaireItemAnswerOptionComponent parseQuestionnaireItemAnswerOptionComponent(JsonObject json) throws IOException, FHIRFormatError {
22772    Questionnaire.QuestionnaireItemAnswerOptionComponent res = new Questionnaire.QuestionnaireItemAnswerOptionComponent();
22773    parseQuestionnaireItemAnswerOptionComponentProperties(json, res);
22774    return res;
22775  }
22776
22777  protected void parseQuestionnaireItemAnswerOptionComponentProperties(JsonObject json, Questionnaire.QuestionnaireItemAnswerOptionComponent res) throws IOException, FHIRFormatError {
22778    parseBackboneElementProperties(json, res);
22779    DataType value = parseType("value", json);
22780    if (value != null)
22781      res.setValue(value);
22782    if (json.has("initialSelected"))
22783      res.setInitialSelectedElement(parseBoolean(json.get("initialSelected").getAsBoolean()));
22784    if (json.has("_initialSelected"))
22785      parseElementProperties(json.getAsJsonObject("_initialSelected"), res.getInitialSelectedElement());
22786  }
22787
22788  protected Questionnaire.QuestionnaireItemInitialComponent parseQuestionnaireItemInitialComponent(JsonObject json) throws IOException, FHIRFormatError {
22789    Questionnaire.QuestionnaireItemInitialComponent res = new Questionnaire.QuestionnaireItemInitialComponent();
22790    parseQuestionnaireItemInitialComponentProperties(json, res);
22791    return res;
22792  }
22793
22794  protected void parseQuestionnaireItemInitialComponentProperties(JsonObject json, Questionnaire.QuestionnaireItemInitialComponent res) throws IOException, FHIRFormatError {
22795    parseBackboneElementProperties(json, res);
22796    DataType value = parseType("value", json);
22797    if (value != null)
22798      res.setValue(value);
22799  }
22800
22801  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
22802    QuestionnaireResponse res = new QuestionnaireResponse();
22803    parseQuestionnaireResponseProperties(json, res);
22804    return res;
22805  }
22806
22807  protected void parseQuestionnaireResponseProperties(JsonObject json, QuestionnaireResponse res) throws IOException, FHIRFormatError {
22808    parseDomainResourceProperties(json, res);
22809    if (json.has("identifier"))
22810      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
22811    if (json.has("basedOn")) {
22812      JsonArray array = json.getAsJsonArray("basedOn");
22813      for (int i = 0; i < array.size(); i++) {
22814        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
22815      }
22816    };
22817    if (json.has("partOf")) {
22818      JsonArray array = json.getAsJsonArray("partOf");
22819      for (int i = 0; i < array.size(); i++) {
22820        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
22821      }
22822    };
22823    if (json.has("questionnaire"))
22824      res.setQuestionnaireElement(parseCanonical(json.get("questionnaire").getAsString()));
22825    if (json.has("_questionnaire"))
22826      parseElementProperties(json.getAsJsonObject("_questionnaire"), res.getQuestionnaireElement());
22827    if (json.has("status"))
22828      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
22829    if (json.has("_status"))
22830      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22831    if (json.has("subject"))
22832      res.setSubject(parseReference(json.getAsJsonObject("subject")));
22833    if (json.has("encounter"))
22834      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
22835    if (json.has("authored"))
22836      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
22837    if (json.has("_authored"))
22838      parseElementProperties(json.getAsJsonObject("_authored"), res.getAuthoredElement());
22839    if (json.has("author"))
22840      res.setAuthor(parseReference(json.getAsJsonObject("author")));
22841    if (json.has("source"))
22842      res.setSource(parseReference(json.getAsJsonObject("source")));
22843    if (json.has("item")) {
22844      JsonArray array = json.getAsJsonArray("item");
22845      for (int i = 0; i < array.size(); i++) {
22846        res.getItem().add(parseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject()));
22847      }
22848    };
22849  }
22850
22851  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseItemComponent(JsonObject json) throws IOException, FHIRFormatError {
22852    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
22853    parseQuestionnaireResponseItemComponentProperties(json, res);
22854    return res;
22855  }
22856
22857  protected void parseQuestionnaireResponseItemComponentProperties(JsonObject json, QuestionnaireResponse.QuestionnaireResponseItemComponent res) throws IOException, FHIRFormatError {
22858    parseBackboneElementProperties(json, res);
22859    if (json.has("linkId"))
22860      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
22861    if (json.has("_linkId"))
22862      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
22863    if (json.has("definition"))
22864      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
22865    if (json.has("_definition"))
22866      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
22867    if (json.has("text"))
22868      res.setTextElement(parseString(json.get("text").getAsString()));
22869    if (json.has("_text"))
22870      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
22871    if (json.has("answer")) {
22872      JsonArray array = json.getAsJsonArray("answer");
22873      for (int i = 0; i < array.size(); i++) {
22874        res.getAnswer().add(parseQuestionnaireResponseItemAnswerComponent(array.get(i).getAsJsonObject()));
22875      }
22876    };
22877    if (json.has("item")) {
22878      JsonArray array = json.getAsJsonArray("item");
22879      for (int i = 0; i < array.size(); i++) {
22880        res.getItem().add(parseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject()));
22881      }
22882    };
22883  }
22884
22885  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseItemAnswerComponent(JsonObject json) throws IOException, FHIRFormatError {
22886    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
22887    parseQuestionnaireResponseItemAnswerComponentProperties(json, res);
22888    return res;
22889  }
22890
22891  protected void parseQuestionnaireResponseItemAnswerComponentProperties(JsonObject json, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res) throws IOException, FHIRFormatError {
22892    parseBackboneElementProperties(json, res);
22893    DataType value = parseType("value", json);
22894    if (value != null)
22895      res.setValue(value);
22896    if (json.has("item")) {
22897      JsonArray array = json.getAsJsonArray("item");
22898      for (int i = 0; i < array.size(); i++) {
22899        res.getItem().add(parseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject()));
22900      }
22901    };
22902  }
22903
22904  protected RegulatedAuthorization parseRegulatedAuthorization(JsonObject json) throws IOException, FHIRFormatError {
22905    RegulatedAuthorization res = new RegulatedAuthorization();
22906    parseRegulatedAuthorizationProperties(json, res);
22907    return res;
22908  }
22909
22910  protected void parseRegulatedAuthorizationProperties(JsonObject json, RegulatedAuthorization res) throws IOException, FHIRFormatError {
22911    parseDomainResourceProperties(json, res);
22912    if (json.has("identifier")) {
22913      JsonArray array = json.getAsJsonArray("identifier");
22914      for (int i = 0; i < array.size(); i++) {
22915        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22916      }
22917    };
22918    if (json.has("subject"))
22919      res.setSubject(parseReference(json.getAsJsonObject("subject")));
22920    if (json.has("type"))
22921      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22922    if (json.has("description"))
22923      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22924    if (json.has("_description"))
22925      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22926    if (json.has("region")) {
22927      JsonArray array = json.getAsJsonArray("region");
22928      for (int i = 0; i < array.size(); i++) {
22929        res.getRegion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22930      }
22931    };
22932    if (json.has("status"))
22933      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
22934    if (json.has("statusDate"))
22935      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
22936    if (json.has("_statusDate"))
22937      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
22938    if (json.has("validityPeriod"))
22939      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
22940    if (json.has("basis")) {
22941      JsonArray array = json.getAsJsonArray("basis");
22942      for (int i = 0; i < array.size(); i++) {
22943        res.getBasis().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22944      }
22945    };
22946    if (json.has("relatedDate")) {
22947      JsonArray array = json.getAsJsonArray("relatedDate");
22948      for (int i = 0; i < array.size(); i++) {
22949        res.getRelatedDate().add(parseRegulatedAuthorizationRelatedDateComponent(array.get(i).getAsJsonObject()));
22950      }
22951    };
22952    if (json.has("jurisdictionalAuthorization")) {
22953      JsonArray array = json.getAsJsonArray("jurisdictionalAuthorization");
22954      for (int i = 0; i < array.size(); i++) {
22955        res.getJurisdictionalAuthorization().add(parseReference(array.get(i).getAsJsonObject()));
22956      }
22957    };
22958    if (json.has("holder"))
22959      res.setHolder(parseReference(json.getAsJsonObject("holder")));
22960    if (json.has("regulator"))
22961      res.setRegulator(parseReference(json.getAsJsonObject("regulator")));
22962    if (json.has("case"))
22963      res.setCase(parseRegulatedAuthorizationCaseComponent(json.getAsJsonObject("case")));
22964  }
22965
22966  protected RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent parseRegulatedAuthorizationRelatedDateComponent(JsonObject json) throws IOException, FHIRFormatError {
22967    RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent res = new RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent();
22968    parseRegulatedAuthorizationRelatedDateComponentProperties(json, res);
22969    return res;
22970  }
22971
22972  protected void parseRegulatedAuthorizationRelatedDateComponentProperties(JsonObject json, RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent res) throws IOException, FHIRFormatError {
22973    parseBackboneElementProperties(json, res);
22974    DataType date = parseType("date", json);
22975    if (date != null)
22976      res.setDate(date);
22977    if (json.has("type"))
22978      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22979  }
22980
22981  protected RegulatedAuthorization.RegulatedAuthorizationCaseComponent parseRegulatedAuthorizationCaseComponent(JsonObject json) throws IOException, FHIRFormatError {
22982    RegulatedAuthorization.RegulatedAuthorizationCaseComponent res = new RegulatedAuthorization.RegulatedAuthorizationCaseComponent();
22983    parseRegulatedAuthorizationCaseComponentProperties(json, res);
22984    return res;
22985  }
22986
22987  protected void parseRegulatedAuthorizationCaseComponentProperties(JsonObject json, RegulatedAuthorization.RegulatedAuthorizationCaseComponent res) throws IOException, FHIRFormatError {
22988    parseBackboneElementProperties(json, res);
22989    if (json.has("identifier"))
22990      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
22991    if (json.has("type"))
22992      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22993    if (json.has("status"))
22994      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
22995    DataType date = parseType("date", json);
22996    if (date != null)
22997      res.setDate(date);
22998    if (json.has("application")) {
22999      JsonArray array = json.getAsJsonArray("application");
23000      for (int i = 0; i < array.size(); i++) {
23001        res.getApplication().add(parseRegulatedAuthorizationCaseComponent(array.get(i).getAsJsonObject()));
23002      }
23003    };
23004  }
23005
23006  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
23007    RelatedPerson res = new RelatedPerson();
23008    parseRelatedPersonProperties(json, res);
23009    return res;
23010  }
23011
23012  protected void parseRelatedPersonProperties(JsonObject json, RelatedPerson res) throws IOException, FHIRFormatError {
23013    parseDomainResourceProperties(json, res);
23014    if (json.has("identifier")) {
23015      JsonArray array = json.getAsJsonArray("identifier");
23016      for (int i = 0; i < array.size(); i++) {
23017        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23018      }
23019    };
23020    if (json.has("active"))
23021      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
23022    if (json.has("_active"))
23023      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
23024    if (json.has("patient"))
23025      res.setPatient(parseReference(json.getAsJsonObject("patient")));
23026    if (json.has("relationship")) {
23027      JsonArray array = json.getAsJsonArray("relationship");
23028      for (int i = 0; i < array.size(); i++) {
23029        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23030      }
23031    };
23032    if (json.has("name")) {
23033      JsonArray array = json.getAsJsonArray("name");
23034      for (int i = 0; i < array.size(); i++) {
23035        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
23036      }
23037    };
23038    if (json.has("telecom")) {
23039      JsonArray array = json.getAsJsonArray("telecom");
23040      for (int i = 0; i < array.size(); i++) {
23041        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
23042      }
23043    };
23044    if (json.has("gender"))
23045      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
23046    if (json.has("_gender"))
23047      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
23048    if (json.has("birthDate"))
23049      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
23050    if (json.has("_birthDate"))
23051      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
23052    if (json.has("address")) {
23053      JsonArray array = json.getAsJsonArray("address");
23054      for (int i = 0; i < array.size(); i++) {
23055        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
23056      }
23057    };
23058    if (json.has("photo")) {
23059      JsonArray array = json.getAsJsonArray("photo");
23060      for (int i = 0; i < array.size(); i++) {
23061        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
23062      }
23063    };
23064    if (json.has("period"))
23065      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
23066    if (json.has("communication")) {
23067      JsonArray array = json.getAsJsonArray("communication");
23068      for (int i = 0; i < array.size(); i++) {
23069        res.getCommunication().add(parseRelatedPersonCommunicationComponent(array.get(i).getAsJsonObject()));
23070      }
23071    };
23072  }
23073
23074  protected RelatedPerson.RelatedPersonCommunicationComponent parseRelatedPersonCommunicationComponent(JsonObject json) throws IOException, FHIRFormatError {
23075    RelatedPerson.RelatedPersonCommunicationComponent res = new RelatedPerson.RelatedPersonCommunicationComponent();
23076    parseRelatedPersonCommunicationComponentProperties(json, res);
23077    return res;
23078  }
23079
23080  protected void parseRelatedPersonCommunicationComponentProperties(JsonObject json, RelatedPerson.RelatedPersonCommunicationComponent res) throws IOException, FHIRFormatError {
23081    parseBackboneElementProperties(json, res);
23082    if (json.has("language"))
23083      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
23084    if (json.has("preferred"))
23085      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
23086    if (json.has("_preferred"))
23087      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
23088  }
23089
23090  protected RequestGroup parseRequestGroup(JsonObject json) throws IOException, FHIRFormatError {
23091    RequestGroup res = new RequestGroup();
23092    parseRequestGroupProperties(json, res);
23093    return res;
23094  }
23095
23096  protected void parseRequestGroupProperties(JsonObject json, RequestGroup res) throws IOException, FHIRFormatError {
23097    parseDomainResourceProperties(json, res);
23098    if (json.has("identifier")) {
23099      JsonArray array = json.getAsJsonArray("identifier");
23100      for (int i = 0; i < array.size(); i++) {
23101        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23102      }
23103    };
23104    if (json.has("instantiatesCanonical")) {
23105      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
23106      for (int i = 0; i < array.size(); i++) {
23107        if (array.get(i).isJsonNull()) {
23108          res.getInstantiatesCanonical().add(new CanonicalType());
23109        } else {;
23110          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
23111        }
23112      }
23113    };
23114    if (json.has("_instantiatesCanonical")) {
23115      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
23116      for (int i = 0; i < array.size(); i++) {
23117        if (i == res.getInstantiatesCanonical().size())
23118          res.getInstantiatesCanonical().add(parseCanonical(null));
23119        if (array.get(i) instanceof JsonObject) 
23120          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
23121      }
23122    };
23123    if (json.has("instantiatesUri")) {
23124      JsonArray array = json.getAsJsonArray("instantiatesUri");
23125      for (int i = 0; i < array.size(); i++) {
23126        if (array.get(i).isJsonNull()) {
23127          res.getInstantiatesUri().add(new UriType());
23128        } else {;
23129          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
23130        }
23131      }
23132    };
23133    if (json.has("_instantiatesUri")) {
23134      JsonArray array = json.getAsJsonArray("_instantiatesUri");
23135      for (int i = 0; i < array.size(); i++) {
23136        if (i == res.getInstantiatesUri().size())
23137          res.getInstantiatesUri().add(parseUri(null));
23138        if (array.get(i) instanceof JsonObject) 
23139          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
23140      }
23141    };
23142    if (json.has("basedOn")) {
23143      JsonArray array = json.getAsJsonArray("basedOn");
23144      for (int i = 0; i < array.size(); i++) {
23145        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
23146      }
23147    };
23148    if (json.has("replaces")) {
23149      JsonArray array = json.getAsJsonArray("replaces");
23150      for (int i = 0; i < array.size(); i++) {
23151        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
23152      }
23153    };
23154    if (json.has("groupIdentifier"))
23155      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
23156    if (json.has("status"))
23157      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
23158    if (json.has("_status"))
23159      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23160    if (json.has("intent"))
23161      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
23162    if (json.has("_intent"))
23163      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
23164    if (json.has("priority"))
23165      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
23166    if (json.has("_priority"))
23167      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
23168    if (json.has("code"))
23169      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
23170    if (json.has("subject"))
23171      res.setSubject(parseReference(json.getAsJsonObject("subject")));
23172    if (json.has("encounter"))
23173      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
23174    if (json.has("authoredOn"))
23175      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
23176    if (json.has("_authoredOn"))
23177      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
23178    if (json.has("author"))
23179      res.setAuthor(parseReference(json.getAsJsonObject("author")));
23180    if (json.has("reason")) {
23181      JsonArray array = json.getAsJsonArray("reason");
23182      for (int i = 0; i < array.size(); i++) {
23183        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
23184      }
23185    };
23186    if (json.has("note")) {
23187      JsonArray array = json.getAsJsonArray("note");
23188      for (int i = 0; i < array.size(); i++) {
23189        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23190      }
23191    };
23192    if (json.has("action")) {
23193      JsonArray array = json.getAsJsonArray("action");
23194      for (int i = 0; i < array.size(); i++) {
23195        res.getAction().add(parseRequestGroupActionComponent(array.get(i).getAsJsonObject()));
23196      }
23197    };
23198  }
23199
23200  protected RequestGroup.RequestGroupActionComponent parseRequestGroupActionComponent(JsonObject json) throws IOException, FHIRFormatError {
23201    RequestGroup.RequestGroupActionComponent res = new RequestGroup.RequestGroupActionComponent();
23202    parseRequestGroupActionComponentProperties(json, res);
23203    return res;
23204  }
23205
23206  protected void parseRequestGroupActionComponentProperties(JsonObject json, RequestGroup.RequestGroupActionComponent res) throws IOException, FHIRFormatError {
23207    parseBackboneElementProperties(json, res);
23208    if (json.has("prefix"))
23209      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
23210    if (json.has("_prefix"))
23211      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
23212    if (json.has("title"))
23213      res.setTitleElement(parseString(json.get("title").getAsString()));
23214    if (json.has("_title"))
23215      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
23216    if (json.has("description"))
23217      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23218    if (json.has("_description"))
23219      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23220    if (json.has("textEquivalent"))
23221      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
23222    if (json.has("_textEquivalent"))
23223      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
23224    if (json.has("priority"))
23225      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
23226    if (json.has("_priority"))
23227      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
23228    if (json.has("code")) {
23229      JsonArray array = json.getAsJsonArray("code");
23230      for (int i = 0; i < array.size(); i++) {
23231        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23232      }
23233    };
23234    if (json.has("documentation")) {
23235      JsonArray array = json.getAsJsonArray("documentation");
23236      for (int i = 0; i < array.size(); i++) {
23237        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
23238      }
23239    };
23240    if (json.has("condition")) {
23241      JsonArray array = json.getAsJsonArray("condition");
23242      for (int i = 0; i < array.size(); i++) {
23243        res.getCondition().add(parseRequestGroupActionConditionComponent(array.get(i).getAsJsonObject()));
23244      }
23245    };
23246    if (json.has("relatedAction")) {
23247      JsonArray array = json.getAsJsonArray("relatedAction");
23248      for (int i = 0; i < array.size(); i++) {
23249        res.getRelatedAction().add(parseRequestGroupActionRelatedActionComponent(array.get(i).getAsJsonObject()));
23250      }
23251    };
23252    DataType timing = parseType("timing", json);
23253    if (timing != null)
23254      res.setTiming(timing);
23255    if (json.has("participant")) {
23256      JsonArray array = json.getAsJsonArray("participant");
23257      for (int i = 0; i < array.size(); i++) {
23258        res.getParticipant().add(parseReference(array.get(i).getAsJsonObject()));
23259      }
23260    };
23261    if (json.has("type"))
23262      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23263    if (json.has("groupingBehavior"))
23264      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), Enumerations.ActionGroupingBehavior.NULL, new Enumerations.ActionGroupingBehaviorEnumFactory()));
23265    if (json.has("_groupingBehavior"))
23266      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
23267    if (json.has("selectionBehavior"))
23268      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), Enumerations.ActionSelectionBehavior.NULL, new Enumerations.ActionSelectionBehaviorEnumFactory()));
23269    if (json.has("_selectionBehavior"))
23270      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
23271    if (json.has("requiredBehavior"))
23272      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), Enumerations.ActionRequiredBehavior.NULL, new Enumerations.ActionRequiredBehaviorEnumFactory()));
23273    if (json.has("_requiredBehavior"))
23274      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
23275    if (json.has("precheckBehavior"))
23276      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), Enumerations.ActionPrecheckBehavior.NULL, new Enumerations.ActionPrecheckBehaviorEnumFactory()));
23277    if (json.has("_precheckBehavior"))
23278      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
23279    if (json.has("cardinalityBehavior"))
23280      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), Enumerations.ActionCardinalityBehavior.NULL, new Enumerations.ActionCardinalityBehaviorEnumFactory()));
23281    if (json.has("_cardinalityBehavior"))
23282      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
23283    if (json.has("resource"))
23284      res.setResource(parseReference(json.getAsJsonObject("resource")));
23285    if (json.has("action")) {
23286      JsonArray array = json.getAsJsonArray("action");
23287      for (int i = 0; i < array.size(); i++) {
23288        res.getAction().add(parseRequestGroupActionComponent(array.get(i).getAsJsonObject()));
23289      }
23290    };
23291  }
23292
23293  protected RequestGroup.RequestGroupActionConditionComponent parseRequestGroupActionConditionComponent(JsonObject json) throws IOException, FHIRFormatError {
23294    RequestGroup.RequestGroupActionConditionComponent res = new RequestGroup.RequestGroupActionConditionComponent();
23295    parseRequestGroupActionConditionComponentProperties(json, res);
23296    return res;
23297  }
23298
23299  protected void parseRequestGroupActionConditionComponentProperties(JsonObject json, RequestGroup.RequestGroupActionConditionComponent res) throws IOException, FHIRFormatError {
23300    parseBackboneElementProperties(json, res);
23301    if (json.has("kind"))
23302      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.ActionConditionKind.NULL, new Enumerations.ActionConditionKindEnumFactory()));
23303    if (json.has("_kind"))
23304      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
23305    if (json.has("expression"))
23306      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
23307  }
23308
23309  protected RequestGroup.RequestGroupActionRelatedActionComponent parseRequestGroupActionRelatedActionComponent(JsonObject json) throws IOException, FHIRFormatError {
23310    RequestGroup.RequestGroupActionRelatedActionComponent res = new RequestGroup.RequestGroupActionRelatedActionComponent();
23311    parseRequestGroupActionRelatedActionComponentProperties(json, res);
23312    return res;
23313  }
23314
23315  protected void parseRequestGroupActionRelatedActionComponentProperties(JsonObject json, RequestGroup.RequestGroupActionRelatedActionComponent res) throws IOException, FHIRFormatError {
23316    parseBackboneElementProperties(json, res);
23317    if (json.has("actionId"))
23318      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
23319    if (json.has("_actionId"))
23320      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
23321    if (json.has("relationship"))
23322      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), Enumerations.ActionRelationshipType.NULL, new Enumerations.ActionRelationshipTypeEnumFactory()));
23323    if (json.has("_relationship"))
23324      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
23325    DataType offset = parseType("offset", json);
23326    if (offset != null)
23327      res.setOffset(offset);
23328  }
23329
23330  protected ResearchStudy parseResearchStudy(JsonObject json) throws IOException, FHIRFormatError {
23331    ResearchStudy res = new ResearchStudy();
23332    parseResearchStudyProperties(json, res);
23333    return res;
23334  }
23335
23336  protected void parseResearchStudyProperties(JsonObject json, ResearchStudy res) throws IOException, FHIRFormatError {
23337    parseDomainResourceProperties(json, res);
23338    if (json.has("identifier")) {
23339      JsonArray array = json.getAsJsonArray("identifier");
23340      for (int i = 0; i < array.size(); i++) {
23341        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23342      }
23343    };
23344    if (json.has("title"))
23345      res.setTitleElement(parseString(json.get("title").getAsString()));
23346    if (json.has("_title"))
23347      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
23348    if (json.has("protocol")) {
23349      JsonArray array = json.getAsJsonArray("protocol");
23350      for (int i = 0; i < array.size(); i++) {
23351        res.getProtocol().add(parseReference(array.get(i).getAsJsonObject()));
23352      }
23353    };
23354    if (json.has("partOf")) {
23355      JsonArray array = json.getAsJsonArray("partOf");
23356      for (int i = 0; i < array.size(); i++) {
23357        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
23358      }
23359    };
23360    if (json.has("status"))
23361      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchStudy.ResearchStudyStatus.NULL, new ResearchStudy.ResearchStudyStatusEnumFactory()));
23362    if (json.has("_status"))
23363      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23364    if (json.has("primaryPurposeType"))
23365      res.setPrimaryPurposeType(parseCodeableConcept(json.getAsJsonObject("primaryPurposeType")));
23366    if (json.has("phase"))
23367      res.setPhase(parseCodeableConcept(json.getAsJsonObject("phase")));
23368    if (json.has("category")) {
23369      JsonArray array = json.getAsJsonArray("category");
23370      for (int i = 0; i < array.size(); i++) {
23371        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23372      }
23373    };
23374    if (json.has("focus")) {
23375      JsonArray array = json.getAsJsonArray("focus");
23376      for (int i = 0; i < array.size(); i++) {
23377        res.getFocus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23378      }
23379    };
23380    if (json.has("condition")) {
23381      JsonArray array = json.getAsJsonArray("condition");
23382      for (int i = 0; i < array.size(); i++) {
23383        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23384      }
23385    };
23386    if (json.has("contact")) {
23387      JsonArray array = json.getAsJsonArray("contact");
23388      for (int i = 0; i < array.size(); i++) {
23389        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23390      }
23391    };
23392    if (json.has("relatedArtifact")) {
23393      JsonArray array = json.getAsJsonArray("relatedArtifact");
23394      for (int i = 0; i < array.size(); i++) {
23395        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
23396      }
23397    };
23398    if (json.has("keyword")) {
23399      JsonArray array = json.getAsJsonArray("keyword");
23400      for (int i = 0; i < array.size(); i++) {
23401        res.getKeyword().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23402      }
23403    };
23404    if (json.has("location")) {
23405      JsonArray array = json.getAsJsonArray("location");
23406      for (int i = 0; i < array.size(); i++) {
23407        res.getLocation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23408      }
23409    };
23410    if (json.has("description"))
23411      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23412    if (json.has("_description"))
23413      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23414    if (json.has("enrollment")) {
23415      JsonArray array = json.getAsJsonArray("enrollment");
23416      for (int i = 0; i < array.size(); i++) {
23417        res.getEnrollment().add(parseReference(array.get(i).getAsJsonObject()));
23418      }
23419    };
23420    if (json.has("period"))
23421      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
23422    if (json.has("sponsor"))
23423      res.setSponsor(parseReference(json.getAsJsonObject("sponsor")));
23424    if (json.has("principalInvestigator"))
23425      res.setPrincipalInvestigator(parseReference(json.getAsJsonObject("principalInvestigator")));
23426    if (json.has("site")) {
23427      JsonArray array = json.getAsJsonArray("site");
23428      for (int i = 0; i < array.size(); i++) {
23429        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
23430      }
23431    };
23432    if (json.has("reasonStopped"))
23433      res.setReasonStopped(parseCodeableConcept(json.getAsJsonObject("reasonStopped")));
23434    if (json.has("note")) {
23435      JsonArray array = json.getAsJsonArray("note");
23436      for (int i = 0; i < array.size(); i++) {
23437        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23438      }
23439    };
23440    if (json.has("arm")) {
23441      JsonArray array = json.getAsJsonArray("arm");
23442      for (int i = 0; i < array.size(); i++) {
23443        res.getArm().add(parseResearchStudyArmComponent(array.get(i).getAsJsonObject()));
23444      }
23445    };
23446    if (json.has("objective")) {
23447      JsonArray array = json.getAsJsonArray("objective");
23448      for (int i = 0; i < array.size(); i++) {
23449        res.getObjective().add(parseResearchStudyObjectiveComponent(array.get(i).getAsJsonObject()));
23450      }
23451    };
23452  }
23453
23454  protected ResearchStudy.ResearchStudyArmComponent parseResearchStudyArmComponent(JsonObject json) throws IOException, FHIRFormatError {
23455    ResearchStudy.ResearchStudyArmComponent res = new ResearchStudy.ResearchStudyArmComponent();
23456    parseResearchStudyArmComponentProperties(json, res);
23457    return res;
23458  }
23459
23460  protected void parseResearchStudyArmComponentProperties(JsonObject json, ResearchStudy.ResearchStudyArmComponent res) throws IOException, FHIRFormatError {
23461    parseBackboneElementProperties(json, res);
23462    if (json.has("name"))
23463      res.setNameElement(parseString(json.get("name").getAsString()));
23464    if (json.has("_name"))
23465      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23466    if (json.has("type"))
23467      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23468    if (json.has("description"))
23469      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23470    if (json.has("_description"))
23471      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23472  }
23473
23474  protected ResearchStudy.ResearchStudyObjectiveComponent parseResearchStudyObjectiveComponent(JsonObject json) throws IOException, FHIRFormatError {
23475    ResearchStudy.ResearchStudyObjectiveComponent res = new ResearchStudy.ResearchStudyObjectiveComponent();
23476    parseResearchStudyObjectiveComponentProperties(json, res);
23477    return res;
23478  }
23479
23480  protected void parseResearchStudyObjectiveComponentProperties(JsonObject json, ResearchStudy.ResearchStudyObjectiveComponent res) throws IOException, FHIRFormatError {
23481    parseBackboneElementProperties(json, res);
23482    if (json.has("name"))
23483      res.setNameElement(parseString(json.get("name").getAsString()));
23484    if (json.has("_name"))
23485      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23486    if (json.has("type"))
23487      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23488  }
23489
23490  protected ResearchSubject parseResearchSubject(JsonObject json) throws IOException, FHIRFormatError {
23491    ResearchSubject res = new ResearchSubject();
23492    parseResearchSubjectProperties(json, res);
23493    return res;
23494  }
23495
23496  protected void parseResearchSubjectProperties(JsonObject json, ResearchSubject res) throws IOException, FHIRFormatError {
23497    parseDomainResourceProperties(json, res);
23498    if (json.has("identifier")) {
23499      JsonArray array = json.getAsJsonArray("identifier");
23500      for (int i = 0; i < array.size(); i++) {
23501        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23502      }
23503    };
23504    if (json.has("status"))
23505      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchSubject.ResearchSubjectStatus.NULL, new ResearchSubject.ResearchSubjectStatusEnumFactory()));
23506    if (json.has("_status"))
23507      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23508    if (json.has("progress")) {
23509      JsonArray array = json.getAsJsonArray("progress");
23510      for (int i = 0; i < array.size(); i++) {
23511        res.getProgress().add(parseResearchSubjectProgressComponent(array.get(i).getAsJsonObject()));
23512      }
23513    };
23514    if (json.has("period"))
23515      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
23516    if (json.has("study"))
23517      res.setStudy(parseReference(json.getAsJsonObject("study")));
23518    if (json.has("individual"))
23519      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
23520    if (json.has("assignedArm"))
23521      res.setAssignedArmElement(parseString(json.get("assignedArm").getAsString()));
23522    if (json.has("_assignedArm"))
23523      parseElementProperties(json.getAsJsonObject("_assignedArm"), res.getAssignedArmElement());
23524    if (json.has("actualArm"))
23525      res.setActualArmElement(parseString(json.get("actualArm").getAsString()));
23526    if (json.has("_actualArm"))
23527      parseElementProperties(json.getAsJsonObject("_actualArm"), res.getActualArmElement());
23528    if (json.has("consent"))
23529      res.setConsent(parseReference(json.getAsJsonObject("consent")));
23530  }
23531
23532  protected ResearchSubject.ResearchSubjectProgressComponent parseResearchSubjectProgressComponent(JsonObject json) throws IOException, FHIRFormatError {
23533    ResearchSubject.ResearchSubjectProgressComponent res = new ResearchSubject.ResearchSubjectProgressComponent();
23534    parseResearchSubjectProgressComponentProperties(json, res);
23535    return res;
23536  }
23537
23538  protected void parseResearchSubjectProgressComponentProperties(JsonObject json, ResearchSubject.ResearchSubjectProgressComponent res) throws IOException, FHIRFormatError {
23539    parseBackboneElementProperties(json, res);
23540    if (json.has("type"))
23541      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23542    if (json.has("state"))
23543      res.setState(parseCodeableConcept(json.getAsJsonObject("state")));
23544    if (json.has("milestone"))
23545      res.setMilestone(parseCodeableConcept(json.getAsJsonObject("milestone")));
23546    if (json.has("reason"))
23547      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
23548    if (json.has("startDate"))
23549      res.setStartDateElement(parseDateTime(json.get("startDate").getAsString()));
23550    if (json.has("_startDate"))
23551      parseElementProperties(json.getAsJsonObject("_startDate"), res.getStartDateElement());
23552  }
23553
23554  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
23555    RiskAssessment res = new RiskAssessment();
23556    parseRiskAssessmentProperties(json, res);
23557    return res;
23558  }
23559
23560  protected void parseRiskAssessmentProperties(JsonObject json, RiskAssessment res) throws IOException, FHIRFormatError {
23561    parseDomainResourceProperties(json, res);
23562    if (json.has("identifier")) {
23563      JsonArray array = json.getAsJsonArray("identifier");
23564      for (int i = 0; i < array.size(); i++) {
23565        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23566      }
23567    };
23568    if (json.has("basedOn"))
23569      res.setBasedOn(parseReference(json.getAsJsonObject("basedOn")));
23570    if (json.has("parent"))
23571      res.setParent(parseReference(json.getAsJsonObject("parent")));
23572    if (json.has("status"))
23573      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.ObservationStatus.NULL, new Enumerations.ObservationStatusEnumFactory()));
23574    if (json.has("_status"))
23575      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23576    if (json.has("method"))
23577      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
23578    if (json.has("code"))
23579      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
23580    if (json.has("subject"))
23581      res.setSubject(parseReference(json.getAsJsonObject("subject")));
23582    if (json.has("encounter"))
23583      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
23584    DataType occurrence = parseType("occurrence", json);
23585    if (occurrence != null)
23586      res.setOccurrence(occurrence);
23587    if (json.has("condition"))
23588      res.setCondition(parseReference(json.getAsJsonObject("condition")));
23589    if (json.has("performer"))
23590      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
23591    if (json.has("reason")) {
23592      JsonArray array = json.getAsJsonArray("reason");
23593      for (int i = 0; i < array.size(); i++) {
23594        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
23595      }
23596    };
23597    if (json.has("basis")) {
23598      JsonArray array = json.getAsJsonArray("basis");
23599      for (int i = 0; i < array.size(); i++) {
23600        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
23601      }
23602    };
23603    if (json.has("prediction")) {
23604      JsonArray array = json.getAsJsonArray("prediction");
23605      for (int i = 0; i < array.size(); i++) {
23606        res.getPrediction().add(parseRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject()));
23607      }
23608    };
23609    if (json.has("mitigation"))
23610      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
23611    if (json.has("_mitigation"))
23612      parseElementProperties(json.getAsJsonObject("_mitigation"), res.getMitigationElement());
23613    if (json.has("note")) {
23614      JsonArray array = json.getAsJsonArray("note");
23615      for (int i = 0; i < array.size(); i++) {
23616        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23617      }
23618    };
23619  }
23620
23621  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentPredictionComponent(JsonObject json) throws IOException, FHIRFormatError {
23622    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
23623    parseRiskAssessmentPredictionComponentProperties(json, res);
23624    return res;
23625  }
23626
23627  protected void parseRiskAssessmentPredictionComponentProperties(JsonObject json, RiskAssessment.RiskAssessmentPredictionComponent res) throws IOException, FHIRFormatError {
23628    parseBackboneElementProperties(json, res);
23629    if (json.has("outcome"))
23630      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
23631    DataType probability = parseType("probability", json);
23632    if (probability != null)
23633      res.setProbability(probability);
23634    if (json.has("qualitativeRisk"))
23635      res.setQualitativeRisk(parseCodeableConcept(json.getAsJsonObject("qualitativeRisk")));
23636    if (json.has("relativeRisk"))
23637      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
23638    if (json.has("_relativeRisk"))
23639      parseElementProperties(json.getAsJsonObject("_relativeRisk"), res.getRelativeRiskElement());
23640    DataType when = parseType("when", json);
23641    if (when != null)
23642      res.setWhen(when);
23643    if (json.has("rationale"))
23644      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
23645    if (json.has("_rationale"))
23646      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
23647  }
23648
23649  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
23650    Schedule res = new Schedule();
23651    parseScheduleProperties(json, res);
23652    return res;
23653  }
23654
23655  protected void parseScheduleProperties(JsonObject json, Schedule res) throws IOException, FHIRFormatError {
23656    parseDomainResourceProperties(json, res);
23657    if (json.has("identifier")) {
23658      JsonArray array = json.getAsJsonArray("identifier");
23659      for (int i = 0; i < array.size(); i++) {
23660        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23661      }
23662    };
23663    if (json.has("active"))
23664      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
23665    if (json.has("_active"))
23666      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
23667    if (json.has("serviceCategory")) {
23668      JsonArray array = json.getAsJsonArray("serviceCategory");
23669      for (int i = 0; i < array.size(); i++) {
23670        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23671      }
23672    };
23673    if (json.has("serviceType")) {
23674      JsonArray array = json.getAsJsonArray("serviceType");
23675      for (int i = 0; i < array.size(); i++) {
23676        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23677      }
23678    };
23679    if (json.has("specialty")) {
23680      JsonArray array = json.getAsJsonArray("specialty");
23681      for (int i = 0; i < array.size(); i++) {
23682        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23683      }
23684    };
23685    if (json.has("actor")) {
23686      JsonArray array = json.getAsJsonArray("actor");
23687      for (int i = 0; i < array.size(); i++) {
23688        res.getActor().add(parseReference(array.get(i).getAsJsonObject()));
23689      }
23690    };
23691    if (json.has("planningHorizon"))
23692      res.setPlanningHorizon(parsePeriod(json.getAsJsonObject("planningHorizon")));
23693    if (json.has("comment"))
23694      res.setCommentElement(parseString(json.get("comment").getAsString()));
23695    if (json.has("_comment"))
23696      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
23697  }
23698
23699  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
23700    SearchParameter res = new SearchParameter();
23701    parseSearchParameterProperties(json, res);
23702    return res;
23703  }
23704
23705  protected void parseSearchParameterProperties(JsonObject json, SearchParameter res) throws IOException, FHIRFormatError {
23706    parseCanonicalResourceProperties(json, res);
23707    if (json.has("url"))
23708      res.setUrlElement(parseUri(json.get("url").getAsString()));
23709    if (json.has("_url"))
23710      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
23711    if (json.has("version"))
23712      res.setVersionElement(parseString(json.get("version").getAsString()));
23713    if (json.has("_version"))
23714      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
23715    if (json.has("name"))
23716      res.setNameElement(parseString(json.get("name").getAsString()));
23717    if (json.has("_name"))
23718      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23719    if (json.has("derivedFrom"))
23720      res.setDerivedFromElement(parseCanonical(json.get("derivedFrom").getAsString()));
23721    if (json.has("_derivedFrom"))
23722      parseElementProperties(json.getAsJsonObject("_derivedFrom"), res.getDerivedFromElement());
23723    if (json.has("status"))
23724      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
23725    if (json.has("_status"))
23726      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23727    if (json.has("experimental"))
23728      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23729    if (json.has("_experimental"))
23730      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
23731    if (json.has("date"))
23732      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23733    if (json.has("_date"))
23734      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
23735    if (json.has("publisher"))
23736      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23737    if (json.has("_publisher"))
23738      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
23739    if (json.has("contact")) {
23740      JsonArray array = json.getAsJsonArray("contact");
23741      for (int i = 0; i < array.size(); i++) {
23742        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23743      }
23744    };
23745    if (json.has("description"))
23746      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23747    if (json.has("_description"))
23748      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23749    if (json.has("useContext")) {
23750      JsonArray array = json.getAsJsonArray("useContext");
23751      for (int i = 0; i < array.size(); i++) {
23752        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23753      }
23754    };
23755    if (json.has("jurisdiction")) {
23756      JsonArray array = json.getAsJsonArray("jurisdiction");
23757      for (int i = 0; i < array.size(); i++) {
23758        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23759      }
23760    };
23761    if (json.has("purpose"))
23762      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23763    if (json.has("_purpose"))
23764      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
23765    if (json.has("code"))
23766      res.setCodeElement(parseCode(json.get("code").getAsString()));
23767    if (json.has("_code"))
23768      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
23769    if (json.has("base")) {
23770      JsonArray array = json.getAsJsonArray("base");
23771      for (int i = 0; i < array.size(); i++) {
23772        if (array.get(i).isJsonNull()) {
23773          res.getBase().add(new CodeType());
23774        } else {;
23775          res.getBase().add(parseCode(array.get(i).getAsString()));
23776        }
23777      }
23778    };
23779    if (json.has("_base")) {
23780      JsonArray array = json.getAsJsonArray("_base");
23781      for (int i = 0; i < array.size(); i++) {
23782        if (i == res.getBase().size())
23783          res.getBase().add(parseCode(null));
23784        if (array.get(i) instanceof JsonObject) 
23785          parseElementProperties(array.get(i).getAsJsonObject(), res.getBase().get(i));
23786      }
23787    };
23788    if (json.has("type"))
23789      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
23790    if (json.has("_type"))
23791      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
23792    if (json.has("expression"))
23793      res.setExpressionElement(parseString(json.get("expression").getAsString()));
23794    if (json.has("_expression"))
23795      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
23796    if (json.has("xpath"))
23797      res.setXpathElement(parseString(json.get("xpath").getAsString()));
23798    if (json.has("_xpath"))
23799      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
23800    if (json.has("xpathUsage"))
23801      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(), SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
23802    if (json.has("_xpathUsage"))
23803      parseElementProperties(json.getAsJsonObject("_xpathUsage"), res.getXpathUsageElement());
23804    if (json.has("target")) {
23805      JsonArray array = json.getAsJsonArray("target");
23806      for (int i = 0; i < array.size(); i++) {
23807        if (array.get(i).isJsonNull()) {
23808          res.getTarget().add(new CodeType());
23809        } else {;
23810          res.getTarget().add(parseCode(array.get(i).getAsString()));
23811        }
23812      }
23813    };
23814    if (json.has("_target")) {
23815      JsonArray array = json.getAsJsonArray("_target");
23816      for (int i = 0; i < array.size(); i++) {
23817        if (i == res.getTarget().size())
23818          res.getTarget().add(parseCode(null));
23819        if (array.get(i) instanceof JsonObject) 
23820          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
23821      }
23822    };
23823    if (json.has("multipleOr"))
23824      res.setMultipleOrElement(parseBoolean(json.get("multipleOr").getAsBoolean()));
23825    if (json.has("_multipleOr"))
23826      parseElementProperties(json.getAsJsonObject("_multipleOr"), res.getMultipleOrElement());
23827    if (json.has("multipleAnd"))
23828      res.setMultipleAndElement(parseBoolean(json.get("multipleAnd").getAsBoolean()));
23829    if (json.has("_multipleAnd"))
23830      parseElementProperties(json.getAsJsonObject("_multipleAnd"), res.getMultipleAndElement());
23831    if (json.has("comparator")) {
23832      JsonArray array = json.getAsJsonArray("comparator");
23833      for (int i = 0; i < array.size(); i++) {
23834        if (array.get(i).isJsonNull()) {
23835          res.getComparator().add(new Enumeration<SearchParameter.SearchComparator>(new SearchParameter.SearchComparatorEnumFactory(), SearchParameter.SearchComparator.NULL));
23836        } else {;
23837          res.getComparator().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
23838        }
23839      }
23840    };
23841    if (json.has("_comparator")) {
23842      JsonArray array = json.getAsJsonArray("_comparator");
23843      for (int i = 0; i < array.size(); i++) {
23844        if (i == res.getComparator().size())
23845          res.getComparator().add(parseEnumeration(null, SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
23846        if (array.get(i) instanceof JsonObject) 
23847          parseElementProperties(array.get(i).getAsJsonObject(), res.getComparator().get(i));
23848      }
23849    };
23850    if (json.has("modifier")) {
23851      JsonArray array = json.getAsJsonArray("modifier");
23852      for (int i = 0; i < array.size(); i++) {
23853        if (array.get(i).isJsonNull()) {
23854          res.getModifier().add(new Enumeration<SearchParameter.SearchModifierCode>(new SearchParameter.SearchModifierCodeEnumFactory(), SearchParameter.SearchModifierCode.NULL));
23855        } else {;
23856          res.getModifier().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
23857        }
23858      }
23859    };
23860    if (json.has("_modifier")) {
23861      JsonArray array = json.getAsJsonArray("_modifier");
23862      for (int i = 0; i < array.size(); i++) {
23863        if (i == res.getModifier().size())
23864          res.getModifier().add(parseEnumeration(null, SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
23865        if (array.get(i) instanceof JsonObject) 
23866          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
23867      }
23868    };
23869    if (json.has("chain")) {
23870      JsonArray array = json.getAsJsonArray("chain");
23871      for (int i = 0; i < array.size(); i++) {
23872        if (array.get(i).isJsonNull()) {
23873          res.getChain().add(new StringType());
23874        } else {;
23875          res.getChain().add(parseString(array.get(i).getAsString()));
23876        }
23877      }
23878    };
23879    if (json.has("_chain")) {
23880      JsonArray array = json.getAsJsonArray("_chain");
23881      for (int i = 0; i < array.size(); i++) {
23882        if (i == res.getChain().size())
23883          res.getChain().add(parseString(null));
23884        if (array.get(i) instanceof JsonObject) 
23885          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
23886      }
23887    };
23888    if (json.has("component")) {
23889      JsonArray array = json.getAsJsonArray("component");
23890      for (int i = 0; i < array.size(); i++) {
23891        res.getComponent().add(parseSearchParameterComponentComponent(array.get(i).getAsJsonObject()));
23892      }
23893    };
23894  }
23895
23896  protected SearchParameter.SearchParameterComponentComponent parseSearchParameterComponentComponent(JsonObject json) throws IOException, FHIRFormatError {
23897    SearchParameter.SearchParameterComponentComponent res = new SearchParameter.SearchParameterComponentComponent();
23898    parseSearchParameterComponentComponentProperties(json, res);
23899    return res;
23900  }
23901
23902  protected void parseSearchParameterComponentComponentProperties(JsonObject json, SearchParameter.SearchParameterComponentComponent res) throws IOException, FHIRFormatError {
23903    parseBackboneElementProperties(json, res);
23904    if (json.has("definition"))
23905      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
23906    if (json.has("_definition"))
23907      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
23908    if (json.has("expression"))
23909      res.setExpressionElement(parseString(json.get("expression").getAsString()));
23910    if (json.has("_expression"))
23911      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
23912  }
23913
23914  protected ServiceRequest parseServiceRequest(JsonObject json) throws IOException, FHIRFormatError {
23915    ServiceRequest res = new ServiceRequest();
23916    parseServiceRequestProperties(json, res);
23917    return res;
23918  }
23919
23920  protected void parseServiceRequestProperties(JsonObject json, ServiceRequest res) throws IOException, FHIRFormatError {
23921    parseDomainResourceProperties(json, res);
23922    if (json.has("identifier")) {
23923      JsonArray array = json.getAsJsonArray("identifier");
23924      for (int i = 0; i < array.size(); i++) {
23925        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23926      }
23927    };
23928    if (json.has("instantiatesCanonical")) {
23929      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
23930      for (int i = 0; i < array.size(); i++) {
23931        if (array.get(i).isJsonNull()) {
23932          res.getInstantiatesCanonical().add(new CanonicalType());
23933        } else {;
23934          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
23935        }
23936      }
23937    };
23938    if (json.has("_instantiatesCanonical")) {
23939      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
23940      for (int i = 0; i < array.size(); i++) {
23941        if (i == res.getInstantiatesCanonical().size())
23942          res.getInstantiatesCanonical().add(parseCanonical(null));
23943        if (array.get(i) instanceof JsonObject) 
23944          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
23945      }
23946    };
23947    if (json.has("instantiatesUri")) {
23948      JsonArray array = json.getAsJsonArray("instantiatesUri");
23949      for (int i = 0; i < array.size(); i++) {
23950        if (array.get(i).isJsonNull()) {
23951          res.getInstantiatesUri().add(new UriType());
23952        } else {;
23953          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
23954        }
23955      }
23956    };
23957    if (json.has("_instantiatesUri")) {
23958      JsonArray array = json.getAsJsonArray("_instantiatesUri");
23959      for (int i = 0; i < array.size(); i++) {
23960        if (i == res.getInstantiatesUri().size())
23961          res.getInstantiatesUri().add(parseUri(null));
23962        if (array.get(i) instanceof JsonObject) 
23963          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
23964      }
23965    };
23966    if (json.has("basedOn")) {
23967      JsonArray array = json.getAsJsonArray("basedOn");
23968      for (int i = 0; i < array.size(); i++) {
23969        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
23970      }
23971    };
23972    if (json.has("replaces")) {
23973      JsonArray array = json.getAsJsonArray("replaces");
23974      for (int i = 0; i < array.size(); i++) {
23975        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
23976      }
23977    };
23978    if (json.has("requisition"))
23979      res.setRequisition(parseIdentifier(json.getAsJsonObject("requisition")));
23980    if (json.has("status"))
23981      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
23982    if (json.has("_status"))
23983      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23984    if (json.has("intent"))
23985      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
23986    if (json.has("_intent"))
23987      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
23988    if (json.has("category")) {
23989      JsonArray array = json.getAsJsonArray("category");
23990      for (int i = 0; i < array.size(); i++) {
23991        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23992      }
23993    };
23994    if (json.has("priority"))
23995      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
23996    if (json.has("_priority"))
23997      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
23998    if (json.has("doNotPerform"))
23999      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
24000    if (json.has("_doNotPerform"))
24001      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
24002    if (json.has("code"))
24003      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
24004    if (json.has("orderDetail")) {
24005      JsonArray array = json.getAsJsonArray("orderDetail");
24006      for (int i = 0; i < array.size(); i++) {
24007        res.getOrderDetail().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24008      }
24009    };
24010    DataType quantity = parseType("quantity", json);
24011    if (quantity != null)
24012      res.setQuantity(quantity);
24013    if (json.has("subject"))
24014      res.setSubject(parseReference(json.getAsJsonObject("subject")));
24015    if (json.has("encounter"))
24016      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
24017    DataType occurrence = parseType("occurrence", json);
24018    if (occurrence != null)
24019      res.setOccurrence(occurrence);
24020    DataType asNeeded = parseType("asNeeded", json);
24021    if (asNeeded != null)
24022      res.setAsNeeded(asNeeded);
24023    if (json.has("authoredOn"))
24024      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
24025    if (json.has("_authoredOn"))
24026      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
24027    if (json.has("requester"))
24028      res.setRequester(parseReference(json.getAsJsonObject("requester")));
24029    if (json.has("performerType"))
24030      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
24031    if (json.has("performer")) {
24032      JsonArray array = json.getAsJsonArray("performer");
24033      for (int i = 0; i < array.size(); i++) {
24034        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
24035      }
24036    };
24037    if (json.has("location")) {
24038      JsonArray array = json.getAsJsonArray("location");
24039      for (int i = 0; i < array.size(); i++) {
24040        res.getLocation().add(parseCodeableReference(array.get(i).getAsJsonObject()));
24041      }
24042    };
24043    if (json.has("reason")) {
24044      JsonArray array = json.getAsJsonArray("reason");
24045      for (int i = 0; i < array.size(); i++) {
24046        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
24047      }
24048    };
24049    if (json.has("insurance")) {
24050      JsonArray array = json.getAsJsonArray("insurance");
24051      for (int i = 0; i < array.size(); i++) {
24052        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
24053      }
24054    };
24055    if (json.has("supportingInfo")) {
24056      JsonArray array = json.getAsJsonArray("supportingInfo");
24057      for (int i = 0; i < array.size(); i++) {
24058        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
24059      }
24060    };
24061    if (json.has("specimen")) {
24062      JsonArray array = json.getAsJsonArray("specimen");
24063      for (int i = 0; i < array.size(); i++) {
24064        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
24065      }
24066    };
24067    if (json.has("bodySite")) {
24068      JsonArray array = json.getAsJsonArray("bodySite");
24069      for (int i = 0; i < array.size(); i++) {
24070        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24071      }
24072    };
24073    if (json.has("note")) {
24074      JsonArray array = json.getAsJsonArray("note");
24075      for (int i = 0; i < array.size(); i++) {
24076        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
24077      }
24078    };
24079    if (json.has("patientInstruction"))
24080      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
24081    if (json.has("_patientInstruction"))
24082      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
24083    if (json.has("relevantHistory")) {
24084      JsonArray array = json.getAsJsonArray("relevantHistory");
24085      for (int i = 0; i < array.size(); i++) {
24086        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
24087      }
24088    };
24089  }
24090
24091  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
24092    Slot res = new Slot();
24093    parseSlotProperties(json, res);
24094    return res;
24095  }
24096
24097  protected void parseSlotProperties(JsonObject json, Slot res) throws IOException, FHIRFormatError {
24098    parseDomainResourceProperties(json, res);
24099    if (json.has("identifier")) {
24100      JsonArray array = json.getAsJsonArray("identifier");
24101      for (int i = 0; i < array.size(); i++) {
24102        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24103      }
24104    };
24105    if (json.has("serviceCategory")) {
24106      JsonArray array = json.getAsJsonArray("serviceCategory");
24107      for (int i = 0; i < array.size(); i++) {
24108        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24109      }
24110    };
24111    if (json.has("serviceType")) {
24112      JsonArray array = json.getAsJsonArray("serviceType");
24113      for (int i = 0; i < array.size(); i++) {
24114        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24115      }
24116    };
24117    if (json.has("specialty")) {
24118      JsonArray array = json.getAsJsonArray("specialty");
24119      for (int i = 0; i < array.size(); i++) {
24120        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24121      }
24122    };
24123    if (json.has("appointmentType"))
24124      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
24125    if (json.has("schedule"))
24126      res.setSchedule(parseReference(json.getAsJsonObject("schedule")));
24127    if (json.has("status"))
24128      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
24129    if (json.has("_status"))
24130      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24131    if (json.has("start"))
24132      res.setStartElement(parseInstant(json.get("start").getAsString()));
24133    if (json.has("_start"))
24134      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
24135    if (json.has("end"))
24136      res.setEndElement(parseInstant(json.get("end").getAsString()));
24137    if (json.has("_end"))
24138      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
24139    if (json.has("overbooked"))
24140      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
24141    if (json.has("_overbooked"))
24142      parseElementProperties(json.getAsJsonObject("_overbooked"), res.getOverbookedElement());
24143    if (json.has("comment"))
24144      res.setCommentElement(parseString(json.get("comment").getAsString()));
24145    if (json.has("_comment"))
24146      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
24147  }
24148
24149  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
24150    Specimen res = new Specimen();
24151    parseSpecimenProperties(json, res);
24152    return res;
24153  }
24154
24155  protected void parseSpecimenProperties(JsonObject json, Specimen res) throws IOException, FHIRFormatError {
24156    parseDomainResourceProperties(json, res);
24157    if (json.has("identifier")) {
24158      JsonArray array = json.getAsJsonArray("identifier");
24159      for (int i = 0; i < array.size(); i++) {
24160        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24161      }
24162    };
24163    if (json.has("accessionIdentifier"))
24164      res.setAccessionIdentifier(parseIdentifier(json.getAsJsonObject("accessionIdentifier")));
24165    if (json.has("status"))
24166      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
24167    if (json.has("_status"))
24168      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24169    if (json.has("type"))
24170      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24171    if (json.has("subject"))
24172      res.setSubject(parseReference(json.getAsJsonObject("subject")));
24173    if (json.has("receivedTime"))
24174      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
24175    if (json.has("_receivedTime"))
24176      parseElementProperties(json.getAsJsonObject("_receivedTime"), res.getReceivedTimeElement());
24177    if (json.has("parent")) {
24178      JsonArray array = json.getAsJsonArray("parent");
24179      for (int i = 0; i < array.size(); i++) {
24180        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
24181      }
24182    };
24183    if (json.has("request")) {
24184      JsonArray array = json.getAsJsonArray("request");
24185      for (int i = 0; i < array.size(); i++) {
24186        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
24187      }
24188    };
24189    if (json.has("collection"))
24190      res.setCollection(parseSpecimenCollectionComponent(json.getAsJsonObject("collection")));
24191    if (json.has("processing")) {
24192      JsonArray array = json.getAsJsonArray("processing");
24193      for (int i = 0; i < array.size(); i++) {
24194        res.getProcessing().add(parseSpecimenProcessingComponent(array.get(i).getAsJsonObject()));
24195      }
24196    };
24197    if (json.has("container")) {
24198      JsonArray array = json.getAsJsonArray("container");
24199      for (int i = 0; i < array.size(); i++) {
24200        res.getContainer().add(parseSpecimenContainerComponent(array.get(i).getAsJsonObject()));
24201      }
24202    };
24203    if (json.has("condition")) {
24204      JsonArray array = json.getAsJsonArray("condition");
24205      for (int i = 0; i < array.size(); i++) {
24206        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24207      }
24208    };
24209    if (json.has("note")) {
24210      JsonArray array = json.getAsJsonArray("note");
24211      for (int i = 0; i < array.size(); i++) {
24212        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
24213      }
24214    };
24215  }
24216
24217  protected Specimen.SpecimenCollectionComponent parseSpecimenCollectionComponent(JsonObject json) throws IOException, FHIRFormatError {
24218    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
24219    parseSpecimenCollectionComponentProperties(json, res);
24220    return res;
24221  }
24222
24223  protected void parseSpecimenCollectionComponentProperties(JsonObject json, Specimen.SpecimenCollectionComponent res) throws IOException, FHIRFormatError {
24224    parseBackboneElementProperties(json, res);
24225    if (json.has("collector"))
24226      res.setCollector(parseReference(json.getAsJsonObject("collector")));
24227    DataType collected = parseType("collected", json);
24228    if (collected != null)
24229      res.setCollected(collected);
24230    if (json.has("duration"))
24231      res.setDuration(parseDuration(json.getAsJsonObject("duration")));
24232    if (json.has("quantity"))
24233      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
24234    if (json.has("method"))
24235      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
24236    if (json.has("bodySite"))
24237      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
24238    DataType fastingStatus = parseType("fastingStatus", json);
24239    if (fastingStatus != null)
24240      res.setFastingStatus(fastingStatus);
24241  }
24242
24243  protected Specimen.SpecimenProcessingComponent parseSpecimenProcessingComponent(JsonObject json) throws IOException, FHIRFormatError {
24244    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
24245    parseSpecimenProcessingComponentProperties(json, res);
24246    return res;
24247  }
24248
24249  protected void parseSpecimenProcessingComponentProperties(JsonObject json, Specimen.SpecimenProcessingComponent res) throws IOException, FHIRFormatError {
24250    parseBackboneElementProperties(json, res);
24251    if (json.has("description"))
24252      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24253    if (json.has("_description"))
24254      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24255    if (json.has("procedure"))
24256      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
24257    if (json.has("additive")) {
24258      JsonArray array = json.getAsJsonArray("additive");
24259      for (int i = 0; i < array.size(); i++) {
24260        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
24261      }
24262    };
24263    DataType time = parseType("time", json);
24264    if (time != null)
24265      res.setTime(time);
24266  }
24267
24268  protected Specimen.SpecimenContainerComponent parseSpecimenContainerComponent(JsonObject json) throws IOException, FHIRFormatError {
24269    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
24270    parseSpecimenContainerComponentProperties(json, res);
24271    return res;
24272  }
24273
24274  protected void parseSpecimenContainerComponentProperties(JsonObject json, Specimen.SpecimenContainerComponent res) throws IOException, FHIRFormatError {
24275    parseBackboneElementProperties(json, res);
24276    if (json.has("identifier")) {
24277      JsonArray array = json.getAsJsonArray("identifier");
24278      for (int i = 0; i < array.size(); i++) {
24279        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24280      }
24281    };
24282    if (json.has("description"))
24283      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24284    if (json.has("_description"))
24285      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24286    if (json.has("type"))
24287      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24288    if (json.has("capacity"))
24289      res.setCapacity(parseQuantity(json.getAsJsonObject("capacity")));
24290    if (json.has("specimenQuantity"))
24291      res.setSpecimenQuantity(parseQuantity(json.getAsJsonObject("specimenQuantity")));
24292    DataType additive = parseType("additive", json);
24293    if (additive != null)
24294      res.setAdditive(additive);
24295  }
24296
24297  protected SpecimenDefinition parseSpecimenDefinition(JsonObject json) throws IOException, FHIRFormatError {
24298    SpecimenDefinition res = new SpecimenDefinition();
24299    parseSpecimenDefinitionProperties(json, res);
24300    return res;
24301  }
24302
24303  protected void parseSpecimenDefinitionProperties(JsonObject json, SpecimenDefinition res) throws IOException, FHIRFormatError {
24304    parseDomainResourceProperties(json, res);
24305    if (json.has("url"))
24306      res.setUrlElement(parseUri(json.get("url").getAsString()));
24307    if (json.has("_url"))
24308      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
24309    if (json.has("identifier"))
24310      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24311    if (json.has("version"))
24312      res.setVersionElement(parseString(json.get("version").getAsString()));
24313    if (json.has("_version"))
24314      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
24315    if (json.has("title"))
24316      res.setTitleElement(parseString(json.get("title").getAsString()));
24317    if (json.has("_title"))
24318      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
24319    if (json.has("derivedFromCanonical")) {
24320      JsonArray array = json.getAsJsonArray("derivedFromCanonical");
24321      for (int i = 0; i < array.size(); i++) {
24322        if (array.get(i).isJsonNull()) {
24323          res.getDerivedFromCanonical().add(new CanonicalType());
24324        } else {;
24325          res.getDerivedFromCanonical().add(parseCanonical(array.get(i).getAsString()));
24326        }
24327      }
24328    };
24329    if (json.has("_derivedFromCanonical")) {
24330      JsonArray array = json.getAsJsonArray("_derivedFromCanonical");
24331      for (int i = 0; i < array.size(); i++) {
24332        if (i == res.getDerivedFromCanonical().size())
24333          res.getDerivedFromCanonical().add(parseCanonical(null));
24334        if (array.get(i) instanceof JsonObject) 
24335          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromCanonical().get(i));
24336      }
24337    };
24338    if (json.has("derivedFromUri")) {
24339      JsonArray array = json.getAsJsonArray("derivedFromUri");
24340      for (int i = 0; i < array.size(); i++) {
24341        if (array.get(i).isJsonNull()) {
24342          res.getDerivedFromUri().add(new UriType());
24343        } else {;
24344          res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
24345        }
24346      }
24347    };
24348    if (json.has("_derivedFromUri")) {
24349      JsonArray array = json.getAsJsonArray("_derivedFromUri");
24350      for (int i = 0; i < array.size(); i++) {
24351        if (i == res.getDerivedFromUri().size())
24352          res.getDerivedFromUri().add(parseUri(null));
24353        if (array.get(i) instanceof JsonObject) 
24354          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
24355      }
24356    };
24357    if (json.has("status"))
24358      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
24359    if (json.has("_status"))
24360      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24361    if (json.has("experimental"))
24362      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
24363    if (json.has("_experimental"))
24364      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
24365    DataType subject = parseType("subject", json);
24366    if (subject != null)
24367      res.setSubject(subject);
24368    if (json.has("date"))
24369      res.setDateElement(parseDateTime(json.get("date").getAsString()));
24370    if (json.has("_date"))
24371      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
24372    if (json.has("publisher"))
24373      res.setPublisher(parseReference(json.getAsJsonObject("publisher")));
24374    if (json.has("contact")) {
24375      JsonArray array = json.getAsJsonArray("contact");
24376      for (int i = 0; i < array.size(); i++) {
24377        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
24378      }
24379    };
24380    if (json.has("description"))
24381      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
24382    if (json.has("_description"))
24383      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24384    if (json.has("useContext")) {
24385      JsonArray array = json.getAsJsonArray("useContext");
24386      for (int i = 0; i < array.size(); i++) {
24387        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
24388      }
24389    };
24390    if (json.has("jurisdiction")) {
24391      JsonArray array = json.getAsJsonArray("jurisdiction");
24392      for (int i = 0; i < array.size(); i++) {
24393        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24394      }
24395    };
24396    if (json.has("purpose"))
24397      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
24398    if (json.has("_purpose"))
24399      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
24400    if (json.has("copyright"))
24401      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
24402    if (json.has("_copyright"))
24403      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
24404    if (json.has("approvalDate"))
24405      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
24406    if (json.has("_approvalDate"))
24407      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
24408    if (json.has("lastReviewDate"))
24409      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
24410    if (json.has("_lastReviewDate"))
24411      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
24412    if (json.has("effectivePeriod"))
24413      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
24414    if (json.has("typeCollected"))
24415      res.setTypeCollected(parseCodeableConcept(json.getAsJsonObject("typeCollected")));
24416    if (json.has("patientPreparation")) {
24417      JsonArray array = json.getAsJsonArray("patientPreparation");
24418      for (int i = 0; i < array.size(); i++) {
24419        res.getPatientPreparation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24420      }
24421    };
24422    if (json.has("timeAspect"))
24423      res.setTimeAspectElement(parseString(json.get("timeAspect").getAsString()));
24424    if (json.has("_timeAspect"))
24425      parseElementProperties(json.getAsJsonObject("_timeAspect"), res.getTimeAspectElement());
24426    if (json.has("collection")) {
24427      JsonArray array = json.getAsJsonArray("collection");
24428      for (int i = 0; i < array.size(); i++) {
24429        res.getCollection().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24430      }
24431    };
24432    if (json.has("typeTested")) {
24433      JsonArray array = json.getAsJsonArray("typeTested");
24434      for (int i = 0; i < array.size(); i++) {
24435        res.getTypeTested().add(parseSpecimenDefinitionTypeTestedComponent(array.get(i).getAsJsonObject()));
24436      }
24437    };
24438  }
24439
24440  protected SpecimenDefinition.SpecimenDefinitionTypeTestedComponent parseSpecimenDefinitionTypeTestedComponent(JsonObject json) throws IOException, FHIRFormatError {
24441    SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedComponent();
24442    parseSpecimenDefinitionTypeTestedComponentProperties(json, res);
24443    return res;
24444  }
24445
24446  protected void parseSpecimenDefinitionTypeTestedComponentProperties(JsonObject json, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res) throws IOException, FHIRFormatError {
24447    parseBackboneElementProperties(json, res);
24448    if (json.has("isDerived"))
24449      res.setIsDerivedElement(parseBoolean(json.get("isDerived").getAsBoolean()));
24450    if (json.has("_isDerived"))
24451      parseElementProperties(json.getAsJsonObject("_isDerived"), res.getIsDerivedElement());
24452    if (json.has("type"))
24453      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24454    if (json.has("preference"))
24455      res.setPreferenceElement(parseEnumeration(json.get("preference").getAsString(), SpecimenDefinition.SpecimenContainedPreference.NULL, new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory()));
24456    if (json.has("_preference"))
24457      parseElementProperties(json.getAsJsonObject("_preference"), res.getPreferenceElement());
24458    if (json.has("container"))
24459      res.setContainer(parseSpecimenDefinitionTypeTestedContainerComponent(json.getAsJsonObject("container")));
24460    if (json.has("requirement"))
24461      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
24462    if (json.has("_requirement"))
24463      parseElementProperties(json.getAsJsonObject("_requirement"), res.getRequirementElement());
24464    if (json.has("retentionTime"))
24465      res.setRetentionTime(parseDuration(json.getAsJsonObject("retentionTime")));
24466    if (json.has("singleUse"))
24467      res.setSingleUseElement(parseBoolean(json.get("singleUse").getAsBoolean()));
24468    if (json.has("_singleUse"))
24469      parseElementProperties(json.getAsJsonObject("_singleUse"), res.getSingleUseElement());
24470    if (json.has("rejectionCriterion")) {
24471      JsonArray array = json.getAsJsonArray("rejectionCriterion");
24472      for (int i = 0; i < array.size(); i++) {
24473        res.getRejectionCriterion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24474      }
24475    };
24476    if (json.has("handling")) {
24477      JsonArray array = json.getAsJsonArray("handling");
24478      for (int i = 0; i < array.size(); i++) {
24479        res.getHandling().add(parseSpecimenDefinitionTypeTestedHandlingComponent(array.get(i).getAsJsonObject()));
24480      }
24481    };
24482    if (json.has("testingDestination")) {
24483      JsonArray array = json.getAsJsonArray("testingDestination");
24484      for (int i = 0; i < array.size(); i++) {
24485        res.getTestingDestination().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24486      }
24487    };
24488  }
24489
24490  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent parseSpecimenDefinitionTypeTestedContainerComponent(JsonObject json) throws IOException, FHIRFormatError {
24491    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent();
24492    parseSpecimenDefinitionTypeTestedContainerComponentProperties(json, res);
24493    return res;
24494  }
24495
24496  protected void parseSpecimenDefinitionTypeTestedContainerComponentProperties(JsonObject json, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res) throws IOException, FHIRFormatError {
24497    parseBackboneElementProperties(json, res);
24498    if (json.has("material"))
24499      res.setMaterial(parseCodeableConcept(json.getAsJsonObject("material")));
24500    if (json.has("type"))
24501      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24502    if (json.has("cap"))
24503      res.setCap(parseCodeableConcept(json.getAsJsonObject("cap")));
24504    if (json.has("description"))
24505      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24506    if (json.has("_description"))
24507      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24508    if (json.has("capacity"))
24509      res.setCapacity(parseQuantity(json.getAsJsonObject("capacity")));
24510    DataType minimumVolume = parseType("minimumVolume", json);
24511    if (minimumVolume != null)
24512      res.setMinimumVolume(minimumVolume);
24513    if (json.has("additive")) {
24514      JsonArray array = json.getAsJsonArray("additive");
24515      for (int i = 0; i < array.size(); i++) {
24516        res.getAdditive().add(parseSpecimenDefinitionTypeTestedContainerAdditiveComponent(array.get(i).getAsJsonObject()));
24517      }
24518    };
24519    if (json.has("preparation"))
24520      res.setPreparationElement(parseString(json.get("preparation").getAsString()));
24521    if (json.has("_preparation"))
24522      parseElementProperties(json.getAsJsonObject("_preparation"), res.getPreparationElement());
24523  }
24524
24525  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent parseSpecimenDefinitionTypeTestedContainerAdditiveComponent(JsonObject json) throws IOException, FHIRFormatError {
24526    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent();
24527    parseSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(json, res);
24528    return res;
24529  }
24530
24531  protected void parseSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(JsonObject json, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res) throws IOException, FHIRFormatError {
24532    parseBackboneElementProperties(json, res);
24533    DataType additive = parseType("additive", json);
24534    if (additive != null)
24535      res.setAdditive(additive);
24536  }
24537
24538  protected SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent parseSpecimenDefinitionTypeTestedHandlingComponent(JsonObject json) throws IOException, FHIRFormatError {
24539    SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent();
24540    parseSpecimenDefinitionTypeTestedHandlingComponentProperties(json, res);
24541    return res;
24542  }
24543
24544  protected void parseSpecimenDefinitionTypeTestedHandlingComponentProperties(JsonObject json, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res) throws IOException, FHIRFormatError {
24545    parseBackboneElementProperties(json, res);
24546    if (json.has("temperatureQualifier"))
24547      res.setTemperatureQualifier(parseCodeableConcept(json.getAsJsonObject("temperatureQualifier")));
24548    if (json.has("temperatureRange"))
24549      res.setTemperatureRange(parseRange(json.getAsJsonObject("temperatureRange")));
24550    if (json.has("maxDuration"))
24551      res.setMaxDuration(parseDuration(json.getAsJsonObject("maxDuration")));
24552    if (json.has("instruction"))
24553      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
24554    if (json.has("_instruction"))
24555      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
24556  }
24557
24558  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
24559    StructureDefinition res = new StructureDefinition();
24560    parseStructureDefinitionProperties(json, res);
24561    return res;
24562  }
24563
24564  protected void parseStructureDefinitionProperties(JsonObject json, StructureDefinition res) throws IOException, FHIRFormatError {
24565    parseCanonicalResourceProperties(json, res);
24566    if (json.has("url"))
24567      res.setUrlElement(parseUri(json.get("url").getAsString()));
24568    if (json.has("_url"))
24569      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
24570    if (json.has("identifier")) {
24571      JsonArray array = json.getAsJsonArray("identifier");
24572      for (int i = 0; i < array.size(); i++) {
24573        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24574      }
24575    };
24576    if (json.has("version"))
24577      res.setVersionElement(parseString(json.get("version").getAsString()));
24578    if (json.has("_version"))
24579      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
24580    if (json.has("name"))
24581      res.setNameElement(parseString(json.get("name").getAsString()));
24582    if (json.has("_name"))
24583      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24584    if (json.has("title"))
24585      res.setTitleElement(parseString(json.get("title").getAsString()));
24586    if (json.has("_title"))
24587      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
24588    if (json.has("status"))
24589      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
24590    if (json.has("_status"))
24591      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24592    if (json.has("experimental"))
24593      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
24594    if (json.has("_experimental"))
24595      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
24596    if (json.has("date"))
24597      res.setDateElement(parseDateTime(json.get("date").getAsString()));
24598    if (json.has("_date"))
24599      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
24600    if (json.has("publisher"))
24601      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
24602    if (json.has("_publisher"))
24603      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
24604    if (json.has("contact")) {
24605      JsonArray array = json.getAsJsonArray("contact");
24606      for (int i = 0; i < array.size(); i++) {
24607        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
24608      }
24609    };
24610    if (json.has("description"))
24611      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
24612    if (json.has("_description"))
24613      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24614    if (json.has("useContext")) {
24615      JsonArray array = json.getAsJsonArray("useContext");
24616      for (int i = 0; i < array.size(); i++) {
24617        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
24618      }
24619    };
24620    if (json.has("jurisdiction")) {
24621      JsonArray array = json.getAsJsonArray("jurisdiction");
24622      for (int i = 0; i < array.size(); i++) {
24623        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24624      }
24625    };
24626    if (json.has("purpose"))
24627      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
24628    if (json.has("_purpose"))
24629      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
24630    if (json.has("copyright"))
24631      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
24632    if (json.has("_copyright"))
24633      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
24634    if (json.has("keyword")) {
24635      JsonArray array = json.getAsJsonArray("keyword");
24636      for (int i = 0; i < array.size(); i++) {
24637        res.getKeyword().add(parseCoding(array.get(i).getAsJsonObject()));
24638      }
24639    };
24640    if (json.has("fhirVersion"))
24641      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
24642    if (json.has("_fhirVersion"))
24643      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
24644    if (json.has("mapping")) {
24645      JsonArray array = json.getAsJsonArray("mapping");
24646      for (int i = 0; i < array.size(); i++) {
24647        res.getMapping().add(parseStructureDefinitionMappingComponent(array.get(i).getAsJsonObject()));
24648      }
24649    };
24650    if (json.has("kind"))
24651      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
24652    if (json.has("_kind"))
24653      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
24654    if (json.has("abstract"))
24655      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
24656    if (json.has("_abstract"))
24657      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
24658    if (json.has("context")) {
24659      JsonArray array = json.getAsJsonArray("context");
24660      for (int i = 0; i < array.size(); i++) {
24661        res.getContext().add(parseStructureDefinitionContextComponent(array.get(i).getAsJsonObject()));
24662      }
24663    };
24664    if (json.has("contextInvariant")) {
24665      JsonArray array = json.getAsJsonArray("contextInvariant");
24666      for (int i = 0; i < array.size(); i++) {
24667        if (array.get(i).isJsonNull()) {
24668          res.getContextInvariant().add(new StringType());
24669        } else {;
24670          res.getContextInvariant().add(parseString(array.get(i).getAsString()));
24671        }
24672      }
24673    };
24674    if (json.has("_contextInvariant")) {
24675      JsonArray array = json.getAsJsonArray("_contextInvariant");
24676      for (int i = 0; i < array.size(); i++) {
24677        if (i == res.getContextInvariant().size())
24678          res.getContextInvariant().add(parseString(null));
24679        if (array.get(i) instanceof JsonObject) 
24680          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextInvariant().get(i));
24681      }
24682    };
24683    if (json.has("type"))
24684      res.setTypeElement(parseUri(json.get("type").getAsString()));
24685    if (json.has("_type"))
24686      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
24687    if (json.has("baseDefinition"))
24688      res.setBaseDefinitionElement(parseCanonical(json.get("baseDefinition").getAsString()));
24689    if (json.has("_baseDefinition"))
24690      parseElementProperties(json.getAsJsonObject("_baseDefinition"), res.getBaseDefinitionElement());
24691    if (json.has("derivation"))
24692      res.setDerivationElement(parseEnumeration(json.get("derivation").getAsString(), StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
24693    if (json.has("_derivation"))
24694      parseElementProperties(json.getAsJsonObject("_derivation"), res.getDerivationElement());
24695    if (json.has("snapshot"))
24696      res.setSnapshot(parseStructureDefinitionSnapshotComponent(json.getAsJsonObject("snapshot")));
24697    if (json.has("differential"))
24698      res.setDifferential(parseStructureDefinitionDifferentialComponent(json.getAsJsonObject("differential")));
24699  }
24700
24701  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionMappingComponent(JsonObject json) throws IOException, FHIRFormatError {
24702    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
24703    parseStructureDefinitionMappingComponentProperties(json, res);
24704    return res;
24705  }
24706
24707  protected void parseStructureDefinitionMappingComponentProperties(JsonObject json, StructureDefinition.StructureDefinitionMappingComponent res) throws IOException, FHIRFormatError {
24708    parseBackboneElementProperties(json, res);
24709    if (json.has("identity"))
24710      res.setIdentityElement(parseId(json.get("identity").getAsString()));
24711    if (json.has("_identity"))
24712      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
24713    if (json.has("uri"))
24714      res.setUriElement(parseUri(json.get("uri").getAsString()));
24715    if (json.has("_uri"))
24716      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
24717    if (json.has("name"))
24718      res.setNameElement(parseString(json.get("name").getAsString()));
24719    if (json.has("_name"))
24720      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24721    if (json.has("comment"))
24722      res.setCommentElement(parseString(json.get("comment").getAsString()));
24723    if (json.has("_comment"))
24724      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
24725  }
24726
24727  protected StructureDefinition.StructureDefinitionContextComponent parseStructureDefinitionContextComponent(JsonObject json) throws IOException, FHIRFormatError {
24728    StructureDefinition.StructureDefinitionContextComponent res = new StructureDefinition.StructureDefinitionContextComponent();
24729    parseStructureDefinitionContextComponentProperties(json, res);
24730    return res;
24731  }
24732
24733  protected void parseStructureDefinitionContextComponentProperties(JsonObject json, StructureDefinition.StructureDefinitionContextComponent res) throws IOException, FHIRFormatError {
24734    parseBackboneElementProperties(json, res);
24735    if (json.has("type"))
24736      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), StructureDefinition.ExtensionContextType.NULL, new StructureDefinition.ExtensionContextTypeEnumFactory()));
24737    if (json.has("_type"))
24738      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
24739    if (json.has("expression"))
24740      res.setExpressionElement(parseString(json.get("expression").getAsString()));
24741    if (json.has("_expression"))
24742      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
24743  }
24744
24745  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionSnapshotComponent(JsonObject json) throws IOException, FHIRFormatError {
24746    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
24747    parseStructureDefinitionSnapshotComponentProperties(json, res);
24748    return res;
24749  }
24750
24751  protected void parseStructureDefinitionSnapshotComponentProperties(JsonObject json, StructureDefinition.StructureDefinitionSnapshotComponent res) throws IOException, FHIRFormatError {
24752    parseBackboneElementProperties(json, res);
24753    if (json.has("element")) {
24754      JsonArray array = json.getAsJsonArray("element");
24755      for (int i = 0; i < array.size(); i++) {
24756        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
24757      }
24758    };
24759  }
24760
24761  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionDifferentialComponent(JsonObject json) throws IOException, FHIRFormatError {
24762    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
24763    parseStructureDefinitionDifferentialComponentProperties(json, res);
24764    return res;
24765  }
24766
24767  protected void parseStructureDefinitionDifferentialComponentProperties(JsonObject json, StructureDefinition.StructureDefinitionDifferentialComponent res) throws IOException, FHIRFormatError {
24768    parseBackboneElementProperties(json, res);
24769    if (json.has("element")) {
24770      JsonArray array = json.getAsJsonArray("element");
24771      for (int i = 0; i < array.size(); i++) {
24772        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
24773      }
24774    };
24775  }
24776
24777  protected StructureMap parseStructureMap(JsonObject json) throws IOException, FHIRFormatError {
24778    StructureMap res = new StructureMap();
24779    parseStructureMapProperties(json, res);
24780    return res;
24781  }
24782
24783  protected void parseStructureMapProperties(JsonObject json, StructureMap res) throws IOException, FHIRFormatError {
24784    parseCanonicalResourceProperties(json, res);
24785    if (json.has("url"))
24786      res.setUrlElement(parseUri(json.get("url").getAsString()));
24787    if (json.has("_url"))
24788      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
24789    if (json.has("identifier")) {
24790      JsonArray array = json.getAsJsonArray("identifier");
24791      for (int i = 0; i < array.size(); i++) {
24792        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24793      }
24794    };
24795    if (json.has("version"))
24796      res.setVersionElement(parseString(json.get("version").getAsString()));
24797    if (json.has("_version"))
24798      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
24799    if (json.has("name"))
24800      res.setNameElement(parseString(json.get("name").getAsString()));
24801    if (json.has("_name"))
24802      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24803    if (json.has("title"))
24804      res.setTitleElement(parseString(json.get("title").getAsString()));
24805    if (json.has("_title"))
24806      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
24807    if (json.has("status"))
24808      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
24809    if (json.has("_status"))
24810      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24811    if (json.has("experimental"))
24812      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
24813    if (json.has("_experimental"))
24814      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
24815    if (json.has("date"))
24816      res.setDateElement(parseDateTime(json.get("date").getAsString()));
24817    if (json.has("_date"))
24818      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
24819    if (json.has("publisher"))
24820      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
24821    if (json.has("_publisher"))
24822      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
24823    if (json.has("contact")) {
24824      JsonArray array = json.getAsJsonArray("contact");
24825      for (int i = 0; i < array.size(); i++) {
24826        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
24827      }
24828    };
24829    if (json.has("description"))
24830      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
24831    if (json.has("_description"))
24832      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24833    if (json.has("useContext")) {
24834      JsonArray array = json.getAsJsonArray("useContext");
24835      for (int i = 0; i < array.size(); i++) {
24836        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
24837      }
24838    };
24839    if (json.has("jurisdiction")) {
24840      JsonArray array = json.getAsJsonArray("jurisdiction");
24841      for (int i = 0; i < array.size(); i++) {
24842        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24843      }
24844    };
24845    if (json.has("purpose"))
24846      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
24847    if (json.has("_purpose"))
24848      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
24849    if (json.has("copyright"))
24850      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
24851    if (json.has("_copyright"))
24852      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
24853    if (json.has("structure")) {
24854      JsonArray array = json.getAsJsonArray("structure");
24855      for (int i = 0; i < array.size(); i++) {
24856        res.getStructure().add(parseStructureMapStructureComponent(array.get(i).getAsJsonObject()));
24857      }
24858    };
24859    if (json.has("import")) {
24860      JsonArray array = json.getAsJsonArray("import");
24861      for (int i = 0; i < array.size(); i++) {
24862        if (array.get(i).isJsonNull()) {
24863          res.getImport().add(new CanonicalType());
24864        } else {;
24865          res.getImport().add(parseCanonical(array.get(i).getAsString()));
24866        }
24867      }
24868    };
24869    if (json.has("_import")) {
24870      JsonArray array = json.getAsJsonArray("_import");
24871      for (int i = 0; i < array.size(); i++) {
24872        if (i == res.getImport().size())
24873          res.getImport().add(parseCanonical(null));
24874        if (array.get(i) instanceof JsonObject) 
24875          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
24876      }
24877    };
24878    if (json.has("group")) {
24879      JsonArray array = json.getAsJsonArray("group");
24880      for (int i = 0; i < array.size(); i++) {
24881        res.getGroup().add(parseStructureMapGroupComponent(array.get(i).getAsJsonObject()));
24882      }
24883    };
24884  }
24885
24886  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureComponent(JsonObject json) throws IOException, FHIRFormatError {
24887    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
24888    parseStructureMapStructureComponentProperties(json, res);
24889    return res;
24890  }
24891
24892  protected void parseStructureMapStructureComponentProperties(JsonObject json, StructureMap.StructureMapStructureComponent res) throws IOException, FHIRFormatError {
24893    parseBackboneElementProperties(json, res);
24894    if (json.has("url"))
24895      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
24896    if (json.has("_url"))
24897      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
24898    if (json.has("mode"))
24899      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapModelMode.NULL, new StructureMap.StructureMapModelModeEnumFactory()));
24900    if (json.has("_mode"))
24901      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
24902    if (json.has("alias"))
24903      res.setAliasElement(parseString(json.get("alias").getAsString()));
24904    if (json.has("_alias"))
24905      parseElementProperties(json.getAsJsonObject("_alias"), res.getAliasElement());
24906    if (json.has("documentation"))
24907      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
24908    if (json.has("_documentation"))
24909      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
24910  }
24911
24912  protected StructureMap.StructureMapGroupComponent parseStructureMapGroupComponent(JsonObject json) throws IOException, FHIRFormatError {
24913    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
24914    parseStructureMapGroupComponentProperties(json, res);
24915    return res;
24916  }
24917
24918  protected void parseStructureMapGroupComponentProperties(JsonObject json, StructureMap.StructureMapGroupComponent res) throws IOException, FHIRFormatError {
24919    parseBackboneElementProperties(json, res);
24920    if (json.has("name"))
24921      res.setNameElement(parseId(json.get("name").getAsString()));
24922    if (json.has("_name"))
24923      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24924    if (json.has("extends"))
24925      res.setExtendsElement(parseId(json.get("extends").getAsString()));
24926    if (json.has("_extends"))
24927      parseElementProperties(json.getAsJsonObject("_extends"), res.getExtendsElement());
24928    if (json.has("typeMode"))
24929      res.setTypeModeElement(parseEnumeration(json.get("typeMode").getAsString(), StructureMap.StructureMapGroupTypeMode.NULL, new StructureMap.StructureMapGroupTypeModeEnumFactory()));
24930    if (json.has("_typeMode"))
24931      parseElementProperties(json.getAsJsonObject("_typeMode"), res.getTypeModeElement());
24932    if (json.has("documentation"))
24933      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
24934    if (json.has("_documentation"))
24935      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
24936    if (json.has("input")) {
24937      JsonArray array = json.getAsJsonArray("input");
24938      for (int i = 0; i < array.size(); i++) {
24939        res.getInput().add(parseStructureMapGroupInputComponent(array.get(i).getAsJsonObject()));
24940      }
24941    };
24942    if (json.has("rule")) {
24943      JsonArray array = json.getAsJsonArray("rule");
24944      for (int i = 0; i < array.size(); i++) {
24945        res.getRule().add(parseStructureMapGroupRuleComponent(array.get(i).getAsJsonObject()));
24946      }
24947    };
24948  }
24949
24950  protected StructureMap.StructureMapGroupInputComponent parseStructureMapGroupInputComponent(JsonObject json) throws IOException, FHIRFormatError {
24951    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
24952    parseStructureMapGroupInputComponentProperties(json, res);
24953    return res;
24954  }
24955
24956  protected void parseStructureMapGroupInputComponentProperties(JsonObject json, StructureMap.StructureMapGroupInputComponent res) throws IOException, FHIRFormatError {
24957    parseBackboneElementProperties(json, res);
24958    if (json.has("name"))
24959      res.setNameElement(parseId(json.get("name").getAsString()));
24960    if (json.has("_name"))
24961      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24962    if (json.has("type"))
24963      res.setTypeElement(parseString(json.get("type").getAsString()));
24964    if (json.has("_type"))
24965      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
24966    if (json.has("mode"))
24967      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapInputMode.NULL, new StructureMap.StructureMapInputModeEnumFactory()));
24968    if (json.has("_mode"))
24969      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
24970    if (json.has("documentation"))
24971      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
24972    if (json.has("_documentation"))
24973      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
24974  }
24975
24976  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapGroupRuleComponent(JsonObject json) throws IOException, FHIRFormatError {
24977    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
24978    parseStructureMapGroupRuleComponentProperties(json, res);
24979    return res;
24980  }
24981
24982  protected void parseStructureMapGroupRuleComponentProperties(JsonObject json, StructureMap.StructureMapGroupRuleComponent res) throws IOException, FHIRFormatError {
24983    parseBackboneElementProperties(json, res);
24984    if (json.has("name"))
24985      res.setNameElement(parseId(json.get("name").getAsString()));
24986    if (json.has("_name"))
24987      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24988    if (json.has("source")) {
24989      JsonArray array = json.getAsJsonArray("source");
24990      for (int i = 0; i < array.size(); i++) {
24991        res.getSource().add(parseStructureMapGroupRuleSourceComponent(array.get(i).getAsJsonObject()));
24992      }
24993    };
24994    if (json.has("target")) {
24995      JsonArray array = json.getAsJsonArray("target");
24996      for (int i = 0; i < array.size(); i++) {
24997        res.getTarget().add(parseStructureMapGroupRuleTargetComponent(array.get(i).getAsJsonObject()));
24998      }
24999    };
25000    if (json.has("rule")) {
25001      JsonArray array = json.getAsJsonArray("rule");
25002      for (int i = 0; i < array.size(); i++) {
25003        res.getRule().add(parseStructureMapGroupRuleComponent(array.get(i).getAsJsonObject()));
25004      }
25005    };
25006    if (json.has("dependent")) {
25007      JsonArray array = json.getAsJsonArray("dependent");
25008      for (int i = 0; i < array.size(); i++) {
25009        res.getDependent().add(parseStructureMapGroupRuleDependentComponent(array.get(i).getAsJsonObject()));
25010      }
25011    };
25012    if (json.has("documentation"))
25013      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
25014    if (json.has("_documentation"))
25015      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
25016  }
25017
25018  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapGroupRuleSourceComponent(JsonObject json) throws IOException, FHIRFormatError {
25019    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
25020    parseStructureMapGroupRuleSourceComponentProperties(json, res);
25021    return res;
25022  }
25023
25024  protected void parseStructureMapGroupRuleSourceComponentProperties(JsonObject json, StructureMap.StructureMapGroupRuleSourceComponent res) throws IOException, FHIRFormatError {
25025    parseBackboneElementProperties(json, res);
25026    if (json.has("context"))
25027      res.setContextElement(parseId(json.get("context").getAsString()));
25028    if (json.has("_context"))
25029      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
25030    if (json.has("min"))
25031      res.setMinElement(parseInteger(json.get("min").getAsLong()));
25032    if (json.has("_min"))
25033      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
25034    if (json.has("max"))
25035      res.setMaxElement(parseString(json.get("max").getAsString()));
25036    if (json.has("_max"))
25037      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
25038    if (json.has("type"))
25039      res.setTypeElement(parseString(json.get("type").getAsString()));
25040    if (json.has("_type"))
25041      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
25042    DataType defaultValue = parseType("defaultValue", json);
25043    if (defaultValue != null)
25044      res.setDefaultValue(defaultValue);
25045    if (json.has("element"))
25046      res.setElementElement(parseString(json.get("element").getAsString()));
25047    if (json.has("_element"))
25048      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
25049    if (json.has("listMode"))
25050      res.setListModeElement(parseEnumeration(json.get("listMode").getAsString(), StructureMap.StructureMapSourceListMode.NULL, new StructureMap.StructureMapSourceListModeEnumFactory()));
25051    if (json.has("_listMode"))
25052      parseElementProperties(json.getAsJsonObject("_listMode"), res.getListModeElement());
25053    if (json.has("variable"))
25054      res.setVariableElement(parseId(json.get("variable").getAsString()));
25055    if (json.has("_variable"))
25056      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
25057    if (json.has("condition"))
25058      res.setConditionElement(parseString(json.get("condition").getAsString()));
25059    if (json.has("_condition"))
25060      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
25061    if (json.has("check"))
25062      res.setCheckElement(parseString(json.get("check").getAsString()));
25063    if (json.has("_check"))
25064      parseElementProperties(json.getAsJsonObject("_check"), res.getCheckElement());
25065    if (json.has("logMessage"))
25066      res.setLogMessageElement(parseString(json.get("logMessage").getAsString()));
25067    if (json.has("_logMessage"))
25068      parseElementProperties(json.getAsJsonObject("_logMessage"), res.getLogMessageElement());
25069  }
25070
25071  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapGroupRuleTargetComponent(JsonObject json) throws IOException, FHIRFormatError {
25072    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
25073    parseStructureMapGroupRuleTargetComponentProperties(json, res);
25074    return res;
25075  }
25076
25077  protected void parseStructureMapGroupRuleTargetComponentProperties(JsonObject json, StructureMap.StructureMapGroupRuleTargetComponent res) throws IOException, FHIRFormatError {
25078    parseBackboneElementProperties(json, res);
25079    if (json.has("context"))
25080      res.setContextElement(parseId(json.get("context").getAsString()));
25081    if (json.has("_context"))
25082      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
25083    if (json.has("contextType"))
25084      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
25085    if (json.has("_contextType"))
25086      parseElementProperties(json.getAsJsonObject("_contextType"), res.getContextTypeElement());
25087    if (json.has("element"))
25088      res.setElementElement(parseString(json.get("element").getAsString()));
25089    if (json.has("_element"))
25090      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
25091    if (json.has("variable"))
25092      res.setVariableElement(parseId(json.get("variable").getAsString()));
25093    if (json.has("_variable"))
25094      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
25095    if (json.has("listMode")) {
25096      JsonArray array = json.getAsJsonArray("listMode");
25097      for (int i = 0; i < array.size(); i++) {
25098        if (array.get(i).isJsonNull()) {
25099          res.getListMode().add(new Enumeration<StructureMap.StructureMapTargetListMode>(new StructureMap.StructureMapTargetListModeEnumFactory(), StructureMap.StructureMapTargetListMode.NULL));
25100        } else {;
25101          res.getListMode().add(parseEnumeration(array.get(i).getAsString(), StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
25102        }
25103      }
25104    };
25105    if (json.has("_listMode")) {
25106      JsonArray array = json.getAsJsonArray("_listMode");
25107      for (int i = 0; i < array.size(); i++) {
25108        if (i == res.getListMode().size())
25109          res.getListMode().add(parseEnumeration(null, StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
25110        if (array.get(i) instanceof JsonObject) 
25111          parseElementProperties(array.get(i).getAsJsonObject(), res.getListMode().get(i));
25112      }
25113    };
25114    if (json.has("listRuleId"))
25115      res.setListRuleIdElement(parseId(json.get("listRuleId").getAsString()));
25116    if (json.has("_listRuleId"))
25117      parseElementProperties(json.getAsJsonObject("_listRuleId"), res.getListRuleIdElement());
25118    if (json.has("transform"))
25119      res.setTransformElement(parseEnumeration(json.get("transform").getAsString(), StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
25120    if (json.has("_transform"))
25121      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
25122    if (json.has("parameter")) {
25123      JsonArray array = json.getAsJsonArray("parameter");
25124      for (int i = 0; i < array.size(); i++) {
25125        res.getParameter().add(parseStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject()));
25126      }
25127    };
25128  }
25129
25130  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapGroupRuleTargetParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
25131    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
25132    parseStructureMapGroupRuleTargetParameterComponentProperties(json, res);
25133    return res;
25134  }
25135
25136  protected void parseStructureMapGroupRuleTargetParameterComponentProperties(JsonObject json, StructureMap.StructureMapGroupRuleTargetParameterComponent res) throws IOException, FHIRFormatError {
25137    parseBackboneElementProperties(json, res);
25138    DataType value = parseType("value", json);
25139    if (value != null)
25140      res.setValue(value);
25141  }
25142
25143  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapGroupRuleDependentComponent(JsonObject json) throws IOException, FHIRFormatError {
25144    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
25145    parseStructureMapGroupRuleDependentComponentProperties(json, res);
25146    return res;
25147  }
25148
25149  protected void parseStructureMapGroupRuleDependentComponentProperties(JsonObject json, StructureMap.StructureMapGroupRuleDependentComponent res) throws IOException, FHIRFormatError {
25150    parseBackboneElementProperties(json, res);
25151    if (json.has("name"))
25152      res.setNameElement(parseId(json.get("name").getAsString()));
25153    if (json.has("_name"))
25154      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25155    if (json.has("variable")) {
25156      JsonArray array = json.getAsJsonArray("variable");
25157      for (int i = 0; i < array.size(); i++) {
25158        if (array.get(i).isJsonNull()) {
25159          res.getVariable().add(new StringType());
25160        } else {;
25161          res.getVariable().add(parseString(array.get(i).getAsString()));
25162        }
25163      }
25164    };
25165    if (json.has("_variable")) {
25166      JsonArray array = json.getAsJsonArray("_variable");
25167      for (int i = 0; i < array.size(); i++) {
25168        if (i == res.getVariable().size())
25169          res.getVariable().add(parseString(null));
25170        if (array.get(i) instanceof JsonObject) 
25171          parseElementProperties(array.get(i).getAsJsonObject(), res.getVariable().get(i));
25172      }
25173    };
25174  }
25175
25176  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
25177    Subscription res = new Subscription();
25178    parseSubscriptionProperties(json, res);
25179    return res;
25180  }
25181
25182  protected void parseSubscriptionProperties(JsonObject json, Subscription res) throws IOException, FHIRFormatError {
25183    parseDomainResourceProperties(json, res);
25184    if (json.has("identifier")) {
25185      JsonArray array = json.getAsJsonArray("identifier");
25186      for (int i = 0; i < array.size(); i++) {
25187        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25188      }
25189    };
25190    if (json.has("name"))
25191      res.setNameElement(parseString(json.get("name").getAsString()));
25192    if (json.has("_name"))
25193      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25194    if (json.has("status"))
25195      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Subscription.SubscriptionStatus.NULL, new Subscription.SubscriptionStatusEnumFactory()));
25196    if (json.has("_status"))
25197      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25198    if (json.has("topic"))
25199      res.setTopic(parseReference(json.getAsJsonObject("topic")));
25200    if (json.has("contact")) {
25201      JsonArray array = json.getAsJsonArray("contact");
25202      for (int i = 0; i < array.size(); i++) {
25203        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
25204      }
25205    };
25206    if (json.has("end"))
25207      res.setEndElement(parseInstant(json.get("end").getAsString()));
25208    if (json.has("_end"))
25209      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
25210    if (json.has("reason"))
25211      res.setReasonElement(parseString(json.get("reason").getAsString()));
25212    if (json.has("_reason"))
25213      parseElementProperties(json.getAsJsonObject("_reason"), res.getReasonElement());
25214    if (json.has("filterBy")) {
25215      JsonArray array = json.getAsJsonArray("filterBy");
25216      for (int i = 0; i < array.size(); i++) {
25217        res.getFilterBy().add(parseSubscriptionFilterByComponent(array.get(i).getAsJsonObject()));
25218      }
25219    };
25220    if (json.has("error")) {
25221      JsonArray array = json.getAsJsonArray("error");
25222      for (int i = 0; i < array.size(); i++) {
25223        res.getError().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25224      }
25225    };
25226    if (json.has("eventCount"))
25227      res.setEventCountElement(parseUnsignedInt(json.get("eventCount").getAsString()));
25228    if (json.has("_eventCount"))
25229      parseElementProperties(json.getAsJsonObject("_eventCount"), res.getEventCountElement());
25230    if (json.has("channel"))
25231      res.setChannel(parseSubscriptionChannelComponent(json.getAsJsonObject("channel")));
25232  }
25233
25234  protected Subscription.SubscriptionFilterByComponent parseSubscriptionFilterByComponent(JsonObject json) throws IOException, FHIRFormatError {
25235    Subscription.SubscriptionFilterByComponent res = new Subscription.SubscriptionFilterByComponent();
25236    parseSubscriptionFilterByComponentProperties(json, res);
25237    return res;
25238  }
25239
25240  protected void parseSubscriptionFilterByComponentProperties(JsonObject json, Subscription.SubscriptionFilterByComponent res) throws IOException, FHIRFormatError {
25241    parseBackboneElementProperties(json, res);
25242    if (json.has("name"))
25243      res.setNameElement(parseString(json.get("name").getAsString()));
25244    if (json.has("_name"))
25245      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25246    if (json.has("matchType"))
25247      res.setMatchTypeElement(parseEnumeration(json.get("matchType").getAsString(), Subscription.SubscriptionFilterByMatchType.NULL, new Subscription.SubscriptionFilterByMatchTypeEnumFactory()));
25248    if (json.has("_matchType"))
25249      parseElementProperties(json.getAsJsonObject("_matchType"), res.getMatchTypeElement());
25250    if (json.has("value"))
25251      res.setValueElement(parseString(json.get("value").getAsString()));
25252    if (json.has("_value"))
25253      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
25254  }
25255
25256  protected Subscription.SubscriptionChannelComponent parseSubscriptionChannelComponent(JsonObject json) throws IOException, FHIRFormatError {
25257    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
25258    parseSubscriptionChannelComponentProperties(json, res);
25259    return res;
25260  }
25261
25262  protected void parseSubscriptionChannelComponentProperties(JsonObject json, Subscription.SubscriptionChannelComponent res) throws IOException, FHIRFormatError {
25263    parseBackboneElementProperties(json, res);
25264    if (json.has("type"))
25265      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25266    if (json.has("endpoint"))
25267      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
25268    if (json.has("_endpoint"))
25269      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
25270    if (json.has("header")) {
25271      JsonArray array = json.getAsJsonArray("header");
25272      for (int i = 0; i < array.size(); i++) {
25273        if (array.get(i).isJsonNull()) {
25274          res.getHeader().add(new StringType());
25275        } else {;
25276          res.getHeader().add(parseString(array.get(i).getAsString()));
25277        }
25278      }
25279    };
25280    if (json.has("_header")) {
25281      JsonArray array = json.getAsJsonArray("_header");
25282      for (int i = 0; i < array.size(); i++) {
25283        if (i == res.getHeader().size())
25284          res.getHeader().add(parseString(null));
25285        if (array.get(i) instanceof JsonObject) 
25286          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
25287      }
25288    };
25289    if (json.has("heartbeatPeriod"))
25290      res.setHeartbeatPeriodElement(parseUnsignedInt(json.get("heartbeatPeriod").getAsString()));
25291    if (json.has("_heartbeatPeriod"))
25292      parseElementProperties(json.getAsJsonObject("_heartbeatPeriod"), res.getHeartbeatPeriodElement());
25293    if (json.has("payload"))
25294      res.setPayload(parseSubscriptionChannelPayloadComponent(json.getAsJsonObject("payload")));
25295  }
25296
25297  protected Subscription.SubscriptionChannelPayloadComponent parseSubscriptionChannelPayloadComponent(JsonObject json) throws IOException, FHIRFormatError {
25298    Subscription.SubscriptionChannelPayloadComponent res = new Subscription.SubscriptionChannelPayloadComponent();
25299    parseSubscriptionChannelPayloadComponentProperties(json, res);
25300    return res;
25301  }
25302
25303  protected void parseSubscriptionChannelPayloadComponentProperties(JsonObject json, Subscription.SubscriptionChannelPayloadComponent res) throws IOException, FHIRFormatError {
25304    parseBackboneElementProperties(json, res);
25305    if (json.has("contentType"))
25306      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
25307    if (json.has("_contentType"))
25308      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
25309    if (json.has("content"))
25310      res.setContentElement(parseEnumeration(json.get("content").getAsString(), Subscription.SubscriptionPayloadContent.NULL, new Subscription.SubscriptionPayloadContentEnumFactory()));
25311    if (json.has("_content"))
25312      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
25313  }
25314
25315  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
25316    Substance res = new Substance();
25317    parseSubstanceProperties(json, res);
25318    return res;
25319  }
25320
25321  protected void parseSubstanceProperties(JsonObject json, Substance res) throws IOException, FHIRFormatError {
25322    parseDomainResourceProperties(json, res);
25323    if (json.has("identifier")) {
25324      JsonArray array = json.getAsJsonArray("identifier");
25325      for (int i = 0; i < array.size(); i++) {
25326        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25327      }
25328    };
25329    if (json.has("status"))
25330      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Substance.FHIRSubstanceStatus.NULL, new Substance.FHIRSubstanceStatusEnumFactory()));
25331    if (json.has("_status"))
25332      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25333    if (json.has("category")) {
25334      JsonArray array = json.getAsJsonArray("category");
25335      for (int i = 0; i < array.size(); i++) {
25336        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25337      }
25338    };
25339    if (json.has("code"))
25340      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
25341    if (json.has("description"))
25342      res.setDescriptionElement(parseString(json.get("description").getAsString()));
25343    if (json.has("_description"))
25344      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
25345    if (json.has("instance")) {
25346      JsonArray array = json.getAsJsonArray("instance");
25347      for (int i = 0; i < array.size(); i++) {
25348        res.getInstance().add(parseSubstanceInstanceComponent(array.get(i).getAsJsonObject()));
25349      }
25350    };
25351    if (json.has("ingredient")) {
25352      JsonArray array = json.getAsJsonArray("ingredient");
25353      for (int i = 0; i < array.size(); i++) {
25354        res.getIngredient().add(parseSubstanceIngredientComponent(array.get(i).getAsJsonObject()));
25355      }
25356    };
25357  }
25358
25359  protected Substance.SubstanceInstanceComponent parseSubstanceInstanceComponent(JsonObject json) throws IOException, FHIRFormatError {
25360    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
25361    parseSubstanceInstanceComponentProperties(json, res);
25362    return res;
25363  }
25364
25365  protected void parseSubstanceInstanceComponentProperties(JsonObject json, Substance.SubstanceInstanceComponent res) throws IOException, FHIRFormatError {
25366    parseBackboneElementProperties(json, res);
25367    if (json.has("identifier"))
25368      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
25369    if (json.has("expiry"))
25370      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
25371    if (json.has("_expiry"))
25372      parseElementProperties(json.getAsJsonObject("_expiry"), res.getExpiryElement());
25373    if (json.has("quantity"))
25374      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
25375  }
25376
25377  protected Substance.SubstanceIngredientComponent parseSubstanceIngredientComponent(JsonObject json) throws IOException, FHIRFormatError {
25378    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
25379    parseSubstanceIngredientComponentProperties(json, res);
25380    return res;
25381  }
25382
25383  protected void parseSubstanceIngredientComponentProperties(JsonObject json, Substance.SubstanceIngredientComponent res) throws IOException, FHIRFormatError {
25384    parseBackboneElementProperties(json, res);
25385    if (json.has("quantity"))
25386      res.setQuantity(parseRatio(json.getAsJsonObject("quantity")));
25387    DataType substance = parseType("substance", json);
25388    if (substance != null)
25389      res.setSubstance(substance);
25390  }
25391
25392  protected SubstanceDefinition parseSubstanceDefinition(JsonObject json) throws IOException, FHIRFormatError {
25393    SubstanceDefinition res = new SubstanceDefinition();
25394    parseSubstanceDefinitionProperties(json, res);
25395    return res;
25396  }
25397
25398  protected void parseSubstanceDefinitionProperties(JsonObject json, SubstanceDefinition res) throws IOException, FHIRFormatError {
25399    parseDomainResourceProperties(json, res);
25400    if (json.has("identifier"))
25401      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
25402    if (json.has("version"))
25403      res.setVersionElement(parseString(json.get("version").getAsString()));
25404    if (json.has("_version"))
25405      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
25406    if (json.has("status"))
25407      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
25408    if (json.has("category"))
25409      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
25410    if (json.has("domain"))
25411      res.setDomain(parseCodeableConcept(json.getAsJsonObject("domain")));
25412    if (json.has("description"))
25413      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25414    if (json.has("_description"))
25415      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
25416    if (json.has("source")) {
25417      JsonArray array = json.getAsJsonArray("source");
25418      for (int i = 0; i < array.size(); i++) {
25419        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25420      }
25421    };
25422    if (json.has("note")) {
25423      JsonArray array = json.getAsJsonArray("note");
25424      for (int i = 0; i < array.size(); i++) {
25425        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
25426      }
25427    };
25428    if (json.has("manufacturer")) {
25429      JsonArray array = json.getAsJsonArray("manufacturer");
25430      for (int i = 0; i < array.size(); i++) {
25431        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
25432      }
25433    };
25434    if (json.has("supplier")) {
25435      JsonArray array = json.getAsJsonArray("supplier");
25436      for (int i = 0; i < array.size(); i++) {
25437        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
25438      }
25439    };
25440    if (json.has("moiety")) {
25441      JsonArray array = json.getAsJsonArray("moiety");
25442      for (int i = 0; i < array.size(); i++) {
25443        res.getMoiety().add(parseSubstanceDefinitionMoietyComponent(array.get(i).getAsJsonObject()));
25444      }
25445    };
25446    if (json.has("property")) {
25447      JsonArray array = json.getAsJsonArray("property");
25448      for (int i = 0; i < array.size(); i++) {
25449        res.getProperty().add(parseSubstanceDefinitionPropertyComponent(array.get(i).getAsJsonObject()));
25450      }
25451    };
25452    if (json.has("referenceInformation"))
25453      res.setReferenceInformation(parseReference(json.getAsJsonObject("referenceInformation")));
25454    if (json.has("structure"))
25455      res.setStructure(parseSubstanceDefinitionStructureComponent(json.getAsJsonObject("structure")));
25456    if (json.has("code")) {
25457      JsonArray array = json.getAsJsonArray("code");
25458      for (int i = 0; i < array.size(); i++) {
25459        res.getCode().add(parseSubstanceDefinitionCodeComponent(array.get(i).getAsJsonObject()));
25460      }
25461    };
25462    if (json.has("name")) {
25463      JsonArray array = json.getAsJsonArray("name");
25464      for (int i = 0; i < array.size(); i++) {
25465        res.getName().add(parseSubstanceDefinitionNameComponent(array.get(i).getAsJsonObject()));
25466      }
25467    };
25468    if (json.has("molecularWeight")) {
25469      JsonArray array = json.getAsJsonArray("molecularWeight");
25470      for (int i = 0; i < array.size(); i++) {
25471        res.getMolecularWeight().add(parseSubstanceDefinitionStructureIsotopeMolecularWeightComponent(array.get(i).getAsJsonObject()));
25472      }
25473    };
25474    if (json.has("relationship")) {
25475      JsonArray array = json.getAsJsonArray("relationship");
25476      for (int i = 0; i < array.size(); i++) {
25477        res.getRelationship().add(parseSubstanceDefinitionRelationshipComponent(array.get(i).getAsJsonObject()));
25478      }
25479    };
25480    if (json.has("nucleicAcid"))
25481      res.setNucleicAcid(parseReference(json.getAsJsonObject("nucleicAcid")));
25482    if (json.has("polymer"))
25483      res.setPolymer(parseReference(json.getAsJsonObject("polymer")));
25484    if (json.has("protein"))
25485      res.setProtein(parseReference(json.getAsJsonObject("protein")));
25486    if (json.has("sourceMaterial"))
25487      res.setSourceMaterial(parseReference(json.getAsJsonObject("sourceMaterial")));
25488  }
25489
25490  protected SubstanceDefinition.SubstanceDefinitionMoietyComponent parseSubstanceDefinitionMoietyComponent(JsonObject json) throws IOException, FHIRFormatError {
25491    SubstanceDefinition.SubstanceDefinitionMoietyComponent res = new SubstanceDefinition.SubstanceDefinitionMoietyComponent();
25492    parseSubstanceDefinitionMoietyComponentProperties(json, res);
25493    return res;
25494  }
25495
25496  protected void parseSubstanceDefinitionMoietyComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionMoietyComponent res) throws IOException, FHIRFormatError {
25497    parseBackboneElementProperties(json, res);
25498    if (json.has("role"))
25499      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
25500    if (json.has("identifier"))
25501      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
25502    if (json.has("name"))
25503      res.setNameElement(parseString(json.get("name").getAsString()));
25504    if (json.has("_name"))
25505      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25506    if (json.has("stereochemistry"))
25507      res.setStereochemistry(parseCodeableConcept(json.getAsJsonObject("stereochemistry")));
25508    if (json.has("opticalActivity"))
25509      res.setOpticalActivity(parseCodeableConcept(json.getAsJsonObject("opticalActivity")));
25510    if (json.has("molecularFormula"))
25511      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
25512    if (json.has("_molecularFormula"))
25513      parseElementProperties(json.getAsJsonObject("_molecularFormula"), res.getMolecularFormulaElement());
25514    DataType amount = parseType("amount", json);
25515    if (amount != null)
25516      res.setAmount(amount);
25517    if (json.has("amountType"))
25518      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
25519  }
25520
25521  protected SubstanceDefinition.SubstanceDefinitionPropertyComponent parseSubstanceDefinitionPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
25522    SubstanceDefinition.SubstanceDefinitionPropertyComponent res = new SubstanceDefinition.SubstanceDefinitionPropertyComponent();
25523    parseSubstanceDefinitionPropertyComponentProperties(json, res);
25524    return res;
25525  }
25526
25527  protected void parseSubstanceDefinitionPropertyComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
25528    parseBackboneElementProperties(json, res);
25529    if (json.has("category"))
25530      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
25531    if (json.has("code"))
25532      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
25533    if (json.has("parameters"))
25534      res.setParametersElement(parseString(json.get("parameters").getAsString()));
25535    if (json.has("_parameters"))
25536      parseElementProperties(json.getAsJsonObject("_parameters"), res.getParametersElement());
25537    DataType definingSubstance = parseType("definingSubstance", json);
25538    if (definingSubstance != null)
25539      res.setDefiningSubstance(definingSubstance);
25540    DataType amount = parseType("amount", json);
25541    if (amount != null)
25542      res.setAmount(amount);
25543    if (json.has("referenceRange"))
25544      res.setReferenceRange(parseRange(json.getAsJsonObject("referenceRange")));
25545    if (json.has("source")) {
25546      JsonArray array = json.getAsJsonArray("source");
25547      for (int i = 0; i < array.size(); i++) {
25548        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25549      }
25550    };
25551  }
25552
25553  protected SubstanceDefinition.SubstanceDefinitionStructureComponent parseSubstanceDefinitionStructureComponent(JsonObject json) throws IOException, FHIRFormatError {
25554    SubstanceDefinition.SubstanceDefinitionStructureComponent res = new SubstanceDefinition.SubstanceDefinitionStructureComponent();
25555    parseSubstanceDefinitionStructureComponentProperties(json, res);
25556    return res;
25557  }
25558
25559  protected void parseSubstanceDefinitionStructureComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionStructureComponent res) throws IOException, FHIRFormatError {
25560    parseBackboneElementProperties(json, res);
25561    if (json.has("stereochemistry"))
25562      res.setStereochemistry(parseCodeableConcept(json.getAsJsonObject("stereochemistry")));
25563    if (json.has("opticalActivity"))
25564      res.setOpticalActivity(parseCodeableConcept(json.getAsJsonObject("opticalActivity")));
25565    if (json.has("molecularFormula"))
25566      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
25567    if (json.has("_molecularFormula"))
25568      parseElementProperties(json.getAsJsonObject("_molecularFormula"), res.getMolecularFormulaElement());
25569    if (json.has("molecularFormulaByMoiety"))
25570      res.setMolecularFormulaByMoietyElement(parseString(json.get("molecularFormulaByMoiety").getAsString()));
25571    if (json.has("_molecularFormulaByMoiety"))
25572      parseElementProperties(json.getAsJsonObject("_molecularFormulaByMoiety"), res.getMolecularFormulaByMoietyElement());
25573    if (json.has("isotope")) {
25574      JsonArray array = json.getAsJsonArray("isotope");
25575      for (int i = 0; i < array.size(); i++) {
25576        res.getIsotope().add(parseSubstanceDefinitionStructureIsotopeComponent(array.get(i).getAsJsonObject()));
25577      }
25578    };
25579    if (json.has("molecularWeight"))
25580      res.setMolecularWeight(parseSubstanceDefinitionStructureIsotopeMolecularWeightComponent(json.getAsJsonObject("molecularWeight")));
25581    if (json.has("sourceCoding")) {
25582      JsonArray array = json.getAsJsonArray("sourceCoding");
25583      for (int i = 0; i < array.size(); i++) {
25584        res.getSourceCoding().add(parseCoding(array.get(i).getAsJsonObject()));
25585      }
25586    };
25587    if (json.has("sourceDocument")) {
25588      JsonArray array = json.getAsJsonArray("sourceDocument");
25589      for (int i = 0; i < array.size(); i++) {
25590        res.getSourceDocument().add(parseReference(array.get(i).getAsJsonObject()));
25591      }
25592    };
25593    if (json.has("representation")) {
25594      JsonArray array = json.getAsJsonArray("representation");
25595      for (int i = 0; i < array.size(); i++) {
25596        res.getRepresentation().add(parseSubstanceDefinitionStructureRepresentationComponent(array.get(i).getAsJsonObject()));
25597      }
25598    };
25599  }
25600
25601  protected SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent parseSubstanceDefinitionStructureIsotopeComponent(JsonObject json) throws IOException, FHIRFormatError {
25602    SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent res = new SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent();
25603    parseSubstanceDefinitionStructureIsotopeComponentProperties(json, res);
25604    return res;
25605  }
25606
25607  protected void parseSubstanceDefinitionStructureIsotopeComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent res) throws IOException, FHIRFormatError {
25608    parseBackboneElementProperties(json, res);
25609    if (json.has("identifier"))
25610      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
25611    if (json.has("name"))
25612      res.setName(parseCodeableConcept(json.getAsJsonObject("name")));
25613    if (json.has("substitution"))
25614      res.setSubstitution(parseCodeableConcept(json.getAsJsonObject("substitution")));
25615    if (json.has("halfLife"))
25616      res.setHalfLife(parseQuantity(json.getAsJsonObject("halfLife")));
25617    if (json.has("molecularWeight"))
25618      res.setMolecularWeight(parseSubstanceDefinitionStructureIsotopeMolecularWeightComponent(json.getAsJsonObject("molecularWeight")));
25619  }
25620
25621  protected SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent parseSubstanceDefinitionStructureIsotopeMolecularWeightComponent(JsonObject json) throws IOException, FHIRFormatError {
25622    SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent res = new SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent();
25623    parseSubstanceDefinitionStructureIsotopeMolecularWeightComponentProperties(json, res);
25624    return res;
25625  }
25626
25627  protected void parseSubstanceDefinitionStructureIsotopeMolecularWeightComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent res) throws IOException, FHIRFormatError {
25628    parseBackboneElementProperties(json, res);
25629    if (json.has("method"))
25630      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
25631    if (json.has("type"))
25632      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25633    if (json.has("amount"))
25634      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
25635  }
25636
25637  protected SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent parseSubstanceDefinitionStructureRepresentationComponent(JsonObject json) throws IOException, FHIRFormatError {
25638    SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent res = new SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent();
25639    parseSubstanceDefinitionStructureRepresentationComponentProperties(json, res);
25640    return res;
25641  }
25642
25643  protected void parseSubstanceDefinitionStructureRepresentationComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent res) throws IOException, FHIRFormatError {
25644    parseBackboneElementProperties(json, res);
25645    if (json.has("type"))
25646      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25647    if (json.has("representation"))
25648      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
25649    if (json.has("_representation"))
25650      parseElementProperties(json.getAsJsonObject("_representation"), res.getRepresentationElement());
25651    if (json.has("attachment"))
25652      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
25653  }
25654
25655  protected SubstanceDefinition.SubstanceDefinitionCodeComponent parseSubstanceDefinitionCodeComponent(JsonObject json) throws IOException, FHIRFormatError {
25656    SubstanceDefinition.SubstanceDefinitionCodeComponent res = new SubstanceDefinition.SubstanceDefinitionCodeComponent();
25657    parseSubstanceDefinitionCodeComponentProperties(json, res);
25658    return res;
25659  }
25660
25661  protected void parseSubstanceDefinitionCodeComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionCodeComponent res) throws IOException, FHIRFormatError {
25662    parseBackboneElementProperties(json, res);
25663    if (json.has("code"))
25664      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
25665    if (json.has("status"))
25666      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
25667    if (json.has("statusDate"))
25668      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
25669    if (json.has("_statusDate"))
25670      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
25671    if (json.has("note")) {
25672      JsonArray array = json.getAsJsonArray("note");
25673      for (int i = 0; i < array.size(); i++) {
25674        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
25675      }
25676    };
25677    if (json.has("source")) {
25678      JsonArray array = json.getAsJsonArray("source");
25679      for (int i = 0; i < array.size(); i++) {
25680        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25681      }
25682    };
25683  }
25684
25685  protected SubstanceDefinition.SubstanceDefinitionNameComponent parseSubstanceDefinitionNameComponent(JsonObject json) throws IOException, FHIRFormatError {
25686    SubstanceDefinition.SubstanceDefinitionNameComponent res = new SubstanceDefinition.SubstanceDefinitionNameComponent();
25687    parseSubstanceDefinitionNameComponentProperties(json, res);
25688    return res;
25689  }
25690
25691  protected void parseSubstanceDefinitionNameComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionNameComponent res) throws IOException, FHIRFormatError {
25692    parseBackboneElementProperties(json, res);
25693    if (json.has("name"))
25694      res.setNameElement(parseString(json.get("name").getAsString()));
25695    if (json.has("_name"))
25696      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25697    if (json.has("type"))
25698      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25699    if (json.has("status"))
25700      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
25701    if (json.has("preferred"))
25702      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
25703    if (json.has("_preferred"))
25704      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
25705    if (json.has("language")) {
25706      JsonArray array = json.getAsJsonArray("language");
25707      for (int i = 0; i < array.size(); i++) {
25708        res.getLanguage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25709      }
25710    };
25711    if (json.has("domain")) {
25712      JsonArray array = json.getAsJsonArray("domain");
25713      for (int i = 0; i < array.size(); i++) {
25714        res.getDomain().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25715      }
25716    };
25717    if (json.has("jurisdiction")) {
25718      JsonArray array = json.getAsJsonArray("jurisdiction");
25719      for (int i = 0; i < array.size(); i++) {
25720        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25721      }
25722    };
25723    if (json.has("synonym")) {
25724      JsonArray array = json.getAsJsonArray("synonym");
25725      for (int i = 0; i < array.size(); i++) {
25726        res.getSynonym().add(parseSubstanceDefinitionNameComponent(array.get(i).getAsJsonObject()));
25727      }
25728    };
25729    if (json.has("translation")) {
25730      JsonArray array = json.getAsJsonArray("translation");
25731      for (int i = 0; i < array.size(); i++) {
25732        res.getTranslation().add(parseSubstanceDefinitionNameComponent(array.get(i).getAsJsonObject()));
25733      }
25734    };
25735    if (json.has("official")) {
25736      JsonArray array = json.getAsJsonArray("official");
25737      for (int i = 0; i < array.size(); i++) {
25738        res.getOfficial().add(parseSubstanceDefinitionNameOfficialComponent(array.get(i).getAsJsonObject()));
25739      }
25740    };
25741    if (json.has("source")) {
25742      JsonArray array = json.getAsJsonArray("source");
25743      for (int i = 0; i < array.size(); i++) {
25744        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25745      }
25746    };
25747  }
25748
25749  protected SubstanceDefinition.SubstanceDefinitionNameOfficialComponent parseSubstanceDefinitionNameOfficialComponent(JsonObject json) throws IOException, FHIRFormatError {
25750    SubstanceDefinition.SubstanceDefinitionNameOfficialComponent res = new SubstanceDefinition.SubstanceDefinitionNameOfficialComponent();
25751    parseSubstanceDefinitionNameOfficialComponentProperties(json, res);
25752    return res;
25753  }
25754
25755  protected void parseSubstanceDefinitionNameOfficialComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionNameOfficialComponent res) throws IOException, FHIRFormatError {
25756    parseBackboneElementProperties(json, res);
25757    if (json.has("authority"))
25758      res.setAuthority(parseCodeableConcept(json.getAsJsonObject("authority")));
25759    if (json.has("status"))
25760      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
25761    if (json.has("date"))
25762      res.setDateElement(parseDateTime(json.get("date").getAsString()));
25763    if (json.has("_date"))
25764      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
25765  }
25766
25767  protected SubstanceDefinition.SubstanceDefinitionRelationshipComponent parseSubstanceDefinitionRelationshipComponent(JsonObject json) throws IOException, FHIRFormatError {
25768    SubstanceDefinition.SubstanceDefinitionRelationshipComponent res = new SubstanceDefinition.SubstanceDefinitionRelationshipComponent();
25769    parseSubstanceDefinitionRelationshipComponentProperties(json, res);
25770    return res;
25771  }
25772
25773  protected void parseSubstanceDefinitionRelationshipComponentProperties(JsonObject json, SubstanceDefinition.SubstanceDefinitionRelationshipComponent res) throws IOException, FHIRFormatError {
25774    parseBackboneElementProperties(json, res);
25775    DataType substanceDefinition = parseType("substanceDefinition", json);
25776    if (substanceDefinition != null)
25777      res.setSubstanceDefinition(substanceDefinition);
25778    if (json.has("type"))
25779      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25780    if (json.has("isDefining"))
25781      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
25782    if (json.has("_isDefining"))
25783      parseElementProperties(json.getAsJsonObject("_isDefining"), res.getIsDefiningElement());
25784    DataType amount = parseType("amount", json);
25785    if (amount != null)
25786      res.setAmount(amount);
25787    if (json.has("amountRatioHighLimit"))
25788      res.setAmountRatioHighLimit(parseRatio(json.getAsJsonObject("amountRatioHighLimit")));
25789    if (json.has("amountType"))
25790      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
25791    if (json.has("source")) {
25792      JsonArray array = json.getAsJsonArray("source");
25793      for (int i = 0; i < array.size(); i++) {
25794        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25795      }
25796    };
25797  }
25798
25799  protected SubstanceNucleicAcid parseSubstanceNucleicAcid(JsonObject json) throws IOException, FHIRFormatError {
25800    SubstanceNucleicAcid res = new SubstanceNucleicAcid();
25801    parseSubstanceNucleicAcidProperties(json, res);
25802    return res;
25803  }
25804
25805  protected void parseSubstanceNucleicAcidProperties(JsonObject json, SubstanceNucleicAcid res) throws IOException, FHIRFormatError {
25806    parseDomainResourceProperties(json, res);
25807    if (json.has("sequenceType"))
25808      res.setSequenceType(parseCodeableConcept(json.getAsJsonObject("sequenceType")));
25809    if (json.has("numberOfSubunits"))
25810      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
25811    if (json.has("_numberOfSubunits"))
25812      parseElementProperties(json.getAsJsonObject("_numberOfSubunits"), res.getNumberOfSubunitsElement());
25813    if (json.has("areaOfHybridisation"))
25814      res.setAreaOfHybridisationElement(parseString(json.get("areaOfHybridisation").getAsString()));
25815    if (json.has("_areaOfHybridisation"))
25816      parseElementProperties(json.getAsJsonObject("_areaOfHybridisation"), res.getAreaOfHybridisationElement());
25817    if (json.has("oligoNucleotideType"))
25818      res.setOligoNucleotideType(parseCodeableConcept(json.getAsJsonObject("oligoNucleotideType")));
25819    if (json.has("subunit")) {
25820      JsonArray array = json.getAsJsonArray("subunit");
25821      for (int i = 0; i < array.size(); i++) {
25822        res.getSubunit().add(parseSubstanceNucleicAcidSubunitComponent(array.get(i).getAsJsonObject()));
25823      }
25824    };
25825  }
25826
25827  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent parseSubstanceNucleicAcidSubunitComponent(JsonObject json) throws IOException, FHIRFormatError {
25828    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent();
25829    parseSubstanceNucleicAcidSubunitComponentProperties(json, res);
25830    return res;
25831  }
25832
25833  protected void parseSubstanceNucleicAcidSubunitComponentProperties(JsonObject json, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res) throws IOException, FHIRFormatError {
25834    parseBackboneElementProperties(json, res);
25835    if (json.has("subunit"))
25836      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
25837    if (json.has("_subunit"))
25838      parseElementProperties(json.getAsJsonObject("_subunit"), res.getSubunitElement());
25839    if (json.has("sequence"))
25840      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
25841    if (json.has("_sequence"))
25842      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
25843    if (json.has("length"))
25844      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
25845    if (json.has("_length"))
25846      parseElementProperties(json.getAsJsonObject("_length"), res.getLengthElement());
25847    if (json.has("sequenceAttachment"))
25848      res.setSequenceAttachment(parseAttachment(json.getAsJsonObject("sequenceAttachment")));
25849    if (json.has("fivePrime"))
25850      res.setFivePrime(parseCodeableConcept(json.getAsJsonObject("fivePrime")));
25851    if (json.has("threePrime"))
25852      res.setThreePrime(parseCodeableConcept(json.getAsJsonObject("threePrime")));
25853    if (json.has("linkage")) {
25854      JsonArray array = json.getAsJsonArray("linkage");
25855      for (int i = 0; i < array.size(); i++) {
25856        res.getLinkage().add(parseSubstanceNucleicAcidSubunitLinkageComponent(array.get(i).getAsJsonObject()));
25857      }
25858    };
25859    if (json.has("sugar")) {
25860      JsonArray array = json.getAsJsonArray("sugar");
25861      for (int i = 0; i < array.size(); i++) {
25862        res.getSugar().add(parseSubstanceNucleicAcidSubunitSugarComponent(array.get(i).getAsJsonObject()));
25863      }
25864    };
25865  }
25866
25867  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent parseSubstanceNucleicAcidSubunitLinkageComponent(JsonObject json) throws IOException, FHIRFormatError {
25868    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent();
25869    parseSubstanceNucleicAcidSubunitLinkageComponentProperties(json, res);
25870    return res;
25871  }
25872
25873  protected void parseSubstanceNucleicAcidSubunitLinkageComponentProperties(JsonObject json, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res) throws IOException, FHIRFormatError {
25874    parseBackboneElementProperties(json, res);
25875    if (json.has("connectivity"))
25876      res.setConnectivityElement(parseString(json.get("connectivity").getAsString()));
25877    if (json.has("_connectivity"))
25878      parseElementProperties(json.getAsJsonObject("_connectivity"), res.getConnectivityElement());
25879    if (json.has("identifier"))
25880      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
25881    if (json.has("name"))
25882      res.setNameElement(parseString(json.get("name").getAsString()));
25883    if (json.has("_name"))
25884      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25885    if (json.has("residueSite"))
25886      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
25887    if (json.has("_residueSite"))
25888      parseElementProperties(json.getAsJsonObject("_residueSite"), res.getResidueSiteElement());
25889  }
25890
25891  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent parseSubstanceNucleicAcidSubunitSugarComponent(JsonObject json) throws IOException, FHIRFormatError {
25892    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent();
25893    parseSubstanceNucleicAcidSubunitSugarComponentProperties(json, res);
25894    return res;
25895  }
25896
25897  protected void parseSubstanceNucleicAcidSubunitSugarComponentProperties(JsonObject json, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res) throws IOException, FHIRFormatError {
25898    parseBackboneElementProperties(json, res);
25899    if (json.has("identifier"))
25900      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
25901    if (json.has("name"))
25902      res.setNameElement(parseString(json.get("name").getAsString()));
25903    if (json.has("_name"))
25904      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25905    if (json.has("residueSite"))
25906      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
25907    if (json.has("_residueSite"))
25908      parseElementProperties(json.getAsJsonObject("_residueSite"), res.getResidueSiteElement());
25909  }
25910
25911  protected SubstancePolymer parseSubstancePolymer(JsonObject json) throws IOException, FHIRFormatError {
25912    SubstancePolymer res = new SubstancePolymer();
25913    parseSubstancePolymerProperties(json, res);
25914    return res;
25915  }
25916
25917  protected void parseSubstancePolymerProperties(JsonObject json, SubstancePolymer res) throws IOException, FHIRFormatError {
25918    parseDomainResourceProperties(json, res);
25919    if (json.has("class"))
25920      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
25921    if (json.has("geometry"))
25922      res.setGeometry(parseCodeableConcept(json.getAsJsonObject("geometry")));
25923    if (json.has("copolymerConnectivity")) {
25924      JsonArray array = json.getAsJsonArray("copolymerConnectivity");
25925      for (int i = 0; i < array.size(); i++) {
25926        res.getCopolymerConnectivity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25927      }
25928    };
25929    if (json.has("modification")) {
25930      JsonArray array = json.getAsJsonArray("modification");
25931      for (int i = 0; i < array.size(); i++) {
25932        if (array.get(i).isJsonNull()) {
25933          res.getModification().add(new StringType());
25934        } else {;
25935          res.getModification().add(parseString(array.get(i).getAsString()));
25936        }
25937      }
25938    };
25939    if (json.has("_modification")) {
25940      JsonArray array = json.getAsJsonArray("_modification");
25941      for (int i = 0; i < array.size(); i++) {
25942        if (i == res.getModification().size())
25943          res.getModification().add(parseString(null));
25944        if (array.get(i) instanceof JsonObject) 
25945          parseElementProperties(array.get(i).getAsJsonObject(), res.getModification().get(i));
25946      }
25947    };
25948    if (json.has("monomerSet")) {
25949      JsonArray array = json.getAsJsonArray("monomerSet");
25950      for (int i = 0; i < array.size(); i++) {
25951        res.getMonomerSet().add(parseSubstancePolymerMonomerSetComponent(array.get(i).getAsJsonObject()));
25952      }
25953    };
25954    if (json.has("repeat")) {
25955      JsonArray array = json.getAsJsonArray("repeat");
25956      for (int i = 0; i < array.size(); i++) {
25957        res.getRepeat().add(parseSubstancePolymerRepeatComponent(array.get(i).getAsJsonObject()));
25958      }
25959    };
25960  }
25961
25962  protected SubstancePolymer.SubstancePolymerMonomerSetComponent parseSubstancePolymerMonomerSetComponent(JsonObject json) throws IOException, FHIRFormatError {
25963    SubstancePolymer.SubstancePolymerMonomerSetComponent res = new SubstancePolymer.SubstancePolymerMonomerSetComponent();
25964    parseSubstancePolymerMonomerSetComponentProperties(json, res);
25965    return res;
25966  }
25967
25968  protected void parseSubstancePolymerMonomerSetComponentProperties(JsonObject json, SubstancePolymer.SubstancePolymerMonomerSetComponent res) throws IOException, FHIRFormatError {
25969    parseBackboneElementProperties(json, res);
25970    if (json.has("ratioType"))
25971      res.setRatioType(parseCodeableConcept(json.getAsJsonObject("ratioType")));
25972    if (json.has("startingMaterial")) {
25973      JsonArray array = json.getAsJsonArray("startingMaterial");
25974      for (int i = 0; i < array.size(); i++) {
25975        res.getStartingMaterial().add(parseSubstancePolymerMonomerSetStartingMaterialComponent(array.get(i).getAsJsonObject()));
25976      }
25977    };
25978  }
25979
25980  protected SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent parseSubstancePolymerMonomerSetStartingMaterialComponent(JsonObject json) throws IOException, FHIRFormatError {
25981    SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res = new SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent();
25982    parseSubstancePolymerMonomerSetStartingMaterialComponentProperties(json, res);
25983    return res;
25984  }
25985
25986  protected void parseSubstancePolymerMonomerSetStartingMaterialComponentProperties(JsonObject json, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res) throws IOException, FHIRFormatError {
25987    parseBackboneElementProperties(json, res);
25988    if (json.has("material"))
25989      res.setMaterial(parseCodeableConcept(json.getAsJsonObject("material")));
25990    if (json.has("type"))
25991      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25992    if (json.has("isDefining"))
25993      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
25994    if (json.has("_isDefining"))
25995      parseElementProperties(json.getAsJsonObject("_isDefining"), res.getIsDefiningElement());
25996    if (json.has("amount"))
25997      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
25998  }
25999
26000  protected SubstancePolymer.SubstancePolymerRepeatComponent parseSubstancePolymerRepeatComponent(JsonObject json) throws IOException, FHIRFormatError {
26001    SubstancePolymer.SubstancePolymerRepeatComponent res = new SubstancePolymer.SubstancePolymerRepeatComponent();
26002    parseSubstancePolymerRepeatComponentProperties(json, res);
26003    return res;
26004  }
26005
26006  protected void parseSubstancePolymerRepeatComponentProperties(JsonObject json, SubstancePolymer.SubstancePolymerRepeatComponent res) throws IOException, FHIRFormatError {
26007    parseBackboneElementProperties(json, res);
26008    if (json.has("numberOfUnits"))
26009      res.setNumberOfUnitsElement(parseInteger(json.get("numberOfUnits").getAsLong()));
26010    if (json.has("_numberOfUnits"))
26011      parseElementProperties(json.getAsJsonObject("_numberOfUnits"), res.getNumberOfUnitsElement());
26012    if (json.has("averageMolecularFormula"))
26013      res.setAverageMolecularFormulaElement(parseString(json.get("averageMolecularFormula").getAsString()));
26014    if (json.has("_averageMolecularFormula"))
26015      parseElementProperties(json.getAsJsonObject("_averageMolecularFormula"), res.getAverageMolecularFormulaElement());
26016    if (json.has("repeatUnitAmountType"))
26017      res.setRepeatUnitAmountType(parseCodeableConcept(json.getAsJsonObject("repeatUnitAmountType")));
26018    if (json.has("repeatUnit")) {
26019      JsonArray array = json.getAsJsonArray("repeatUnit");
26020      for (int i = 0; i < array.size(); i++) {
26021        res.getRepeatUnit().add(parseSubstancePolymerRepeatRepeatUnitComponent(array.get(i).getAsJsonObject()));
26022      }
26023    };
26024  }
26025
26026  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent parseSubstancePolymerRepeatRepeatUnitComponent(JsonObject json) throws IOException, FHIRFormatError {
26027    SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent();
26028    parseSubstancePolymerRepeatRepeatUnitComponentProperties(json, res);
26029    return res;
26030  }
26031
26032  protected void parseSubstancePolymerRepeatRepeatUnitComponentProperties(JsonObject json, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res) throws IOException, FHIRFormatError {
26033    parseBackboneElementProperties(json, res);
26034    if (json.has("orientationOfPolymerisation"))
26035      res.setOrientationOfPolymerisation(parseCodeableConcept(json.getAsJsonObject("orientationOfPolymerisation")));
26036    if (json.has("repeatUnit"))
26037      res.setRepeatUnitElement(parseString(json.get("repeatUnit").getAsString()));
26038    if (json.has("_repeatUnit"))
26039      parseElementProperties(json.getAsJsonObject("_repeatUnit"), res.getRepeatUnitElement());
26040    if (json.has("amount"))
26041      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
26042    if (json.has("degreeOfPolymerisation")) {
26043      JsonArray array = json.getAsJsonArray("degreeOfPolymerisation");
26044      for (int i = 0; i < array.size(); i++) {
26045        res.getDegreeOfPolymerisation().add(parseSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(array.get(i).getAsJsonObject()));
26046      }
26047    };
26048    if (json.has("structuralRepresentation")) {
26049      JsonArray array = json.getAsJsonArray("structuralRepresentation");
26050      for (int i = 0; i < array.size(); i++) {
26051        res.getStructuralRepresentation().add(parseSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(array.get(i).getAsJsonObject()));
26052      }
26053    };
26054  }
26055
26056  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent parseSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(JsonObject json) throws IOException, FHIRFormatError {
26057    SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent();
26058    parseSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(json, res);
26059    return res;
26060  }
26061
26062  protected void parseSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(JsonObject json, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res) throws IOException, FHIRFormatError {
26063    parseBackboneElementProperties(json, res);
26064    if (json.has("degree"))
26065      res.setDegree(parseCodeableConcept(json.getAsJsonObject("degree")));
26066    if (json.has("amount"))
26067      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
26068  }
26069
26070  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent parseSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(JsonObject json) throws IOException, FHIRFormatError {
26071    SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent();
26072    parseSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(json, res);
26073    return res;
26074  }
26075
26076  protected void parseSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(JsonObject json, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res) throws IOException, FHIRFormatError {
26077    parseBackboneElementProperties(json, res);
26078    if (json.has("type"))
26079      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
26080    if (json.has("representation"))
26081      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
26082    if (json.has("_representation"))
26083      parseElementProperties(json.getAsJsonObject("_representation"), res.getRepresentationElement());
26084    if (json.has("attachment"))
26085      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
26086  }
26087
26088  protected SubstanceProtein parseSubstanceProtein(JsonObject json) throws IOException, FHIRFormatError {
26089    SubstanceProtein res = new SubstanceProtein();
26090    parseSubstanceProteinProperties(json, res);
26091    return res;
26092  }
26093
26094  protected void parseSubstanceProteinProperties(JsonObject json, SubstanceProtein res) throws IOException, FHIRFormatError {
26095    parseDomainResourceProperties(json, res);
26096    if (json.has("sequenceType"))
26097      res.setSequenceType(parseCodeableConcept(json.getAsJsonObject("sequenceType")));
26098    if (json.has("numberOfSubunits"))
26099      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
26100    if (json.has("_numberOfSubunits"))
26101      parseElementProperties(json.getAsJsonObject("_numberOfSubunits"), res.getNumberOfSubunitsElement());
26102    if (json.has("disulfideLinkage")) {
26103      JsonArray array = json.getAsJsonArray("disulfideLinkage");
26104      for (int i = 0; i < array.size(); i++) {
26105        if (array.get(i).isJsonNull()) {
26106          res.getDisulfideLinkage().add(new StringType());
26107        } else {;
26108          res.getDisulfideLinkage().add(parseString(array.get(i).getAsString()));
26109        }
26110      }
26111    };
26112    if (json.has("_disulfideLinkage")) {
26113      JsonArray array = json.getAsJsonArray("_disulfideLinkage");
26114      for (int i = 0; i < array.size(); i++) {
26115        if (i == res.getDisulfideLinkage().size())
26116          res.getDisulfideLinkage().add(parseString(null));
26117        if (array.get(i) instanceof JsonObject) 
26118          parseElementProperties(array.get(i).getAsJsonObject(), res.getDisulfideLinkage().get(i));
26119      }
26120    };
26121    if (json.has("subunit")) {
26122      JsonArray array = json.getAsJsonArray("subunit");
26123      for (int i = 0; i < array.size(); i++) {
26124        res.getSubunit().add(parseSubstanceProteinSubunitComponent(array.get(i).getAsJsonObject()));
26125      }
26126    };
26127  }
26128
26129  protected SubstanceProtein.SubstanceProteinSubunitComponent parseSubstanceProteinSubunitComponent(JsonObject json) throws IOException, FHIRFormatError {
26130    SubstanceProtein.SubstanceProteinSubunitComponent res = new SubstanceProtein.SubstanceProteinSubunitComponent();
26131    parseSubstanceProteinSubunitComponentProperties(json, res);
26132    return res;
26133  }
26134
26135  protected void parseSubstanceProteinSubunitComponentProperties(JsonObject json, SubstanceProtein.SubstanceProteinSubunitComponent res) throws IOException, FHIRFormatError {
26136    parseBackboneElementProperties(json, res);
26137    if (json.has("subunit"))
26138      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
26139    if (json.has("_subunit"))
26140      parseElementProperties(json.getAsJsonObject("_subunit"), res.getSubunitElement());
26141    if (json.has("sequence"))
26142      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
26143    if (json.has("_sequence"))
26144      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
26145    if (json.has("length"))
26146      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
26147    if (json.has("_length"))
26148      parseElementProperties(json.getAsJsonObject("_length"), res.getLengthElement());
26149    if (json.has("sequenceAttachment"))
26150      res.setSequenceAttachment(parseAttachment(json.getAsJsonObject("sequenceAttachment")));
26151    if (json.has("nTerminalModificationId"))
26152      res.setNTerminalModificationId(parseIdentifier(json.getAsJsonObject("nTerminalModificationId")));
26153    if (json.has("nTerminalModification"))
26154      res.setNTerminalModificationElement(parseString(json.get("nTerminalModification").getAsString()));
26155    if (json.has("_nTerminalModification"))
26156      parseElementProperties(json.getAsJsonObject("_nTerminalModification"), res.getNTerminalModificationElement());
26157    if (json.has("cTerminalModificationId"))
26158      res.setCTerminalModificationId(parseIdentifier(json.getAsJsonObject("cTerminalModificationId")));
26159    if (json.has("cTerminalModification"))
26160      res.setCTerminalModificationElement(parseString(json.get("cTerminalModification").getAsString()));
26161    if (json.has("_cTerminalModification"))
26162      parseElementProperties(json.getAsJsonObject("_cTerminalModification"), res.getCTerminalModificationElement());
26163  }
26164
26165  protected SubstanceReferenceInformation parseSubstanceReferenceInformation(JsonObject json) throws IOException, FHIRFormatError {
26166    SubstanceReferenceInformation res = new SubstanceReferenceInformation();
26167    parseSubstanceReferenceInformationProperties(json, res);
26168    return res;
26169  }
26170
26171  protected void parseSubstanceReferenceInformationProperties(JsonObject json, SubstanceReferenceInformation res) throws IOException, FHIRFormatError {
26172    parseDomainResourceProperties(json, res);
26173    if (json.has("comment"))
26174      res.setCommentElement(parseString(json.get("comment").getAsString()));
26175    if (json.has("_comment"))
26176      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
26177    if (json.has("gene")) {
26178      JsonArray array = json.getAsJsonArray("gene");
26179      for (int i = 0; i < array.size(); i++) {
26180        res.getGene().add(parseSubstanceReferenceInformationGeneComponent(array.get(i).getAsJsonObject()));
26181      }
26182    };
26183    if (json.has("geneElement")) {
26184      JsonArray array = json.getAsJsonArray("geneElement");
26185      for (int i = 0; i < array.size(); i++) {
26186        res.getGeneElement().add(parseSubstanceReferenceInformationGeneElementComponent(array.get(i).getAsJsonObject()));
26187      }
26188    };
26189    if (json.has("classification")) {
26190      JsonArray array = json.getAsJsonArray("classification");
26191      for (int i = 0; i < array.size(); i++) {
26192        res.getClassification().add(parseSubstanceReferenceInformationClassificationComponent(array.get(i).getAsJsonObject()));
26193      }
26194    };
26195    if (json.has("target")) {
26196      JsonArray array = json.getAsJsonArray("target");
26197      for (int i = 0; i < array.size(); i++) {
26198        res.getTarget().add(parseSubstanceReferenceInformationTargetComponent(array.get(i).getAsJsonObject()));
26199      }
26200    };
26201  }
26202
26203  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent parseSubstanceReferenceInformationGeneComponent(JsonObject json) throws IOException, FHIRFormatError {
26204    SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent();
26205    parseSubstanceReferenceInformationGeneComponentProperties(json, res);
26206    return res;
26207  }
26208
26209  protected void parseSubstanceReferenceInformationGeneComponentProperties(JsonObject json, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res) throws IOException, FHIRFormatError {
26210    parseBackboneElementProperties(json, res);
26211    if (json.has("geneSequenceOrigin"))
26212      res.setGeneSequenceOrigin(parseCodeableConcept(json.getAsJsonObject("geneSequenceOrigin")));
26213    if (json.has("gene"))
26214      res.setGene(parseCodeableConcept(json.getAsJsonObject("gene")));
26215    if (json.has("source")) {
26216      JsonArray array = json.getAsJsonArray("source");
26217      for (int i = 0; i < array.size(); i++) {
26218        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
26219      }
26220    };
26221  }
26222
26223  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent parseSubstanceReferenceInformationGeneElementComponent(JsonObject json) throws IOException, FHIRFormatError {
26224    SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent();
26225    parseSubstanceReferenceInformationGeneElementComponentProperties(json, res);
26226    return res;
26227  }
26228
26229  protected void parseSubstanceReferenceInformationGeneElementComponentProperties(JsonObject json, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res) throws IOException, FHIRFormatError {
26230    parseBackboneElementProperties(json, res);
26231    if (json.has("type"))
26232      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
26233    if (json.has("element"))
26234      res.setElement(parseIdentifier(json.getAsJsonObject("element")));
26235    if (json.has("source")) {
26236      JsonArray array = json.getAsJsonArray("source");
26237      for (int i = 0; i < array.size(); i++) {
26238        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
26239      }
26240    };
26241  }
26242
26243  protected SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent parseSubstanceReferenceInformationClassificationComponent(JsonObject json) throws IOException, FHIRFormatError {
26244    SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent();
26245    parseSubstanceReferenceInformationClassificationComponentProperties(json, res);
26246    return res;
26247  }
26248
26249  protected void parseSubstanceReferenceInformationClassificationComponentProperties(JsonObject json, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res) throws IOException, FHIRFormatError {
26250    parseBackboneElementProperties(json, res);
26251    if (json.has("domain"))
26252      res.setDomain(parseCodeableConcept(json.getAsJsonObject("domain")));
26253    if (json.has("classification"))
26254      res.setClassification(parseCodeableConcept(json.getAsJsonObject("classification")));
26255    if (json.has("subtype")) {
26256      JsonArray array = json.getAsJsonArray("subtype");
26257      for (int i = 0; i < array.size(); i++) {
26258        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26259      }
26260    };
26261    if (json.has("source")) {
26262      JsonArray array = json.getAsJsonArray("source");
26263      for (int i = 0; i < array.size(); i++) {
26264        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
26265      }
26266    };
26267  }
26268
26269  protected SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent parseSubstanceReferenceInformationTargetComponent(JsonObject json) throws IOException, FHIRFormatError {
26270    SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent();
26271    parseSubstanceReferenceInformationTargetComponentProperties(json, res);
26272    return res;
26273  }
26274
26275  protected void parseSubstanceReferenceInformationTargetComponentProperties(JsonObject json, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res) throws IOException, FHIRFormatError {
26276    parseBackboneElementProperties(json, res);
26277    if (json.has("target"))
26278      res.setTarget(parseIdentifier(json.getAsJsonObject("target")));
26279    if (json.has("type"))
26280      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
26281    if (json.has("interaction"))
26282      res.setInteraction(parseCodeableConcept(json.getAsJsonObject("interaction")));
26283    if (json.has("organism"))
26284      res.setOrganism(parseCodeableConcept(json.getAsJsonObject("organism")));
26285    if (json.has("organismType"))
26286      res.setOrganismType(parseCodeableConcept(json.getAsJsonObject("organismType")));
26287    DataType amount = parseType("amount", json);
26288    if (amount != null)
26289      res.setAmount(amount);
26290    if (json.has("amountType"))
26291      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
26292    if (json.has("source")) {
26293      JsonArray array = json.getAsJsonArray("source");
26294      for (int i = 0; i < array.size(); i++) {
26295        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
26296      }
26297    };
26298  }
26299
26300  protected SubstanceSourceMaterial parseSubstanceSourceMaterial(JsonObject json) throws IOException, FHIRFormatError {
26301    SubstanceSourceMaterial res = new SubstanceSourceMaterial();
26302    parseSubstanceSourceMaterialProperties(json, res);
26303    return res;
26304  }
26305
26306  protected void parseSubstanceSourceMaterialProperties(JsonObject json, SubstanceSourceMaterial res) throws IOException, FHIRFormatError {
26307    parseDomainResourceProperties(json, res);
26308    if (json.has("sourceMaterialClass"))
26309      res.setSourceMaterialClass(parseCodeableConcept(json.getAsJsonObject("sourceMaterialClass")));
26310    if (json.has("sourceMaterialType"))
26311      res.setSourceMaterialType(parseCodeableConcept(json.getAsJsonObject("sourceMaterialType")));
26312    if (json.has("sourceMaterialState"))
26313      res.setSourceMaterialState(parseCodeableConcept(json.getAsJsonObject("sourceMaterialState")));
26314    if (json.has("organismId"))
26315      res.setOrganismId(parseIdentifier(json.getAsJsonObject("organismId")));
26316    if (json.has("organismName"))
26317      res.setOrganismNameElement(parseString(json.get("organismName").getAsString()));
26318    if (json.has("_organismName"))
26319      parseElementProperties(json.getAsJsonObject("_organismName"), res.getOrganismNameElement());
26320    if (json.has("parentSubstanceId")) {
26321      JsonArray array = json.getAsJsonArray("parentSubstanceId");
26322      for (int i = 0; i < array.size(); i++) {
26323        res.getParentSubstanceId().add(parseIdentifier(array.get(i).getAsJsonObject()));
26324      }
26325    };
26326    if (json.has("parentSubstanceName")) {
26327      JsonArray array = json.getAsJsonArray("parentSubstanceName");
26328      for (int i = 0; i < array.size(); i++) {
26329        if (array.get(i).isJsonNull()) {
26330          res.getParentSubstanceName().add(new StringType());
26331        } else {;
26332          res.getParentSubstanceName().add(parseString(array.get(i).getAsString()));
26333        }
26334      }
26335    };
26336    if (json.has("_parentSubstanceName")) {
26337      JsonArray array = json.getAsJsonArray("_parentSubstanceName");
26338      for (int i = 0; i < array.size(); i++) {
26339        if (i == res.getParentSubstanceName().size())
26340          res.getParentSubstanceName().add(parseString(null));
26341        if (array.get(i) instanceof JsonObject) 
26342          parseElementProperties(array.get(i).getAsJsonObject(), res.getParentSubstanceName().get(i));
26343      }
26344    };
26345    if (json.has("countryOfOrigin")) {
26346      JsonArray array = json.getAsJsonArray("countryOfOrigin");
26347      for (int i = 0; i < array.size(); i++) {
26348        res.getCountryOfOrigin().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26349      }
26350    };
26351    if (json.has("geographicalLocation")) {
26352      JsonArray array = json.getAsJsonArray("geographicalLocation");
26353      for (int i = 0; i < array.size(); i++) {
26354        if (array.get(i).isJsonNull()) {
26355          res.getGeographicalLocation().add(new StringType());
26356        } else {;
26357          res.getGeographicalLocation().add(parseString(array.get(i).getAsString()));
26358        }
26359      }
26360    };
26361    if (json.has("_geographicalLocation")) {
26362      JsonArray array = json.getAsJsonArray("_geographicalLocation");
26363      for (int i = 0; i < array.size(); i++) {
26364        if (i == res.getGeographicalLocation().size())
26365          res.getGeographicalLocation().add(parseString(null));
26366        if (array.get(i) instanceof JsonObject) 
26367          parseElementProperties(array.get(i).getAsJsonObject(), res.getGeographicalLocation().get(i));
26368      }
26369    };
26370    if (json.has("developmentStage"))
26371      res.setDevelopmentStage(parseCodeableConcept(json.getAsJsonObject("developmentStage")));
26372    if (json.has("fractionDescription")) {
26373      JsonArray array = json.getAsJsonArray("fractionDescription");
26374      for (int i = 0; i < array.size(); i++) {
26375        res.getFractionDescription().add(parseSubstanceSourceMaterialFractionDescriptionComponent(array.get(i).getAsJsonObject()));
26376      }
26377    };
26378    if (json.has("organism"))
26379      res.setOrganism(parseSubstanceSourceMaterialOrganismComponent(json.getAsJsonObject("organism")));
26380    if (json.has("partDescription")) {
26381      JsonArray array = json.getAsJsonArray("partDescription");
26382      for (int i = 0; i < array.size(); i++) {
26383        res.getPartDescription().add(parseSubstanceSourceMaterialPartDescriptionComponent(array.get(i).getAsJsonObject()));
26384      }
26385    };
26386  }
26387
26388  protected SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent parseSubstanceSourceMaterialFractionDescriptionComponent(JsonObject json) throws IOException, FHIRFormatError {
26389    SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent();
26390    parseSubstanceSourceMaterialFractionDescriptionComponentProperties(json, res);
26391    return res;
26392  }
26393
26394  protected void parseSubstanceSourceMaterialFractionDescriptionComponentProperties(JsonObject json, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res) throws IOException, FHIRFormatError {
26395    parseBackboneElementProperties(json, res);
26396    if (json.has("fraction"))
26397      res.setFractionElement(parseString(json.get("fraction").getAsString()));
26398    if (json.has("_fraction"))
26399      parseElementProperties(json.getAsJsonObject("_fraction"), res.getFractionElement());
26400    if (json.has("materialType"))
26401      res.setMaterialType(parseCodeableConcept(json.getAsJsonObject("materialType")));
26402  }
26403
26404  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent parseSubstanceSourceMaterialOrganismComponent(JsonObject json) throws IOException, FHIRFormatError {
26405    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent();
26406    parseSubstanceSourceMaterialOrganismComponentProperties(json, res);
26407    return res;
26408  }
26409
26410  protected void parseSubstanceSourceMaterialOrganismComponentProperties(JsonObject json, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res) throws IOException, FHIRFormatError {
26411    parseBackboneElementProperties(json, res);
26412    if (json.has("family"))
26413      res.setFamily(parseCodeableConcept(json.getAsJsonObject("family")));
26414    if (json.has("genus"))
26415      res.setGenus(parseCodeableConcept(json.getAsJsonObject("genus")));
26416    if (json.has("species"))
26417      res.setSpecies(parseCodeableConcept(json.getAsJsonObject("species")));
26418    if (json.has("intraspecificType"))
26419      res.setIntraspecificType(parseCodeableConcept(json.getAsJsonObject("intraspecificType")));
26420    if (json.has("intraspecificDescription"))
26421      res.setIntraspecificDescriptionElement(parseString(json.get("intraspecificDescription").getAsString()));
26422    if (json.has("_intraspecificDescription"))
26423      parseElementProperties(json.getAsJsonObject("_intraspecificDescription"), res.getIntraspecificDescriptionElement());
26424    if (json.has("author")) {
26425      JsonArray array = json.getAsJsonArray("author");
26426      for (int i = 0; i < array.size(); i++) {
26427        res.getAuthor().add(parseSubstanceSourceMaterialOrganismAuthorComponent(array.get(i).getAsJsonObject()));
26428      }
26429    };
26430    if (json.has("hybrid"))
26431      res.setHybrid(parseSubstanceSourceMaterialOrganismHybridComponent(json.getAsJsonObject("hybrid")));
26432    if (json.has("organismGeneral"))
26433      res.setOrganismGeneral(parseSubstanceSourceMaterialOrganismOrganismGeneralComponent(json.getAsJsonObject("organismGeneral")));
26434  }
26435
26436  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent parseSubstanceSourceMaterialOrganismAuthorComponent(JsonObject json) throws IOException, FHIRFormatError {
26437    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent();
26438    parseSubstanceSourceMaterialOrganismAuthorComponentProperties(json, res);
26439    return res;
26440  }
26441
26442  protected void parseSubstanceSourceMaterialOrganismAuthorComponentProperties(JsonObject json, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res) throws IOException, FHIRFormatError {
26443    parseBackboneElementProperties(json, res);
26444    if (json.has("authorType"))
26445      res.setAuthorType(parseCodeableConcept(json.getAsJsonObject("authorType")));
26446    if (json.has("authorDescription"))
26447      res.setAuthorDescriptionElement(parseString(json.get("authorDescription").getAsString()));
26448    if (json.has("_authorDescription"))
26449      parseElementProperties(json.getAsJsonObject("_authorDescription"), res.getAuthorDescriptionElement());
26450  }
26451
26452  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent parseSubstanceSourceMaterialOrganismHybridComponent(JsonObject json) throws IOException, FHIRFormatError {
26453    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent();
26454    parseSubstanceSourceMaterialOrganismHybridComponentProperties(json, res);
26455    return res;
26456  }
26457
26458  protected void parseSubstanceSourceMaterialOrganismHybridComponentProperties(JsonObject json, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res) throws IOException, FHIRFormatError {
26459    parseBackboneElementProperties(json, res);
26460    if (json.has("maternalOrganismId"))
26461      res.setMaternalOrganismIdElement(parseString(json.get("maternalOrganismId").getAsString()));
26462    if (json.has("_maternalOrganismId"))
26463      parseElementProperties(json.getAsJsonObject("_maternalOrganismId"), res.getMaternalOrganismIdElement());
26464    if (json.has("maternalOrganismName"))
26465      res.setMaternalOrganismNameElement(parseString(json.get("maternalOrganismName").getAsString()));
26466    if (json.has("_maternalOrganismName"))
26467      parseElementProperties(json.getAsJsonObject("_maternalOrganismName"), res.getMaternalOrganismNameElement());
26468    if (json.has("paternalOrganismId"))
26469      res.setPaternalOrganismIdElement(parseString(json.get("paternalOrganismId").getAsString()));
26470    if (json.has("_paternalOrganismId"))
26471      parseElementProperties(json.getAsJsonObject("_paternalOrganismId"), res.getPaternalOrganismIdElement());
26472    if (json.has("paternalOrganismName"))
26473      res.setPaternalOrganismNameElement(parseString(json.get("paternalOrganismName").getAsString()));
26474    if (json.has("_paternalOrganismName"))
26475      parseElementProperties(json.getAsJsonObject("_paternalOrganismName"), res.getPaternalOrganismNameElement());
26476    if (json.has("hybridType"))
26477      res.setHybridType(parseCodeableConcept(json.getAsJsonObject("hybridType")));
26478  }
26479
26480  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent parseSubstanceSourceMaterialOrganismOrganismGeneralComponent(JsonObject json) throws IOException, FHIRFormatError {
26481    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent();
26482    parseSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(json, res);
26483    return res;
26484  }
26485
26486  protected void parseSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(JsonObject json, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res) throws IOException, FHIRFormatError {
26487    parseBackboneElementProperties(json, res);
26488    if (json.has("kingdom"))
26489      res.setKingdom(parseCodeableConcept(json.getAsJsonObject("kingdom")));
26490    if (json.has("phylum"))
26491      res.setPhylum(parseCodeableConcept(json.getAsJsonObject("phylum")));
26492    if (json.has("class"))
26493      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
26494    if (json.has("order"))
26495      res.setOrder(parseCodeableConcept(json.getAsJsonObject("order")));
26496  }
26497
26498  protected SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent parseSubstanceSourceMaterialPartDescriptionComponent(JsonObject json) throws IOException, FHIRFormatError {
26499    SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent();
26500    parseSubstanceSourceMaterialPartDescriptionComponentProperties(json, res);
26501    return res;
26502  }
26503
26504  protected void parseSubstanceSourceMaterialPartDescriptionComponentProperties(JsonObject json, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res) throws IOException, FHIRFormatError {
26505    parseBackboneElementProperties(json, res);
26506    if (json.has("part"))
26507      res.setPart(parseCodeableConcept(json.getAsJsonObject("part")));
26508    if (json.has("partLocation"))
26509      res.setPartLocation(parseCodeableConcept(json.getAsJsonObject("partLocation")));
26510  }
26511
26512  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
26513    SupplyDelivery res = new SupplyDelivery();
26514    parseSupplyDeliveryProperties(json, res);
26515    return res;
26516  }
26517
26518  protected void parseSupplyDeliveryProperties(JsonObject json, SupplyDelivery res) throws IOException, FHIRFormatError {
26519    parseDomainResourceProperties(json, res);
26520    if (json.has("identifier")) {
26521      JsonArray array = json.getAsJsonArray("identifier");
26522      for (int i = 0; i < array.size(); i++) {
26523        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26524      }
26525    };
26526    if (json.has("basedOn")) {
26527      JsonArray array = json.getAsJsonArray("basedOn");
26528      for (int i = 0; i < array.size(); i++) {
26529        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
26530      }
26531    };
26532    if (json.has("partOf")) {
26533      JsonArray array = json.getAsJsonArray("partOf");
26534      for (int i = 0; i < array.size(); i++) {
26535        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
26536      }
26537    };
26538    if (json.has("status"))
26539      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
26540    if (json.has("_status"))
26541      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
26542    if (json.has("patient"))
26543      res.setPatient(parseReference(json.getAsJsonObject("patient")));
26544    if (json.has("type"))
26545      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
26546    if (json.has("suppliedItem"))
26547      res.setSuppliedItem(parseSupplyDeliverySuppliedItemComponent(json.getAsJsonObject("suppliedItem")));
26548    DataType occurrence = parseType("occurrence", json);
26549    if (occurrence != null)
26550      res.setOccurrence(occurrence);
26551    if (json.has("supplier"))
26552      res.setSupplier(parseReference(json.getAsJsonObject("supplier")));
26553    if (json.has("destination"))
26554      res.setDestination(parseReference(json.getAsJsonObject("destination")));
26555    if (json.has("receiver")) {
26556      JsonArray array = json.getAsJsonArray("receiver");
26557      for (int i = 0; i < array.size(); i++) {
26558        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
26559      }
26560    };
26561  }
26562
26563  protected SupplyDelivery.SupplyDeliverySuppliedItemComponent parseSupplyDeliverySuppliedItemComponent(JsonObject json) throws IOException, FHIRFormatError {
26564    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
26565    parseSupplyDeliverySuppliedItemComponentProperties(json, res);
26566    return res;
26567  }
26568
26569  protected void parseSupplyDeliverySuppliedItemComponentProperties(JsonObject json, SupplyDelivery.SupplyDeliverySuppliedItemComponent res) throws IOException, FHIRFormatError {
26570    parseBackboneElementProperties(json, res);
26571    if (json.has("quantity"))
26572      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
26573    DataType item = parseType("item", json);
26574    if (item != null)
26575      res.setItem(item);
26576  }
26577
26578  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
26579    SupplyRequest res = new SupplyRequest();
26580    parseSupplyRequestProperties(json, res);
26581    return res;
26582  }
26583
26584  protected void parseSupplyRequestProperties(JsonObject json, SupplyRequest res) throws IOException, FHIRFormatError {
26585    parseDomainResourceProperties(json, res);
26586    if (json.has("identifier")) {
26587      JsonArray array = json.getAsJsonArray("identifier");
26588      for (int i = 0; i < array.size(); i++) {
26589        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26590      }
26591    };
26592    if (json.has("status"))
26593      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
26594    if (json.has("_status"))
26595      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
26596    if (json.has("category"))
26597      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
26598    if (json.has("priority"))
26599      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
26600    if (json.has("_priority"))
26601      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
26602    DataType item = parseType("item", json);
26603    if (item != null)
26604      res.setItem(item);
26605    if (json.has("quantity"))
26606      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
26607    if (json.has("parameter")) {
26608      JsonArray array = json.getAsJsonArray("parameter");
26609      for (int i = 0; i < array.size(); i++) {
26610        res.getParameter().add(parseSupplyRequestParameterComponent(array.get(i).getAsJsonObject()));
26611      }
26612    };
26613    DataType occurrence = parseType("occurrence", json);
26614    if (occurrence != null)
26615      res.setOccurrence(occurrence);
26616    if (json.has("authoredOn"))
26617      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
26618    if (json.has("_authoredOn"))
26619      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
26620    if (json.has("requester"))
26621      res.setRequester(parseReference(json.getAsJsonObject("requester")));
26622    if (json.has("supplier")) {
26623      JsonArray array = json.getAsJsonArray("supplier");
26624      for (int i = 0; i < array.size(); i++) {
26625        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
26626      }
26627    };
26628    if (json.has("reason")) {
26629      JsonArray array = json.getAsJsonArray("reason");
26630      for (int i = 0; i < array.size(); i++) {
26631        res.getReason().add(parseCodeableReference(array.get(i).getAsJsonObject()));
26632      }
26633    };
26634    if (json.has("deliverFrom"))
26635      res.setDeliverFrom(parseReference(json.getAsJsonObject("deliverFrom")));
26636    if (json.has("deliverTo"))
26637      res.setDeliverTo(parseReference(json.getAsJsonObject("deliverTo")));
26638  }
26639
26640  protected SupplyRequest.SupplyRequestParameterComponent parseSupplyRequestParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
26641    SupplyRequest.SupplyRequestParameterComponent res = new SupplyRequest.SupplyRequestParameterComponent();
26642    parseSupplyRequestParameterComponentProperties(json, res);
26643    return res;
26644  }
26645
26646  protected void parseSupplyRequestParameterComponentProperties(JsonObject json, SupplyRequest.SupplyRequestParameterComponent res) throws IOException, FHIRFormatError {
26647    parseBackboneElementProperties(json, res);
26648    if (json.has("code"))
26649      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
26650    DataType value = parseType("value", json);
26651    if (value != null)
26652      res.setValue(value);
26653  }
26654
26655  protected Task parseTask(JsonObject json) throws IOException, FHIRFormatError {
26656    Task res = new Task();
26657    parseTaskProperties(json, res);
26658    return res;
26659  }
26660
26661  protected void parseTaskProperties(JsonObject json, Task res) throws IOException, FHIRFormatError {
26662    parseDomainResourceProperties(json, res);
26663    if (json.has("identifier")) {
26664      JsonArray array = json.getAsJsonArray("identifier");
26665      for (int i = 0; i < array.size(); i++) {
26666        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26667      }
26668    };
26669    if (json.has("instantiatesCanonical"))
26670      res.setInstantiatesCanonicalElement(parseCanonical(json.get("instantiatesCanonical").getAsString()));
26671    if (json.has("_instantiatesCanonical"))
26672      parseElementProperties(json.getAsJsonObject("_instantiatesCanonical"), res.getInstantiatesCanonicalElement());
26673    if (json.has("instantiatesUri"))
26674      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
26675    if (json.has("_instantiatesUri"))
26676      parseElementProperties(json.getAsJsonObject("_instantiatesUri"), res.getInstantiatesUriElement());
26677    if (json.has("basedOn")) {
26678      JsonArray array = json.getAsJsonArray("basedOn");
26679      for (int i = 0; i < array.size(); i++) {
26680        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
26681      }
26682    };
26683    if (json.has("groupIdentifier"))
26684      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
26685    if (json.has("partOf")) {
26686      JsonArray array = json.getAsJsonArray("partOf");
26687      for (int i = 0; i < array.size(); i++) {
26688        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
26689      }
26690    };
26691    if (json.has("status"))
26692      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
26693    if (json.has("_status"))
26694      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
26695    if (json.has("statusReason"))
26696      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
26697    if (json.has("businessStatus"))
26698      res.setBusinessStatus(parseCodeableConcept(json.getAsJsonObject("businessStatus")));
26699    if (json.has("intent"))
26700      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Task.TaskIntent.NULL, new Task.TaskIntentEnumFactory()));
26701    if (json.has("_intent"))
26702      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
26703    if (json.has("priority"))
26704      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
26705    if (json.has("_priority"))
26706      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
26707    if (json.has("code"))
26708      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
26709    if (json.has("description"))
26710      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26711    if (json.has("_description"))
26712      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26713    if (json.has("focus"))
26714      res.setFocus(parseReference(json.getAsJsonObject("focus")));
26715    if (json.has("for"))
26716      res.setFor(parseReference(json.getAsJsonObject("for")));
26717    if (json.has("encounter"))
26718      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
26719    if (json.has("executionPeriod"))
26720      res.setExecutionPeriod(parsePeriod(json.getAsJsonObject("executionPeriod")));
26721    if (json.has("authoredOn"))
26722      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
26723    if (json.has("_authoredOn"))
26724      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
26725    if (json.has("lastModified"))
26726      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
26727    if (json.has("_lastModified"))
26728      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
26729    if (json.has("requester"))
26730      res.setRequester(parseReference(json.getAsJsonObject("requester")));
26731    if (json.has("performerType")) {
26732      JsonArray array = json.getAsJsonArray("performerType");
26733      for (int i = 0; i < array.size(); i++) {
26734        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26735      }
26736    };
26737    if (json.has("owner"))
26738      res.setOwner(parseReference(json.getAsJsonObject("owner")));
26739    if (json.has("location"))
26740      res.setLocation(parseReference(json.getAsJsonObject("location")));
26741    if (json.has("reasonCode"))
26742      res.setReasonCode(parseCodeableConcept(json.getAsJsonObject("reasonCode")));
26743    if (json.has("reasonReference"))
26744      res.setReasonReference(parseReference(json.getAsJsonObject("reasonReference")));
26745    if (json.has("insurance")) {
26746      JsonArray array = json.getAsJsonArray("insurance");
26747      for (int i = 0; i < array.size(); i++) {
26748        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
26749      }
26750    };
26751    if (json.has("note")) {
26752      JsonArray array = json.getAsJsonArray("note");
26753      for (int i = 0; i < array.size(); i++) {
26754        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
26755      }
26756    };
26757    if (json.has("relevantHistory")) {
26758      JsonArray array = json.getAsJsonArray("relevantHistory");
26759      for (int i = 0; i < array.size(); i++) {
26760        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
26761      }
26762    };
26763    if (json.has("restriction"))
26764      res.setRestriction(parseTaskRestrictionComponent(json.getAsJsonObject("restriction")));
26765    if (json.has("input")) {
26766      JsonArray array = json.getAsJsonArray("input");
26767      for (int i = 0; i < array.size(); i++) {
26768        res.getInput().add(parseTaskParameterComponent(array.get(i).getAsJsonObject()));
26769      }
26770    };
26771    if (json.has("output")) {
26772      JsonArray array = json.getAsJsonArray("output");
26773      for (int i = 0; i < array.size(); i++) {
26774        res.getOutput().add(parseTaskOutputComponent(array.get(i).getAsJsonObject()));
26775      }
26776    };
26777  }
26778
26779  protected Task.TaskRestrictionComponent parseTaskRestrictionComponent(JsonObject json) throws IOException, FHIRFormatError {
26780    Task.TaskRestrictionComponent res = new Task.TaskRestrictionComponent();
26781    parseTaskRestrictionComponentProperties(json, res);
26782    return res;
26783  }
26784
26785  protected void parseTaskRestrictionComponentProperties(JsonObject json, Task.TaskRestrictionComponent res) throws IOException, FHIRFormatError {
26786    parseBackboneElementProperties(json, res);
26787    if (json.has("repetitions"))
26788      res.setRepetitionsElement(parsePositiveInt(json.get("repetitions").getAsString()));
26789    if (json.has("_repetitions"))
26790      parseElementProperties(json.getAsJsonObject("_repetitions"), res.getRepetitionsElement());
26791    if (json.has("period"))
26792      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
26793    if (json.has("recipient")) {
26794      JsonArray array = json.getAsJsonArray("recipient");
26795      for (int i = 0; i < array.size(); i++) {
26796        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
26797      }
26798    };
26799  }
26800
26801  protected Task.ParameterComponent parseTaskParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
26802    Task.ParameterComponent res = new Task.ParameterComponent();
26803    parseTaskParameterComponentProperties(json, res);
26804    return res;
26805  }
26806
26807  protected void parseTaskParameterComponentProperties(JsonObject json, Task.ParameterComponent res) throws IOException, FHIRFormatError {
26808    parseBackboneElementProperties(json, res);
26809    if (json.has("type"))
26810      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
26811    DataType value = parseType("value", json);
26812    if (value != null)
26813      res.setValue(value);
26814  }
26815
26816  protected Task.TaskOutputComponent parseTaskOutputComponent(JsonObject json) throws IOException, FHIRFormatError {
26817    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
26818    parseTaskOutputComponentProperties(json, res);
26819    return res;
26820  }
26821
26822  protected void parseTaskOutputComponentProperties(JsonObject json, Task.TaskOutputComponent res) throws IOException, FHIRFormatError {
26823    parseBackboneElementProperties(json, res);
26824    if (json.has("type"))
26825      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
26826    DataType value = parseType("value", json);
26827    if (value != null)
26828      res.setValue(value);
26829  }
26830
26831  protected TerminologyCapabilities parseTerminologyCapabilities(JsonObject json) throws IOException, FHIRFormatError {
26832    TerminologyCapabilities res = new TerminologyCapabilities();
26833    parseTerminologyCapabilitiesProperties(json, res);
26834    return res;
26835  }
26836
26837  protected void parseTerminologyCapabilitiesProperties(JsonObject json, TerminologyCapabilities res) throws IOException, FHIRFormatError {
26838    parseCanonicalResourceProperties(json, res);
26839    if (json.has("url"))
26840      res.setUrlElement(parseUri(json.get("url").getAsString()));
26841    if (json.has("_url"))
26842      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
26843    if (json.has("version"))
26844      res.setVersionElement(parseString(json.get("version").getAsString()));
26845    if (json.has("_version"))
26846      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
26847    if (json.has("name"))
26848      res.setNameElement(parseString(json.get("name").getAsString()));
26849    if (json.has("_name"))
26850      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26851    if (json.has("title"))
26852      res.setTitleElement(parseString(json.get("title").getAsString()));
26853    if (json.has("_title"))
26854      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
26855    if (json.has("status"))
26856      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
26857    if (json.has("_status"))
26858      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
26859    if (json.has("experimental"))
26860      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
26861    if (json.has("_experimental"))
26862      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
26863    if (json.has("date"))
26864      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26865    if (json.has("_date"))
26866      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
26867    if (json.has("publisher"))
26868      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
26869    if (json.has("_publisher"))
26870      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
26871    if (json.has("contact")) {
26872      JsonArray array = json.getAsJsonArray("contact");
26873      for (int i = 0; i < array.size(); i++) {
26874        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
26875      }
26876    };
26877    if (json.has("description"))
26878      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26879    if (json.has("_description"))
26880      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26881    if (json.has("useContext")) {
26882      JsonArray array = json.getAsJsonArray("useContext");
26883      for (int i = 0; i < array.size(); i++) {
26884        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
26885      }
26886    };
26887    if (json.has("jurisdiction")) {
26888      JsonArray array = json.getAsJsonArray("jurisdiction");
26889      for (int i = 0; i < array.size(); i++) {
26890        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26891      }
26892    };
26893    if (json.has("purpose"))
26894      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
26895    if (json.has("_purpose"))
26896      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
26897    if (json.has("copyright"))
26898      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
26899    if (json.has("_copyright"))
26900      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
26901    if (json.has("kind"))
26902      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), Enumerations.CapabilityStatementKind.NULL, new Enumerations.CapabilityStatementKindEnumFactory()));
26903    if (json.has("_kind"))
26904      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
26905    if (json.has("software"))
26906      res.setSoftware(parseTerminologyCapabilitiesSoftwareComponent(json.getAsJsonObject("software")));
26907    if (json.has("implementation"))
26908      res.setImplementation(parseTerminologyCapabilitiesImplementationComponent(json.getAsJsonObject("implementation")));
26909    if (json.has("lockedDate"))
26910      res.setLockedDateElement(parseBoolean(json.get("lockedDate").getAsBoolean()));
26911    if (json.has("_lockedDate"))
26912      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
26913    if (json.has("codeSystem")) {
26914      JsonArray array = json.getAsJsonArray("codeSystem");
26915      for (int i = 0; i < array.size(); i++) {
26916        res.getCodeSystem().add(parseTerminologyCapabilitiesCodeSystemComponent(array.get(i).getAsJsonObject()));
26917      }
26918    };
26919    if (json.has("expansion"))
26920      res.setExpansion(parseTerminologyCapabilitiesExpansionComponent(json.getAsJsonObject("expansion")));
26921    if (json.has("codeSearch"))
26922      res.setCodeSearchElement(parseEnumeration(json.get("codeSearch").getAsString(), TerminologyCapabilities.CodeSearchSupport.NULL, new TerminologyCapabilities.CodeSearchSupportEnumFactory()));
26923    if (json.has("_codeSearch"))
26924      parseElementProperties(json.getAsJsonObject("_codeSearch"), res.getCodeSearchElement());
26925    if (json.has("validateCode"))
26926      res.setValidateCode(parseTerminologyCapabilitiesValidateCodeComponent(json.getAsJsonObject("validateCode")));
26927    if (json.has("translation"))
26928      res.setTranslation(parseTerminologyCapabilitiesTranslationComponent(json.getAsJsonObject("translation")));
26929    if (json.has("closure"))
26930      res.setClosure(parseTerminologyCapabilitiesClosureComponent(json.getAsJsonObject("closure")));
26931  }
26932
26933  protected TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent parseTerminologyCapabilitiesSoftwareComponent(JsonObject json) throws IOException, FHIRFormatError {
26934    TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res = new TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent();
26935    parseTerminologyCapabilitiesSoftwareComponentProperties(json, res);
26936    return res;
26937  }
26938
26939  protected void parseTerminologyCapabilitiesSoftwareComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res) throws IOException, FHIRFormatError {
26940    parseBackboneElementProperties(json, res);
26941    if (json.has("name"))
26942      res.setNameElement(parseString(json.get("name").getAsString()));
26943    if (json.has("_name"))
26944      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26945    if (json.has("version"))
26946      res.setVersionElement(parseString(json.get("version").getAsString()));
26947    if (json.has("_version"))
26948      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
26949  }
26950
26951  protected TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent parseTerminologyCapabilitiesImplementationComponent(JsonObject json) throws IOException, FHIRFormatError {
26952    TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent();
26953    parseTerminologyCapabilitiesImplementationComponentProperties(json, res);
26954    return res;
26955  }
26956
26957  protected void parseTerminologyCapabilitiesImplementationComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res) throws IOException, FHIRFormatError {
26958    parseBackboneElementProperties(json, res);
26959    if (json.has("description"))
26960      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26961    if (json.has("_description"))
26962      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26963    if (json.has("url"))
26964      res.setUrlElement(parseUrl(json.get("url").getAsString()));
26965    if (json.has("_url"))
26966      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
26967  }
26968
26969  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent parseTerminologyCapabilitiesCodeSystemComponent(JsonObject json) throws IOException, FHIRFormatError {
26970    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent();
26971    parseTerminologyCapabilitiesCodeSystemComponentProperties(json, res);
26972    return res;
26973  }
26974
26975  protected void parseTerminologyCapabilitiesCodeSystemComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res) throws IOException, FHIRFormatError {
26976    parseBackboneElementProperties(json, res);
26977    if (json.has("uri"))
26978      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
26979    if (json.has("_uri"))
26980      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
26981    if (json.has("version")) {
26982      JsonArray array = json.getAsJsonArray("version");
26983      for (int i = 0; i < array.size(); i++) {
26984        res.getVersion().add(parseTerminologyCapabilitiesCodeSystemVersionComponent(array.get(i).getAsJsonObject()));
26985      }
26986    };
26987    if (json.has("subsumption"))
26988      res.setSubsumptionElement(parseBoolean(json.get("subsumption").getAsBoolean()));
26989    if (json.has("_subsumption"))
26990      parseElementProperties(json.getAsJsonObject("_subsumption"), res.getSubsumptionElement());
26991  }
26992
26993  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent parseTerminologyCapabilitiesCodeSystemVersionComponent(JsonObject json) throws IOException, FHIRFormatError {
26994    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent();
26995    parseTerminologyCapabilitiesCodeSystemVersionComponentProperties(json, res);
26996    return res;
26997  }
26998
26999  protected void parseTerminologyCapabilitiesCodeSystemVersionComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res) throws IOException, FHIRFormatError {
27000    parseBackboneElementProperties(json, res);
27001    if (json.has("code"))
27002      res.setCodeElement(parseString(json.get("code").getAsString()));
27003    if (json.has("_code"))
27004      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
27005    if (json.has("isDefault"))
27006      res.setIsDefaultElement(parseBoolean(json.get("isDefault").getAsBoolean()));
27007    if (json.has("_isDefault"))
27008      parseElementProperties(json.getAsJsonObject("_isDefault"), res.getIsDefaultElement());
27009    if (json.has("compositional"))
27010      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
27011    if (json.has("_compositional"))
27012      parseElementProperties(json.getAsJsonObject("_compositional"), res.getCompositionalElement());
27013    if (json.has("language")) {
27014      JsonArray array = json.getAsJsonArray("language");
27015      for (int i = 0; i < array.size(); i++) {
27016        if (array.get(i).isJsonNull()) {
27017          res.getLanguage().add(new CodeType());
27018        } else {;
27019          res.getLanguage().add(parseCode(array.get(i).getAsString()));
27020        }
27021      }
27022    };
27023    if (json.has("_language")) {
27024      JsonArray array = json.getAsJsonArray("_language");
27025      for (int i = 0; i < array.size(); i++) {
27026        if (i == res.getLanguage().size())
27027          res.getLanguage().add(parseCode(null));
27028        if (array.get(i) instanceof JsonObject) 
27029          parseElementProperties(array.get(i).getAsJsonObject(), res.getLanguage().get(i));
27030      }
27031    };
27032    if (json.has("filter")) {
27033      JsonArray array = json.getAsJsonArray("filter");
27034      for (int i = 0; i < array.size(); i++) {
27035        res.getFilter().add(parseTerminologyCapabilitiesCodeSystemVersionFilterComponent(array.get(i).getAsJsonObject()));
27036      }
27037    };
27038    if (json.has("property")) {
27039      JsonArray array = json.getAsJsonArray("property");
27040      for (int i = 0; i < array.size(); i++) {
27041        if (array.get(i).isJsonNull()) {
27042          res.getProperty().add(new CodeType());
27043        } else {;
27044          res.getProperty().add(parseCode(array.get(i).getAsString()));
27045        }
27046      }
27047    };
27048    if (json.has("_property")) {
27049      JsonArray array = json.getAsJsonArray("_property");
27050      for (int i = 0; i < array.size(); i++) {
27051        if (i == res.getProperty().size())
27052          res.getProperty().add(parseCode(null));
27053        if (array.get(i) instanceof JsonObject) 
27054          parseElementProperties(array.get(i).getAsJsonObject(), res.getProperty().get(i));
27055      }
27056    };
27057  }
27058
27059  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent parseTerminologyCapabilitiesCodeSystemVersionFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
27060    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent();
27061    parseTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(json, res);
27062    return res;
27063  }
27064
27065  protected void parseTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res) throws IOException, FHIRFormatError {
27066    parseBackboneElementProperties(json, res);
27067    if (json.has("code"))
27068      res.setCodeElement(parseCode(json.get("code").getAsString()));
27069    if (json.has("_code"))
27070      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
27071    if (json.has("op")) {
27072      JsonArray array = json.getAsJsonArray("op");
27073      for (int i = 0; i < array.size(); i++) {
27074        if (array.get(i).isJsonNull()) {
27075          res.getOp().add(new CodeType());
27076        } else {;
27077          res.getOp().add(parseCode(array.get(i).getAsString()));
27078        }
27079      }
27080    };
27081    if (json.has("_op")) {
27082      JsonArray array = json.getAsJsonArray("_op");
27083      for (int i = 0; i < array.size(); i++) {
27084        if (i == res.getOp().size())
27085          res.getOp().add(parseCode(null));
27086        if (array.get(i) instanceof JsonObject) 
27087          parseElementProperties(array.get(i).getAsJsonObject(), res.getOp().get(i));
27088      }
27089    };
27090  }
27091
27092  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent parseTerminologyCapabilitiesExpansionComponent(JsonObject json) throws IOException, FHIRFormatError {
27093    TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent();
27094    parseTerminologyCapabilitiesExpansionComponentProperties(json, res);
27095    return res;
27096  }
27097
27098  protected void parseTerminologyCapabilitiesExpansionComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res) throws IOException, FHIRFormatError {
27099    parseBackboneElementProperties(json, res);
27100    if (json.has("hierarchical"))
27101      res.setHierarchicalElement(parseBoolean(json.get("hierarchical").getAsBoolean()));
27102    if (json.has("_hierarchical"))
27103      parseElementProperties(json.getAsJsonObject("_hierarchical"), res.getHierarchicalElement());
27104    if (json.has("paging"))
27105      res.setPagingElement(parseBoolean(json.get("paging").getAsBoolean()));
27106    if (json.has("_paging"))
27107      parseElementProperties(json.getAsJsonObject("_paging"), res.getPagingElement());
27108    if (json.has("incomplete"))
27109      res.setIncompleteElement(parseBoolean(json.get("incomplete").getAsBoolean()));
27110    if (json.has("_incomplete"))
27111      parseElementProperties(json.getAsJsonObject("_incomplete"), res.getIncompleteElement());
27112    if (json.has("parameter")) {
27113      JsonArray array = json.getAsJsonArray("parameter");
27114      for (int i = 0; i < array.size(); i++) {
27115        res.getParameter().add(parseTerminologyCapabilitiesExpansionParameterComponent(array.get(i).getAsJsonObject()));
27116      }
27117    };
27118    if (json.has("textFilter"))
27119      res.setTextFilterElement(parseMarkdown(json.get("textFilter").getAsString()));
27120    if (json.has("_textFilter"))
27121      parseElementProperties(json.getAsJsonObject("_textFilter"), res.getTextFilterElement());
27122  }
27123
27124  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent parseTerminologyCapabilitiesExpansionParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
27125    TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent();
27126    parseTerminologyCapabilitiesExpansionParameterComponentProperties(json, res);
27127    return res;
27128  }
27129
27130  protected void parseTerminologyCapabilitiesExpansionParameterComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res) throws IOException, FHIRFormatError {
27131    parseBackboneElementProperties(json, res);
27132    if (json.has("name"))
27133      res.setNameElement(parseCode(json.get("name").getAsString()));
27134    if (json.has("_name"))
27135      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
27136    if (json.has("documentation"))
27137      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
27138    if (json.has("_documentation"))
27139      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
27140  }
27141
27142  protected TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent parseTerminologyCapabilitiesValidateCodeComponent(JsonObject json) throws IOException, FHIRFormatError {
27143    TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res = new TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent();
27144    parseTerminologyCapabilitiesValidateCodeComponentProperties(json, res);
27145    return res;
27146  }
27147
27148  protected void parseTerminologyCapabilitiesValidateCodeComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res) throws IOException, FHIRFormatError {
27149    parseBackboneElementProperties(json, res);
27150    if (json.has("translations"))
27151      res.setTranslationsElement(parseBoolean(json.get("translations").getAsBoolean()));
27152    if (json.has("_translations"))
27153      parseElementProperties(json.getAsJsonObject("_translations"), res.getTranslationsElement());
27154  }
27155
27156  protected TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent parseTerminologyCapabilitiesTranslationComponent(JsonObject json) throws IOException, FHIRFormatError {
27157    TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent();
27158    parseTerminologyCapabilitiesTranslationComponentProperties(json, res);
27159    return res;
27160  }
27161
27162  protected void parseTerminologyCapabilitiesTranslationComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res) throws IOException, FHIRFormatError {
27163    parseBackboneElementProperties(json, res);
27164    if (json.has("needsMap"))
27165      res.setNeedsMapElement(parseBoolean(json.get("needsMap").getAsBoolean()));
27166    if (json.has("_needsMap"))
27167      parseElementProperties(json.getAsJsonObject("_needsMap"), res.getNeedsMapElement());
27168  }
27169
27170  protected TerminologyCapabilities.TerminologyCapabilitiesClosureComponent parseTerminologyCapabilitiesClosureComponent(JsonObject json) throws IOException, FHIRFormatError {
27171    TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res = new TerminologyCapabilities.TerminologyCapabilitiesClosureComponent();
27172    parseTerminologyCapabilitiesClosureComponentProperties(json, res);
27173    return res;
27174  }
27175
27176  protected void parseTerminologyCapabilitiesClosureComponentProperties(JsonObject json, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res) throws IOException, FHIRFormatError {
27177    parseBackboneElementProperties(json, res);
27178    if (json.has("translation"))
27179      res.setTranslationElement(parseBoolean(json.get("translation").getAsBoolean()));
27180    if (json.has("_translation"))
27181      parseElementProperties(json.getAsJsonObject("_translation"), res.getTranslationElement());
27182  }
27183
27184  protected TestReport parseTestReport(JsonObject json) throws IOException, FHIRFormatError {
27185    TestReport res = new TestReport();
27186    parseTestReportProperties(json, res);
27187    return res;
27188  }
27189
27190  protected void parseTestReportProperties(JsonObject json, TestReport res) throws IOException, FHIRFormatError {
27191    parseDomainResourceProperties(json, res);
27192    if (json.has("identifier"))
27193      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
27194    if (json.has("name"))
27195      res.setNameElement(parseString(json.get("name").getAsString()));
27196    if (json.has("_name"))
27197      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
27198    if (json.has("status"))
27199      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), TestReport.TestReportStatus.NULL, new TestReport.TestReportStatusEnumFactory()));
27200    if (json.has("_status"))
27201      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
27202    if (json.has("testScript"))
27203      res.setTestScript(parseReference(json.getAsJsonObject("testScript")));
27204    if (json.has("result"))
27205      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportResult.NULL, new TestReport.TestReportResultEnumFactory()));
27206    if (json.has("_result"))
27207      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
27208    if (json.has("score"))
27209      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
27210    if (json.has("_score"))
27211      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
27212    if (json.has("tester"))
27213      res.setTesterElement(parseString(json.get("tester").getAsString()));
27214    if (json.has("_tester"))
27215      parseElementProperties(json.getAsJsonObject("_tester"), res.getTesterElement());
27216    if (json.has("issued"))
27217      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
27218    if (json.has("_issued"))
27219      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
27220    if (json.has("participant")) {
27221      JsonArray array = json.getAsJsonArray("participant");
27222      for (int i = 0; i < array.size(); i++) {
27223        res.getParticipant().add(parseTestReportParticipantComponent(array.get(i).getAsJsonObject()));
27224      }
27225    };
27226    if (json.has("setup"))
27227      res.setSetup(parseTestReportSetupComponent(json.getAsJsonObject("setup")));
27228    if (json.has("test")) {
27229      JsonArray array = json.getAsJsonArray("test");
27230      for (int i = 0; i < array.size(); i++) {
27231        res.getTest().add(parseTestReportTestComponent(array.get(i).getAsJsonObject()));
27232      }
27233    };
27234    if (json.has("teardown"))
27235      res.setTeardown(parseTestReportTeardownComponent(json.getAsJsonObject("teardown")));
27236  }
27237
27238  protected TestReport.TestReportParticipantComponent parseTestReportParticipantComponent(JsonObject json) throws IOException, FHIRFormatError {
27239    TestReport.TestReportParticipantComponent res = new TestReport.TestReportParticipantComponent();
27240    parseTestReportParticipantComponentProperties(json, res);
27241    return res;
27242  }
27243
27244  protected void parseTestReportParticipantComponentProperties(JsonObject json, TestReport.TestReportParticipantComponent res) throws IOException, FHIRFormatError {
27245    parseBackboneElementProperties(json, res);
27246    if (json.has("type"))
27247      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TestReport.TestReportParticipantType.NULL, new TestReport.TestReportParticipantTypeEnumFactory()));
27248    if (json.has("_type"))
27249      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
27250    if (json.has("uri"))
27251      res.setUriElement(parseUri(json.get("uri").getAsString()));
27252    if (json.has("_uri"))
27253      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
27254    if (json.has("display"))
27255      res.setDisplayElement(parseString(json.get("display").getAsString()));
27256    if (json.has("_display"))
27257      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
27258  }
27259
27260  protected TestReport.TestReportSetupComponent parseTestReportSetupComponent(JsonObject json) throws IOException, FHIRFormatError {
27261    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
27262    parseTestReportSetupComponentProperties(json, res);
27263    return res;
27264  }
27265
27266  protected void parseTestReportSetupComponentProperties(JsonObject json, TestReport.TestReportSetupComponent res) throws IOException, FHIRFormatError {
27267    parseBackboneElementProperties(json, res);
27268    if (json.has("action")) {
27269      JsonArray array = json.getAsJsonArray("action");
27270      for (int i = 0; i < array.size(); i++) {
27271        res.getAction().add(parseTestReportSetupActionComponent(array.get(i).getAsJsonObject()));
27272      }
27273    };
27274  }
27275
27276  protected TestReport.SetupActionComponent parseTestReportSetupActionComponent(JsonObject json) throws IOException, FHIRFormatError {
27277    TestReport.SetupActionComponent res = new TestReport.SetupActionComponent();
27278    parseTestReportSetupActionComponentProperties(json, res);
27279    return res;
27280  }
27281
27282  protected void parseTestReportSetupActionComponentProperties(JsonObject json, TestReport.SetupActionComponent res) throws IOException, FHIRFormatError {
27283    parseBackboneElementProperties(json, res);
27284    if (json.has("operation"))
27285      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation")));
27286    if (json.has("assert"))
27287      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert")));
27288  }
27289
27290  protected TestReport.SetupActionOperationComponent parseTestReportSetupActionOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
27291    TestReport.SetupActionOperationComponent res = new TestReport.SetupActionOperationComponent();
27292    parseTestReportSetupActionOperationComponentProperties(json, res);
27293    return res;
27294  }
27295
27296  protected void parseTestReportSetupActionOperationComponentProperties(JsonObject json, TestReport.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
27297    parseBackboneElementProperties(json, res);
27298    if (json.has("result"))
27299      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
27300    if (json.has("_result"))
27301      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
27302    if (json.has("message"))
27303      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
27304    if (json.has("_message"))
27305      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
27306    if (json.has("detail"))
27307      res.setDetailElement(parseUri(json.get("detail").getAsString()));
27308    if (json.has("_detail"))
27309      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
27310  }
27311
27312  protected TestReport.SetupActionAssertComponent parseTestReportSetupActionAssertComponent(JsonObject json) throws IOException, FHIRFormatError {
27313    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
27314    parseTestReportSetupActionAssertComponentProperties(json, res);
27315    return res;
27316  }
27317
27318  protected void parseTestReportSetupActionAssertComponentProperties(JsonObject json, TestReport.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
27319    parseBackboneElementProperties(json, res);
27320    if (json.has("result"))
27321      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
27322    if (json.has("_result"))
27323      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
27324    if (json.has("message"))
27325      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
27326    if (json.has("_message"))
27327      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
27328    if (json.has("detail"))
27329      res.setDetailElement(parseString(json.get("detail").getAsString()));
27330    if (json.has("_detail"))
27331      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
27332  }
27333
27334  protected TestReport.TestReportTestComponent parseTestReportTestComponent(JsonObject json) throws IOException, FHIRFormatError {
27335    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
27336    parseTestReportTestComponentProperties(json, res);
27337    return res;
27338  }
27339
27340  protected void parseTestReportTestComponentProperties(JsonObject json, TestReport.TestReportTestComponent res) throws IOException, FHIRFormatError {
27341    parseBackboneElementProperties(json, res);
27342    if (json.has("name"))
27343      res.setNameElement(parseString(json.get("name").getAsString()));
27344    if (json.has("_name"))
27345      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
27346    if (json.has("description"))
27347      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27348    if (json.has("_description"))
27349      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
27350    if (json.has("action")) {
27351      JsonArray array = json.getAsJsonArray("action");
27352      for (int i = 0; i < array.size(); i++) {
27353        res.getAction().add(parseTestReportTestActionComponent(array.get(i).getAsJsonObject()));
27354      }
27355    };
27356  }
27357
27358  protected TestReport.TestActionComponent parseTestReportTestActionComponent(JsonObject json) throws IOException, FHIRFormatError {
27359    TestReport.TestActionComponent res = new TestReport.TestActionComponent();
27360    parseTestReportTestActionComponentProperties(json, res);
27361    return res;
27362  }
27363
27364  protected void parseTestReportTestActionComponentProperties(JsonObject json, TestReport.TestActionComponent res) throws IOException, FHIRFormatError {
27365    parseBackboneElementProperties(json, res);
27366    if (json.has("operation"))
27367      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation")));
27368    if (json.has("assert"))
27369      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert")));
27370  }
27371
27372  protected TestReport.TestReportTeardownComponent parseTestReportTeardownComponent(JsonObject json) throws IOException, FHIRFormatError {
27373    TestReport.TestReportTeardownComponent res = new TestReport.TestReportTeardownComponent();
27374    parseTestReportTeardownComponentProperties(json, res);
27375    return res;
27376  }
27377
27378  protected void parseTestReportTeardownComponentProperties(JsonObject json, TestReport.TestReportTeardownComponent res) throws IOException, FHIRFormatError {
27379    parseBackboneElementProperties(json, res);
27380    if (json.has("action")) {
27381      JsonArray array = json.getAsJsonArray("action");
27382      for (int i = 0; i < array.size(); i++) {
27383        res.getAction().add(parseTestReportTeardownActionComponent(array.get(i).getAsJsonObject()));
27384      }
27385    };
27386  }
27387
27388  protected TestReport.TeardownActionComponent parseTestReportTeardownActionComponent(JsonObject json) throws IOException, FHIRFormatError {
27389    TestReport.TeardownActionComponent res = new TestReport.TeardownActionComponent();
27390    parseTestReportTeardownActionComponentProperties(json, res);
27391    return res;
27392  }
27393
27394  protected void parseTestReportTeardownActionComponentProperties(JsonObject json, TestReport.TeardownActionComponent res) throws IOException, FHIRFormatError {
27395    parseBackboneElementProperties(json, res);
27396    if (json.has("operation"))
27397      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation")));
27398  }
27399
27400  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
27401    TestScript res = new TestScript();
27402    parseTestScriptProperties(json, res);
27403    return res;
27404  }
27405
27406  protected void parseTestScriptProperties(JsonObject json, TestScript res) throws IOException, FHIRFormatError {
27407    parseCanonicalResourceProperties(json, res);
27408    if (json.has("url"))
27409      res.setUrlElement(parseUri(json.get("url").getAsString()));
27410    if (json.has("_url"))
27411      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
27412    if (json.has("identifier"))
27413      res.addIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
27414    if (json.has("version"))
27415      res.setVersionElement(parseString(json.get("version").getAsString()));
27416    if (json.has("_version"))
27417      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
27418    if (json.has("name"))
27419      res.setNameElement(parseString(json.get("name").getAsString()));
27420    if (json.has("_name"))
27421      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
27422    if (json.has("title"))
27423      res.setTitleElement(parseString(json.get("title").getAsString()));
27424    if (json.has("_title"))
27425      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
27426    if (json.has("status"))
27427      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
27428    if (json.has("_status"))
27429      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
27430    if (json.has("experimental"))
27431      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
27432    if (json.has("_experimental"))
27433      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
27434    if (json.has("date"))
27435      res.setDateElement(parseDateTime(json.get("date").getAsString()));
27436    if (json.has("_date"))
27437      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
27438    if (json.has("publisher"))
27439      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
27440    if (json.has("_publisher"))
27441      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
27442    if (json.has("contact")) {
27443      JsonArray array = json.getAsJsonArray("contact");
27444      for (int i = 0; i < array.size(); i++) {
27445        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
27446      }
27447    };
27448    if (json.has("description"))
27449      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
27450    if (json.has("_description"))
27451      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
27452    if (json.has("useContext")) {
27453      JsonArray array = json.getAsJsonArray("useContext");
27454      for (int i = 0; i < array.size(); i++) {
27455        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
27456      }
27457    };
27458    if (json.has("jurisdiction")) {
27459      JsonArray array = json.getAsJsonArray("jurisdiction");
27460      for (int i = 0; i < array.size(); i++) {
27461        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27462      }
27463    };
27464    if (json.has("purpose"))
27465      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
27466    if (json.has("_purpose"))
27467      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
27468    if (json.has("copyright"))
27469      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
27470    if (json.has("_copyright"))
27471      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
27472    if (json.has("origin")) {
27473      JsonArray array = json.getAsJsonArray("origin");
27474      for (int i = 0; i < array.size(); i++) {
27475        res.getOrigin().add(parseTestScriptOriginComponent(array.get(i).getAsJsonObject()));
27476      }
27477    };
27478    if (json.has("destination")) {
27479      JsonArray array = json.getAsJsonArray("destination");
27480      for (int i = 0; i < array.size(); i++) {
27481        res.getDestination().add(parseTestScriptDestinationComponent(array.get(i).getAsJsonObject()));
27482      }
27483    };
27484    if (json.has("metadata"))
27485      res.setMetadata(parseTestScriptMetadataComponent(json.getAsJsonObject("metadata")));
27486    if (json.has("fixture")) {
27487      JsonArray array = json.getAsJsonArray("fixture");
27488      for (int i = 0; i < array.size(); i++) {
27489        res.getFixture().add(parseTestScriptFixtureComponent(array.get(i).getAsJsonObject()));
27490      }
27491    };
27492    if (json.has("profile")) {
27493      JsonArray array = json.getAsJsonArray("profile");
27494      for (int i = 0; i < array.size(); i++) {
27495        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
27496      }
27497    };
27498    if (json.has("variable")) {
27499      JsonArray array = json.getAsJsonArray("variable");
27500      for (int i = 0; i < array.size(); i++) {
27501        res.getVariable().add(parseTestScriptVariableComponent(array.get(i).getAsJsonObject()));
27502      }
27503    };
27504    if (json.has("setup"))
27505      res.setSetup(parseTestScriptSetupComponent(json.getAsJsonObject("setup")));
27506    if (json.has("test")) {
27507      JsonArray array = json.getAsJsonArray("test");
27508      for (int i = 0; i < array.size(); i++) {
27509        res.getTest().add(parseTestScriptTestComponent(array.get(i).getAsJsonObject()));
27510      }
27511    };
27512    if (json.has("teardown"))
27513      res.setTeardown(parseTestScriptTeardownComponent(json.getAsJsonObject("teardown")));
27514  }
27515
27516  protected TestScript.TestScriptOriginComponent parseTestScriptOriginComponent(JsonObject json) throws IOException, FHIRFormatError {
27517    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
27518    parseTestScriptOriginComponentProperties(json, res);
27519    return res;
27520  }
27521
27522  protected void parseTestScriptOriginComponentProperties(JsonObject json, TestScript.TestScriptOriginComponent res) throws IOException, FHIRFormatError {
27523    parseBackboneElementProperties(json, res);
27524    if (json.has("index"))
27525      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
27526    if (json.has("_index"))
27527      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
27528    if (json.has("profile"))
27529      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
27530  }
27531
27532  protected TestScript.TestScriptDestinationComponent parseTestScriptDestinationComponent(JsonObject json) throws IOException, FHIRFormatError {
27533    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
27534    parseTestScriptDestinationComponentProperties(json, res);
27535    return res;
27536  }
27537
27538  protected void parseTestScriptDestinationComponentProperties(JsonObject json, TestScript.TestScriptDestinationComponent res) throws IOException, FHIRFormatError {
27539    parseBackboneElementProperties(json, res);
27540    if (json.has("index"))
27541      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
27542    if (json.has("_index"))
27543      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
27544    if (json.has("profile"))
27545      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
27546  }
27547
27548  protected TestScript.TestScriptMetadataComponent parseTestScriptMetadataComponent(JsonObject json) throws IOException, FHIRFormatError {
27549    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
27550    parseTestScriptMetadataComponentProperties(json, res);
27551    return res;
27552  }
27553
27554  protected void parseTestScriptMetadataComponentProperties(JsonObject json, TestScript.TestScriptMetadataComponent res) throws IOException, FHIRFormatError {
27555    parseBackboneElementProperties(json, res);
27556    if (json.has("link")) {
27557      JsonArray array = json.getAsJsonArray("link");
27558      for (int i = 0; i < array.size(); i++) {
27559        res.getLink().add(parseTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject()));
27560      }
27561    };
27562    if (json.has("capability")) {
27563      JsonArray array = json.getAsJsonArray("capability");
27564      for (int i = 0; i < array.size(); i++) {
27565        res.getCapability().add(parseTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject()));
27566      }
27567    };
27568  }
27569
27570  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptMetadataLinkComponent(JsonObject json) throws IOException, FHIRFormatError {
27571    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
27572    parseTestScriptMetadataLinkComponentProperties(json, res);
27573    return res;
27574  }
27575
27576  protected void parseTestScriptMetadataLinkComponentProperties(JsonObject json, TestScript.TestScriptMetadataLinkComponent res) throws IOException, FHIRFormatError {
27577    parseBackboneElementProperties(json, res);
27578    if (json.has("url"))
27579      res.setUrlElement(parseUri(json.get("url").getAsString()));
27580    if (json.has("_url"))
27581      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
27582    if (json.has("description"))
27583      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27584    if (json.has("_description"))
27585      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
27586  }
27587
27588  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptMetadataCapabilityComponent(JsonObject json) throws IOException, FHIRFormatError {
27589    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
27590    parseTestScriptMetadataCapabilityComponentProperties(json, res);
27591    return res;
27592  }
27593
27594  protected void parseTestScriptMetadataCapabilityComponentProperties(JsonObject json, TestScript.TestScriptMetadataCapabilityComponent res) throws IOException, FHIRFormatError {
27595    parseBackboneElementProperties(json, res);
27596    if (json.has("required"))
27597      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
27598    if (json.has("_required"))
27599      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
27600    if (json.has("validated"))
27601      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
27602    if (json.has("_validated"))
27603      parseElementProperties(json.getAsJsonObject("_validated"), res.getValidatedElement());
27604    if (json.has("description"))
27605      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27606    if (json.has("_description"))
27607      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
27608    if (json.has("origin")) {
27609      JsonArray array = json.getAsJsonArray("origin");
27610      for (int i = 0; i < array.size(); i++) {
27611        if (array.get(i).isJsonNull()) {
27612          res.getOrigin().add(new IntegerType());
27613        } else {;
27614          res.getOrigin().add(parseInteger(array.get(i).getAsLong()));
27615        }
27616      }
27617    };
27618    if (json.has("_origin")) {
27619      JsonArray array = json.getAsJsonArray("_origin");
27620      for (int i = 0; i < array.size(); i++) {
27621        if (i == res.getOrigin().size())
27622          res.getOrigin().add(parseInteger(null));
27623        if (array.get(i) instanceof JsonObject) 
27624          parseElementProperties(array.get(i).getAsJsonObject(), res.getOrigin().get(i));
27625      }
27626    };
27627    if (json.has("destination"))
27628      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
27629    if (json.has("_destination"))
27630      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
27631    if (json.has("link")) {
27632      JsonArray array = json.getAsJsonArray("link");
27633      for (int i = 0; i < array.size(); i++) {
27634        if (array.get(i).isJsonNull()) {
27635          res.getLink().add(new UriType());
27636        } else {;
27637          res.getLink().add(parseUri(array.get(i).getAsString()));
27638        }
27639      }
27640    };
27641    if (json.has("_link")) {
27642      JsonArray array = json.getAsJsonArray("_link");
27643      for (int i = 0; i < array.size(); i++) {
27644        if (i == res.getLink().size())
27645          res.getLink().add(parseUri(null));
27646        if (array.get(i) instanceof JsonObject) 
27647          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
27648      }
27649    };
27650    if (json.has("capabilities"))
27651      res.setCapabilitiesElement(parseCanonical(json.get("capabilities").getAsString()));
27652    if (json.has("_capabilities"))
27653      parseElementProperties(json.getAsJsonObject("_capabilities"), res.getCapabilitiesElement());
27654  }
27655
27656  protected TestScript.TestScriptFixtureComponent parseTestScriptFixtureComponent(JsonObject json) throws IOException, FHIRFormatError {
27657    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
27658    parseTestScriptFixtureComponentProperties(json, res);
27659    return res;
27660  }
27661
27662  protected void parseTestScriptFixtureComponentProperties(JsonObject json, TestScript.TestScriptFixtureComponent res) throws IOException, FHIRFormatError {
27663    parseBackboneElementProperties(json, res);
27664    if (json.has("autocreate"))
27665      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
27666    if (json.has("_autocreate"))
27667      parseElementProperties(json.getAsJsonObject("_autocreate"), res.getAutocreateElement());
27668    if (json.has("autodelete"))
27669      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
27670    if (json.has("_autodelete"))
27671      parseElementProperties(json.getAsJsonObject("_autodelete"), res.getAutodeleteElement());
27672    if (json.has("resource"))
27673      res.setResource(parseReference(json.getAsJsonObject("resource")));
27674  }
27675
27676  protected TestScript.TestScriptVariableComponent parseTestScriptVariableComponent(JsonObject json) throws IOException, FHIRFormatError {
27677    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
27678    parseTestScriptVariableComponentProperties(json, res);
27679    return res;
27680  }
27681
27682  protected void parseTestScriptVariableComponentProperties(JsonObject json, TestScript.TestScriptVariableComponent res) throws IOException, FHIRFormatError {
27683    parseBackboneElementProperties(json, res);
27684    if (json.has("name"))
27685      res.setNameElement(parseString(json.get("name").getAsString()));
27686    if (json.has("_name"))
27687      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
27688    if (json.has("defaultValue"))
27689      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
27690    if (json.has("_defaultValue"))
27691      parseElementProperties(json.getAsJsonObject("_defaultValue"), res.getDefaultValueElement());
27692    if (json.has("description"))
27693      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27694    if (json.has("_description"))
27695      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
27696    if (json.has("expression"))
27697      res.setExpressionElement(parseString(json.get("expression").getAsString()));
27698    if (json.has("_expression"))
27699      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
27700    if (json.has("headerField"))
27701      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
27702    if (json.has("_headerField"))
27703      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
27704    if (json.has("hint"))
27705      res.setHintElement(parseString(json.get("hint").getAsString()));
27706    if (json.has("_hint"))
27707      parseElementProperties(json.getAsJsonObject("_hint"), res.getHintElement());
27708    if (json.has("path"))
27709      res.setPathElement(parseString(json.get("path").getAsString()));
27710    if (json.has("_path"))
27711      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
27712    if (json.has("sourceId"))
27713      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
27714    if (json.has("_sourceId"))
27715      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
27716  }
27717
27718  protected TestScript.TestScriptSetupComponent parseTestScriptSetupComponent(JsonObject json) throws IOException, FHIRFormatError {
27719    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
27720    parseTestScriptSetupComponentProperties(json, res);
27721    return res;
27722  }
27723
27724  protected void parseTestScriptSetupComponentProperties(JsonObject json, TestScript.TestScriptSetupComponent res) throws IOException, FHIRFormatError {
27725    parseBackboneElementProperties(json, res);
27726    if (json.has("action")) {
27727      JsonArray array = json.getAsJsonArray("action");
27728      for (int i = 0; i < array.size(); i++) {
27729        res.getAction().add(parseTestScriptSetupActionComponent(array.get(i).getAsJsonObject()));
27730      }
27731    };
27732  }
27733
27734  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(JsonObject json) throws IOException, FHIRFormatError {
27735    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
27736    parseTestScriptSetupActionComponentProperties(json, res);
27737    return res;
27738  }
27739
27740  protected void parseTestScriptSetupActionComponentProperties(JsonObject json, TestScript.SetupActionComponent res) throws IOException, FHIRFormatError {
27741    parseBackboneElementProperties(json, res);
27742    if (json.has("operation"))
27743      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation")));
27744    if (json.has("assert"))
27745      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert")));
27746  }
27747
27748  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(JsonObject json) throws IOException, FHIRFormatError {
27749    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
27750    parseTestScriptSetupActionOperationComponentProperties(json, res);
27751    return res;
27752  }
27753
27754  protected void parseTestScriptSetupActionOperationComponentProperties(JsonObject json, TestScript.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
27755    parseBackboneElementProperties(json, res);
27756    if (json.has("type"))
27757      res.setType(parseCoding(json.getAsJsonObject("type")));
27758    if (json.has("resource"))
27759      res.setResourceElement(parseEnumeration(json.get("resource").getAsString(), TestScript.FHIRDefinedType.NULL, new TestScript.FHIRDefinedTypeEnumFactory()));
27760    if (json.has("_resource"))
27761      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
27762    if (json.has("label"))
27763      res.setLabelElement(parseString(json.get("label").getAsString()));
27764    if (json.has("_label"))
27765      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
27766    if (json.has("description"))
27767      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27768    if (json.has("_description"))
27769      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
27770    if (json.has("accept"))
27771      res.setAcceptElement(parseCode(json.get("accept").getAsString()));
27772    if (json.has("_accept"))
27773      parseElementProperties(json.getAsJsonObject("_accept"), res.getAcceptElement());
27774    if (json.has("contentType"))
27775      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
27776    if (json.has("_contentType"))
27777      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
27778    if (json.has("destination"))
27779      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
27780    if (json.has("_destination"))
27781      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
27782    if (json.has("encodeRequestUrl"))
27783      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
27784    if (json.has("_encodeRequestUrl"))
27785      parseElementProperties(json.getAsJsonObject("_encodeRequestUrl"), res.getEncodeRequestUrlElement());
27786    if (json.has("method"))
27787      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
27788    if (json.has("_method"))
27789      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
27790    if (json.has("origin"))
27791      res.setOriginElement(parseInteger(json.get("origin").getAsLong()));
27792    if (json.has("_origin"))
27793      parseElementProperties(json.getAsJsonObject("_origin"), res.getOriginElement());
27794    if (json.has("params"))
27795      res.setParamsElement(parseString(json.get("params").getAsString()));
27796    if (json.has("_params"))
27797      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
27798    if (json.has("requestHeader")) {
27799      JsonArray array = json.getAsJsonArray("requestHeader");
27800      for (int i = 0; i < array.size(); i++) {
27801        res.getRequestHeader().add(parseTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject()));
27802      }
27803    };
27804    if (json.has("requestId"))
27805      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
27806    if (json.has("_requestId"))
27807      parseElementProperties(json.getAsJsonObject("_requestId"), res.getRequestIdElement());
27808    if (json.has("responseId"))
27809      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
27810    if (json.has("_responseId"))
27811      parseElementProperties(json.getAsJsonObject("_responseId"), res.getResponseIdElement());
27812    if (json.has("sourceId"))
27813      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
27814    if (json.has("_sourceId"))
27815      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
27816    if (json.has("targetId"))
27817      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
27818    if (json.has("_targetId"))
27819      parseElementProperties(json.getAsJsonObject("_targetId"), res.getTargetIdElement());
27820    if (json.has("url"))
27821      res.setUrlElement(parseString(json.get("url").getAsString()));
27822    if (json.has("_url"))
27823      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
27824  }
27825
27826  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json) throws IOException, FHIRFormatError {
27827    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
27828    parseTestScriptSetupActionOperationRequestHeaderComponentProperties(json, res);
27829    return res;
27830  }
27831
27832  protected void parseTestScriptSetupActionOperationRequestHeaderComponentProperties(JsonObject json, TestScript.SetupActionOperationRequestHeaderComponent res) throws IOException, FHIRFormatError {
27833    parseBackboneElementProperties(json, res);
27834    if (json.has("field"))
27835      res.setFieldElement(parseString(json.get("field").getAsString()));
27836    if (json.has("_field"))
27837      parseElementProperties(json.getAsJsonObject("_field"), res.getFieldElement());
27838    if (json.has("value"))
27839      res.setValueElement(parseString(json.get("value").getAsString()));
27840    if (json.has("_value"))
27841      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
27842  }
27843
27844  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(JsonObject json) throws IOException, FHIRFormatError {
27845    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
27846    parseTestScriptSetupActionAssertComponentProperties(json, res);
27847    return res;
27848  }
27849
27850  protected void parseTestScriptSetupActionAssertComponentProperties(JsonObject json, TestScript.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
27851    parseBackboneElementProperties(json, res);
27852    if (json.has("label"))
27853      res.setLabelElement(parseString(json.get("label").getAsString()));
27854    if (json.has("_label"))
27855      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
27856    if (json.has("description"))
27857      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27858    if (json.has("_description"))
27859      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
27860    if (json.has("direction"))
27861      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
27862    if (json.has("_direction"))
27863      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
27864    if (json.has("compareToSourceId"))
27865      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
27866    if (json.has("_compareToSourceId"))
27867      parseElementProperties(json.getAsJsonObject("_compareToSourceId"), res.getCompareToSourceIdElement());
27868    if (json.has("compareToSourceExpression"))
27869      res.setCompareToSourceExpressionElement(parseString(json.get("compareToSourceExpression").getAsString()));
27870    if (json.has("_compareToSourceExpression"))
27871      parseElementProperties(json.getAsJsonObject("_compareToSourceExpression"), res.getCompareToSourceExpressionElement());
27872    if (json.has("compareToSourcePath"))
27873      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
27874    if (json.has("_compareToSourcePath"))
27875      parseElementProperties(json.getAsJsonObject("_compareToSourcePath"), res.getCompareToSourcePathElement());
27876    if (json.has("contentType"))
27877      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
27878    if (json.has("_contentType"))
27879      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
27880    if (json.has("expression"))
27881      res.setExpressionElement(parseString(json.get("expression").getAsString()));
27882    if (json.has("_expression"))
27883      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
27884    if (json.has("headerField"))
27885      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
27886    if (json.has("_headerField"))
27887      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
27888    if (json.has("minimumId"))
27889      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
27890    if (json.has("_minimumId"))
27891      parseElementProperties(json.getAsJsonObject("_minimumId"), res.getMinimumIdElement());
27892    if (json.has("navigationLinks"))
27893      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
27894    if (json.has("_navigationLinks"))
27895      parseElementProperties(json.getAsJsonObject("_navigationLinks"), res.getNavigationLinksElement());
27896    if (json.has("operator"))
27897      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
27898    if (json.has("_operator"))
27899      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
27900    if (json.has("path"))
27901      res.setPathElement(parseString(json.get("path").getAsString()));
27902    if (json.has("_path"))
27903      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
27904    if (json.has("requestMethod"))
27905      res.setRequestMethodElement(parseEnumeration(json.get("requestMethod").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
27906    if (json.has("_requestMethod"))
27907      parseElementProperties(json.getAsJsonObject("_requestMethod"), res.getRequestMethodElement());
27908    if (json.has("requestURL"))
27909      res.setRequestURLElement(parseString(json.get("requestURL").getAsString()));
27910    if (json.has("_requestURL"))
27911      parseElementProperties(json.getAsJsonObject("_requestURL"), res.getRequestURLElement());
27912    if (json.has("resource"))
27913      res.setResourceElement(parseEnumeration(json.get("resource").getAsString(), TestScript.FHIRDefinedType.NULL, new TestScript.FHIRDefinedTypeEnumFactory()));
27914    if (json.has("_resource"))
27915      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
27916    if (json.has("response"))
27917      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
27918    if (json.has("_response"))
27919      parseElementProperties(json.getAsJsonObject("_response"), res.getResponseElement());
27920    if (json.has("responseCode"))
27921      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
27922    if (json.has("_responseCode"))
27923      parseElementProperties(json.getAsJsonObject("_responseCode"), res.getResponseCodeElement());
27924    if (json.has("sourceId"))
27925      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
27926    if (json.has("_sourceId"))
27927      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
27928    if (json.has("validateProfileId"))
27929      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
27930    if (json.has("_validateProfileId"))
27931      parseElementProperties(json.getAsJsonObject("_validateProfileId"), res.getValidateProfileIdElement());
27932    if (json.has("value"))
27933      res.setValueElement(parseString(json.get("value").getAsString()));
27934    if (json.has("_value"))
27935      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
27936    if (json.has("warningOnly"))
27937      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
27938    if (json.has("_warningOnly"))
27939      parseElementProperties(json.getAsJsonObject("_warningOnly"), res.getWarningOnlyElement());
27940  }
27941
27942  protected TestScript.TestScriptTestComponent parseTestScriptTestComponent(JsonObject json) throws IOException, FHIRFormatError {
27943    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
27944    parseTestScriptTestComponentProperties(json, res);
27945    return res;
27946  }
27947
27948  protected void parseTestScriptTestComponentProperties(JsonObject json, TestScript.TestScriptTestComponent res) throws IOException, FHIRFormatError {
27949    parseBackboneElementProperties(json, res);
27950    if (json.has("name"))
27951      res.setNameElement(parseString(json.get("name").getAsString()));
27952    if (json.has("_name"))
27953      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
27954    if (json.has("description"))
27955      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27956    if (json.has("_description"))
27957      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
27958    if (json.has("action")) {
27959      JsonArray array = json.getAsJsonArray("action");
27960      for (int i = 0; i < array.size(); i++) {
27961        res.getAction().add(parseTestScriptTestActionComponent(array.get(i).getAsJsonObject()));
27962      }
27963    };
27964  }
27965
27966  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(JsonObject json) throws IOException, FHIRFormatError {
27967    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
27968    parseTestScriptTestActionComponentProperties(json, res);
27969    return res;
27970  }
27971
27972  protected void parseTestScriptTestActionComponentProperties(JsonObject json, TestScript.TestActionComponent res) throws IOException, FHIRFormatError {
27973    parseBackboneElementProperties(json, res);
27974    if (json.has("operation"))
27975      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation")));
27976    if (json.has("assert"))
27977      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert")));
27978  }
27979
27980  protected TestScript.TestScriptTeardownComponent parseTestScriptTeardownComponent(JsonObject json) throws IOException, FHIRFormatError {
27981    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
27982    parseTestScriptTeardownComponentProperties(json, res);
27983    return res;
27984  }
27985
27986  protected void parseTestScriptTeardownComponentProperties(JsonObject json, TestScript.TestScriptTeardownComponent res) throws IOException, FHIRFormatError {
27987    parseBackboneElementProperties(json, res);
27988    if (json.has("action")) {
27989      JsonArray array = json.getAsJsonArray("action");
27990      for (int i = 0; i < array.size(); i++) {
27991        res.getAction().add(parseTestScriptTeardownActionComponent(array.get(i).getAsJsonObject()));
27992      }
27993    };
27994  }
27995
27996  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(JsonObject json) throws IOException, FHIRFormatError {
27997    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
27998    parseTestScriptTeardownActionComponentProperties(json, res);
27999    return res;
28000  }
28001
28002  protected void parseTestScriptTeardownActionComponentProperties(JsonObject json, TestScript.TeardownActionComponent res) throws IOException, FHIRFormatError {
28003    parseBackboneElementProperties(json, res);
28004    if (json.has("operation"))
28005      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation")));
28006  }
28007
28008  protected Topic parseTopic(JsonObject json) throws IOException, FHIRFormatError {
28009    Topic res = new Topic();
28010    parseTopicProperties(json, res);
28011    return res;
28012  }
28013
28014  protected void parseTopicProperties(JsonObject json, Topic res) throws IOException, FHIRFormatError {
28015    parseDomainResourceProperties(json, res);
28016    if (json.has("url"))
28017      res.setUrlElement(parseUri(json.get("url").getAsString()));
28018    if (json.has("_url"))
28019      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
28020    if (json.has("identifier")) {
28021      JsonArray array = json.getAsJsonArray("identifier");
28022      for (int i = 0; i < array.size(); i++) {
28023        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
28024      }
28025    };
28026    if (json.has("version"))
28027      res.setVersionElement(parseString(json.get("version").getAsString()));
28028    if (json.has("_version"))
28029      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
28030    if (json.has("title"))
28031      res.setTitleElement(parseString(json.get("title").getAsString()));
28032    if (json.has("_title"))
28033      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
28034    if (json.has("derivedFromCanonical")) {
28035      JsonArray array = json.getAsJsonArray("derivedFromCanonical");
28036      for (int i = 0; i < array.size(); i++) {
28037        if (array.get(i).isJsonNull()) {
28038          res.getDerivedFromCanonical().add(new CanonicalType());
28039        } else {;
28040          res.getDerivedFromCanonical().add(parseCanonical(array.get(i).getAsString()));
28041        }
28042      }
28043    };
28044    if (json.has("_derivedFromCanonical")) {
28045      JsonArray array = json.getAsJsonArray("_derivedFromCanonical");
28046      for (int i = 0; i < array.size(); i++) {
28047        if (i == res.getDerivedFromCanonical().size())
28048          res.getDerivedFromCanonical().add(parseCanonical(null));
28049        if (array.get(i) instanceof JsonObject) 
28050          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromCanonical().get(i));
28051      }
28052    };
28053    if (json.has("derivedFromUri")) {
28054      JsonArray array = json.getAsJsonArray("derivedFromUri");
28055      for (int i = 0; i < array.size(); i++) {
28056        if (array.get(i).isJsonNull()) {
28057          res.getDerivedFromUri().add(new UriType());
28058        } else {;
28059          res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
28060        }
28061      }
28062    };
28063    if (json.has("_derivedFromUri")) {
28064      JsonArray array = json.getAsJsonArray("_derivedFromUri");
28065      for (int i = 0; i < array.size(); i++) {
28066        if (i == res.getDerivedFromUri().size())
28067          res.getDerivedFromUri().add(parseUri(null));
28068        if (array.get(i) instanceof JsonObject) 
28069          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
28070      }
28071    };
28072    if (json.has("status"))
28073      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
28074    if (json.has("_status"))
28075      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
28076    if (json.has("experimental"))
28077      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
28078    if (json.has("_experimental"))
28079      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
28080    if (json.has("date"))
28081      res.setDateElement(parseDateTime(json.get("date").getAsString()));
28082    if (json.has("_date"))
28083      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
28084    if (json.has("publisher"))
28085      res.setPublisher(parseReference(json.getAsJsonObject("publisher")));
28086    if (json.has("contact")) {
28087      JsonArray array = json.getAsJsonArray("contact");
28088      for (int i = 0; i < array.size(); i++) {
28089        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
28090      }
28091    };
28092    if (json.has("description"))
28093      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
28094    if (json.has("_description"))
28095      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
28096    if (json.has("useContext")) {
28097      JsonArray array = json.getAsJsonArray("useContext");
28098      for (int i = 0; i < array.size(); i++) {
28099        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
28100      }
28101    };
28102    if (json.has("jurisdiction")) {
28103      JsonArray array = json.getAsJsonArray("jurisdiction");
28104      for (int i = 0; i < array.size(); i++) {
28105        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28106      }
28107    };
28108    if (json.has("purpose"))
28109      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
28110    if (json.has("_purpose"))
28111      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
28112    if (json.has("copyright"))
28113      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
28114    if (json.has("_copyright"))
28115      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
28116    if (json.has("approvalDate"))
28117      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
28118    if (json.has("_approvalDate"))
28119      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
28120    if (json.has("lastReviewDate"))
28121      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
28122    if (json.has("_lastReviewDate"))
28123      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
28124    if (json.has("effectivePeriod"))
28125      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
28126    if (json.has("resourceTrigger"))
28127      res.setResourceTrigger(parseTopicResourceTriggerComponent(json.getAsJsonObject("resourceTrigger")));
28128    if (json.has("canFilterBy")) {
28129      JsonArray array = json.getAsJsonArray("canFilterBy");
28130      for (int i = 0; i < array.size(); i++) {
28131        res.getCanFilterBy().add(parseTopicCanFilterByComponent(array.get(i).getAsJsonObject()));
28132      }
28133    };
28134  }
28135
28136  protected Topic.TopicResourceTriggerComponent parseTopicResourceTriggerComponent(JsonObject json) throws IOException, FHIRFormatError {
28137    Topic.TopicResourceTriggerComponent res = new Topic.TopicResourceTriggerComponent();
28138    parseTopicResourceTriggerComponentProperties(json, res);
28139    return res;
28140  }
28141
28142  protected void parseTopicResourceTriggerComponentProperties(JsonObject json, Topic.TopicResourceTriggerComponent res) throws IOException, FHIRFormatError {
28143    parseBackboneElementProperties(json, res);
28144    if (json.has("description"))
28145      res.setDescriptionElement(parseString(json.get("description").getAsString()));
28146    if (json.has("_description"))
28147      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
28148    if (json.has("resourceType")) {
28149      JsonArray array = json.getAsJsonArray("resourceType");
28150      for (int i = 0; i < array.size(); i++) {
28151        if (array.get(i).isJsonNull()) {
28152          res.getResourceType().add(new CodeType());
28153        } else {;
28154          res.getResourceType().add(parseCode(array.get(i).getAsString()));
28155        }
28156      }
28157    };
28158    if (json.has("_resourceType")) {
28159      JsonArray array = json.getAsJsonArray("_resourceType");
28160      for (int i = 0; i < array.size(); i++) {
28161        if (i == res.getResourceType().size())
28162          res.getResourceType().add(parseCode(null));
28163        if (array.get(i) instanceof JsonObject) 
28164          parseElementProperties(array.get(i).getAsJsonObject(), res.getResourceType().get(i));
28165      }
28166    };
28167    if (json.has("methodCriteria")) {
28168      JsonArray array = json.getAsJsonArray("methodCriteria");
28169      for (int i = 0; i < array.size(); i++) {
28170        if (array.get(i).isJsonNull()) {
28171          res.getMethodCriteria().add(new Enumeration<Topic.InteractionTrigger>(new Topic.InteractionTriggerEnumFactory(), Topic.InteractionTrigger.NULL));
28172        } else {;
28173          res.getMethodCriteria().add(parseEnumeration(array.get(i).getAsString(), Topic.InteractionTrigger.NULL, new Topic.InteractionTriggerEnumFactory()));
28174        }
28175      }
28176    };
28177    if (json.has("_methodCriteria")) {
28178      JsonArray array = json.getAsJsonArray("_methodCriteria");
28179      for (int i = 0; i < array.size(); i++) {
28180        if (i == res.getMethodCriteria().size())
28181          res.getMethodCriteria().add(parseEnumeration(null, Topic.InteractionTrigger.NULL, new Topic.InteractionTriggerEnumFactory()));
28182        if (array.get(i) instanceof JsonObject) 
28183          parseElementProperties(array.get(i).getAsJsonObject(), res.getMethodCriteria().get(i));
28184      }
28185    };
28186    if (json.has("queryCriteria"))
28187      res.setQueryCriteria(parseTopicResourceTriggerQueryCriteriaComponent(json.getAsJsonObject("queryCriteria")));
28188    if (json.has("fhirPathCriteria"))
28189      res.setFhirPathCriteriaElement(parseString(json.get("fhirPathCriteria").getAsString()));
28190    if (json.has("_fhirPathCriteria"))
28191      parseElementProperties(json.getAsJsonObject("_fhirPathCriteria"), res.getFhirPathCriteriaElement());
28192  }
28193
28194  protected Topic.TopicResourceTriggerQueryCriteriaComponent parseTopicResourceTriggerQueryCriteriaComponent(JsonObject json) throws IOException, FHIRFormatError {
28195    Topic.TopicResourceTriggerQueryCriteriaComponent res = new Topic.TopicResourceTriggerQueryCriteriaComponent();
28196    parseTopicResourceTriggerQueryCriteriaComponentProperties(json, res);
28197    return res;
28198  }
28199
28200  protected void parseTopicResourceTriggerQueryCriteriaComponentProperties(JsonObject json, Topic.TopicResourceTriggerQueryCriteriaComponent res) throws IOException, FHIRFormatError {
28201    parseBackboneElementProperties(json, res);
28202    if (json.has("previous"))
28203      res.setPreviousElement(parseString(json.get("previous").getAsString()));
28204    if (json.has("_previous"))
28205      parseElementProperties(json.getAsJsonObject("_previous"), res.getPreviousElement());
28206    if (json.has("current"))
28207      res.setCurrentElement(parseString(json.get("current").getAsString()));
28208    if (json.has("_current"))
28209      parseElementProperties(json.getAsJsonObject("_current"), res.getCurrentElement());
28210    if (json.has("requireBoth"))
28211      res.setRequireBothElement(parseBoolean(json.get("requireBoth").getAsBoolean()));
28212    if (json.has("_requireBoth"))
28213      parseElementProperties(json.getAsJsonObject("_requireBoth"), res.getRequireBothElement());
28214  }
28215
28216  protected Topic.TopicCanFilterByComponent parseTopicCanFilterByComponent(JsonObject json) throws IOException, FHIRFormatError {
28217    Topic.TopicCanFilterByComponent res = new Topic.TopicCanFilterByComponent();
28218    parseTopicCanFilterByComponentProperties(json, res);
28219    return res;
28220  }
28221
28222  protected void parseTopicCanFilterByComponentProperties(JsonObject json, Topic.TopicCanFilterByComponent res) throws IOException, FHIRFormatError {
28223    parseBackboneElementProperties(json, res);
28224    if (json.has("name"))
28225      res.setNameElement(parseString(json.get("name").getAsString()));
28226    if (json.has("_name"))
28227      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
28228    if (json.has("matchType")) {
28229      JsonArray array = json.getAsJsonArray("matchType");
28230      for (int i = 0; i < array.size(); i++) {
28231        if (array.get(i).isJsonNull()) {
28232          res.getMatchType().add(new Enumeration<Topic.TopicFilterByMatchType>(new Topic.TopicFilterByMatchTypeEnumFactory(), Topic.TopicFilterByMatchType.NULL));
28233        } else {;
28234          res.getMatchType().add(parseEnumeration(array.get(i).getAsString(), Topic.TopicFilterByMatchType.NULL, new Topic.TopicFilterByMatchTypeEnumFactory()));
28235        }
28236      }
28237    };
28238    if (json.has("_matchType")) {
28239      JsonArray array = json.getAsJsonArray("_matchType");
28240      for (int i = 0; i < array.size(); i++) {
28241        if (i == res.getMatchType().size())
28242          res.getMatchType().add(parseEnumeration(null, Topic.TopicFilterByMatchType.NULL, new Topic.TopicFilterByMatchTypeEnumFactory()));
28243        if (array.get(i) instanceof JsonObject) 
28244          parseElementProperties(array.get(i).getAsJsonObject(), res.getMatchType().get(i));
28245      }
28246    };
28247    if (json.has("documentation"))
28248      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
28249    if (json.has("_documentation"))
28250      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
28251  }
28252
28253  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
28254    ValueSet res = new ValueSet();
28255    parseValueSetProperties(json, res);
28256    return res;
28257  }
28258
28259  protected void parseValueSetProperties(JsonObject json, ValueSet res) throws IOException, FHIRFormatError {
28260    parseCanonicalResourceProperties(json, res);
28261    if (json.has("url"))
28262      res.setUrlElement(parseUri(json.get("url").getAsString()));
28263    if (json.has("_url"))
28264      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
28265    if (json.has("identifier")) {
28266      JsonArray array = json.getAsJsonArray("identifier");
28267      for (int i = 0; i < array.size(); i++) {
28268        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
28269      }
28270    };
28271    if (json.has("version"))
28272      res.setVersionElement(parseString(json.get("version").getAsString()));
28273    if (json.has("_version"))
28274      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
28275    if (json.has("name"))
28276      res.setNameElement(parseString(json.get("name").getAsString()));
28277    if (json.has("_name"))
28278      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
28279    if (json.has("title"))
28280      res.setTitleElement(parseString(json.get("title").getAsString()));
28281    if (json.has("_title"))
28282      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
28283    if (json.has("status"))
28284      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
28285    if (json.has("_status"))
28286      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
28287    if (json.has("experimental"))
28288      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
28289    if (json.has("_experimental"))
28290      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
28291    if (json.has("date"))
28292      res.setDateElement(parseDateTime(json.get("date").getAsString()));
28293    if (json.has("_date"))
28294      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
28295    if (json.has("publisher"))
28296      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
28297    if (json.has("_publisher"))
28298      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
28299    if (json.has("contact")) {
28300      JsonArray array = json.getAsJsonArray("contact");
28301      for (int i = 0; i < array.size(); i++) {
28302        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
28303      }
28304    };
28305    if (json.has("description"))
28306      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
28307    if (json.has("_description"))
28308      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
28309    if (json.has("useContext")) {
28310      JsonArray array = json.getAsJsonArray("useContext");
28311      for (int i = 0; i < array.size(); i++) {
28312        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
28313      }
28314    };
28315    if (json.has("jurisdiction")) {
28316      JsonArray array = json.getAsJsonArray("jurisdiction");
28317      for (int i = 0; i < array.size(); i++) {
28318        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28319      }
28320    };
28321    if (json.has("immutable"))
28322      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
28323    if (json.has("_immutable"))
28324      parseElementProperties(json.getAsJsonObject("_immutable"), res.getImmutableElement());
28325    if (json.has("purpose"))
28326      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
28327    if (json.has("_purpose"))
28328      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
28329    if (json.has("copyright"))
28330      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
28331    if (json.has("_copyright"))
28332      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
28333    if (json.has("compose"))
28334      res.setCompose(parseValueSetComposeComponent(json.getAsJsonObject("compose")));
28335    if (json.has("expansion"))
28336      res.setExpansion(parseValueSetExpansionComponent(json.getAsJsonObject("expansion")));
28337  }
28338
28339  protected ValueSet.ValueSetComposeComponent parseValueSetComposeComponent(JsonObject json) throws IOException, FHIRFormatError {
28340    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
28341    parseValueSetComposeComponentProperties(json, res);
28342    return res;
28343  }
28344
28345  protected void parseValueSetComposeComponentProperties(JsonObject json, ValueSet.ValueSetComposeComponent res) throws IOException, FHIRFormatError {
28346    parseBackboneElementProperties(json, res);
28347    if (json.has("lockedDate"))
28348      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
28349    if (json.has("_lockedDate"))
28350      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
28351    if (json.has("inactive"))
28352      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
28353    if (json.has("_inactive"))
28354      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
28355    if (json.has("include")) {
28356      JsonArray array = json.getAsJsonArray("include");
28357      for (int i = 0; i < array.size(); i++) {
28358        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject()));
28359      }
28360    };
28361    if (json.has("exclude")) {
28362      JsonArray array = json.getAsJsonArray("exclude");
28363      for (int i = 0; i < array.size(); i++) {
28364        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject()));
28365      }
28366    };
28367    if (json.has("property")) {
28368      JsonArray array = json.getAsJsonArray("property");
28369      for (int i = 0; i < array.size(); i++) {
28370        if (array.get(i).isJsonNull()) {
28371          res.getProperty().add(new StringType());
28372        } else {;
28373          res.getProperty().add(parseString(array.get(i).getAsString()));
28374        }
28375      }
28376    };
28377    if (json.has("_property")) {
28378      JsonArray array = json.getAsJsonArray("_property");
28379      for (int i = 0; i < array.size(); i++) {
28380        if (i == res.getProperty().size())
28381          res.getProperty().add(parseString(null));
28382        if (array.get(i) instanceof JsonObject) 
28383          parseElementProperties(array.get(i).getAsJsonObject(), res.getProperty().get(i));
28384      }
28385    };
28386  }
28387
28388  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json) throws IOException, FHIRFormatError {
28389    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
28390    parseValueSetConceptSetComponentProperties(json, res);
28391    return res;
28392  }
28393
28394  protected void parseValueSetConceptSetComponentProperties(JsonObject json, ValueSet.ConceptSetComponent res) throws IOException, FHIRFormatError {
28395    parseBackboneElementProperties(json, res);
28396    if (json.has("system"))
28397      res.setSystemElement(parseUri(json.get("system").getAsString()));
28398    if (json.has("_system"))
28399      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
28400    if (json.has("version"))
28401      res.setVersionElement(parseString(json.get("version").getAsString()));
28402    if (json.has("_version"))
28403      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
28404    if (json.has("concept")) {
28405      JsonArray array = json.getAsJsonArray("concept");
28406      for (int i = 0; i < array.size(); i++) {
28407        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject()));
28408      }
28409    };
28410    if (json.has("filter")) {
28411      JsonArray array = json.getAsJsonArray("filter");
28412      for (int i = 0; i < array.size(); i++) {
28413        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject()));
28414      }
28415    };
28416    if (json.has("valueSet")) {
28417      JsonArray array = json.getAsJsonArray("valueSet");
28418      for (int i = 0; i < array.size(); i++) {
28419        if (array.get(i).isJsonNull()) {
28420          res.getValueSet().add(new CanonicalType());
28421        } else {;
28422          res.getValueSet().add(parseCanonical(array.get(i).getAsString()));
28423        }
28424      }
28425    };
28426    if (json.has("_valueSet")) {
28427      JsonArray array = json.getAsJsonArray("_valueSet");
28428      for (int i = 0; i < array.size(); i++) {
28429        if (i == res.getValueSet().size())
28430          res.getValueSet().add(parseCanonical(null));
28431        if (array.get(i) instanceof JsonObject) 
28432          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueSet().get(i));
28433      }
28434    };
28435  }
28436
28437  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json) throws IOException, FHIRFormatError {
28438    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
28439    parseValueSetConceptReferenceComponentProperties(json, res);
28440    return res;
28441  }
28442
28443  protected void parseValueSetConceptReferenceComponentProperties(JsonObject json, ValueSet.ConceptReferenceComponent res) throws IOException, FHIRFormatError {
28444    parseBackboneElementProperties(json, res);
28445    if (json.has("code"))
28446      res.setCodeElement(parseCode(json.get("code").getAsString()));
28447    if (json.has("_code"))
28448      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
28449    if (json.has("display"))
28450      res.setDisplayElement(parseString(json.get("display").getAsString()));
28451    if (json.has("_display"))
28452      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
28453    if (json.has("designation")) {
28454      JsonArray array = json.getAsJsonArray("designation");
28455      for (int i = 0; i < array.size(); i++) {
28456        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject()));
28457      }
28458    };
28459  }
28460
28461  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(JsonObject json) throws IOException, FHIRFormatError {
28462    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
28463    parseValueSetConceptReferenceDesignationComponentProperties(json, res);
28464    return res;
28465  }
28466
28467  protected void parseValueSetConceptReferenceDesignationComponentProperties(JsonObject json, ValueSet.ConceptReferenceDesignationComponent res) throws IOException, FHIRFormatError {
28468    parseBackboneElementProperties(json, res);
28469    if (json.has("language"))
28470      res.setLanguageElement(parseCode(json.get("language").getAsString()));
28471    if (json.has("_language"))
28472      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
28473    if (json.has("use"))
28474      res.setUse(parseCoding(json.getAsJsonObject("use")));
28475    if (json.has("value"))
28476      res.setValueElement(parseString(json.get("value").getAsString()));
28477    if (json.has("_value"))
28478      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
28479  }
28480
28481  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json) throws IOException, FHIRFormatError {
28482    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
28483    parseValueSetConceptSetFilterComponentProperties(json, res);
28484    return res;
28485  }
28486
28487  protected void parseValueSetConceptSetFilterComponentProperties(JsonObject json, ValueSet.ConceptSetFilterComponent res) throws IOException, FHIRFormatError {
28488    parseBackboneElementProperties(json, res);
28489    if (json.has("property"))
28490      res.setPropertyElement(parseCode(json.get("property").getAsString()));
28491    if (json.has("_property"))
28492      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
28493    if (json.has("op"))
28494      res.setOpElement(parseEnumeration(json.get("op").getAsString(), Enumerations.FilterOperator.NULL, new Enumerations.FilterOperatorEnumFactory()));
28495    if (json.has("_op"))
28496      parseElementProperties(json.getAsJsonObject("_op"), res.getOpElement());
28497    if (json.has("value"))
28498      res.setValueElement(parseString(json.get("value").getAsString()));
28499    if (json.has("_value"))
28500      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
28501  }
28502
28503  protected ValueSet.ValueSetExpansionComponent parseValueSetExpansionComponent(JsonObject json) throws IOException, FHIRFormatError {
28504    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
28505    parseValueSetExpansionComponentProperties(json, res);
28506    return res;
28507  }
28508
28509  protected void parseValueSetExpansionComponentProperties(JsonObject json, ValueSet.ValueSetExpansionComponent res) throws IOException, FHIRFormatError {
28510    parseBackboneElementProperties(json, res);
28511    if (json.has("identifier"))
28512      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
28513    if (json.has("_identifier"))
28514      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
28515    if (json.has("timestamp"))
28516      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
28517    if (json.has("_timestamp"))
28518      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
28519    if (json.has("total"))
28520      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
28521    if (json.has("_total"))
28522      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
28523    if (json.has("offset"))
28524      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
28525    if (json.has("_offset"))
28526      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
28527    if (json.has("parameter")) {
28528      JsonArray array = json.getAsJsonArray("parameter");
28529      for (int i = 0; i < array.size(); i++) {
28530        res.getParameter().add(parseValueSetExpansionParameterComponent(array.get(i).getAsJsonObject()));
28531      }
28532    };
28533    if (json.has("property")) {
28534      JsonArray array = json.getAsJsonArray("property");
28535      for (int i = 0; i < array.size(); i++) {
28536        res.getProperty().add(parseValueSetExpansionPropertyComponent(array.get(i).getAsJsonObject()));
28537      }
28538    };
28539    if (json.has("contains")) {
28540      JsonArray array = json.getAsJsonArray("contains");
28541      for (int i = 0; i < array.size(); i++) {
28542        res.getContains().add(parseValueSetExpansionContainsComponent(array.get(i).getAsJsonObject()));
28543      }
28544    };
28545  }
28546
28547  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetExpansionParameterComponent(JsonObject json) throws IOException, FHIRFormatError {
28548    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
28549    parseValueSetExpansionParameterComponentProperties(json, res);
28550    return res;
28551  }
28552
28553  protected void parseValueSetExpansionParameterComponentProperties(JsonObject json, ValueSet.ValueSetExpansionParameterComponent res) throws IOException, FHIRFormatError {
28554    parseBackboneElementProperties(json, res);
28555    if (json.has("name"))
28556      res.setNameElement(parseString(json.get("name").getAsString()));
28557    if (json.has("_name"))
28558      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
28559    DataType value = parseType("value", json);
28560    if (value != null)
28561      res.setValue(value);
28562  }
28563
28564  protected ValueSet.ValueSetExpansionPropertyComponent parseValueSetExpansionPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
28565    ValueSet.ValueSetExpansionPropertyComponent res = new ValueSet.ValueSetExpansionPropertyComponent();
28566    parseValueSetExpansionPropertyComponentProperties(json, res);
28567    return res;
28568  }
28569
28570  protected void parseValueSetExpansionPropertyComponentProperties(JsonObject json, ValueSet.ValueSetExpansionPropertyComponent res) throws IOException, FHIRFormatError {
28571    parseBackboneElementProperties(json, res);
28572    if (json.has("code"))
28573      res.setCodeElement(parseCode(json.get("code").getAsString()));
28574    if (json.has("_code"))
28575      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
28576    if (json.has("uri"))
28577      res.setUriElement(parseUri(json.get("uri").getAsString()));
28578    if (json.has("_uri"))
28579      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
28580  }
28581
28582  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetExpansionContainsComponent(JsonObject json) throws IOException, FHIRFormatError {
28583    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
28584    parseValueSetExpansionContainsComponentProperties(json, res);
28585    return res;
28586  }
28587
28588  protected void parseValueSetExpansionContainsComponentProperties(JsonObject json, ValueSet.ValueSetExpansionContainsComponent res) throws IOException, FHIRFormatError {
28589    parseBackboneElementProperties(json, res);
28590    if (json.has("system"))
28591      res.setSystemElement(parseUri(json.get("system").getAsString()));
28592    if (json.has("_system"))
28593      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
28594    if (json.has("abstract"))
28595      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
28596    if (json.has("_abstract"))
28597      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
28598    if (json.has("inactive"))
28599      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
28600    if (json.has("_inactive"))
28601      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
28602    if (json.has("version"))
28603      res.setVersionElement(parseString(json.get("version").getAsString()));
28604    if (json.has("_version"))
28605      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
28606    if (json.has("code"))
28607      res.setCodeElement(parseCode(json.get("code").getAsString()));
28608    if (json.has("_code"))
28609      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
28610    if (json.has("display"))
28611      res.setDisplayElement(parseString(json.get("display").getAsString()));
28612    if (json.has("_display"))
28613      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
28614    if (json.has("designation")) {
28615      JsonArray array = json.getAsJsonArray("designation");
28616      for (int i = 0; i < array.size(); i++) {
28617        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject()));
28618      }
28619    };
28620    if (json.has("property")) {
28621      JsonArray array = json.getAsJsonArray("property");
28622      for (int i = 0; i < array.size(); i++) {
28623        res.getProperty().add(parseValueSetConceptPropertyComponent(array.get(i).getAsJsonObject()));
28624      }
28625    };
28626    if (json.has("contains")) {
28627      JsonArray array = json.getAsJsonArray("contains");
28628      for (int i = 0; i < array.size(); i++) {
28629        res.getContains().add(parseValueSetExpansionContainsComponent(array.get(i).getAsJsonObject()));
28630      }
28631    };
28632  }
28633
28634  protected ValueSet.ConceptPropertyComponent parseValueSetConceptPropertyComponent(JsonObject json) throws IOException, FHIRFormatError {
28635    ValueSet.ConceptPropertyComponent res = new ValueSet.ConceptPropertyComponent();
28636    parseValueSetConceptPropertyComponentProperties(json, res);
28637    return res;
28638  }
28639
28640  protected void parseValueSetConceptPropertyComponentProperties(JsonObject json, ValueSet.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
28641    parseBackboneElementProperties(json, res);
28642    if (json.has("code"))
28643      res.setCodeElement(parseCode(json.get("code").getAsString()));
28644    if (json.has("_code"))
28645      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
28646    DataType value = parseType("value", json);
28647    if (value != null)
28648      res.setValue(value);
28649  }
28650
28651  protected VerificationResult parseVerificationResult(JsonObject json) throws IOException, FHIRFormatError {
28652    VerificationResult res = new VerificationResult();
28653    parseVerificationResultProperties(json, res);
28654    return res;
28655  }
28656
28657  protected void parseVerificationResultProperties(JsonObject json, VerificationResult res) throws IOException, FHIRFormatError {
28658    parseDomainResourceProperties(json, res);
28659    if (json.has("target")) {
28660      JsonArray array = json.getAsJsonArray("target");
28661      for (int i = 0; i < array.size(); i++) {
28662        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
28663      }
28664    };
28665    if (json.has("targetLocation")) {
28666      JsonArray array = json.getAsJsonArray("targetLocation");
28667      for (int i = 0; i < array.size(); i++) {
28668        if (array.get(i).isJsonNull()) {
28669          res.getTargetLocation().add(new StringType());
28670        } else {;
28671          res.getTargetLocation().add(parseString(array.get(i).getAsString()));
28672        }
28673      }
28674    };
28675    if (json.has("_targetLocation")) {
28676      JsonArray array = json.getAsJsonArray("_targetLocation");
28677      for (int i = 0; i < array.size(); i++) {
28678        if (i == res.getTargetLocation().size())
28679          res.getTargetLocation().add(parseString(null));
28680        if (array.get(i) instanceof JsonObject) 
28681          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetLocation().get(i));
28682      }
28683    };
28684    if (json.has("need"))
28685      res.setNeed(parseCodeableConcept(json.getAsJsonObject("need")));
28686    if (json.has("status"))
28687      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VerificationResult.Status.NULL, new VerificationResult.StatusEnumFactory()));
28688    if (json.has("_status"))
28689      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
28690    if (json.has("statusDate"))
28691      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
28692    if (json.has("_statusDate"))
28693      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
28694    if (json.has("validationType"))
28695      res.setValidationType(parseCodeableConcept(json.getAsJsonObject("validationType")));
28696    if (json.has("validationProcess")) {
28697      JsonArray array = json.getAsJsonArray("validationProcess");
28698      for (int i = 0; i < array.size(); i++) {
28699        res.getValidationProcess().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28700      }
28701    };
28702    if (json.has("frequency"))
28703      res.setFrequency(parseTiming(json.getAsJsonObject("frequency")));
28704    if (json.has("lastPerformed"))
28705      res.setLastPerformedElement(parseDateTime(json.get("lastPerformed").getAsString()));
28706    if (json.has("_lastPerformed"))
28707      parseElementProperties(json.getAsJsonObject("_lastPerformed"), res.getLastPerformedElement());
28708    if (json.has("nextScheduled"))
28709      res.setNextScheduledElement(parseDate(json.get("nextScheduled").getAsString()));
28710    if (json.has("_nextScheduled"))
28711      parseElementProperties(json.getAsJsonObject("_nextScheduled"), res.getNextScheduledElement());
28712    if (json.has("failureAction"))
28713      res.setFailureAction(parseCodeableConcept(json.getAsJsonObject("failureAction")));
28714    if (json.has("primarySource")) {
28715      JsonArray array = json.getAsJsonArray("primarySource");
28716      for (int i = 0; i < array.size(); i++) {
28717        res.getPrimarySource().add(parseVerificationResultPrimarySourceComponent(array.get(i).getAsJsonObject()));
28718      }
28719    };
28720    if (json.has("attestation"))
28721      res.setAttestation(parseVerificationResultAttestationComponent(json.getAsJsonObject("attestation")));
28722    if (json.has("validator")) {
28723      JsonArray array = json.getAsJsonArray("validator");
28724      for (int i = 0; i < array.size(); i++) {
28725        res.getValidator().add(parseVerificationResultValidatorComponent(array.get(i).getAsJsonObject()));
28726      }
28727    };
28728  }
28729
28730  protected VerificationResult.VerificationResultPrimarySourceComponent parseVerificationResultPrimarySourceComponent(JsonObject json) throws IOException, FHIRFormatError {
28731    VerificationResult.VerificationResultPrimarySourceComponent res = new VerificationResult.VerificationResultPrimarySourceComponent();
28732    parseVerificationResultPrimarySourceComponentProperties(json, res);
28733    return res;
28734  }
28735
28736  protected void parseVerificationResultPrimarySourceComponentProperties(JsonObject json, VerificationResult.VerificationResultPrimarySourceComponent res) throws IOException, FHIRFormatError {
28737    parseBackboneElementProperties(json, res);
28738    if (json.has("who"))
28739      res.setWho(parseReference(json.getAsJsonObject("who")));
28740    if (json.has("type")) {
28741      JsonArray array = json.getAsJsonArray("type");
28742      for (int i = 0; i < array.size(); i++) {
28743        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28744      }
28745    };
28746    if (json.has("communicationMethod")) {
28747      JsonArray array = json.getAsJsonArray("communicationMethod");
28748      for (int i = 0; i < array.size(); i++) {
28749        res.getCommunicationMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28750      }
28751    };
28752    if (json.has("validationStatus"))
28753      res.setValidationStatus(parseCodeableConcept(json.getAsJsonObject("validationStatus")));
28754    if (json.has("validationDate"))
28755      res.setValidationDateElement(parseDateTime(json.get("validationDate").getAsString()));
28756    if (json.has("_validationDate"))
28757      parseElementProperties(json.getAsJsonObject("_validationDate"), res.getValidationDateElement());
28758    if (json.has("canPushUpdates"))
28759      res.setCanPushUpdates(parseCodeableConcept(json.getAsJsonObject("canPushUpdates")));
28760    if (json.has("pushTypeAvailable")) {
28761      JsonArray array = json.getAsJsonArray("pushTypeAvailable");
28762      for (int i = 0; i < array.size(); i++) {
28763        res.getPushTypeAvailable().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
28764      }
28765    };
28766  }
28767
28768  protected VerificationResult.VerificationResultAttestationComponent parseVerificationResultAttestationComponent(JsonObject json) throws IOException, FHIRFormatError {
28769    VerificationResult.VerificationResultAttestationComponent res = new VerificationResult.VerificationResultAttestationComponent();
28770    parseVerificationResultAttestationComponentProperties(json, res);
28771    return res;
28772  }
28773
28774  protected void parseVerificationResultAttestationComponentProperties(JsonObject json, VerificationResult.VerificationResultAttestationComponent res) throws IOException, FHIRFormatError {
28775    parseBackboneElementProperties(json, res);
28776    if (json.has("who"))
28777      res.setWho(parseReference(json.getAsJsonObject("who")));
28778    if (json.has("onBehalfOf"))
28779      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
28780    if (json.has("communicationMethod"))
28781      res.setCommunicationMethod(parseCodeableConcept(json.getAsJsonObject("communicationMethod")));
28782    if (json.has("date"))
28783      res.setDateElement(parseDate(json.get("date").getAsString()));
28784    if (json.has("_date"))
28785      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
28786    if (json.has("sourceIdentityCertificate"))
28787      res.setSourceIdentityCertificateElement(parseString(json.get("sourceIdentityCertificate").getAsString()));
28788    if (json.has("_sourceIdentityCertificate"))
28789      parseElementProperties(json.getAsJsonObject("_sourceIdentityCertificate"), res.getSourceIdentityCertificateElement());
28790    if (json.has("proxyIdentityCertificate"))
28791      res.setProxyIdentityCertificateElement(parseString(json.get("proxyIdentityCertificate").getAsString()));
28792    if (json.has("_proxyIdentityCertificate"))
28793      parseElementProperties(json.getAsJsonObject("_proxyIdentityCertificate"), res.getProxyIdentityCertificateElement());
28794    if (json.has("proxySignature"))
28795      res.setProxySignature(parseSignature(json.getAsJsonObject("proxySignature")));
28796    if (json.has("sourceSignature"))
28797      res.setSourceSignature(parseSignature(json.getAsJsonObject("sourceSignature")));
28798  }
28799
28800  protected VerificationResult.VerificationResultValidatorComponent parseVerificationResultValidatorComponent(JsonObject json) throws IOException, FHIRFormatError {
28801    VerificationResult.VerificationResultValidatorComponent res = new VerificationResult.VerificationResultValidatorComponent();
28802    parseVerificationResultValidatorComponentProperties(json, res);
28803    return res;
28804  }
28805
28806  protected void parseVerificationResultValidatorComponentProperties(JsonObject json, VerificationResult.VerificationResultValidatorComponent res) throws IOException, FHIRFormatError {
28807    parseBackboneElementProperties(json, res);
28808    if (json.has("organization"))
28809      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
28810    if (json.has("identityCertificate"))
28811      res.setIdentityCertificateElement(parseString(json.get("identityCertificate").getAsString()));
28812    if (json.has("_identityCertificate"))
28813      parseElementProperties(json.getAsJsonObject("_identityCertificate"), res.getIdentityCertificateElement());
28814    if (json.has("attestationSignature"))
28815      res.setAttestationSignature(parseSignature(json.getAsJsonObject("attestationSignature")));
28816  }
28817
28818  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
28819    VisionPrescription res = new VisionPrescription();
28820    parseVisionPrescriptionProperties(json, res);
28821    return res;
28822  }
28823
28824  protected void parseVisionPrescriptionProperties(JsonObject json, VisionPrescription res) throws IOException, FHIRFormatError {
28825    parseDomainResourceProperties(json, res);
28826    if (json.has("identifier")) {
28827      JsonArray array = json.getAsJsonArray("identifier");
28828      for (int i = 0; i < array.size(); i++) {
28829        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
28830      }
28831    };
28832    if (json.has("status"))
28833      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
28834    if (json.has("_status"))
28835      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
28836    if (json.has("created"))
28837      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
28838    if (json.has("_created"))
28839      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
28840    if (json.has("patient"))
28841      res.setPatient(parseReference(json.getAsJsonObject("patient")));
28842    if (json.has("encounter"))
28843      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
28844    if (json.has("dateWritten"))
28845      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
28846    if (json.has("_dateWritten"))
28847      parseElementProperties(json.getAsJsonObject("_dateWritten"), res.getDateWrittenElement());
28848    if (json.has("prescriber"))
28849      res.setPrescriber(parseReference(json.getAsJsonObject("prescriber")));
28850    if (json.has("lensSpecification")) {
28851      JsonArray array = json.getAsJsonArray("lensSpecification");
28852      for (int i = 0; i < array.size(); i++) {
28853        res.getLensSpecification().add(parseVisionPrescriptionLensSpecificationComponent(array.get(i).getAsJsonObject()));
28854      }
28855    };
28856  }
28857
28858  protected VisionPrescription.VisionPrescriptionLensSpecificationComponent parseVisionPrescriptionLensSpecificationComponent(JsonObject json) throws IOException, FHIRFormatError {
28859    VisionPrescription.VisionPrescriptionLensSpecificationComponent res = new VisionPrescription.VisionPrescriptionLensSpecificationComponent();
28860    parseVisionPrescriptionLensSpecificationComponentProperties(json, res);
28861    return res;
28862  }
28863
28864  protected void parseVisionPrescriptionLensSpecificationComponentProperties(JsonObject json, VisionPrescription.VisionPrescriptionLensSpecificationComponent res) throws IOException, FHIRFormatError {
28865    parseBackboneElementProperties(json, res);
28866    if (json.has("product"))
28867      res.setProduct(parseCodeableConcept(json.getAsJsonObject("product")));
28868    if (json.has("eye"))
28869      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
28870    if (json.has("_eye"))
28871      parseElementProperties(json.getAsJsonObject("_eye"), res.getEyeElement());
28872    if (json.has("sphere"))
28873      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
28874    if (json.has("_sphere"))
28875      parseElementProperties(json.getAsJsonObject("_sphere"), res.getSphereElement());
28876    if (json.has("cylinder"))
28877      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
28878    if (json.has("_cylinder"))
28879      parseElementProperties(json.getAsJsonObject("_cylinder"), res.getCylinderElement());
28880    if (json.has("axis"))
28881      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
28882    if (json.has("_axis"))
28883      parseElementProperties(json.getAsJsonObject("_axis"), res.getAxisElement());
28884    if (json.has("prism")) {
28885      JsonArray array = json.getAsJsonArray("prism");
28886      for (int i = 0; i < array.size(); i++) {
28887        res.getPrism().add(parseVisionPrescriptionPrismComponent(array.get(i).getAsJsonObject()));
28888      }
28889    };
28890    if (json.has("add"))
28891      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
28892    if (json.has("_add"))
28893      parseElementProperties(json.getAsJsonObject("_add"), res.getAddElement());
28894    if (json.has("power"))
28895      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
28896    if (json.has("_power"))
28897      parseElementProperties(json.getAsJsonObject("_power"), res.getPowerElement());
28898    if (json.has("backCurve"))
28899      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
28900    if (json.has("_backCurve"))
28901      parseElementProperties(json.getAsJsonObject("_backCurve"), res.getBackCurveElement());
28902    if (json.has("diameter"))
28903      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
28904    if (json.has("_diameter"))
28905      parseElementProperties(json.getAsJsonObject("_diameter"), res.getDiameterElement());
28906    if (json.has("duration"))
28907      res.setDuration(parseQuantity(json.getAsJsonObject("duration")));
28908    if (json.has("color"))
28909      res.setColorElement(parseString(json.get("color").getAsString()));
28910    if (json.has("_color"))
28911      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
28912    if (json.has("brand"))
28913      res.setBrandElement(parseString(json.get("brand").getAsString()));
28914    if (json.has("_brand"))
28915      parseElementProperties(json.getAsJsonObject("_brand"), res.getBrandElement());
28916    if (json.has("note")) {
28917      JsonArray array = json.getAsJsonArray("note");
28918      for (int i = 0; i < array.size(); i++) {
28919        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
28920      }
28921    };
28922  }
28923
28924  protected VisionPrescription.PrismComponent parseVisionPrescriptionPrismComponent(JsonObject json) throws IOException, FHIRFormatError {
28925    VisionPrescription.PrismComponent res = new VisionPrescription.PrismComponent();
28926    parseVisionPrescriptionPrismComponentProperties(json, res);
28927    return res;
28928  }
28929
28930  protected void parseVisionPrescriptionPrismComponentProperties(JsonObject json, VisionPrescription.PrismComponent res) throws IOException, FHIRFormatError {
28931    parseBackboneElementProperties(json, res);
28932    if (json.has("amount"))
28933      res.setAmountElement(parseDecimal(json.get("amount").getAsBigDecimal()));
28934    if (json.has("_amount"))
28935      parseElementProperties(json.getAsJsonObject("_amount"), res.getAmountElement());
28936    if (json.has("base"))
28937      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
28938    if (json.has("_base"))
28939      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
28940  }
28941
28942
28943  
28944  @Override
28945  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
28946    if (!json.has("resourceType")) {
28947      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
28948    }
28949    String t = json.get("resourceType").getAsString();
28950    if (Utilities.noString(t)) {
28951      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
28952    } else if (t.equals("Account")) {
28953      return parseAccount(json);
28954    } else if (t.equals("ActivityDefinition")) {
28955      return parseActivityDefinition(json);
28956    } else if (t.equals("AdministrableProductDefinition")) {
28957      return parseAdministrableProductDefinition(json);
28958    } else if (t.equals("AdverseEvent")) {
28959      return parseAdverseEvent(json);
28960    } else if (t.equals("AllergyIntolerance")) {
28961      return parseAllergyIntolerance(json);
28962    } else if (t.equals("Appointment")) {
28963      return parseAppointment(json);
28964    } else if (t.equals("AppointmentResponse")) {
28965      return parseAppointmentResponse(json);
28966    } else if (t.equals("AuditEvent")) {
28967      return parseAuditEvent(json);
28968    } else if (t.equals("Basic")) {
28969      return parseBasic(json);
28970    } else if (t.equals("Binary")) {
28971      return parseBinary(json);
28972    } else if (t.equals("BiologicallyDerivedProduct")) {
28973      return parseBiologicallyDerivedProduct(json);
28974    } else if (t.equals("BodyStructure")) {
28975      return parseBodyStructure(json);
28976    } else if (t.equals("Bundle")) {
28977      return parseBundle(json);
28978    } else if (t.equals("CapabilityStatement")) {
28979      return parseCapabilityStatement(json);
28980    } else if (t.equals("CapabilityStatement2")) {
28981      return parseCapabilityStatement2(json);
28982    } else if (t.equals("CarePlan")) {
28983      return parseCarePlan(json);
28984    } else if (t.equals("CareTeam")) {
28985      return parseCareTeam(json);
28986    } else if (t.equals("CatalogEntry")) {
28987      return parseCatalogEntry(json);
28988    } else if (t.equals("ChargeItem")) {
28989      return parseChargeItem(json);
28990    } else if (t.equals("ChargeItemDefinition")) {
28991      return parseChargeItemDefinition(json);
28992    } else if (t.equals("Claim")) {
28993      return parseClaim(json);
28994    } else if (t.equals("ClaimResponse")) {
28995      return parseClaimResponse(json);
28996    } else if (t.equals("ClinicalImpression")) {
28997      return parseClinicalImpression(json);
28998    } else if (t.equals("ClinicalUseIssue")) {
28999      return parseClinicalUseIssue(json);
29000    } else if (t.equals("CodeSystem")) {
29001      return parseCodeSystem(json);
29002    } else if (t.equals("Communication")) {
29003      return parseCommunication(json);
29004    } else if (t.equals("CommunicationRequest")) {
29005      return parseCommunicationRequest(json);
29006    } else if (t.equals("CompartmentDefinition")) {
29007      return parseCompartmentDefinition(json);
29008    } else if (t.equals("Composition")) {
29009      return parseComposition(json);
29010    } else if (t.equals("ConceptMap")) {
29011      return parseConceptMap(json);
29012    } else if (t.equals("Condition")) {
29013      return parseCondition(json);
29014    } else if (t.equals("ConditionDefinition")) {
29015      return parseConditionDefinition(json);
29016    } else if (t.equals("Consent")) {
29017      return parseConsent(json);
29018    } else if (t.equals("Contract")) {
29019      return parseContract(json);
29020    } else if (t.equals("Coverage")) {
29021      return parseCoverage(json);
29022    } else if (t.equals("CoverageEligibilityRequest")) {
29023      return parseCoverageEligibilityRequest(json);
29024    } else if (t.equals("CoverageEligibilityResponse")) {
29025      return parseCoverageEligibilityResponse(json);
29026    } else if (t.equals("DetectedIssue")) {
29027      return parseDetectedIssue(json);
29028    } else if (t.equals("Device")) {
29029      return parseDevice(json);
29030    } else if (t.equals("DeviceDefinition")) {
29031      return parseDeviceDefinition(json);
29032    } else if (t.equals("DeviceMetric")) {
29033      return parseDeviceMetric(json);
29034    } else if (t.equals("DeviceRequest")) {
29035      return parseDeviceRequest(json);
29036    } else if (t.equals("DeviceUseStatement")) {
29037      return parseDeviceUseStatement(json);
29038    } else if (t.equals("DiagnosticReport")) {
29039      return parseDiagnosticReport(json);
29040    } else if (t.equals("DocumentManifest")) {
29041      return parseDocumentManifest(json);
29042    } else if (t.equals("DocumentReference")) {
29043      return parseDocumentReference(json);
29044    } else if (t.equals("Encounter")) {
29045      return parseEncounter(json);
29046    } else if (t.equals("Endpoint")) {
29047      return parseEndpoint(json);
29048    } else if (t.equals("EnrollmentRequest")) {
29049      return parseEnrollmentRequest(json);
29050    } else if (t.equals("EnrollmentResponse")) {
29051      return parseEnrollmentResponse(json);
29052    } else if (t.equals("EpisodeOfCare")) {
29053      return parseEpisodeOfCare(json);
29054    } else if (t.equals("EventDefinition")) {
29055      return parseEventDefinition(json);
29056    } else if (t.equals("Evidence")) {
29057      return parseEvidence(json);
29058    } else if (t.equals("EvidenceVariable")) {
29059      return parseEvidenceVariable(json);
29060    } else if (t.equals("ExampleScenario")) {
29061      return parseExampleScenario(json);
29062    } else if (t.equals("ExplanationOfBenefit")) {
29063      return parseExplanationOfBenefit(json);
29064    } else if (t.equals("FamilyMemberHistory")) {
29065      return parseFamilyMemberHistory(json);
29066    } else if (t.equals("Flag")) {
29067      return parseFlag(json);
29068    } else if (t.equals("Goal")) {
29069      return parseGoal(json);
29070    } else if (t.equals("GraphDefinition")) {
29071      return parseGraphDefinition(json);
29072    } else if (t.equals("Group")) {
29073      return parseGroup(json);
29074    } else if (t.equals("GuidanceResponse")) {
29075      return parseGuidanceResponse(json);
29076    } else if (t.equals("HealthcareService")) {
29077      return parseHealthcareService(json);
29078    } else if (t.equals("ImagingStudy")) {
29079      return parseImagingStudy(json);
29080    } else if (t.equals("Immunization")) {
29081      return parseImmunization(json);
29082    } else if (t.equals("ImmunizationEvaluation")) {
29083      return parseImmunizationEvaluation(json);
29084    } else if (t.equals("ImmunizationRecommendation")) {
29085      return parseImmunizationRecommendation(json);
29086    } else if (t.equals("ImplementationGuide")) {
29087      return parseImplementationGuide(json);
29088    } else if (t.equals("Ingredient")) {
29089      return parseIngredient(json);
29090    } else if (t.equals("InsurancePlan")) {
29091      return parseInsurancePlan(json);
29092    } else if (t.equals("Invoice")) {
29093      return parseInvoice(json);
29094    } else if (t.equals("Library")) {
29095      return parseLibrary(json);
29096    } else if (t.equals("Linkage")) {
29097      return parseLinkage(json);
29098    } else if (t.equals("List")) {
29099      return parseListResource(json);
29100    } else if (t.equals("Location")) {
29101      return parseLocation(json);
29102    } else if (t.equals("ManufacturedItemDefinition")) {
29103      return parseManufacturedItemDefinition(json);
29104    } else if (t.equals("Measure")) {
29105      return parseMeasure(json);
29106    } else if (t.equals("MeasureReport")) {
29107      return parseMeasureReport(json);
29108    } else if (t.equals("Medication")) {
29109      return parseMedication(json);
29110    } else if (t.equals("MedicationAdministration")) {
29111      return parseMedicationAdministration(json);
29112    } else if (t.equals("MedicationDispense")) {
29113      return parseMedicationDispense(json);
29114    } else if (t.equals("MedicationKnowledge")) {
29115      return parseMedicationKnowledge(json);
29116    } else if (t.equals("MedicationRequest")) {
29117      return parseMedicationRequest(json);
29118    } else if (t.equals("MedicationUsage")) {
29119      return parseMedicationUsage(json);
29120    } else if (t.equals("MedicinalProductDefinition")) {
29121      return parseMedicinalProductDefinition(json);
29122    } else if (t.equals("MessageDefinition")) {
29123      return parseMessageDefinition(json);
29124    } else if (t.equals("MessageHeader")) {
29125      return parseMessageHeader(json);
29126    } else if (t.equals("MolecularSequence")) {
29127      return parseMolecularSequence(json);
29128    } else if (t.equals("NamingSystem")) {
29129      return parseNamingSystem(json);
29130    } else if (t.equals("NutritionIntake")) {
29131      return parseNutritionIntake(json);
29132    } else if (t.equals("NutritionOrder")) {
29133      return parseNutritionOrder(json);
29134    } else if (t.equals("Observation")) {
29135      return parseObservation(json);
29136    } else if (t.equals("ObservationDefinition")) {
29137      return parseObservationDefinition(json);
29138    } else if (t.equals("OperationDefinition")) {
29139      return parseOperationDefinition(json);
29140    } else if (t.equals("OperationOutcome")) {
29141      return parseOperationOutcome(json);
29142    } else if (t.equals("Organization")) {
29143      return parseOrganization(json);
29144    } else if (t.equals("OrganizationAffiliation")) {
29145      return parseOrganizationAffiliation(json);
29146    } else if (t.equals("PackagedProductDefinition")) {
29147      return parsePackagedProductDefinition(json);
29148    } else if (t.equals("Parameters")) {
29149      return parseParameters(json);
29150    } else if (t.equals("Patient")) {
29151      return parsePatient(json);
29152    } else if (t.equals("PaymentNotice")) {
29153      return parsePaymentNotice(json);
29154    } else if (t.equals("PaymentReconciliation")) {
29155      return parsePaymentReconciliation(json);
29156    } else if (t.equals("Person")) {
29157      return parsePerson(json);
29158    } else if (t.equals("PlanDefinition")) {
29159      return parsePlanDefinition(json);
29160    } else if (t.equals("Practitioner")) {
29161      return parsePractitioner(json);
29162    } else if (t.equals("PractitionerRole")) {
29163      return parsePractitionerRole(json);
29164    } else if (t.equals("Procedure")) {
29165      return parseProcedure(json);
29166    } else if (t.equals("Provenance")) {
29167      return parseProvenance(json);
29168    } else if (t.equals("Questionnaire")) {
29169      return parseQuestionnaire(json);
29170    } else if (t.equals("QuestionnaireResponse")) {
29171      return parseQuestionnaireResponse(json);
29172    } else if (t.equals("RegulatedAuthorization")) {
29173      return parseRegulatedAuthorization(json);
29174    } else if (t.equals("RelatedPerson")) {
29175      return parseRelatedPerson(json);
29176    } else if (t.equals("RequestGroup")) {
29177      return parseRequestGroup(json);
29178    } else if (t.equals("ResearchStudy")) {
29179      return parseResearchStudy(json);
29180    } else if (t.equals("ResearchSubject")) {
29181      return parseResearchSubject(json);
29182    } else if (t.equals("RiskAssessment")) {
29183      return parseRiskAssessment(json);
29184    } else if (t.equals("Schedule")) {
29185      return parseSchedule(json);
29186    } else if (t.equals("SearchParameter")) {
29187      return parseSearchParameter(json);
29188    } else if (t.equals("ServiceRequest")) {
29189      return parseServiceRequest(json);
29190    } else if (t.equals("Slot")) {
29191      return parseSlot(json);
29192    } else if (t.equals("Specimen")) {
29193      return parseSpecimen(json);
29194    } else if (t.equals("SpecimenDefinition")) {
29195      return parseSpecimenDefinition(json);
29196    } else if (t.equals("StructureDefinition")) {
29197      return parseStructureDefinition(json);
29198    } else if (t.equals("StructureMap")) {
29199      return parseStructureMap(json);
29200    } else if (t.equals("Subscription")) {
29201      return parseSubscription(json);
29202    } else if (t.equals("Substance")) {
29203      return parseSubstance(json);
29204    } else if (t.equals("SubstanceDefinition")) {
29205      return parseSubstanceDefinition(json);
29206    } else if (t.equals("SubstanceNucleicAcid")) {
29207      return parseSubstanceNucleicAcid(json);
29208    } else if (t.equals("SubstancePolymer")) {
29209      return parseSubstancePolymer(json);
29210    } else if (t.equals("SubstanceProtein")) {
29211      return parseSubstanceProtein(json);
29212    } else if (t.equals("SubstanceReferenceInformation")) {
29213      return parseSubstanceReferenceInformation(json);
29214    } else if (t.equals("SubstanceSourceMaterial")) {
29215      return parseSubstanceSourceMaterial(json);
29216    } else if (t.equals("SupplyDelivery")) {
29217      return parseSupplyDelivery(json);
29218    } else if (t.equals("SupplyRequest")) {
29219      return parseSupplyRequest(json);
29220    } else if (t.equals("Task")) {
29221      return parseTask(json);
29222    } else if (t.equals("TerminologyCapabilities")) {
29223      return parseTerminologyCapabilities(json);
29224    } else if (t.equals("TestReport")) {
29225      return parseTestReport(json);
29226    } else if (t.equals("TestScript")) {
29227      return parseTestScript(json);
29228    } else if (t.equals("Topic")) {
29229      return parseTopic(json);
29230    } else if (t.equals("ValueSet")) {
29231      return parseValueSet(json);
29232    } else if (t.equals("VerificationResult")) {
29233      return parseVerificationResult(json);
29234    } else if (t.equals("VisionPrescription")) {
29235      return parseVisionPrescription(json);
29236
29237    } else {
29238      throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
29239    }
29240  }
29241
29242  protected DataType parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
29243    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
29244      DataType t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
29245      if (json.has("_"+prefix+"Date"))
29246        parseElementProperties(json.getAsJsonObject("_"+prefix+"Date"), t);
29247      return t;
29248    }
29249    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
29250      DataType t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
29251      if (json.has("_"+prefix+"DateTime"))
29252        parseElementProperties(json.getAsJsonObject("_"+prefix+"DateTime"), t);
29253      return t;
29254    }
29255    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
29256      DataType t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
29257      if (json.has("_"+prefix+"Code"))
29258        parseElementProperties(json.getAsJsonObject("_"+prefix+"Code"), t);
29259      return t;
29260    }
29261    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
29262      DataType t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
29263      if (json.has("_"+prefix+"String"))
29264        parseElementProperties(json.getAsJsonObject("_"+prefix+"String"), t);
29265      return t;
29266    }
29267    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
29268      DataType t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
29269      if (json.has("_"+prefix+"Integer"))
29270        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
29271      return t;
29272    }
29273    else if (json.has(prefix+"Integer64") || json.has("_"+prefix+"Integer64")) {
29274      DataType t = json.has(prefix+"Integer64") ? parseInteger64(json.get(prefix+"Integer64").getAsLong()) : new Integer64Type();
29275      if (json.has("_"+prefix+"Integer64"))
29276        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer64"), t);
29277      return t;
29278    }
29279    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
29280      DataType t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
29281      if (json.has("_"+prefix+"Oid"))
29282        parseElementProperties(json.getAsJsonObject("_"+prefix+"Oid"), t);
29283      return t;
29284    }
29285    else if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical")) {
29286      DataType t = json.has(prefix+"Canonical") ? parseCanonical(json.get(prefix+"Canonical").getAsString()) : new CanonicalType();
29287      if (json.has("_"+prefix+"Canonical"))
29288        parseElementProperties(json.getAsJsonObject("_"+prefix+"Canonical"), t);
29289      return t;
29290    }
29291    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
29292      DataType t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
29293      if (json.has("_"+prefix+"Uri"))
29294        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uri"), t);
29295      return t;
29296    }
29297    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
29298      DataType t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
29299      if (json.has("_"+prefix+"Uuid"))
29300        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uuid"), t);
29301      return t;
29302    }
29303    else if (json.has(prefix+"Url") || json.has("_"+prefix+"Url")) {
29304      DataType t = json.has(prefix+"Url") ? parseUrl(json.get(prefix+"Url").getAsString()) : new UrlType();
29305      if (json.has("_"+prefix+"Url"))
29306        parseElementProperties(json.getAsJsonObject("_"+prefix+"Url"), t);
29307      return t;
29308    }
29309    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
29310      DataType t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
29311      if (json.has("_"+prefix+"Instant"))
29312        parseElementProperties(json.getAsJsonObject("_"+prefix+"Instant"), t);
29313      return t;
29314    }
29315    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
29316      DataType t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
29317      if (json.has("_"+prefix+"Boolean"))
29318        parseElementProperties(json.getAsJsonObject("_"+prefix+"Boolean"), t);
29319      return t;
29320    }
29321    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
29322      DataType t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
29323      if (json.has("_"+prefix+"Base64Binary"))
29324        parseElementProperties(json.getAsJsonObject("_"+prefix+"Base64Binary"), t);
29325      return t;
29326    }
29327    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
29328      DataType t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
29329      if (json.has("_"+prefix+"UnsignedInt"))
29330        parseElementProperties(json.getAsJsonObject("_"+prefix+"UnsignedInt"), t);
29331      return t;
29332    }
29333    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
29334      DataType t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
29335      if (json.has("_"+prefix+"Markdown"))
29336        parseElementProperties(json.getAsJsonObject("_"+prefix+"Markdown"), t);
29337      return t;
29338    }
29339    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
29340      DataType t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
29341      if (json.has("_"+prefix+"Time"))
29342        parseElementProperties(json.getAsJsonObject("_"+prefix+"Time"), t);
29343      return t;
29344    }
29345    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
29346      DataType t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
29347      if (json.has("_"+prefix+"Id"))
29348        parseElementProperties(json.getAsJsonObject("_"+prefix+"Id"), t);
29349      return t;
29350    }
29351    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
29352      DataType t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
29353      if (json.has("_"+prefix+"PositiveInt"))
29354        parseElementProperties(json.getAsJsonObject("_"+prefix+"PositiveInt"), t);
29355      return t;
29356    }
29357    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
29358      DataType t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
29359      if (json.has("_"+prefix+"Decimal"))
29360        parseElementProperties(json.getAsJsonObject("_"+prefix+"Decimal"), t);
29361      return t;
29362    } else if (json.has(prefix+"Address")) {
29363      return parseAddress(json.getAsJsonObject(prefix+"Address"));
29364    } else if (json.has(prefix+"Age")) {
29365      return parseAge(json.getAsJsonObject(prefix+"Age"));
29366    } else if (json.has(prefix+"Annotation")) {
29367      return parseAnnotation(json.getAsJsonObject(prefix+"Annotation"));
29368    } else if (json.has(prefix+"Attachment")) {
29369      return parseAttachment(json.getAsJsonObject(prefix+"Attachment"));
29370    } else if (json.has(prefix+"CodeableConcept")) {
29371      return parseCodeableConcept(json.getAsJsonObject(prefix+"CodeableConcept"));
29372    } else if (json.has(prefix+"CodeableReference")) {
29373      return parseCodeableReference(json.getAsJsonObject(prefix+"CodeableReference"));
29374    } else if (json.has(prefix+"Coding")) {
29375      return parseCoding(json.getAsJsonObject(prefix+"Coding"));
29376    } else if (json.has(prefix+"ContactDetail")) {
29377      return parseContactDetail(json.getAsJsonObject(prefix+"ContactDetail"));
29378    } else if (json.has(prefix+"ContactPoint")) {
29379      return parseContactPoint(json.getAsJsonObject(prefix+"ContactPoint"));
29380    } else if (json.has(prefix+"Contributor")) {
29381      return parseContributor(json.getAsJsonObject(prefix+"Contributor"));
29382    } else if (json.has(prefix+"Count")) {
29383      return parseCount(json.getAsJsonObject(prefix+"Count"));
29384    } else if (json.has(prefix+"DataRequirement")) {
29385      return parseDataRequirement(json.getAsJsonObject(prefix+"DataRequirement"));
29386    } else if (json.has(prefix+"Distance")) {
29387      return parseDistance(json.getAsJsonObject(prefix+"Distance"));
29388    } else if (json.has(prefix+"Dosage")) {
29389      return parseDosage(json.getAsJsonObject(prefix+"Dosage"));
29390    } else if (json.has(prefix+"Duration")) {
29391      return parseDuration(json.getAsJsonObject(prefix+"Duration"));
29392    } else if (json.has(prefix+"ElementDefinition")) {
29393      return parseElementDefinition(json.getAsJsonObject(prefix+"ElementDefinition"));
29394    } else if (json.has(prefix+"Expression")) {
29395      return parseExpression(json.getAsJsonObject(prefix+"Expression"));
29396    } else if (json.has(prefix+"Extension")) {
29397      return parseExtension(json.getAsJsonObject(prefix+"Extension"));
29398    } else if (json.has(prefix+"HumanName")) {
29399      return parseHumanName(json.getAsJsonObject(prefix+"HumanName"));
29400    } else if (json.has(prefix+"Identifier")) {
29401      return parseIdentifier(json.getAsJsonObject(prefix+"Identifier"));
29402    } else if (json.has(prefix+"MarketingStatus")) {
29403      return parseMarketingStatus(json.getAsJsonObject(prefix+"MarketingStatus"));
29404    } else if (json.has(prefix+"Meta")) {
29405      return parseMeta(json.getAsJsonObject(prefix+"Meta"));
29406    } else if (json.has(prefix+"Money")) {
29407      return parseMoney(json.getAsJsonObject(prefix+"Money"));
29408    } else if (json.has(prefix+"Narrative")) {
29409      return parseNarrative(json.getAsJsonObject(prefix+"Narrative"));
29410    } else if (json.has(prefix+"OrderedDistribution")) {
29411      return parseOrderedDistribution(json.getAsJsonObject(prefix+"OrderedDistribution"));
29412    } else if (json.has(prefix+"ParameterDefinition")) {
29413      return parseParameterDefinition(json.getAsJsonObject(prefix+"ParameterDefinition"));
29414    } else if (json.has(prefix+"Period")) {
29415      return parsePeriod(json.getAsJsonObject(prefix+"Period"));
29416    } else if (json.has(prefix+"Population")) {
29417      return parsePopulation(json.getAsJsonObject(prefix+"Population"));
29418    } else if (json.has(prefix+"ProdCharacteristic")) {
29419      return parseProdCharacteristic(json.getAsJsonObject(prefix+"ProdCharacteristic"));
29420    } else if (json.has(prefix+"ProductShelfLife")) {
29421      return parseProductShelfLife(json.getAsJsonObject(prefix+"ProductShelfLife"));
29422    } else if (json.has(prefix+"Quantity")) {
29423      return parseQuantity(json.getAsJsonObject(prefix+"Quantity"));
29424    } else if (json.has(prefix+"Range")) {
29425      return parseRange(json.getAsJsonObject(prefix+"Range"));
29426    } else if (json.has(prefix+"Ratio")) {
29427      return parseRatio(json.getAsJsonObject(prefix+"Ratio"));
29428    } else if (json.has(prefix+"Reference")) {
29429      return parseReference(json.getAsJsonObject(prefix+"Reference"));
29430    } else if (json.has(prefix+"RelatedArtifact")) {
29431      return parseRelatedArtifact(json.getAsJsonObject(prefix+"RelatedArtifact"));
29432    } else if (json.has(prefix+"SampledData")) {
29433      return parseSampledData(json.getAsJsonObject(prefix+"SampledData"));
29434    } else if (json.has(prefix+"Signature")) {
29435      return parseSignature(json.getAsJsonObject(prefix+"Signature"));
29436    } else if (json.has(prefix+"Statistic")) {
29437      return parseStatistic(json.getAsJsonObject(prefix+"Statistic"));
29438    } else if (json.has(prefix+"SubstanceAmount")) {
29439      return parseSubstanceAmount(json.getAsJsonObject(prefix+"SubstanceAmount"));
29440    } else if (json.has(prefix+"Timing")) {
29441      return parseTiming(json.getAsJsonObject(prefix+"Timing"));
29442    } else if (json.has(prefix+"TriggerDefinition")) {
29443      return parseTriggerDefinition(json.getAsJsonObject(prefix+"TriggerDefinition"));
29444    } else if (json.has(prefix+"UsageContext")) {
29445      return parseUsageContext(json.getAsJsonObject(prefix+"UsageContext"));
29446
29447    } else {
29448      return null;
29449    }
29450  }
29451
29452  protected DataType parseAnyType(JsonObject json, String type) throws IOException, FHIRFormatError {
29453    return parseType(json, type);
29454  }
29455
29456  protected DataType parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
29457    if (Utilities.noString(type)) {
29458      throw new FHIRFormatError("Unable to parse type - type not specified"); 
29459   } else if (type.equals("Address")) {
29460      return parseAddress(json);
29461   } else if (type.equals("Age")) {
29462      return parseAge(json);
29463   } else if (type.equals("Annotation")) {
29464      return parseAnnotation(json);
29465   } else if (type.equals("Attachment")) {
29466      return parseAttachment(json);
29467   } else if (type.equals("CodeableConcept")) {
29468      return parseCodeableConcept(json);
29469   } else if (type.equals("CodeableReference")) {
29470      return parseCodeableReference(json);
29471   } else if (type.equals("Coding")) {
29472      return parseCoding(json);
29473   } else if (type.equals("ContactDetail")) {
29474      return parseContactDetail(json);
29475   } else if (type.equals("ContactPoint")) {
29476      return parseContactPoint(json);
29477   } else if (type.equals("Contributor")) {
29478      return parseContributor(json);
29479   } else if (type.equals("Count")) {
29480      return parseCount(json);
29481   } else if (type.equals("DataRequirement")) {
29482      return parseDataRequirement(json);
29483   } else if (type.equals("Distance")) {
29484      return parseDistance(json);
29485   } else if (type.equals("Dosage")) {
29486      return parseDosage(json);
29487   } else if (type.equals("Duration")) {
29488      return parseDuration(json);
29489   } else if (type.equals("ElementDefinition")) {
29490      return parseElementDefinition(json);
29491   } else if (type.equals("Expression")) {
29492      return parseExpression(json);
29493   } else if (type.equals("Extension")) {
29494      return parseExtension(json);
29495   } else if (type.equals("HumanName")) {
29496      return parseHumanName(json);
29497   } else if (type.equals("Identifier")) {
29498      return parseIdentifier(json);
29499   } else if (type.equals("MarketingStatus")) {
29500      return parseMarketingStatus(json);
29501   } else if (type.equals("Meta")) {
29502      return parseMeta(json);
29503   } else if (type.equals("Money")) {
29504      return parseMoney(json);
29505   } else if (type.equals("Narrative")) {
29506      return parseNarrative(json);
29507   } else if (type.equals("OrderedDistribution")) {
29508      return parseOrderedDistribution(json);
29509   } else if (type.equals("ParameterDefinition")) {
29510      return parseParameterDefinition(json);
29511   } else if (type.equals("Period")) {
29512      return parsePeriod(json);
29513   } else if (type.equals("Population")) {
29514      return parsePopulation(json);
29515   } else if (type.equals("ProdCharacteristic")) {
29516      return parseProdCharacteristic(json);
29517   } else if (type.equals("ProductShelfLife")) {
29518      return parseProductShelfLife(json);
29519   } else if (type.equals("Quantity")) {
29520      return parseQuantity(json);
29521   } else if (type.equals("Range")) {
29522      return parseRange(json);
29523   } else if (type.equals("Ratio")) {
29524      return parseRatio(json);
29525   } else if (type.equals("Reference")) {
29526      return parseReference(json);
29527   } else if (type.equals("RelatedArtifact")) {
29528      return parseRelatedArtifact(json);
29529   } else if (type.equals("SampledData")) {
29530      return parseSampledData(json);
29531   } else if (type.equals("Signature")) {
29532      return parseSignature(json);
29533   } else if (type.equals("Statistic")) {
29534      return parseStatistic(json);
29535   } else if (type.equals("SubstanceAmount")) {
29536      return parseSubstanceAmount(json);
29537   } else if (type.equals("Timing")) {
29538      return parseTiming(json);
29539   } else if (type.equals("TriggerDefinition")) {
29540      return parseTriggerDefinition(json);
29541   } else if (type.equals("UsageContext")) {
29542      return parseUsageContext(json);
29543
29544    } else {
29545      throw new FHIRFormatError("Unknown Type "+type);
29546    }
29547  }
29548
29549  protected boolean hasTypeName(JsonObject json, String prefix) {
29550    if (json.has(prefix+"Address")) {
29551      return true;
29552    };
29553    if (json.has(prefix+"Age")) {
29554      return true;
29555    };
29556    if (json.has(prefix+"Annotation")) {
29557      return true;
29558    };
29559    if (json.has(prefix+"Attachment")) {
29560      return true;
29561    };
29562    if (json.has(prefix+"CodeableConcept")) {
29563      return true;
29564    };
29565    if (json.has(prefix+"CodeableReference")) {
29566      return true;
29567    };
29568    if (json.has(prefix+"Coding")) {
29569      return true;
29570    };
29571    if (json.has(prefix+"ContactDetail")) {
29572      return true;
29573    };
29574    if (json.has(prefix+"ContactPoint")) {
29575      return true;
29576    };
29577    if (json.has(prefix+"Contributor")) {
29578      return true;
29579    };
29580    if (json.has(prefix+"Count")) {
29581      return true;
29582    };
29583    if (json.has(prefix+"DataRequirement")) {
29584      return true;
29585    };
29586    if (json.has(prefix+"Distance")) {
29587      return true;
29588    };
29589    if (json.has(prefix+"Dosage")) {
29590      return true;
29591    };
29592    if (json.has(prefix+"Duration")) {
29593      return true;
29594    };
29595    if (json.has(prefix+"ElementDefinition")) {
29596      return true;
29597    };
29598    if (json.has(prefix+"Expression")) {
29599      return true;
29600    };
29601    if (json.has(prefix+"Extension")) {
29602      return true;
29603    };
29604    if (json.has(prefix+"HumanName")) {
29605      return true;
29606    };
29607    if (json.has(prefix+"Identifier")) {
29608      return true;
29609    };
29610    if (json.has(prefix+"MarketingStatus")) {
29611      return true;
29612    };
29613    if (json.has(prefix+"Meta")) {
29614      return true;
29615    };
29616    if (json.has(prefix+"Money")) {
29617      return true;
29618    };
29619    if (json.has(prefix+"Narrative")) {
29620      return true;
29621    };
29622    if (json.has(prefix+"OrderedDistribution")) {
29623      return true;
29624    };
29625    if (json.has(prefix+"ParameterDefinition")) {
29626      return true;
29627    };
29628    if (json.has(prefix+"Period")) {
29629      return true;
29630    };
29631    if (json.has(prefix+"Population")) {
29632      return true;
29633    };
29634    if (json.has(prefix+"ProdCharacteristic")) {
29635      return true;
29636    };
29637    if (json.has(prefix+"ProductShelfLife")) {
29638      return true;
29639    };
29640    if (json.has(prefix+"Quantity")) {
29641      return true;
29642    };
29643    if (json.has(prefix+"Range")) {
29644      return true;
29645    };
29646    if (json.has(prefix+"Ratio")) {
29647      return true;
29648    };
29649    if (json.has(prefix+"Reference")) {
29650      return true;
29651    };
29652    if (json.has(prefix+"RelatedArtifact")) {
29653      return true;
29654    };
29655    if (json.has(prefix+"SampledData")) {
29656      return true;
29657    };
29658    if (json.has(prefix+"Signature")) {
29659      return true;
29660    };
29661    if (json.has(prefix+"Statistic")) {
29662      return true;
29663    };
29664    if (json.has(prefix+"SubstanceAmount")) {
29665      return true;
29666    };
29667    if (json.has(prefix+"Timing")) {
29668      return true;
29669    };
29670    if (json.has(prefix+"TriggerDefinition")) {
29671      return true;
29672    };
29673    if (json.has(prefix+"UsageContext")) {
29674      return true;
29675    };
29676    if (json.has(prefix+"Account")) {
29677      return true;
29678    };
29679    if (json.has(prefix+"ActivityDefinition")) {
29680      return true;
29681    };
29682    if (json.has(prefix+"AdministrableProductDefinition")) {
29683      return true;
29684    };
29685    if (json.has(prefix+"AdverseEvent")) {
29686      return true;
29687    };
29688    if (json.has(prefix+"AllergyIntolerance")) {
29689      return true;
29690    };
29691    if (json.has(prefix+"Appointment")) {
29692      return true;
29693    };
29694    if (json.has(prefix+"AppointmentResponse")) {
29695      return true;
29696    };
29697    if (json.has(prefix+"AuditEvent")) {
29698      return true;
29699    };
29700    if (json.has(prefix+"Basic")) {
29701      return true;
29702    };
29703    if (json.has(prefix+"Binary")) {
29704      return true;
29705    };
29706    if (json.has(prefix+"BiologicallyDerivedProduct")) {
29707      return true;
29708    };
29709    if (json.has(prefix+"BodyStructure")) {
29710      return true;
29711    };
29712    if (json.has(prefix+"Bundle")) {
29713      return true;
29714    };
29715    if (json.has(prefix+"CapabilityStatement")) {
29716      return true;
29717    };
29718    if (json.has(prefix+"CapabilityStatement2")) {
29719      return true;
29720    };
29721    if (json.has(prefix+"CarePlan")) {
29722      return true;
29723    };
29724    if (json.has(prefix+"CareTeam")) {
29725      return true;
29726    };
29727    if (json.has(prefix+"CatalogEntry")) {
29728      return true;
29729    };
29730    if (json.has(prefix+"ChargeItem")) {
29731      return true;
29732    };
29733    if (json.has(prefix+"ChargeItemDefinition")) {
29734      return true;
29735    };
29736    if (json.has(prefix+"Claim")) {
29737      return true;
29738    };
29739    if (json.has(prefix+"ClaimResponse")) {
29740      return true;
29741    };
29742    if (json.has(prefix+"ClinicalImpression")) {
29743      return true;
29744    };
29745    if (json.has(prefix+"ClinicalUseIssue")) {
29746      return true;
29747    };
29748    if (json.has(prefix+"CodeSystem")) {
29749      return true;
29750    };
29751    if (json.has(prefix+"Communication")) {
29752      return true;
29753    };
29754    if (json.has(prefix+"CommunicationRequest")) {
29755      return true;
29756    };
29757    if (json.has(prefix+"CompartmentDefinition")) {
29758      return true;
29759    };
29760    if (json.has(prefix+"Composition")) {
29761      return true;
29762    };
29763    if (json.has(prefix+"ConceptMap")) {
29764      return true;
29765    };
29766    if (json.has(prefix+"Condition")) {
29767      return true;
29768    };
29769    if (json.has(prefix+"ConditionDefinition")) {
29770      return true;
29771    };
29772    if (json.has(prefix+"Consent")) {
29773      return true;
29774    };
29775    if (json.has(prefix+"Contract")) {
29776      return true;
29777    };
29778    if (json.has(prefix+"Coverage")) {
29779      return true;
29780    };
29781    if (json.has(prefix+"CoverageEligibilityRequest")) {
29782      return true;
29783    };
29784    if (json.has(prefix+"CoverageEligibilityResponse")) {
29785      return true;
29786    };
29787    if (json.has(prefix+"DetectedIssue")) {
29788      return true;
29789    };
29790    if (json.has(prefix+"Device")) {
29791      return true;
29792    };
29793    if (json.has(prefix+"DeviceDefinition")) {
29794      return true;
29795    };
29796    if (json.has(prefix+"DeviceMetric")) {
29797      return true;
29798    };
29799    if (json.has(prefix+"DeviceRequest")) {
29800      return true;
29801    };
29802    if (json.has(prefix+"DeviceUseStatement")) {
29803      return true;
29804    };
29805    if (json.has(prefix+"DiagnosticReport")) {
29806      return true;
29807    };
29808    if (json.has(prefix+"DocumentManifest")) {
29809      return true;
29810    };
29811    if (json.has(prefix+"DocumentReference")) {
29812      return true;
29813    };
29814    if (json.has(prefix+"Encounter")) {
29815      return true;
29816    };
29817    if (json.has(prefix+"Endpoint")) {
29818      return true;
29819    };
29820    if (json.has(prefix+"EnrollmentRequest")) {
29821      return true;
29822    };
29823    if (json.has(prefix+"EnrollmentResponse")) {
29824      return true;
29825    };
29826    if (json.has(prefix+"EpisodeOfCare")) {
29827      return true;
29828    };
29829    if (json.has(prefix+"EventDefinition")) {
29830      return true;
29831    };
29832    if (json.has(prefix+"Evidence")) {
29833      return true;
29834    };
29835    if (json.has(prefix+"EvidenceVariable")) {
29836      return true;
29837    };
29838    if (json.has(prefix+"ExampleScenario")) {
29839      return true;
29840    };
29841    if (json.has(prefix+"ExplanationOfBenefit")) {
29842      return true;
29843    };
29844    if (json.has(prefix+"FamilyMemberHistory")) {
29845      return true;
29846    };
29847    if (json.has(prefix+"Flag")) {
29848      return true;
29849    };
29850    if (json.has(prefix+"Goal")) {
29851      return true;
29852    };
29853    if (json.has(prefix+"GraphDefinition")) {
29854      return true;
29855    };
29856    if (json.has(prefix+"Group")) {
29857      return true;
29858    };
29859    if (json.has(prefix+"GuidanceResponse")) {
29860      return true;
29861    };
29862    if (json.has(prefix+"HealthcareService")) {
29863      return true;
29864    };
29865    if (json.has(prefix+"ImagingStudy")) {
29866      return true;
29867    };
29868    if (json.has(prefix+"Immunization")) {
29869      return true;
29870    };
29871    if (json.has(prefix+"ImmunizationEvaluation")) {
29872      return true;
29873    };
29874    if (json.has(prefix+"ImmunizationRecommendation")) {
29875      return true;
29876    };
29877    if (json.has(prefix+"ImplementationGuide")) {
29878      return true;
29879    };
29880    if (json.has(prefix+"Ingredient")) {
29881      return true;
29882    };
29883    if (json.has(prefix+"InsurancePlan")) {
29884      return true;
29885    };
29886    if (json.has(prefix+"Invoice")) {
29887      return true;
29888    };
29889    if (json.has(prefix+"Library")) {
29890      return true;
29891    };
29892    if (json.has(prefix+"Linkage")) {
29893      return true;
29894    };
29895    if (json.has(prefix+"List")) {
29896      return true;
29897    };
29898    if (json.has(prefix+"Location")) {
29899      return true;
29900    };
29901    if (json.has(prefix+"ManufacturedItemDefinition")) {
29902      return true;
29903    };
29904    if (json.has(prefix+"Measure")) {
29905      return true;
29906    };
29907    if (json.has(prefix+"MeasureReport")) {
29908      return true;
29909    };
29910    if (json.has(prefix+"Medication")) {
29911      return true;
29912    };
29913    if (json.has(prefix+"MedicationAdministration")) {
29914      return true;
29915    };
29916    if (json.has(prefix+"MedicationDispense")) {
29917      return true;
29918    };
29919    if (json.has(prefix+"MedicationKnowledge")) {
29920      return true;
29921    };
29922    if (json.has(prefix+"MedicationRequest")) {
29923      return true;
29924    };
29925    if (json.has(prefix+"MedicationUsage")) {
29926      return true;
29927    };
29928    if (json.has(prefix+"MedicinalProductDefinition")) {
29929      return true;
29930    };
29931    if (json.has(prefix+"MessageDefinition")) {
29932      return true;
29933    };
29934    if (json.has(prefix+"MessageHeader")) {
29935      return true;
29936    };
29937    if (json.has(prefix+"MolecularSequence")) {
29938      return true;
29939    };
29940    if (json.has(prefix+"NamingSystem")) {
29941      return true;
29942    };
29943    if (json.has(prefix+"NutritionIntake")) {
29944      return true;
29945    };
29946    if (json.has(prefix+"NutritionOrder")) {
29947      return true;
29948    };
29949    if (json.has(prefix+"Observation")) {
29950      return true;
29951    };
29952    if (json.has(prefix+"ObservationDefinition")) {
29953      return true;
29954    };
29955    if (json.has(prefix+"OperationDefinition")) {
29956      return true;
29957    };
29958    if (json.has(prefix+"OperationOutcome")) {
29959      return true;
29960    };
29961    if (json.has(prefix+"Organization")) {
29962      return true;
29963    };
29964    if (json.has(prefix+"OrganizationAffiliation")) {
29965      return true;
29966    };
29967    if (json.has(prefix+"PackagedProductDefinition")) {
29968      return true;
29969    };
29970    if (json.has(prefix+"Parameters")) {
29971      return true;
29972    };
29973    if (json.has(prefix+"Patient")) {
29974      return true;
29975    };
29976    if (json.has(prefix+"PaymentNotice")) {
29977      return true;
29978    };
29979    if (json.has(prefix+"PaymentReconciliation")) {
29980      return true;
29981    };
29982    if (json.has(prefix+"Person")) {
29983      return true;
29984    };
29985    if (json.has(prefix+"PlanDefinition")) {
29986      return true;
29987    };
29988    if (json.has(prefix+"Practitioner")) {
29989      return true;
29990    };
29991    if (json.has(prefix+"PractitionerRole")) {
29992      return true;
29993    };
29994    if (json.has(prefix+"Procedure")) {
29995      return true;
29996    };
29997    if (json.has(prefix+"Provenance")) {
29998      return true;
29999    };
30000    if (json.has(prefix+"Questionnaire")) {
30001      return true;
30002    };
30003    if (json.has(prefix+"QuestionnaireResponse")) {
30004      return true;
30005    };
30006    if (json.has(prefix+"RegulatedAuthorization")) {
30007      return true;
30008    };
30009    if (json.has(prefix+"RelatedPerson")) {
30010      return true;
30011    };
30012    if (json.has(prefix+"RequestGroup")) {
30013      return true;
30014    };
30015    if (json.has(prefix+"ResearchStudy")) {
30016      return true;
30017    };
30018    if (json.has(prefix+"ResearchSubject")) {
30019      return true;
30020    };
30021    if (json.has(prefix+"RiskAssessment")) {
30022      return true;
30023    };
30024    if (json.has(prefix+"Schedule")) {
30025      return true;
30026    };
30027    if (json.has(prefix+"SearchParameter")) {
30028      return true;
30029    };
30030    if (json.has(prefix+"ServiceRequest")) {
30031      return true;
30032    };
30033    if (json.has(prefix+"Slot")) {
30034      return true;
30035    };
30036    if (json.has(prefix+"Specimen")) {
30037      return true;
30038    };
30039    if (json.has(prefix+"SpecimenDefinition")) {
30040      return true;
30041    };
30042    if (json.has(prefix+"StructureDefinition")) {
30043      return true;
30044    };
30045    if (json.has(prefix+"StructureMap")) {
30046      return true;
30047    };
30048    if (json.has(prefix+"Subscription")) {
30049      return true;
30050    };
30051    if (json.has(prefix+"Substance")) {
30052      return true;
30053    };
30054    if (json.has(prefix+"SubstanceDefinition")) {
30055      return true;
30056    };
30057    if (json.has(prefix+"SubstanceNucleicAcid")) {
30058      return true;
30059    };
30060    if (json.has(prefix+"SubstancePolymer")) {
30061      return true;
30062    };
30063    if (json.has(prefix+"SubstanceProtein")) {
30064      return true;
30065    };
30066    if (json.has(prefix+"SubstanceReferenceInformation")) {
30067      return true;
30068    };
30069    if (json.has(prefix+"SubstanceSourceMaterial")) {
30070      return true;
30071    };
30072    if (json.has(prefix+"SupplyDelivery")) {
30073      return true;
30074    };
30075    if (json.has(prefix+"SupplyRequest")) {
30076      return true;
30077    };
30078    if (json.has(prefix+"Task")) {
30079      return true;
30080    };
30081    if (json.has(prefix+"TerminologyCapabilities")) {
30082      return true;
30083    };
30084    if (json.has(prefix+"TestReport")) {
30085      return true;
30086    };
30087    if (json.has(prefix+"TestScript")) {
30088      return true;
30089    };
30090    if (json.has(prefix+"Topic")) {
30091      return true;
30092    };
30093    if (json.has(prefix+"ValueSet")) {
30094      return true;
30095    };
30096    if (json.has(prefix+"VerificationResult")) {
30097      return true;
30098    };
30099    if (json.has(prefix+"VisionPrescription")) {
30100      return true;
30101    };
30102
30103    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
30104      return true;
30105    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
30106      return true;
30107    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
30108      return true;
30109    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
30110      return true;
30111    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
30112      return true;
30113    if (json.has(prefix+"Integer64") || json.has("_"+prefix+"Integer64"))
30114      return true;
30115    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
30116      return true;
30117    if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical"))
30118      return true;
30119    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
30120      return true;
30121    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
30122      return true;
30123    if (json.has(prefix+"Url") || json.has("_"+prefix+"Url"))
30124      return true;
30125    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
30126      return true;
30127    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
30128      return true;
30129    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
30130      return true;
30131    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
30132      return true;
30133    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
30134      return true;
30135    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
30136      return true;
30137    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
30138      return true;
30139    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
30140      return true;
30141    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
30142      return true;
30143    return false;
30144  }
30145
30146// -- compose ---------------------------------------------------------------------------------------------------------------------
30147
30148  protected void composeBaseProperties(Base element) throws IOException {
30149  }
30150
30151
30152  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
30153    if (value != null && value.getValue() != null) {
30154      prop(name, e.toCode(value.getValue()));
30155    } else if (inArray)   
30156      writeNull(name);
30157  }    
30158
30159  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
30160    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30161      open(inArray ? null : "_"+name);
30162      composeElementProperties(value);
30163      close();
30164    } else if (inArray)   
30165      writeNull(name);
30166  }    
30167
30168  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
30169    if (value != null && value.hasValue()) {
30170        prop(name, value.asStringValue());
30171    }    
30172    else if (inArray) 
30173      writeNull(name); 
30174  }    
30175
30176  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
30177    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30178      open(inArray ? null : "_"+name);
30179      composeElementProperties(value);
30180      close();
30181    }
30182    else if (inArray) 
30183      writeNull(name); 
30184  }
30185
30186  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
30187    if (value != null && value.hasValue()) {
30188        prop(name, value.asStringValue());
30189    }    
30190    else if (inArray) 
30191      writeNull(name); 
30192  }    
30193
30194  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
30195    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30196      open(inArray ? null : "_"+name);
30197      composeElementProperties(value);
30198      close();
30199    }
30200    else if (inArray) 
30201      writeNull(name); 
30202  }
30203
30204  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
30205    if (value != null && value.hasValue()) {
30206        prop(name, toString(value.getValue()));
30207    }    
30208    else if (inArray) 
30209      writeNull(name); 
30210  }    
30211
30212  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
30213    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30214      open(inArray ? null : "_"+name);
30215      composeElementProperties(value);
30216      close();
30217    }
30218    else if (inArray) 
30219      writeNull(name); 
30220  }
30221
30222  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
30223    if (value != null && value.hasValue()) {
30224        prop(name, toString(value.getValue()));
30225    }    
30226    else if (inArray) 
30227      writeNull(name); 
30228  }    
30229
30230  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
30231    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30232      open(inArray ? null : "_"+name);
30233      composeElementProperties(value);
30234      close();
30235    }
30236    else if (inArray) 
30237      writeNull(name); 
30238  }
30239
30240  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
30241    if (value != null && value.hasValue()) {
30242        prop(name, Integer.valueOf(value.getValue()));
30243    }    
30244    else if (inArray) 
30245      writeNull(name); 
30246  }    
30247
30248  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
30249    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30250      open(inArray ? null : "_"+name);
30251      composeElementProperties(value);
30252      close();
30253    }
30254    else if (inArray) 
30255      writeNull(name); 
30256  }
30257
30258  protected void composeInteger64Core(String name, Integer64Type value, boolean inArray) throws IOException {
30259    if (value != null && value.hasValue()) {
30260        prop(name, value.getValue().toString());
30261    }    
30262    else if (inArray) 
30263      writeNull(name); 
30264  }    
30265
30266  protected void composeInteger64Extras(String name, Integer64Type value, boolean inArray) throws IOException {
30267    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30268      open(inArray ? null : "_"+name);
30269      composeElementProperties(value);
30270      close();
30271    }
30272    else if (inArray) 
30273      writeNull(name); 
30274  }
30275
30276  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
30277    if (value != null && value.hasValue()) {
30278        prop(name, toString(value.getValue()));
30279    }    
30280    else if (inArray) 
30281      writeNull(name); 
30282  }    
30283
30284  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
30285    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30286      open(inArray ? null : "_"+name);
30287      composeElementProperties(value);
30288      close();
30289    }
30290    else if (inArray) 
30291      writeNull(name); 
30292  }
30293
30294  protected void composeCanonicalCore(String name, CanonicalType value, boolean inArray) throws IOException {
30295    if (value != null && value.hasValue()) {
30296        prop(name, toString(value.getValue()));
30297    }    
30298    else if (inArray) 
30299      writeNull(name); 
30300  }    
30301
30302  protected void composeCanonicalExtras(String name, CanonicalType value, boolean inArray) throws IOException {
30303    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30304      open(inArray ? null : "_"+name);
30305      composeElementProperties(value);
30306      close();
30307    }
30308    else if (inArray) 
30309      writeNull(name); 
30310  }
30311
30312  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
30313    if (value != null && value.hasValue()) {
30314        prop(name, toString(value.getValue()));
30315    }    
30316    else if (inArray) 
30317      writeNull(name); 
30318  }    
30319
30320  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
30321    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30322      open(inArray ? null : "_"+name);
30323      composeElementProperties(value);
30324      close();
30325    }
30326    else if (inArray) 
30327      writeNull(name); 
30328  }
30329
30330  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
30331    if (value != null && value.hasValue()) {
30332        prop(name, toString(value.getValue()));
30333    }    
30334    else if (inArray) 
30335      writeNull(name); 
30336  }    
30337
30338  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
30339    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30340      open(inArray ? null : "_"+name);
30341      composeElementProperties(value);
30342      close();
30343    }
30344    else if (inArray) 
30345      writeNull(name); 
30346  }
30347
30348  protected void composeUrlCore(String name, UrlType value, boolean inArray) throws IOException {
30349    if (value != null && value.hasValue()) {
30350        prop(name, toString(value.getValue()));
30351    }    
30352    else if (inArray) 
30353      writeNull(name); 
30354  }    
30355
30356  protected void composeUrlExtras(String name, UrlType value, boolean inArray) throws IOException {
30357    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30358      open(inArray ? null : "_"+name);
30359      composeElementProperties(value);
30360      close();
30361    }
30362    else if (inArray) 
30363      writeNull(name); 
30364  }
30365
30366  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
30367    if (value != null && value.hasValue()) {
30368        prop(name, value.asStringValue());
30369    }    
30370    else if (inArray) 
30371      writeNull(name); 
30372  }    
30373
30374  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
30375    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30376      open(inArray ? null : "_"+name);
30377      composeElementProperties(value);
30378      close();
30379    }
30380    else if (inArray) 
30381      writeNull(name); 
30382  }
30383
30384  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
30385    if (value != null && value.hasValue()) {
30386        prop(name, value.getValue());
30387    }    
30388    else if (inArray) 
30389      writeNull(name); 
30390  }    
30391
30392  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
30393    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30394      open(inArray ? null : "_"+name);
30395      composeElementProperties(value);
30396      close();
30397    }
30398    else if (inArray) 
30399      writeNull(name); 
30400  }
30401
30402  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
30403    if (value != null && value.hasValue()) {
30404        prop(name, toString(value.getValue()));
30405    }    
30406    else if (inArray) 
30407      writeNull(name); 
30408  }    
30409
30410  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
30411    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30412      open(inArray ? null : "_"+name);
30413      composeElementProperties(value);
30414      close();
30415    }
30416    else if (inArray) 
30417      writeNull(name); 
30418  }
30419
30420  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
30421    if (value != null && value.hasValue()) {
30422        prop(name, Integer.valueOf(value.getValue()));
30423    }    
30424    else if (inArray) 
30425      writeNull(name); 
30426  }    
30427
30428  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
30429    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30430      open(inArray ? null : "_"+name);
30431      composeElementProperties(value);
30432      close();
30433    }
30434    else if (inArray) 
30435      writeNull(name); 
30436  }
30437
30438  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
30439    if (value != null && value.hasValue()) {
30440        prop(name, toString(value.getValue()));
30441    }    
30442    else if (inArray) 
30443      writeNull(name); 
30444  }    
30445
30446  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
30447    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30448      open(inArray ? null : "_"+name);
30449      composeElementProperties(value);
30450      close();
30451    }
30452    else if (inArray) 
30453      writeNull(name); 
30454  }
30455
30456  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
30457    if (value != null && value.hasValue()) {
30458        prop(name, value.asStringValue());
30459    }    
30460    else if (inArray) 
30461      writeNull(name); 
30462  }    
30463
30464  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
30465    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30466      open(inArray ? null : "_"+name);
30467      composeElementProperties(value);
30468      close();
30469    }
30470    else if (inArray) 
30471      writeNull(name); 
30472  }
30473
30474  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
30475    if (value != null && value.hasValue()) {
30476        prop(name, toString(value.getValue()));
30477    }    
30478    else if (inArray) 
30479      writeNull(name); 
30480  }    
30481
30482  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
30483    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30484      open(inArray ? null : "_"+name);
30485      composeElementProperties(value);
30486      close();
30487    }
30488    else if (inArray) 
30489      writeNull(name); 
30490  }
30491
30492  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
30493    if (value != null && value.hasValue()) {
30494        prop(name, Integer.valueOf(value.getValue()));
30495    }    
30496    else if (inArray) 
30497      writeNull(name); 
30498  }    
30499
30500  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
30501    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30502      open(inArray ? null : "_"+name);
30503      composeElementProperties(value);
30504      close();
30505    }
30506    else if (inArray) 
30507      writeNull(name); 
30508  }
30509
30510  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
30511    if (value != null && value.hasValue()) {
30512        prop(name, value.getValue());
30513    }    
30514    else if (inArray) 
30515      writeNull(name); 
30516  }    
30517
30518  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
30519    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
30520      open(inArray ? null : "_"+name);
30521      composeElementProperties(value);
30522      close();
30523    }
30524    else if (inArray) 
30525      writeNull(name); 
30526  }
30527
30528  protected void composeBackboneElementProperties(BackboneElement element) throws IOException {
30529      composeElementProperties(element);
30530      if (element.hasModifierExtension()) {
30531        openArray("modifierExtension");
30532        for (Extension e : element.getModifierExtension()) 
30533          composeExtension(null, e);
30534        closeArray();
30535      };
30536  }
30537
30538  protected void composeBackboneTypeProperties(BackboneType element) throws IOException {
30539      composeDataTypeProperties(element);
30540      if (element.hasModifierExtension()) {
30541        openArray("modifierExtension");
30542        for (Extension e : element.getModifierExtension()) 
30543          composeExtension(null, e);
30544        closeArray();
30545      };
30546  }
30547
30548  protected void composeDataTypeProperties(DataType element) throws IOException {
30549      composeElementProperties(element);
30550  }
30551
30552  protected void composeElementProperties(Element element) throws IOException {
30553      composeBaseProperties(element);
30554      if (element.hasIdElement()) {
30555        composeStringCore("id", element.getIdElement(), false);
30556        composeStringExtras("id", element.getIdElement(), false);
30557      }
30558      if (element.hasExtension()) {
30559        openArray("extension");
30560        for (Extension e : element.getExtension()) 
30561          composeExtension(null, e);
30562        closeArray();
30563      };
30564  }
30565
30566  protected void composeAddress(String name, Address element) throws IOException {
30567    if (element != null) {
30568      open(name);
30569      composeAddressProperties(element);
30570      close();
30571    }
30572  }
30573
30574  protected void composeAddressProperties(Address element) throws IOException {
30575    composeDataTypeProperties(element);
30576      if (element.hasUseElement()) {
30577        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
30578        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
30579      }
30580      if (element.hasTypeElement()) {
30581        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
30582        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
30583      }
30584      if (element.hasTextElement()) {
30585        composeStringCore("text", element.getTextElement(), false);
30586        composeStringExtras("text", element.getTextElement(), false);
30587      }
30588      if (element.hasLine()) {
30589        openArray("line");
30590        for (StringType e : element.getLine()) 
30591          composeStringCore(null, e, true);
30592        closeArray();
30593        if (anyHasExtras(element.getLine())) {
30594          openArray("_line");
30595          for (StringType e : element.getLine()) 
30596            composeStringExtras(null, e, true);
30597          closeArray();
30598        }
30599      };
30600      if (element.hasCityElement()) {
30601        composeStringCore("city", element.getCityElement(), false);
30602        composeStringExtras("city", element.getCityElement(), false);
30603      }
30604      if (element.hasDistrictElement()) {
30605        composeStringCore("district", element.getDistrictElement(), false);
30606        composeStringExtras("district", element.getDistrictElement(), false);
30607      }
30608      if (element.hasStateElement()) {
30609        composeStringCore("state", element.getStateElement(), false);
30610        composeStringExtras("state", element.getStateElement(), false);
30611      }
30612      if (element.hasPostalCodeElement()) {
30613        composeStringCore("postalCode", element.getPostalCodeElement(), false);
30614        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
30615      }
30616      if (element.hasCountryElement()) {
30617        composeStringCore("country", element.getCountryElement(), false);
30618        composeStringExtras("country", element.getCountryElement(), false);
30619      }
30620      if (element.hasPeriod()) {
30621        composePeriod("period", element.getPeriod());
30622      }
30623  }
30624
30625  protected void composeAge(String name, Age element) throws IOException {
30626    if (element != null) {
30627      open(name);
30628      composeAgeProperties(element);
30629      close();
30630    }
30631  }
30632
30633  protected void composeAgeProperties(Age element) throws IOException {
30634    composeQuantityProperties(element);
30635  }
30636
30637  protected void composeAnnotation(String name, Annotation element) throws IOException {
30638    if (element != null) {
30639      open(name);
30640      composeAnnotationProperties(element);
30641      close();
30642    }
30643  }
30644
30645  protected void composeAnnotationProperties(Annotation element) throws IOException {
30646    composeDataTypeProperties(element);
30647      if (element.hasAuthor()) {
30648        composeType("author", element.getAuthor());
30649      }
30650      if (element.hasTimeElement()) {
30651        composeDateTimeCore("time", element.getTimeElement(), false);
30652        composeDateTimeExtras("time", element.getTimeElement(), false);
30653      }
30654      if (element.hasTextElement()) {
30655        composeMarkdownCore("text", element.getTextElement(), false);
30656        composeMarkdownExtras("text", element.getTextElement(), false);
30657      }
30658  }
30659
30660  protected void composeAttachment(String name, Attachment element) throws IOException {
30661    if (element != null) {
30662      open(name);
30663      composeAttachmentProperties(element);
30664      close();
30665    }
30666  }
30667
30668  protected void composeAttachmentProperties(Attachment element) throws IOException {
30669    composeDataTypeProperties(element);
30670      if (element.hasContentTypeElement()) {
30671        composeCodeCore("contentType", element.getContentTypeElement(), false);
30672        composeCodeExtras("contentType", element.getContentTypeElement(), false);
30673      }
30674      if (element.hasLanguageElement()) {
30675        composeCodeCore("language", element.getLanguageElement(), false);
30676        composeCodeExtras("language", element.getLanguageElement(), false);
30677      }
30678      if (element.hasDataElement()) {
30679        composeBase64BinaryCore("data", element.getDataElement(), false);
30680        composeBase64BinaryExtras("data", element.getDataElement(), false);
30681      }
30682      if (element.hasUrlElement()) {
30683        composeUrlCore("url", element.getUrlElement(), false);
30684        composeUrlExtras("url", element.getUrlElement(), false);
30685      }
30686      if (element.hasSizeElement()) {
30687        composeInteger64Core("size", element.getSizeElement(), false);
30688        composeInteger64Extras("size", element.getSizeElement(), false);
30689      }
30690      if (element.hasHashElement()) {
30691        composeBase64BinaryCore("hash", element.getHashElement(), false);
30692        composeBase64BinaryExtras("hash", element.getHashElement(), false);
30693      }
30694      if (element.hasTitleElement()) {
30695        composeStringCore("title", element.getTitleElement(), false);
30696        composeStringExtras("title", element.getTitleElement(), false);
30697      }
30698      if (element.hasCreationElement()) {
30699        composeDateTimeCore("creation", element.getCreationElement(), false);
30700        composeDateTimeExtras("creation", element.getCreationElement(), false);
30701      }
30702      if (element.hasHeightElement()) {
30703        composePositiveIntCore("height", element.getHeightElement(), false);
30704        composePositiveIntExtras("height", element.getHeightElement(), false);
30705      }
30706      if (element.hasWidthElement()) {
30707        composePositiveIntCore("width", element.getWidthElement(), false);
30708        composePositiveIntExtras("width", element.getWidthElement(), false);
30709      }
30710      if (element.hasFramesElement()) {
30711        composePositiveIntCore("frames", element.getFramesElement(), false);
30712        composePositiveIntExtras("frames", element.getFramesElement(), false);
30713      }
30714      if (element.hasDurationElement()) {
30715        composeDecimalCore("duration", element.getDurationElement(), false);
30716        composeDecimalExtras("duration", element.getDurationElement(), false);
30717      }
30718      if (element.hasPagesElement()) {
30719        composePositiveIntCore("pages", element.getPagesElement(), false);
30720        composePositiveIntExtras("pages", element.getPagesElement(), false);
30721      }
30722  }
30723
30724  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
30725    if (element != null) {
30726      open(name);
30727      composeCodeableConceptProperties(element);
30728      close();
30729    }
30730  }
30731
30732  protected void composeCodeableConceptProperties(CodeableConcept element) throws IOException {
30733    composeDataTypeProperties(element);
30734      if (element.hasCoding()) {
30735        openArray("coding");
30736        for (Coding e : element.getCoding()) 
30737          composeCoding(null, e);
30738        closeArray();
30739      };
30740      if (element.hasTextElement()) {
30741        composeStringCore("text", element.getTextElement(), false);
30742        composeStringExtras("text", element.getTextElement(), false);
30743      }
30744  }
30745
30746  protected void composeCodeableReference(String name, CodeableReference element) throws IOException {
30747    if (element != null) {
30748      open(name);
30749      composeCodeableReferenceProperties(element);
30750      close();
30751    }
30752  }
30753
30754  protected void composeCodeableReferenceProperties(CodeableReference element) throws IOException {
30755    composeDataTypeProperties(element);
30756      if (element.hasConcept()) {
30757        composeCodeableConcept("concept", element.getConcept());
30758      }
30759      if (element.hasReference()) {
30760        composeReference("reference", element.getReference());
30761      }
30762  }
30763
30764  protected void composeCoding(String name, Coding element) throws IOException {
30765    if (element != null) {
30766      open(name);
30767      composeCodingProperties(element);
30768      close();
30769    }
30770  }
30771
30772  protected void composeCodingProperties(Coding element) throws IOException {
30773    composeDataTypeProperties(element);
30774      if (element.hasSystemElement()) {
30775        composeUriCore("system", element.getSystemElement(), false);
30776        composeUriExtras("system", element.getSystemElement(), false);
30777      }
30778      if (element.hasVersionElement()) {
30779        composeStringCore("version", element.getVersionElement(), false);
30780        composeStringExtras("version", element.getVersionElement(), false);
30781      }
30782      if (element.hasCodeElement()) {
30783        composeCodeCore("code", element.getCodeElement(), false);
30784        composeCodeExtras("code", element.getCodeElement(), false);
30785      }
30786      if (element.hasDisplayElement()) {
30787        composeStringCore("display", element.getDisplayElement(), false);
30788        composeStringExtras("display", element.getDisplayElement(), false);
30789      }
30790      if (element.hasUserSelectedElement()) {
30791        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
30792        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
30793      }
30794  }
30795
30796  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
30797    if (element != null) {
30798      open(name);
30799      composeContactDetailProperties(element);
30800      close();
30801    }
30802  }
30803
30804  protected void composeContactDetailProperties(ContactDetail element) throws IOException {
30805    composeDataTypeProperties(element);
30806      if (element.hasNameElement()) {
30807        composeStringCore("name", element.getNameElement(), false);
30808        composeStringExtras("name", element.getNameElement(), false);
30809      }
30810      if (element.hasTelecom()) {
30811        openArray("telecom");
30812        for (ContactPoint e : element.getTelecom()) 
30813          composeContactPoint(null, e);
30814        closeArray();
30815      };
30816  }
30817
30818  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
30819    if (element != null) {
30820      open(name);
30821      composeContactPointProperties(element);
30822      close();
30823    }
30824  }
30825
30826  protected void composeContactPointProperties(ContactPoint element) throws IOException {
30827    composeDataTypeProperties(element);
30828      if (element.hasSystemElement()) {
30829        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
30830        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
30831      }
30832      if (element.hasValueElement()) {
30833        composeStringCore("value", element.getValueElement(), false);
30834        composeStringExtras("value", element.getValueElement(), false);
30835      }
30836      if (element.hasUseElement()) {
30837        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
30838        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
30839      }
30840      if (element.hasRankElement()) {
30841        composePositiveIntCore("rank", element.getRankElement(), false);
30842        composePositiveIntExtras("rank", element.getRankElement(), false);
30843      }
30844      if (element.hasPeriod()) {
30845        composePeriod("period", element.getPeriod());
30846      }
30847  }
30848
30849  protected void composeContributor(String name, Contributor element) throws IOException {
30850    if (element != null) {
30851      open(name);
30852      composeContributorProperties(element);
30853      close();
30854    }
30855  }
30856
30857  protected void composeContributorProperties(Contributor element) throws IOException {
30858    composeDataTypeProperties(element);
30859      if (element.hasTypeElement()) {
30860        composeEnumerationCore("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
30861        composeEnumerationExtras("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
30862      }
30863      if (element.hasNameElement()) {
30864        composeStringCore("name", element.getNameElement(), false);
30865        composeStringExtras("name", element.getNameElement(), false);
30866      }
30867      if (element.hasContact()) {
30868        openArray("contact");
30869        for (ContactDetail e : element.getContact()) 
30870          composeContactDetail(null, e);
30871        closeArray();
30872      };
30873  }
30874
30875  protected void composeCount(String name, Count element) throws IOException {
30876    if (element != null) {
30877      open(name);
30878      composeCountProperties(element);
30879      close();
30880    }
30881  }
30882
30883  protected void composeCountProperties(Count element) throws IOException {
30884    composeQuantityProperties(element);
30885  }
30886
30887  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
30888    if (element != null) {
30889      open(name);
30890      composeDataRequirementProperties(element);
30891      close();
30892    }
30893  }
30894
30895  protected void composeDataRequirementProperties(DataRequirement element) throws IOException {
30896    composeDataTypeProperties(element);
30897      if (element.hasTypeElement()) {
30898        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.FHIRAllTypesEnumFactory(), false);
30899        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.FHIRAllTypesEnumFactory(), false);
30900      }
30901      if (element.hasProfile()) {
30902        openArray("profile");
30903        for (CanonicalType e : element.getProfile()) 
30904          composeCanonicalCore(null, e, true);
30905        closeArray();
30906        if (anyHasExtras(element.getProfile())) {
30907          openArray("_profile");
30908          for (CanonicalType e : element.getProfile()) 
30909            composeCanonicalExtras(null, e, true);
30910          closeArray();
30911        }
30912      };
30913      if (element.hasSubject()) {
30914        composeType("subject", element.getSubject());
30915      }
30916      if (element.hasMustSupport()) {
30917        openArray("mustSupport");
30918        for (StringType e : element.getMustSupport()) 
30919          composeStringCore(null, e, true);
30920        closeArray();
30921        if (anyHasExtras(element.getMustSupport())) {
30922          openArray("_mustSupport");
30923          for (StringType e : element.getMustSupport()) 
30924            composeStringExtras(null, e, true);
30925          closeArray();
30926        }
30927      };
30928      if (element.hasCodeFilter()) {
30929        openArray("codeFilter");
30930        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
30931          composeDataRequirementCodeFilterComponent(null, e);
30932        closeArray();
30933      };
30934      if (element.hasDateFilter()) {
30935        openArray("dateFilter");
30936        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
30937          composeDataRequirementDateFilterComponent(null, e);
30938        closeArray();
30939      };
30940      if (element.hasLimitElement()) {
30941        composePositiveIntCore("limit", element.getLimitElement(), false);
30942        composePositiveIntExtras("limit", element.getLimitElement(), false);
30943      }
30944      if (element.hasSort()) {
30945        openArray("sort");
30946        for (DataRequirement.DataRequirementSortComponent e : element.getSort()) 
30947          composeDataRequirementSortComponent(null, e);
30948        closeArray();
30949      };
30950  }
30951
30952  protected void composeDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
30953    if (element != null) {
30954      open(name);
30955      composeDataRequirementCodeFilterComponentProperties(element);
30956      close();
30957    }
30958  }
30959
30960  protected void composeDataRequirementCodeFilterComponentProperties(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
30961    composeElementProperties(element);
30962      if (element.hasPathElement()) {
30963        composeStringCore("path", element.getPathElement(), false);
30964        composeStringExtras("path", element.getPathElement(), false);
30965      }
30966      if (element.hasSearchParamElement()) {
30967        composeStringCore("searchParam", element.getSearchParamElement(), false);
30968        composeStringExtras("searchParam", element.getSearchParamElement(), false);
30969      }
30970      if (element.hasValueSetElement()) {
30971        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
30972        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
30973      }
30974      if (element.hasCode()) {
30975        openArray("code");
30976        for (Coding e : element.getCode()) 
30977          composeCoding(null, e);
30978        closeArray();
30979      };
30980  }
30981
30982  protected void composeDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
30983    if (element != null) {
30984      open(name);
30985      composeDataRequirementDateFilterComponentProperties(element);
30986      close();
30987    }
30988  }
30989
30990  protected void composeDataRequirementDateFilterComponentProperties(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
30991    composeElementProperties(element);
30992      if (element.hasPathElement()) {
30993        composeStringCore("path", element.getPathElement(), false);
30994        composeStringExtras("path", element.getPathElement(), false);
30995      }
30996      if (element.hasSearchParamElement()) {
30997        composeStringCore("searchParam", element.getSearchParamElement(), false);
30998        composeStringExtras("searchParam", element.getSearchParamElement(), false);
30999      }
31000      if (element.hasValue()) {
31001        composeType("value", element.getValue());
31002      }
31003  }
31004
31005  protected void composeDataRequirementSortComponent(String name, DataRequirement.DataRequirementSortComponent element) throws IOException {
31006    if (element != null) {
31007      open(name);
31008      composeDataRequirementSortComponentProperties(element);
31009      close();
31010    }
31011  }
31012
31013  protected void composeDataRequirementSortComponentProperties(DataRequirement.DataRequirementSortComponent element) throws IOException {
31014    composeElementProperties(element);
31015      if (element.hasPathElement()) {
31016        composeStringCore("path", element.getPathElement(), false);
31017        composeStringExtras("path", element.getPathElement(), false);
31018      }
31019      if (element.hasDirectionElement()) {
31020        composeEnumerationCore("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
31021        composeEnumerationExtras("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
31022      }
31023  }
31024
31025  protected void composeDistance(String name, Distance element) throws IOException {
31026    if (element != null) {
31027      open(name);
31028      composeDistanceProperties(element);
31029      close();
31030    }
31031  }
31032
31033  protected void composeDistanceProperties(Distance element) throws IOException {
31034    composeQuantityProperties(element);
31035  }
31036
31037  protected void composeDosage(String name, Dosage element) throws IOException {
31038    if (element != null) {
31039      open(name);
31040      composeDosageProperties(element);
31041      close();
31042    }
31043  }
31044
31045  protected void composeDosageProperties(Dosage element) throws IOException {
31046    composeBackboneTypeProperties(element);
31047      if (element.hasSequenceElement()) {
31048        composeIntegerCore("sequence", element.getSequenceElement(), false);
31049        composeIntegerExtras("sequence", element.getSequenceElement(), false);
31050      }
31051      if (element.hasTextElement()) {
31052        composeStringCore("text", element.getTextElement(), false);
31053        composeStringExtras("text", element.getTextElement(), false);
31054      }
31055      if (element.hasAdditionalInstruction()) {
31056        openArray("additionalInstruction");
31057        for (CodeableConcept e : element.getAdditionalInstruction()) 
31058          composeCodeableConcept(null, e);
31059        closeArray();
31060      };
31061      if (element.hasPatientInstructionElement()) {
31062        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
31063        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
31064      }
31065      if (element.hasTiming()) {
31066        composeTiming("timing", element.getTiming());
31067      }
31068      if (element.hasAsNeeded()) {
31069        composeType("asNeeded", element.getAsNeeded());
31070      }
31071      if (element.hasSite()) {
31072        composeCodeableConcept("site", element.getSite());
31073      }
31074      if (element.hasRoute()) {
31075        composeCodeableConcept("route", element.getRoute());
31076      }
31077      if (element.hasMethod()) {
31078        composeCodeableConcept("method", element.getMethod());
31079      }
31080      if (element.hasDoseAndRate()) {
31081        openArray("doseAndRate");
31082        for (Dosage.DosageDoseAndRateComponent e : element.getDoseAndRate()) 
31083          composeDosageDoseAndRateComponent(null, e);
31084        closeArray();
31085      };
31086      if (element.hasMaxDosePerPeriod()) {
31087        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
31088      }
31089      if (element.hasMaxDosePerAdministration()) {
31090        composeQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
31091      }
31092      if (element.hasMaxDosePerLifetime()) {
31093        composeQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
31094      }
31095  }
31096
31097  protected void composeDosageDoseAndRateComponent(String name, Dosage.DosageDoseAndRateComponent element) throws IOException {
31098    if (element != null) {
31099      open(name);
31100      composeDosageDoseAndRateComponentProperties(element);
31101      close();
31102    }
31103  }
31104
31105  protected void composeDosageDoseAndRateComponentProperties(Dosage.DosageDoseAndRateComponent element) throws IOException {
31106    composeElementProperties(element);
31107      if (element.hasType()) {
31108        composeCodeableConcept("type", element.getType());
31109      }
31110      if (element.hasDose()) {
31111        composeType("dose", element.getDose());
31112      }
31113      if (element.hasRate()) {
31114        composeType("rate", element.getRate());
31115      }
31116  }
31117
31118  protected void composeDuration(String name, Duration element) throws IOException {
31119    if (element != null) {
31120      open(name);
31121      composeDurationProperties(element);
31122      close();
31123    }
31124  }
31125
31126  protected void composeDurationProperties(Duration element) throws IOException {
31127    composeQuantityProperties(element);
31128  }
31129
31130  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
31131    if (element != null) {
31132      open(name);
31133      composeElementDefinitionProperties(element);
31134      close();
31135    }
31136  }
31137
31138  protected void composeElementDefinitionProperties(ElementDefinition element) throws IOException {
31139    composeBackboneTypeProperties(element);
31140      if (element.hasPathElement()) {
31141        composeStringCore("path", element.getPathElement(), false);
31142        composeStringExtras("path", element.getPathElement(), false);
31143      }
31144      if (element.hasRepresentation()) {
31145        openArray("representation");
31146        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
31147          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
31148        closeArray();
31149        if (anyHasExtras(element.getRepresentation())) {
31150          openArray("_representation");
31151          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
31152            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
31153          closeArray();
31154        }
31155      };
31156      if (element.hasSliceNameElement()) {
31157        composeStringCore("sliceName", element.getSliceNameElement(), false);
31158        composeStringExtras("sliceName", element.getSliceNameElement(), false);
31159      }
31160      if (element.hasSliceIsConstrainingElement()) {
31161        composeBooleanCore("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
31162        composeBooleanExtras("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
31163      }
31164      if (element.hasLabelElement()) {
31165        composeStringCore("label", element.getLabelElement(), false);
31166        composeStringExtras("label", element.getLabelElement(), false);
31167      }
31168      if (element.hasCode()) {
31169        openArray("code");
31170        for (Coding e : element.getCode()) 
31171          composeCoding(null, e);
31172        closeArray();
31173      };
31174      if (element.hasSlicing()) {
31175        composeElementDefinitionSlicingComponent("slicing", element.getSlicing());
31176      }
31177      if (element.hasShortElement()) {
31178        composeStringCore("short", element.getShortElement(), false);
31179        composeStringExtras("short", element.getShortElement(), false);
31180      }
31181      if (element.hasDefinitionElement()) {
31182        composeMarkdownCore("definition", element.getDefinitionElement(), false);
31183        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
31184      }
31185      if (element.hasCommentElement()) {
31186        composeMarkdownCore("comment", element.getCommentElement(), false);
31187        composeMarkdownExtras("comment", element.getCommentElement(), false);
31188      }
31189      if (element.hasRequirementsElement()) {
31190        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
31191        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
31192      }
31193      if (element.hasAlias()) {
31194        openArray("alias");
31195        for (StringType e : element.getAlias()) 
31196          composeStringCore(null, e, true);
31197        closeArray();
31198        if (anyHasExtras(element.getAlias())) {
31199          openArray("_alias");
31200          for (StringType e : element.getAlias()) 
31201            composeStringExtras(null, e, true);
31202          closeArray();
31203        }
31204      };
31205      if (element.hasMinElement()) {
31206        composeUnsignedIntCore("min", element.getMinElement(), false);
31207        composeUnsignedIntExtras("min", element.getMinElement(), false);
31208      }
31209      if (element.hasMaxElement()) {
31210        composeStringCore("max", element.getMaxElement(), false);
31211        composeStringExtras("max", element.getMaxElement(), false);
31212      }
31213      if (element.hasBase()) {
31214        composeElementDefinitionBaseComponent("base", element.getBase());
31215      }
31216      if (element.hasContentReferenceElement()) {
31217        composeUriCore("contentReference", element.getContentReferenceElement(), false);
31218        composeUriExtras("contentReference", element.getContentReferenceElement(), false);
31219      }
31220      if (element.hasType()) {
31221        openArray("type");
31222        for (ElementDefinition.TypeRefComponent e : element.getType()) 
31223          composeTypeRefComponent(null, e);
31224        closeArray();
31225      };
31226      if (element.hasDefaultValue()) {
31227        composeType("defaultValue", element.getDefaultValue());
31228      }
31229      if (element.hasMeaningWhenMissingElement()) {
31230        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
31231        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
31232      }
31233      if (element.hasOrderMeaningElement()) {
31234        composeStringCore("orderMeaning", element.getOrderMeaningElement(), false);
31235        composeStringExtras("orderMeaning", element.getOrderMeaningElement(), false);
31236      }
31237      if (element.hasFixed()) {
31238        composeType("fixed", element.getFixed());
31239      }
31240      if (element.hasPattern()) {
31241        composeType("pattern", element.getPattern());
31242      }
31243      if (element.hasExample()) {
31244        openArray("example");
31245        for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample()) 
31246          composeElementDefinitionExampleComponent(null, e);
31247        closeArray();
31248      };
31249      if (element.hasMinValue()) {
31250        composeType("minValue", element.getMinValue());
31251      }
31252      if (element.hasMaxValue()) {
31253        composeType("maxValue", element.getMaxValue());
31254      }
31255      if (element.hasMaxLengthElement()) {
31256        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
31257        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
31258      }
31259      if (element.hasCondition()) {
31260        openArray("condition");
31261        for (IdType e : element.getCondition()) 
31262          composeIdCore(null, e, true);
31263        closeArray();
31264        if (anyHasExtras(element.getCondition())) {
31265          openArray("_condition");
31266          for (IdType e : element.getCondition()) 
31267            composeIdExtras(null, e, true);
31268          closeArray();
31269        }
31270      };
31271      if (element.hasConstraint()) {
31272        openArray("constraint");
31273        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
31274          composeElementDefinitionConstraintComponent(null, e);
31275        closeArray();
31276      };
31277      if (element.hasMustSupportElement()) {
31278        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
31279        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
31280      }
31281      if (element.hasIsModifierElement()) {
31282        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
31283        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
31284      }
31285      if (element.hasIsModifierReasonElement()) {
31286        composeStringCore("isModifierReason", element.getIsModifierReasonElement(), false);
31287        composeStringExtras("isModifierReason", element.getIsModifierReasonElement(), false);
31288      }
31289      if (element.hasIsSummaryElement()) {
31290        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
31291        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
31292      }
31293      if (element.hasBinding()) {
31294        composeElementDefinitionBindingComponent("binding", element.getBinding());
31295      }
31296      if (element.hasMapping()) {
31297        openArray("mapping");
31298        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
31299          composeElementDefinitionMappingComponent(null, e);
31300        closeArray();
31301      };
31302  }
31303
31304  protected void composeElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
31305    if (element != null) {
31306      open(name);
31307      composeElementDefinitionSlicingComponentProperties(element);
31308      close();
31309    }
31310  }
31311
31312  protected void composeElementDefinitionSlicingComponentProperties(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
31313    composeElementProperties(element);
31314      if (element.hasDiscriminator()) {
31315        openArray("discriminator");
31316        for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
31317          composeElementDefinitionSlicingDiscriminatorComponent(null, e);
31318        closeArray();
31319      };
31320      if (element.hasDescriptionElement()) {
31321        composeStringCore("description", element.getDescriptionElement(), false);
31322        composeStringExtras("description", element.getDescriptionElement(), false);
31323      }
31324      if (element.hasOrderedElement()) {
31325        composeBooleanCore("ordered", element.getOrderedElement(), false);
31326        composeBooleanExtras("ordered", element.getOrderedElement(), false);
31327      }
31328      if (element.hasRulesElement()) {
31329        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
31330        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
31331      }
31332  }
31333
31334  protected void composeElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
31335    if (element != null) {
31336      open(name);
31337      composeElementDefinitionSlicingDiscriminatorComponentProperties(element);
31338      close();
31339    }
31340  }
31341
31342  protected void composeElementDefinitionSlicingDiscriminatorComponentProperties(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
31343    composeElementProperties(element);
31344      if (element.hasTypeElement()) {
31345        composeEnumerationCore("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
31346        composeEnumerationExtras("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
31347      }
31348      if (element.hasPathElement()) {
31349        composeStringCore("path", element.getPathElement(), false);
31350        composeStringExtras("path", element.getPathElement(), false);
31351      }
31352  }
31353
31354  protected void composeElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
31355    if (element != null) {
31356      open(name);
31357      composeElementDefinitionBaseComponentProperties(element);
31358      close();
31359    }
31360  }
31361
31362  protected void composeElementDefinitionBaseComponentProperties(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
31363    composeElementProperties(element);
31364      if (element.hasPathElement()) {
31365        composeStringCore("path", element.getPathElement(), false);
31366        composeStringExtras("path", element.getPathElement(), false);
31367      }
31368      if (element.hasMinElement()) {
31369        composeUnsignedIntCore("min", element.getMinElement(), false);
31370        composeUnsignedIntExtras("min", element.getMinElement(), false);
31371      }
31372      if (element.hasMaxElement()) {
31373        composeStringCore("max", element.getMaxElement(), false);
31374        composeStringExtras("max", element.getMaxElement(), false);
31375      }
31376  }
31377
31378  protected void composeTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
31379    if (element != null) {
31380      open(name);
31381      composeTypeRefComponentProperties(element);
31382      close();
31383    }
31384  }
31385
31386  protected void composeTypeRefComponentProperties(ElementDefinition.TypeRefComponent element) throws IOException {
31387    composeElementProperties(element);
31388      if (element.hasCodeElement()) {
31389        composeUriCore("code", element.getCodeElement(), false);
31390        composeUriExtras("code", element.getCodeElement(), false);
31391      }
31392      if (element.hasProfile()) {
31393        openArray("profile");
31394        for (CanonicalType e : element.getProfile()) 
31395          composeCanonicalCore(null, e, true);
31396        closeArray();
31397        if (anyHasExtras(element.getProfile())) {
31398          openArray("_profile");
31399          for (CanonicalType e : element.getProfile()) 
31400            composeCanonicalExtras(null, e, true);
31401          closeArray();
31402        }
31403      };
31404      if (element.hasTargetProfile()) {
31405        openArray("targetProfile");
31406        for (CanonicalType e : element.getTargetProfile()) 
31407          composeCanonicalCore(null, e, true);
31408        closeArray();
31409        if (anyHasExtras(element.getTargetProfile())) {
31410          openArray("_targetProfile");
31411          for (CanonicalType e : element.getTargetProfile()) 
31412            composeCanonicalExtras(null, e, true);
31413          closeArray();
31414        }
31415      };
31416      if (element.hasAggregation()) {
31417        openArray("aggregation");
31418        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
31419          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
31420        closeArray();
31421        if (anyHasExtras(element.getAggregation())) {
31422          openArray("_aggregation");
31423          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
31424            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
31425          closeArray();
31426        }
31427      };
31428      if (element.hasVersioningElement()) {
31429        composeEnumerationCore("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
31430        composeEnumerationExtras("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
31431      }
31432  }
31433
31434  protected void composeElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
31435    if (element != null) {
31436      open(name);
31437      composeElementDefinitionExampleComponentProperties(element);
31438      close();
31439    }
31440  }
31441
31442  protected void composeElementDefinitionExampleComponentProperties(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
31443    composeElementProperties(element);
31444      if (element.hasLabelElement()) {
31445        composeStringCore("label", element.getLabelElement(), false);
31446        composeStringExtras("label", element.getLabelElement(), false);
31447      }
31448      if (element.hasValue()) {
31449        composeType("value", element.getValue());
31450      }
31451  }
31452
31453  protected void composeElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
31454    if (element != null) {
31455      open(name);
31456      composeElementDefinitionConstraintComponentProperties(element);
31457      close();
31458    }
31459  }
31460
31461  protected void composeElementDefinitionConstraintComponentProperties(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
31462    composeElementProperties(element);
31463      if (element.hasKeyElement()) {
31464        composeIdCore("key", element.getKeyElement(), false);
31465        composeIdExtras("key", element.getKeyElement(), false);
31466      }
31467      if (element.hasRequirementsElement()) {
31468        composeStringCore("requirements", element.getRequirementsElement(), false);
31469        composeStringExtras("requirements", element.getRequirementsElement(), false);
31470      }
31471      if (element.hasSeverityElement()) {
31472        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
31473        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
31474      }
31475      if (element.hasHumanElement()) {
31476        composeStringCore("human", element.getHumanElement(), false);
31477        composeStringExtras("human", element.getHumanElement(), false);
31478      }
31479      if (element.hasExpressionElement()) {
31480        composeStringCore("expression", element.getExpressionElement(), false);
31481        composeStringExtras("expression", element.getExpressionElement(), false);
31482      }
31483      if (element.hasXpathElement()) {
31484        composeStringCore("xpath", element.getXpathElement(), false);
31485        composeStringExtras("xpath", element.getXpathElement(), false);
31486      }
31487      if (element.hasSourceElement()) {
31488        composeCanonicalCore("source", element.getSourceElement(), false);
31489        composeCanonicalExtras("source", element.getSourceElement(), false);
31490      }
31491  }
31492
31493  protected void composeElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
31494    if (element != null) {
31495      open(name);
31496      composeElementDefinitionBindingComponentProperties(element);
31497      close();
31498    }
31499  }
31500
31501  protected void composeElementDefinitionBindingComponentProperties(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
31502    composeElementProperties(element);
31503      if (element.hasStrengthElement()) {
31504        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
31505        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
31506      }
31507      if (element.hasDescriptionElement()) {
31508        composeStringCore("description", element.getDescriptionElement(), false);
31509        composeStringExtras("description", element.getDescriptionElement(), false);
31510      }
31511      if (element.hasValueSetElement()) {
31512        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
31513        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
31514      }
31515  }
31516
31517  protected void composeElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
31518    if (element != null) {
31519      open(name);
31520      composeElementDefinitionMappingComponentProperties(element);
31521      close();
31522    }
31523  }
31524
31525  protected void composeElementDefinitionMappingComponentProperties(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
31526    composeElementProperties(element);
31527      if (element.hasIdentityElement()) {
31528        composeIdCore("identity", element.getIdentityElement(), false);
31529        composeIdExtras("identity", element.getIdentityElement(), false);
31530      }
31531      if (element.hasLanguageElement()) {
31532        composeCodeCore("language", element.getLanguageElement(), false);
31533        composeCodeExtras("language", element.getLanguageElement(), false);
31534      }
31535      if (element.hasMapElement()) {
31536        composeStringCore("map", element.getMapElement(), false);
31537        composeStringExtras("map", element.getMapElement(), false);
31538      }
31539      if (element.hasCommentElement()) {
31540        composeStringCore("comment", element.getCommentElement(), false);
31541        composeStringExtras("comment", element.getCommentElement(), false);
31542      }
31543  }
31544
31545  protected void composeExpression(String name, Expression element) throws IOException {
31546    if (element != null) {
31547      open(name);
31548      composeExpressionProperties(element);
31549      close();
31550    }
31551  }
31552
31553  protected void composeExpressionProperties(Expression element) throws IOException {
31554    composeDataTypeProperties(element);
31555      if (element.hasDescriptionElement()) {
31556        composeStringCore("description", element.getDescriptionElement(), false);
31557        composeStringExtras("description", element.getDescriptionElement(), false);
31558      }
31559      if (element.hasNameElement()) {
31560        composeIdCore("name", element.getNameElement(), false);
31561        composeIdExtras("name", element.getNameElement(), false);
31562      }
31563      if (element.hasLanguageElement()) {
31564        composeCodeCore("language", element.getLanguageElement(), false);
31565        composeCodeExtras("language", element.getLanguageElement(), false);
31566      }
31567      if (element.hasExpressionElement()) {
31568        composeStringCore("expression", element.getExpressionElement(), false);
31569        composeStringExtras("expression", element.getExpressionElement(), false);
31570      }
31571      if (element.hasReferenceElement()) {
31572        composeUriCore("reference", element.getReferenceElement(), false);
31573        composeUriExtras("reference", element.getReferenceElement(), false);
31574      }
31575  }
31576
31577  protected void composeExtension(String name, Extension element) throws IOException {
31578    if (element != null) {
31579      open(name);
31580      composeExtensionProperties(element);
31581      close();
31582    }
31583  }
31584
31585  protected void composeExtensionProperties(Extension element) throws IOException {
31586    composeDataTypeProperties(element);
31587      if (element.hasUrlElement()) {
31588        composeUriCore("url", element.getUrlElement(), false);
31589        composeUriExtras("url", element.getUrlElement(), false);
31590      }
31591      if (element.hasValue()) {
31592        composeType("value", element.getValue());
31593      }
31594  }
31595
31596  protected void composeHumanName(String name, HumanName element) throws IOException {
31597    if (element != null) {
31598      open(name);
31599      composeHumanNameProperties(element);
31600      close();
31601    }
31602  }
31603
31604  protected void composeHumanNameProperties(HumanName element) throws IOException {
31605    composeDataTypeProperties(element);
31606      if (element.hasUseElement()) {
31607        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
31608        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
31609      }
31610      if (element.hasTextElement()) {
31611        composeStringCore("text", element.getTextElement(), false);
31612        composeStringExtras("text", element.getTextElement(), false);
31613      }
31614      if (element.hasFamilyElement()) {
31615        composeStringCore("family", element.getFamilyElement(), false);
31616        composeStringExtras("family", element.getFamilyElement(), false);
31617      }
31618      if (element.hasGiven()) {
31619        openArray("given");
31620        for (StringType e : element.getGiven()) 
31621          composeStringCore(null, e, true);
31622        closeArray();
31623        if (anyHasExtras(element.getGiven())) {
31624          openArray("_given");
31625          for (StringType e : element.getGiven()) 
31626            composeStringExtras(null, e, true);
31627          closeArray();
31628        }
31629      };
31630      if (element.hasPrefix()) {
31631        openArray("prefix");
31632        for (StringType e : element.getPrefix()) 
31633          composeStringCore(null, e, true);
31634        closeArray();
31635        if (anyHasExtras(element.getPrefix())) {
31636          openArray("_prefix");
31637          for (StringType e : element.getPrefix()) 
31638            composeStringExtras(null, e, true);
31639          closeArray();
31640        }
31641      };
31642      if (element.hasSuffix()) {
31643        openArray("suffix");
31644        for (StringType e : element.getSuffix()) 
31645          composeStringCore(null, e, true);
31646        closeArray();
31647        if (anyHasExtras(element.getSuffix())) {
31648          openArray("_suffix");
31649          for (StringType e : element.getSuffix()) 
31650            composeStringExtras(null, e, true);
31651          closeArray();
31652        }
31653      };
31654      if (element.hasPeriod()) {
31655        composePeriod("period", element.getPeriod());
31656      }
31657  }
31658
31659  protected void composeIdentifier(String name, Identifier element) throws IOException {
31660    if (element != null) {
31661      open(name);
31662      composeIdentifierProperties(element);
31663      close();
31664    }
31665  }
31666
31667  protected void composeIdentifierProperties(Identifier element) throws IOException {
31668    composeDataTypeProperties(element);
31669      if (element.hasUseElement()) {
31670        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
31671        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
31672      }
31673      if (element.hasType()) {
31674        composeCodeableConcept("type", element.getType());
31675      }
31676      if (element.hasSystemElement()) {
31677        composeUriCore("system", element.getSystemElement(), false);
31678        composeUriExtras("system", element.getSystemElement(), false);
31679      }
31680      if (element.hasValueElement()) {
31681        composeStringCore("value", element.getValueElement(), false);
31682        composeStringExtras("value", element.getValueElement(), false);
31683      }
31684      if (element.hasPeriod()) {
31685        composePeriod("period", element.getPeriod());
31686      }
31687      if (element.hasAssigner()) {
31688        composeReference("assigner", element.getAssigner());
31689      }
31690  }
31691
31692  protected void composeMarketingStatus(String name, MarketingStatus element) throws IOException {
31693    if (element != null) {
31694      open(name);
31695      composeMarketingStatusProperties(element);
31696      close();
31697    }
31698  }
31699
31700  protected void composeMarketingStatusProperties(MarketingStatus element) throws IOException {
31701    composeBackboneTypeProperties(element);
31702      if (element.hasCountry()) {
31703        composeCodeableConcept("country", element.getCountry());
31704      }
31705      if (element.hasJurisdiction()) {
31706        composeCodeableConcept("jurisdiction", element.getJurisdiction());
31707      }
31708      if (element.hasStatus()) {
31709        composeCodeableConcept("status", element.getStatus());
31710      }
31711      if (element.hasDateRange()) {
31712        composePeriod("dateRange", element.getDateRange());
31713      }
31714      if (element.hasRestoreDateElement()) {
31715        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
31716        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
31717      }
31718  }
31719
31720  protected void composeMeta(String name, Meta element) throws IOException {
31721    if (element != null) {
31722      open(name);
31723      composeMetaProperties(element);
31724      close();
31725    }
31726  }
31727
31728  protected void composeMetaProperties(Meta element) throws IOException {
31729    composeElementProperties(element);
31730      if (element.hasVersionIdElement()) {
31731        composeIdCore("versionId", element.getVersionIdElement(), false);
31732        composeIdExtras("versionId", element.getVersionIdElement(), false);
31733      }
31734      if (element.hasLastUpdatedElement()) {
31735        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
31736        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
31737      }
31738      if (element.hasSourceElement()) {
31739        composeUriCore("source", element.getSourceElement(), false);
31740        composeUriExtras("source", element.getSourceElement(), false);
31741      }
31742      if (element.hasProfile()) {
31743        openArray("profile");
31744        for (CanonicalType e : element.getProfile()) 
31745          composeCanonicalCore(null, e, true);
31746        closeArray();
31747        if (anyHasExtras(element.getProfile())) {
31748          openArray("_profile");
31749          for (CanonicalType e : element.getProfile()) 
31750            composeCanonicalExtras(null, e, true);
31751          closeArray();
31752        }
31753      };
31754      if (element.hasSecurity()) {
31755        openArray("security");
31756        for (Coding e : element.getSecurity()) 
31757          composeCoding(null, e);
31758        closeArray();
31759      };
31760      if (element.hasTag()) {
31761        openArray("tag");
31762        for (Coding e : element.getTag()) 
31763          composeCoding(null, e);
31764        closeArray();
31765      };
31766  }
31767
31768  protected void composeMoney(String name, Money element) throws IOException {
31769    if (element != null) {
31770      open(name);
31771      composeMoneyProperties(element);
31772      close();
31773    }
31774  }
31775
31776  protected void composeMoneyProperties(Money element) throws IOException {
31777    composeDataTypeProperties(element);
31778      if (element.hasValueElement()) {
31779        composeDecimalCore("value", element.getValueElement(), false);
31780        composeDecimalExtras("value", element.getValueElement(), false);
31781      }
31782      if (element.hasCurrencyElement()) {
31783        composeCodeCore("currency", element.getCurrencyElement(), false);
31784        composeCodeExtras("currency", element.getCurrencyElement(), false);
31785      }
31786  }
31787
31788  protected void composeNarrative(String name, Narrative element) throws IOException {
31789    if (element != null) {
31790      open(name);
31791      composeNarrativeProperties(element);
31792      close();
31793    }
31794  }
31795
31796  protected void composeNarrativeProperties(Narrative element) throws IOException {
31797    composeDataTypeProperties(element);
31798      if (element.hasStatusElement()) {
31799        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
31800        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
31801      }
31802      if (element.hasDiv()) {
31803        XhtmlNode node = element.getDiv();
31804        if (node.getNsDecl() == null) {
31805          node.attribute("xmlns", XHTML_NS);
31806        }
31807        composeXhtml("div", node);
31808      }
31809  }
31810
31811  protected void composeOrderedDistribution(String name, OrderedDistribution element) throws IOException {
31812    if (element != null) {
31813      open(name);
31814      composeOrderedDistributionProperties(element);
31815      close();
31816    }
31817  }
31818
31819  protected void composeOrderedDistributionProperties(OrderedDistribution element) throws IOException {
31820    composeBackboneTypeProperties(element);
31821      if (element.hasDescriptionElement()) {
31822        composeStringCore("description", element.getDescriptionElement(), false);
31823        composeStringExtras("description", element.getDescriptionElement(), false);
31824      }
31825      if (element.hasNote()) {
31826        openArray("note");
31827        for (Annotation e : element.getNote()) 
31828          composeAnnotation(null, e);
31829        closeArray();
31830      };
31831      if (element.hasNumberOfIntervalsElement()) {
31832        composeIntegerCore("numberOfIntervals", element.getNumberOfIntervalsElement(), false);
31833        composeIntegerExtras("numberOfIntervals", element.getNumberOfIntervalsElement(), false);
31834      }
31835      if (element.hasBottomOfFirstInterval()) {
31836        composeQuantity("bottomOfFirstInterval", element.getBottomOfFirstInterval());
31837      }
31838      if (element.hasInterval()) {
31839        openArray("interval");
31840        for (OrderedDistribution.OrderedDistributionIntervalComponent e : element.getInterval()) 
31841          composeOrderedDistributionIntervalComponent(null, e);
31842        closeArray();
31843      };
31844      if (element.hasTopOfInterval()) {
31845        composeQuantity("topOfInterval", element.getTopOfInterval());
31846      }
31847  }
31848
31849  protected void composeOrderedDistributionIntervalComponent(String name, OrderedDistribution.OrderedDistributionIntervalComponent element) throws IOException {
31850    if (element != null) {
31851      open(name);
31852      composeOrderedDistributionIntervalComponentProperties(element);
31853      close();
31854    }
31855  }
31856
31857  protected void composeOrderedDistributionIntervalComponentProperties(OrderedDistribution.OrderedDistributionIntervalComponent element) throws IOException {
31858    composeElementProperties(element);
31859      if (element.hasRankOrderElement()) {
31860        composeIntegerCore("rankOrder", element.getRankOrderElement(), false);
31861        composeIntegerExtras("rankOrder", element.getRankOrderElement(), false);
31862      }
31863      if (element.hasIntervalStatistic()) {
31864        openArray("intervalStatistic");
31865        for (Statistic e : element.getIntervalStatistic()) 
31866          composeStatistic(null, e);
31867        closeArray();
31868      };
31869  }
31870
31871  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
31872    if (element != null) {
31873      open(name);
31874      composeParameterDefinitionProperties(element);
31875      close();
31876    }
31877  }
31878
31879  protected void composeParameterDefinitionProperties(ParameterDefinition element) throws IOException {
31880    composeDataTypeProperties(element);
31881      if (element.hasNameElement()) {
31882        composeCodeCore("name", element.getNameElement(), false);
31883        composeCodeExtras("name", element.getNameElement(), false);
31884      }
31885      if (element.hasUseElement()) {
31886        composeEnumerationCore("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
31887        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
31888      }
31889      if (element.hasMinElement()) {
31890        composeIntegerCore("min", element.getMinElement(), false);
31891        composeIntegerExtras("min", element.getMinElement(), false);
31892      }
31893      if (element.hasMaxElement()) {
31894        composeStringCore("max", element.getMaxElement(), false);
31895        composeStringExtras("max", element.getMaxElement(), false);
31896      }
31897      if (element.hasDocumentationElement()) {
31898        composeStringCore("documentation", element.getDocumentationElement(), false);
31899        composeStringExtras("documentation", element.getDocumentationElement(), false);
31900      }
31901      if (element.hasTypeElement()) {
31902        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.FHIRAllTypesEnumFactory(), false);
31903        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.FHIRAllTypesEnumFactory(), false);
31904      }
31905      if (element.hasProfileElement()) {
31906        composeCanonicalCore("profile", element.getProfileElement(), false);
31907        composeCanonicalExtras("profile", element.getProfileElement(), false);
31908      }
31909  }
31910
31911  protected void composePeriod(String name, Period element) throws IOException {
31912    if (element != null) {
31913      open(name);
31914      composePeriodProperties(element);
31915      close();
31916    }
31917  }
31918
31919  protected void composePeriodProperties(Period element) throws IOException {
31920    composeDataTypeProperties(element);
31921      if (element.hasStartElement()) {
31922        composeDateTimeCore("start", element.getStartElement(), false);
31923        composeDateTimeExtras("start", element.getStartElement(), false);
31924      }
31925      if (element.hasEndElement()) {
31926        composeDateTimeCore("end", element.getEndElement(), false);
31927        composeDateTimeExtras("end", element.getEndElement(), false);
31928      }
31929  }
31930
31931  protected void composePopulation(String name, Population element) throws IOException {
31932    if (element != null) {
31933      open(name);
31934      composePopulationProperties(element);
31935      close();
31936    }
31937  }
31938
31939  protected void composePopulationProperties(Population element) throws IOException {
31940    composeBackboneTypeProperties(element);
31941      if (element.hasAge()) {
31942        composeType("age", element.getAge());
31943      }
31944      if (element.hasGender()) {
31945        composeCodeableConcept("gender", element.getGender());
31946      }
31947      if (element.hasRace()) {
31948        composeCodeableConcept("race", element.getRace());
31949      }
31950      if (element.hasPhysiologicalCondition()) {
31951        composeCodeableConcept("physiologicalCondition", element.getPhysiologicalCondition());
31952      }
31953  }
31954
31955  protected void composeProdCharacteristic(String name, ProdCharacteristic element) throws IOException {
31956    if (element != null) {
31957      open(name);
31958      composeProdCharacteristicProperties(element);
31959      close();
31960    }
31961  }
31962
31963  protected void composeProdCharacteristicProperties(ProdCharacteristic element) throws IOException {
31964    composeBackboneTypeProperties(element);
31965      if (element.hasHeight()) {
31966        composeQuantity("height", element.getHeight());
31967      }
31968      if (element.hasWidth()) {
31969        composeQuantity("width", element.getWidth());
31970      }
31971      if (element.hasDepth()) {
31972        composeQuantity("depth", element.getDepth());
31973      }
31974      if (element.hasWeight()) {
31975        composeQuantity("weight", element.getWeight());
31976      }
31977      if (element.hasNominalVolume()) {
31978        composeQuantity("nominalVolume", element.getNominalVolume());
31979      }
31980      if (element.hasExternalDiameter()) {
31981        composeQuantity("externalDiameter", element.getExternalDiameter());
31982      }
31983      if (element.hasShapeElement()) {
31984        composeStringCore("shape", element.getShapeElement(), false);
31985        composeStringExtras("shape", element.getShapeElement(), false);
31986      }
31987      if (element.hasColor()) {
31988        openArray("color");
31989        for (StringType e : element.getColor()) 
31990          composeStringCore(null, e, true);
31991        closeArray();
31992        if (anyHasExtras(element.getColor())) {
31993          openArray("_color");
31994          for (StringType e : element.getColor()) 
31995            composeStringExtras(null, e, true);
31996          closeArray();
31997        }
31998      };
31999      if (element.hasImprint()) {
32000        openArray("imprint");
32001        for (StringType e : element.getImprint()) 
32002          composeStringCore(null, e, true);
32003        closeArray();
32004        if (anyHasExtras(element.getImprint())) {
32005          openArray("_imprint");
32006          for (StringType e : element.getImprint()) 
32007            composeStringExtras(null, e, true);
32008          closeArray();
32009        }
32010      };
32011      if (element.hasImage()) {
32012        openArray("image");
32013        for (Attachment e : element.getImage()) 
32014          composeAttachment(null, e);
32015        closeArray();
32016      };
32017      if (element.hasScoring()) {
32018        composeCodeableConcept("scoring", element.getScoring());
32019      }
32020  }
32021
32022  protected void composeProductShelfLife(String name, ProductShelfLife element) throws IOException {
32023    if (element != null) {
32024      open(name);
32025      composeProductShelfLifeProperties(element);
32026      close();
32027    }
32028  }
32029
32030  protected void composeProductShelfLifeProperties(ProductShelfLife element) throws IOException {
32031    composeBackboneTypeProperties(element);
32032      if (element.hasIdentifier()) {
32033        composeIdentifier("identifier", element.getIdentifier());
32034      }
32035      if (element.hasType()) {
32036        composeCodeableConcept("type", element.getType());
32037      }
32038      if (element.hasPeriod()) {
32039        composeQuantity("period", element.getPeriod());
32040      }
32041      if (element.hasSpecialPrecautionsForStorage()) {
32042        openArray("specialPrecautionsForStorage");
32043        for (CodeableConcept e : element.getSpecialPrecautionsForStorage()) 
32044          composeCodeableConcept(null, e);
32045        closeArray();
32046      };
32047  }
32048
32049  protected void composeQuantity(String name, Quantity element) throws IOException {
32050    if (element != null) {
32051      open(name);
32052      composeQuantityProperties(element);
32053      close();
32054    }
32055  }
32056
32057  protected void composeQuantityProperties(Quantity element) throws IOException {
32058    composeDataTypeProperties(element);
32059      if (element.hasValueElement()) {
32060        composeDecimalCore("value", element.getValueElement(), false);
32061        composeDecimalExtras("value", element.getValueElement(), false);
32062      }
32063      if (element.hasComparatorElement()) {
32064        composeEnumerationCore("comparator", element.getComparatorElement(), new Enumerations.QuantityComparatorEnumFactory(), false);
32065        composeEnumerationExtras("comparator", element.getComparatorElement(), new Enumerations.QuantityComparatorEnumFactory(), false);
32066      }
32067      if (element.hasUnitElement()) {
32068        composeStringCore("unit", element.getUnitElement(), false);
32069        composeStringExtras("unit", element.getUnitElement(), false);
32070      }
32071      if (element.hasSystemElement()) {
32072        composeUriCore("system", element.getSystemElement(), false);
32073        composeUriExtras("system", element.getSystemElement(), false);
32074      }
32075      if (element.hasCodeElement()) {
32076        composeCodeCore("code", element.getCodeElement(), false);
32077        composeCodeExtras("code", element.getCodeElement(), false);
32078      }
32079  }
32080
32081  protected void composeRange(String name, Range element) throws IOException {
32082    if (element != null) {
32083      open(name);
32084      composeRangeProperties(element);
32085      close();
32086    }
32087  }
32088
32089  protected void composeRangeProperties(Range element) throws IOException {
32090    composeDataTypeProperties(element);
32091      if (element.hasLow()) {
32092        composeQuantity("low", element.getLow());
32093      }
32094      if (element.hasHigh()) {
32095        composeQuantity("high", element.getHigh());
32096      }
32097  }
32098
32099  protected void composeRatio(String name, Ratio element) throws IOException {
32100    if (element != null) {
32101      open(name);
32102      composeRatioProperties(element);
32103      close();
32104    }
32105  }
32106
32107  protected void composeRatioProperties(Ratio element) throws IOException {
32108    composeDataTypeProperties(element);
32109      if (element.hasNumerator()) {
32110        composeQuantity("numerator", element.getNumerator());
32111      }
32112      if (element.hasDenominator()) {
32113        composeQuantity("denominator", element.getDenominator());
32114      }
32115  }
32116
32117  protected void composeReference(String name, Reference element) throws IOException {
32118    if (element != null) {
32119      open(name);
32120      composeReferenceProperties(element);
32121      close();
32122    }
32123  }
32124
32125  protected void composeReferenceProperties(Reference element) throws IOException {
32126    composeDataTypeProperties(element);
32127      if (element.hasReferenceElement()) {
32128        composeStringCore("reference", element.getReferenceElement(), false);
32129        composeStringExtras("reference", element.getReferenceElement(), false);
32130      }
32131      if (element.hasTypeElement()) {
32132        composeUriCore("type", element.getTypeElement(), false);
32133        composeUriExtras("type", element.getTypeElement(), false);
32134      }
32135      if (element.hasIdentifier()) {
32136        composeIdentifier("identifier", element.getIdentifier());
32137      }
32138      if (element.hasDisplayElement()) {
32139        composeStringCore("display", element.getDisplayElement(), false);
32140        composeStringExtras("display", element.getDisplayElement(), false);
32141      }
32142  }
32143
32144  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
32145    if (element != null) {
32146      open(name);
32147      composeRelatedArtifactProperties(element);
32148      close();
32149    }
32150  }
32151
32152  protected void composeRelatedArtifactProperties(RelatedArtifact element) throws IOException {
32153    composeDataTypeProperties(element);
32154      if (element.hasTypeElement()) {
32155        composeEnumerationCore("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
32156        composeEnumerationExtras("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
32157      }
32158      if (element.hasLabelElement()) {
32159        composeStringCore("label", element.getLabelElement(), false);
32160        composeStringExtras("label", element.getLabelElement(), false);
32161      }
32162      if (element.hasDisplayElement()) {
32163        composeStringCore("display", element.getDisplayElement(), false);
32164        composeStringExtras("display", element.getDisplayElement(), false);
32165      }
32166      if (element.hasCitationElement()) {
32167        composeMarkdownCore("citation", element.getCitationElement(), false);
32168        composeMarkdownExtras("citation", element.getCitationElement(), false);
32169      }
32170      if (element.hasUrlElement()) {
32171        composeUrlCore("url", element.getUrlElement(), false);
32172        composeUrlExtras("url", element.getUrlElement(), false);
32173      }
32174      if (element.hasDocument()) {
32175        composeAttachment("document", element.getDocument());
32176      }
32177      if (element.hasResourceElement()) {
32178        composeCanonicalCore("resource", element.getResourceElement(), false);
32179        composeCanonicalExtras("resource", element.getResourceElement(), false);
32180      }
32181  }
32182
32183  protected void composeSampledData(String name, SampledData element) throws IOException {
32184    if (element != null) {
32185      open(name);
32186      composeSampledDataProperties(element);
32187      close();
32188    }
32189  }
32190
32191  protected void composeSampledDataProperties(SampledData element) throws IOException {
32192    composeDataTypeProperties(element);
32193      if (element.hasOrigin()) {
32194        composeQuantity("origin", element.getOrigin());
32195      }
32196      if (element.hasPeriodElement()) {
32197        composeDecimalCore("period", element.getPeriodElement(), false);
32198        composeDecimalExtras("period", element.getPeriodElement(), false);
32199      }
32200      if (element.hasFactorElement()) {
32201        composeDecimalCore("factor", element.getFactorElement(), false);
32202        composeDecimalExtras("factor", element.getFactorElement(), false);
32203      }
32204      if (element.hasLowerLimitElement()) {
32205        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
32206        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
32207      }
32208      if (element.hasUpperLimitElement()) {
32209        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
32210        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
32211      }
32212      if (element.hasDimensionsElement()) {
32213        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
32214        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
32215      }
32216      if (element.hasDataElement()) {
32217        composeStringCore("data", element.getDataElement(), false);
32218        composeStringExtras("data", element.getDataElement(), false);
32219      }
32220  }
32221
32222  protected void composeSignature(String name, Signature element) throws IOException {
32223    if (element != null) {
32224      open(name);
32225      composeSignatureProperties(element);
32226      close();
32227    }
32228  }
32229
32230  protected void composeSignatureProperties(Signature element) throws IOException {
32231    composeDataTypeProperties(element);
32232      if (element.hasType()) {
32233        openArray("type");
32234        for (Coding e : element.getType()) 
32235          composeCoding(null, e);
32236        closeArray();
32237      };
32238      if (element.hasWhenElement()) {
32239        composeInstantCore("when", element.getWhenElement(), false);
32240        composeInstantExtras("when", element.getWhenElement(), false);
32241      }
32242      if (element.hasWho()) {
32243        composeReference("who", element.getWho());
32244      }
32245      if (element.hasOnBehalfOf()) {
32246        composeReference("onBehalfOf", element.getOnBehalfOf());
32247      }
32248      if (element.hasTargetFormatElement()) {
32249        composeCodeCore("targetFormat", element.getTargetFormatElement(), false);
32250        composeCodeExtras("targetFormat", element.getTargetFormatElement(), false);
32251      }
32252      if (element.hasSigFormatElement()) {
32253        composeCodeCore("sigFormat", element.getSigFormatElement(), false);
32254        composeCodeExtras("sigFormat", element.getSigFormatElement(), false);
32255      }
32256      if (element.hasDataElement()) {
32257        composeBase64BinaryCore("data", element.getDataElement(), false);
32258        composeBase64BinaryExtras("data", element.getDataElement(), false);
32259      }
32260  }
32261
32262  protected void composeStatistic(String name, Statistic element) throws IOException {
32263    if (element != null) {
32264      open(name);
32265      composeStatisticProperties(element);
32266      close();
32267    }
32268  }
32269
32270  protected void composeStatisticProperties(Statistic element) throws IOException {
32271    composeBackboneTypeProperties(element);
32272      if (element.hasDescriptionElement()) {
32273        composeStringCore("description", element.getDescriptionElement(), false);
32274        composeStringExtras("description", element.getDescriptionElement(), false);
32275      }
32276      if (element.hasNote()) {
32277        openArray("note");
32278        for (Annotation e : element.getNote()) 
32279          composeAnnotation(null, e);
32280        closeArray();
32281      };
32282      if (element.hasStatisticType()) {
32283        composeCodeableConcept("statisticType", element.getStatisticType());
32284      }
32285      if (element.hasQuantity()) {
32286        composeQuantity("quantity", element.getQuantity());
32287      }
32288      if (element.hasSampleSize()) {
32289        composeStatisticSampleSizeComponent("sampleSize", element.getSampleSize());
32290      }
32291      if (element.hasAttributeEstimate()) {
32292        openArray("attributeEstimate");
32293        for (Statistic.StatisticAttributeEstimateComponent e : element.getAttributeEstimate()) 
32294          composeStatisticAttributeEstimateComponent(null, e);
32295        closeArray();
32296      };
32297  }
32298
32299  protected void composeStatisticSampleSizeComponent(String name, Statistic.StatisticSampleSizeComponent element) throws IOException {
32300    if (element != null) {
32301      open(name);
32302      composeStatisticSampleSizeComponentProperties(element);
32303      close();
32304    }
32305  }
32306
32307  protected void composeStatisticSampleSizeComponentProperties(Statistic.StatisticSampleSizeComponent element) throws IOException {
32308    composeElementProperties(element);
32309      if (element.hasDescriptionElement()) {
32310        composeStringCore("description", element.getDescriptionElement(), false);
32311        composeStringExtras("description", element.getDescriptionElement(), false);
32312      }
32313      if (element.hasNote()) {
32314        openArray("note");
32315        for (Annotation e : element.getNote()) 
32316          composeAnnotation(null, e);
32317        closeArray();
32318      };
32319      if (element.hasNumberOfStudiesElement()) {
32320        composeIntegerCore("numberOfStudies", element.getNumberOfStudiesElement(), false);
32321        composeIntegerExtras("numberOfStudies", element.getNumberOfStudiesElement(), false);
32322      }
32323      if (element.hasNumberOfParticipantsElement()) {
32324        composeIntegerCore("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
32325        composeIntegerExtras("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
32326      }
32327      if (element.hasKnownDataCountElement()) {
32328        composeIntegerCore("knownDataCount", element.getKnownDataCountElement(), false);
32329        composeIntegerExtras("knownDataCount", element.getKnownDataCountElement(), false);
32330      }
32331      if (element.hasNumeratorCountElement()) {
32332        composeIntegerCore("numeratorCount", element.getNumeratorCountElement(), false);
32333        composeIntegerExtras("numeratorCount", element.getNumeratorCountElement(), false);
32334      }
32335  }
32336
32337  protected void composeStatisticAttributeEstimateComponent(String name, Statistic.StatisticAttributeEstimateComponent element) throws IOException {
32338    if (element != null) {
32339      open(name);
32340      composeStatisticAttributeEstimateComponentProperties(element);
32341      close();
32342    }
32343  }
32344
32345  protected void composeStatisticAttributeEstimateComponentProperties(Statistic.StatisticAttributeEstimateComponent element) throws IOException {
32346    composeElementProperties(element);
32347      if (element.hasDescriptionElement()) {
32348        composeStringCore("description", element.getDescriptionElement(), false);
32349        composeStringExtras("description", element.getDescriptionElement(), false);
32350      }
32351      if (element.hasNote()) {
32352        openArray("note");
32353        for (Annotation e : element.getNote()) 
32354          composeAnnotation(null, e);
32355        closeArray();
32356      };
32357      if (element.hasType()) {
32358        composeCodeableConcept("type", element.getType());
32359      }
32360      if (element.hasQuantity()) {
32361        composeQuantity("quantity", element.getQuantity());
32362      }
32363      if (element.hasLevelElement()) {
32364        composeDecimalCore("level", element.getLevelElement(), false);
32365        composeDecimalExtras("level", element.getLevelElement(), false);
32366      }
32367      if (element.hasRange()) {
32368        composeRange("range", element.getRange());
32369      }
32370      if (element.hasEstimateQualifier()) {
32371        openArray("estimateQualifier");
32372        for (Statistic.StatisticAttributeEstimateEstimateQualifierComponent e : element.getEstimateQualifier()) 
32373          composeStatisticAttributeEstimateEstimateQualifierComponent(null, e);
32374        closeArray();
32375      };
32376  }
32377
32378  protected void composeStatisticAttributeEstimateEstimateQualifierComponent(String name, Statistic.StatisticAttributeEstimateEstimateQualifierComponent element) throws IOException {
32379    if (element != null) {
32380      open(name);
32381      composeStatisticAttributeEstimateEstimateQualifierComponentProperties(element);
32382      close();
32383    }
32384  }
32385
32386  protected void composeStatisticAttributeEstimateEstimateQualifierComponentProperties(Statistic.StatisticAttributeEstimateEstimateQualifierComponent element) throws IOException {
32387    composeElementProperties(element);
32388      if (element.hasDescriptionElement()) {
32389        composeStringCore("description", element.getDescriptionElement(), false);
32390        composeStringExtras("description", element.getDescriptionElement(), false);
32391      }
32392      if (element.hasNote()) {
32393        openArray("note");
32394        for (Annotation e : element.getNote()) 
32395          composeAnnotation(null, e);
32396        closeArray();
32397      };
32398      if (element.hasType()) {
32399        composeCodeableConcept("type", element.getType());
32400      }
32401      if (element.hasQuantity()) {
32402        composeQuantity("quantity", element.getQuantity());
32403      }
32404      if (element.hasLevelElement()) {
32405        composeDecimalCore("level", element.getLevelElement(), false);
32406        composeDecimalExtras("level", element.getLevelElement(), false);
32407      }
32408      if (element.hasRange()) {
32409        composeRange("range", element.getRange());
32410      }
32411  }
32412
32413  protected void composeSubstanceAmount(String name, SubstanceAmount element) throws IOException {
32414    if (element != null) {
32415      open(name);
32416      composeSubstanceAmountProperties(element);
32417      close();
32418    }
32419  }
32420
32421  protected void composeSubstanceAmountProperties(SubstanceAmount element) throws IOException {
32422    composeBackboneTypeProperties(element);
32423      if (element.hasAmount()) {
32424        composeType("amount", element.getAmount());
32425      }
32426      if (element.hasAmountType()) {
32427        composeCodeableConcept("amountType", element.getAmountType());
32428      }
32429      if (element.hasAmountTextElement()) {
32430        composeStringCore("amountText", element.getAmountTextElement(), false);
32431        composeStringExtras("amountText", element.getAmountTextElement(), false);
32432      }
32433      if (element.hasReferenceRange()) {
32434        composeSubstanceAmountReferenceRangeComponent("referenceRange", element.getReferenceRange());
32435      }
32436  }
32437
32438  protected void composeSubstanceAmountReferenceRangeComponent(String name, SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
32439    if (element != null) {
32440      open(name);
32441      composeSubstanceAmountReferenceRangeComponentProperties(element);
32442      close();
32443    }
32444  }
32445
32446  protected void composeSubstanceAmountReferenceRangeComponentProperties(SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
32447    composeElementProperties(element);
32448      if (element.hasLowLimit()) {
32449        composeQuantity("lowLimit", element.getLowLimit());
32450      }
32451      if (element.hasHighLimit()) {
32452        composeQuantity("highLimit", element.getHighLimit());
32453      }
32454  }
32455
32456  protected void composeTiming(String name, Timing element) throws IOException {
32457    if (element != null) {
32458      open(name);
32459      composeTimingProperties(element);
32460      close();
32461    }
32462  }
32463
32464  protected void composeTimingProperties(Timing element) throws IOException {
32465    composeBackboneTypeProperties(element);
32466      if (element.hasEvent()) {
32467        openArray("event");
32468        for (DateTimeType e : element.getEvent()) 
32469          composeDateTimeCore(null, e, true);
32470        closeArray();
32471        if (anyHasExtras(element.getEvent())) {
32472          openArray("_event");
32473          for (DateTimeType e : element.getEvent()) 
32474            composeDateTimeExtras(null, e, true);
32475          closeArray();
32476        }
32477      };
32478      if (element.hasRepeat()) {
32479        composeTimingRepeatComponent("repeat", element.getRepeat());
32480      }
32481      if (element.hasCode()) {
32482        composeCodeableConcept("code", element.getCode());
32483      }
32484  }
32485
32486  protected void composeTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
32487    if (element != null) {
32488      open(name);
32489      composeTimingRepeatComponentProperties(element);
32490      close();
32491    }
32492  }
32493
32494  protected void composeTimingRepeatComponentProperties(Timing.TimingRepeatComponent element) throws IOException {
32495    composeElementProperties(element);
32496      if (element.hasBounds()) {
32497        composeType("bounds", element.getBounds());
32498      }
32499      if (element.hasCountElement()) {
32500        composePositiveIntCore("count", element.getCountElement(), false);
32501        composePositiveIntExtras("count", element.getCountElement(), false);
32502      }
32503      if (element.hasCountMaxElement()) {
32504        composePositiveIntCore("countMax", element.getCountMaxElement(), false);
32505        composePositiveIntExtras("countMax", element.getCountMaxElement(), false);
32506      }
32507      if (element.hasDurationElement()) {
32508        composeDecimalCore("duration", element.getDurationElement(), false);
32509        composeDecimalExtras("duration", element.getDurationElement(), false);
32510      }
32511      if (element.hasDurationMaxElement()) {
32512        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
32513        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
32514      }
32515      if (element.hasDurationUnitElement()) {
32516        composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
32517        composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
32518      }
32519      if (element.hasFrequencyElement()) {
32520        composePositiveIntCore("frequency", element.getFrequencyElement(), false);
32521        composePositiveIntExtras("frequency", element.getFrequencyElement(), false);
32522      }
32523      if (element.hasFrequencyMaxElement()) {
32524        composePositiveIntCore("frequencyMax", element.getFrequencyMaxElement(), false);
32525        composePositiveIntExtras("frequencyMax", element.getFrequencyMaxElement(), false);
32526      }
32527      if (element.hasPeriodElement()) {
32528        composeDecimalCore("period", element.getPeriodElement(), false);
32529        composeDecimalExtras("period", element.getPeriodElement(), false);
32530      }
32531      if (element.hasPeriodMaxElement()) {
32532        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
32533        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
32534      }
32535      if (element.hasPeriodUnitElement()) {
32536        composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
32537        composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
32538      }
32539      if (element.hasDayOfWeek()) {
32540        openArray("dayOfWeek");
32541        for (Enumeration<Enumerations.DaysOfWeek> e : element.getDayOfWeek()) 
32542          composeEnumerationCore(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
32543        closeArray();
32544        if (anyHasExtras(element.getDayOfWeek())) {
32545          openArray("_dayOfWeek");
32546          for (Enumeration<Enumerations.DaysOfWeek> e : element.getDayOfWeek()) 
32547            composeEnumerationExtras(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
32548          closeArray();
32549        }
32550      };
32551      if (element.hasTimeOfDay()) {
32552        openArray("timeOfDay");
32553        for (TimeType e : element.getTimeOfDay()) 
32554          composeTimeCore(null, e, true);
32555        closeArray();
32556        if (anyHasExtras(element.getTimeOfDay())) {
32557          openArray("_timeOfDay");
32558          for (TimeType e : element.getTimeOfDay()) 
32559            composeTimeExtras(null, e, true);
32560          closeArray();
32561        }
32562      };
32563      if (element.hasWhen()) {
32564        openArray("when");
32565        for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
32566          composeEnumerationCore(null, e, new Timing.EventTimingEnumFactory(), true);
32567        closeArray();
32568        if (anyHasExtras(element.getWhen())) {
32569          openArray("_when");
32570          for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
32571            composeEnumerationExtras(null, e, new Timing.EventTimingEnumFactory(), true);
32572          closeArray();
32573        }
32574      };
32575      if (element.hasOffsetElement()) {
32576        composeUnsignedIntCore("offset", element.getOffsetElement(), false);
32577        composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
32578      }
32579  }
32580
32581  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
32582    if (element != null) {
32583      open(name);
32584      composeTriggerDefinitionProperties(element);
32585      close();
32586    }
32587  }
32588
32589  protected void composeTriggerDefinitionProperties(TriggerDefinition element) throws IOException {
32590    composeDataTypeProperties(element);
32591      if (element.hasTypeElement()) {
32592        composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
32593        composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
32594      }
32595      if (element.hasNameElement()) {
32596        composeStringCore("name", element.getNameElement(), false);
32597        composeStringExtras("name", element.getNameElement(), false);
32598      }
32599      if (element.hasTiming()) {
32600        composeType("timing", element.getTiming());
32601      }
32602      if (element.hasData()) {
32603        openArray("data");
32604        for (DataRequirement e : element.getData()) 
32605          composeDataRequirement(null, e);
32606        closeArray();
32607      };
32608      if (element.hasCondition()) {
32609        composeExpression("condition", element.getCondition());
32610      }
32611  }
32612
32613  protected void composeUsageContext(String name, UsageContext element) throws IOException {
32614    if (element != null) {
32615      open(name);
32616      composeUsageContextProperties(element);
32617      close();
32618    }
32619  }
32620
32621  protected void composeUsageContextProperties(UsageContext element) throws IOException {
32622    composeDataTypeProperties(element);
32623      if (element.hasCode()) {
32624        composeCoding("code", element.getCode());
32625      }
32626      if (element.hasValue()) {
32627        composeType("value", element.getValue());
32628      }
32629  }
32630
32631  protected void composeCanonicalResourceProperties(CanonicalResource element) throws IOException {
32632      composeDomainResourceProperties(element);
32633  }
32634
32635  protected void composeDomainResourceProperties(DomainResource element) throws IOException {
32636      composeResourceProperties(element);
32637      if (element.hasText()) {
32638        composeNarrative("text", element.getText());
32639      }
32640      if (element.hasContained()) {
32641        openArray("contained");
32642        for (Resource e : element.getContained()) {
32643          open(null);
32644          composeResource(e);
32645          close();
32646        }
32647        closeArray();
32648      };
32649      if (element.hasExtension()) {
32650        openArray("extension");
32651        for (Extension e : element.getExtension()) 
32652          composeExtension(null, e);
32653        closeArray();
32654      };
32655      if (element.hasModifierExtension()) {
32656        openArray("modifierExtension");
32657        for (Extension e : element.getModifierExtension()) 
32658          composeExtension(null, e);
32659        closeArray();
32660      };
32661  }
32662
32663  protected void composeMetadataResourceProperties(MetadataResource element) throws IOException {
32664      composeCanonicalResourceProperties(element);
32665  }
32666
32667  protected void composeResourceProperties(Resource element) throws IOException {
32668      composeBaseProperties(element);
32669      if (element.hasIdElement()) {
32670        composeIdCore("id", element.getIdElement(), false);
32671        composeIdExtras("id", element.getIdElement(), false);
32672      }
32673      if (element.hasMeta()) {
32674        composeMeta("meta", element.getMeta());
32675      }
32676      if (element.hasImplicitRulesElement()) {
32677        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
32678        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
32679      }
32680      if (element.hasLanguageElement()) {
32681        composeCodeCore("language", element.getLanguageElement(), false);
32682        composeCodeExtras("language", element.getLanguageElement(), false);
32683      }
32684  }
32685
32686  protected void composeAccount(String name, Account element) throws IOException {
32687    if (element != null) {
32688      prop("resourceType", name);
32689      composeAccountProperties(element);
32690    }
32691  }
32692
32693  protected void composeAccountProperties(Account element) throws IOException {
32694    composeDomainResourceProperties(element);
32695      if (element.hasIdentifier()) {
32696        openArray("identifier");
32697        for (Identifier e : element.getIdentifier()) 
32698          composeIdentifier(null, e);
32699        closeArray();
32700      };
32701      if (element.hasStatusElement()) {
32702        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
32703        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
32704      }
32705      if (element.hasType()) {
32706        composeCodeableConcept("type", element.getType());
32707      }
32708      if (element.hasNameElement()) {
32709        composeStringCore("name", element.getNameElement(), false);
32710        composeStringExtras("name", element.getNameElement(), false);
32711      }
32712      if (element.hasSubject()) {
32713        openArray("subject");
32714        for (Reference e : element.getSubject()) 
32715          composeReference(null, e);
32716        closeArray();
32717      };
32718      if (element.hasServicePeriod()) {
32719        composePeriod("servicePeriod", element.getServicePeriod());
32720      }
32721      if (element.hasCoverage()) {
32722        openArray("coverage");
32723        for (Account.CoverageComponent e : element.getCoverage()) 
32724          composeCoverageComponent(null, e);
32725        closeArray();
32726      };
32727      if (element.hasOwner()) {
32728        composeReference("owner", element.getOwner());
32729      }
32730      if (element.hasDescriptionElement()) {
32731        composeStringCore("description", element.getDescriptionElement(), false);
32732        composeStringExtras("description", element.getDescriptionElement(), false);
32733      }
32734      if (element.hasGuarantor()) {
32735        openArray("guarantor");
32736        for (Account.GuarantorComponent e : element.getGuarantor()) 
32737          composeGuarantorComponent(null, e);
32738        closeArray();
32739      };
32740      if (element.hasPartOf()) {
32741        composeReference("partOf", element.getPartOf());
32742      }
32743  }
32744
32745  protected void composeCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
32746    if (element != null) {
32747      open(name);
32748      composeCoverageComponentProperties(element);
32749      close();
32750    }
32751  }
32752
32753  protected void composeCoverageComponentProperties(Account.CoverageComponent element) throws IOException {
32754    composeBackboneElementProperties(element);
32755      if (element.hasCoverage()) {
32756        composeReference("coverage", element.getCoverage());
32757      }
32758      if (element.hasPriorityElement()) {
32759        composePositiveIntCore("priority", element.getPriorityElement(), false);
32760        composePositiveIntExtras("priority", element.getPriorityElement(), false);
32761      }
32762  }
32763
32764  protected void composeGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
32765    if (element != null) {
32766      open(name);
32767      composeGuarantorComponentProperties(element);
32768      close();
32769    }
32770  }
32771
32772  protected void composeGuarantorComponentProperties(Account.GuarantorComponent element) throws IOException {
32773    composeBackboneElementProperties(element);
32774      if (element.hasParty()) {
32775        composeReference("party", element.getParty());
32776      }
32777      if (element.hasOnHoldElement()) {
32778        composeBooleanCore("onHold", element.getOnHoldElement(), false);
32779        composeBooleanExtras("onHold", element.getOnHoldElement(), false);
32780      }
32781      if (element.hasPeriod()) {
32782        composePeriod("period", element.getPeriod());
32783      }
32784  }
32785
32786  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
32787    if (element != null) {
32788      prop("resourceType", name);
32789      composeActivityDefinitionProperties(element);
32790    }
32791  }
32792
32793  protected void composeActivityDefinitionProperties(ActivityDefinition element) throws IOException {
32794    composeMetadataResourceProperties(element);
32795      if (element.hasUrlElement()) {
32796        composeUriCore("url", element.getUrlElement(), false);
32797        composeUriExtras("url", element.getUrlElement(), false);
32798      }
32799      if (element.hasIdentifier()) {
32800        openArray("identifier");
32801        for (Identifier e : element.getIdentifier()) 
32802          composeIdentifier(null, e);
32803        closeArray();
32804      };
32805      if (element.hasVersionElement()) {
32806        composeStringCore("version", element.getVersionElement(), false);
32807        composeStringExtras("version", element.getVersionElement(), false);
32808      }
32809      if (element.hasNameElement()) {
32810        composeStringCore("name", element.getNameElement(), false);
32811        composeStringExtras("name", element.getNameElement(), false);
32812      }
32813      if (element.hasTitleElement()) {
32814        composeStringCore("title", element.getTitleElement(), false);
32815        composeStringExtras("title", element.getTitleElement(), false);
32816      }
32817      if (element.hasSubtitleElement()) {
32818        composeStringCore("subtitle", element.getSubtitleElement(), false);
32819        composeStringExtras("subtitle", element.getSubtitleElement(), false);
32820      }
32821      if (element.hasStatusElement()) {
32822        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32823        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32824      }
32825      if (element.hasExperimentalElement()) {
32826        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32827        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32828      }
32829      if (element.hasSubject()) {
32830        composeType("subject", element.getSubject());
32831      }
32832      if (element.hasDateElement()) {
32833        composeDateTimeCore("date", element.getDateElement(), false);
32834        composeDateTimeExtras("date", element.getDateElement(), false);
32835      }
32836      if (element.hasPublisherElement()) {
32837        composeStringCore("publisher", element.getPublisherElement(), false);
32838        composeStringExtras("publisher", element.getPublisherElement(), false);
32839      }
32840      if (element.hasContact()) {
32841        openArray("contact");
32842        for (ContactDetail e : element.getContact()) 
32843          composeContactDetail(null, e);
32844        closeArray();
32845      };
32846      if (element.hasDescriptionElement()) {
32847        composeMarkdownCore("description", element.getDescriptionElement(), false);
32848        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32849      }
32850      if (element.hasUseContext()) {
32851        openArray("useContext");
32852        for (UsageContext e : element.getUseContext()) 
32853          composeUsageContext(null, e);
32854        closeArray();
32855      };
32856      if (element.hasJurisdiction()) {
32857        openArray("jurisdiction");
32858        for (CodeableConcept e : element.getJurisdiction()) 
32859          composeCodeableConcept(null, e);
32860        closeArray();
32861      };
32862      if (element.hasPurposeElement()) {
32863        composeMarkdownCore("purpose", element.getPurposeElement(), false);
32864        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
32865      }
32866      if (element.hasUsageElement()) {
32867        composeStringCore("usage", element.getUsageElement(), false);
32868        composeStringExtras("usage", element.getUsageElement(), false);
32869      }
32870      if (element.hasCopyrightElement()) {
32871        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32872        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
32873      }
32874      if (element.hasApprovalDateElement()) {
32875        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
32876        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
32877      }
32878      if (element.hasLastReviewDateElement()) {
32879        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
32880        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
32881      }
32882      if (element.hasEffectivePeriod()) {
32883        composePeriod("effectivePeriod", element.getEffectivePeriod());
32884      }
32885      if (element.hasTopic()) {
32886        openArray("topic");
32887        for (CodeableConcept e : element.getTopic()) 
32888          composeCodeableConcept(null, e);
32889        closeArray();
32890      };
32891      if (element.hasAuthor()) {
32892        openArray("author");
32893        for (ContactDetail e : element.getAuthor()) 
32894          composeContactDetail(null, e);
32895        closeArray();
32896      };
32897      if (element.hasEditor()) {
32898        openArray("editor");
32899        for (ContactDetail e : element.getEditor()) 
32900          composeContactDetail(null, e);
32901        closeArray();
32902      };
32903      if (element.hasReviewer()) {
32904        openArray("reviewer");
32905        for (ContactDetail e : element.getReviewer()) 
32906          composeContactDetail(null, e);
32907        closeArray();
32908      };
32909      if (element.hasEndorser()) {
32910        openArray("endorser");
32911        for (ContactDetail e : element.getEndorser()) 
32912          composeContactDetail(null, e);
32913        closeArray();
32914      };
32915      if (element.hasRelatedArtifact()) {
32916        openArray("relatedArtifact");
32917        for (RelatedArtifact e : element.getRelatedArtifact()) 
32918          composeRelatedArtifact(null, e);
32919        closeArray();
32920      };
32921      if (element.hasLibrary()) {
32922        openArray("library");
32923        for (CanonicalType e : element.getLibrary()) 
32924          composeCanonicalCore(null, e, true);
32925        closeArray();
32926        if (anyHasExtras(element.getLibrary())) {
32927          openArray("_library");
32928          for (CanonicalType e : element.getLibrary()) 
32929            composeCanonicalExtras(null, e, true);
32930          closeArray();
32931        }
32932      };
32933      if (element.hasKindElement()) {
32934        composeEnumerationCore("kind", element.getKindElement(), new ActivityDefinition.RequestResourceTypeEnumFactory(), false);
32935        composeEnumerationExtras("kind", element.getKindElement(), new ActivityDefinition.RequestResourceTypeEnumFactory(), false);
32936      }
32937      if (element.hasProfileElement()) {
32938        composeCanonicalCore("profile", element.getProfileElement(), false);
32939        composeCanonicalExtras("profile", element.getProfileElement(), false);
32940      }
32941      if (element.hasCode()) {
32942        composeCodeableConcept("code", element.getCode());
32943      }
32944      if (element.hasIntentElement()) {
32945        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
32946        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
32947      }
32948      if (element.hasPriorityElement()) {
32949        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
32950        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
32951      }
32952      if (element.hasDoNotPerformElement()) {
32953        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
32954        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
32955      }
32956      if (element.hasTiming()) {
32957        composeType("timing", element.getTiming());
32958      }
32959      if (element.hasLocation()) {
32960        composeReference("location", element.getLocation());
32961      }
32962      if (element.hasParticipant()) {
32963        openArray("participant");
32964        for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant()) 
32965          composeActivityDefinitionParticipantComponent(null, e);
32966        closeArray();
32967      };
32968      if (element.hasProduct()) {
32969        composeType("product", element.getProduct());
32970      }
32971      if (element.hasQuantity()) {
32972        composeQuantity("quantity", element.getQuantity());
32973      }
32974      if (element.hasDosage()) {
32975        openArray("dosage");
32976        for (Dosage e : element.getDosage()) 
32977          composeDosage(null, e);
32978        closeArray();
32979      };
32980      if (element.hasBodySite()) {
32981        openArray("bodySite");
32982        for (CodeableConcept e : element.getBodySite()) 
32983          composeCodeableConcept(null, e);
32984        closeArray();
32985      };
32986      if (element.hasSpecimenRequirement()) {
32987        openArray("specimenRequirement");
32988        for (Reference e : element.getSpecimenRequirement()) 
32989          composeReference(null, e);
32990        closeArray();
32991      };
32992      if (element.hasObservationRequirement()) {
32993        openArray("observationRequirement");
32994        for (Reference e : element.getObservationRequirement()) 
32995          composeReference(null, e);
32996        closeArray();
32997      };
32998      if (element.hasObservationResultRequirement()) {
32999        openArray("observationResultRequirement");
33000        for (Reference e : element.getObservationResultRequirement()) 
33001          composeReference(null, e);
33002        closeArray();
33003      };
33004      if (element.hasTransformElement()) {
33005        composeCanonicalCore("transform", element.getTransformElement(), false);
33006        composeCanonicalExtras("transform", element.getTransformElement(), false);
33007      }
33008      if (element.hasDynamicValue()) {
33009        openArray("dynamicValue");
33010        for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue()) 
33011          composeActivityDefinitionDynamicValueComponent(null, e);
33012        closeArray();
33013      };
33014  }
33015
33016  protected void composeActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
33017    if (element != null) {
33018      open(name);
33019      composeActivityDefinitionParticipantComponentProperties(element);
33020      close();
33021    }
33022  }
33023
33024  protected void composeActivityDefinitionParticipantComponentProperties(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
33025    composeBackboneElementProperties(element);
33026      if (element.hasTypeElement()) {
33027        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
33028        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
33029      }
33030      if (element.hasRole()) {
33031        composeCodeableConcept("role", element.getRole());
33032      }
33033  }
33034
33035  protected void composeActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
33036    if (element != null) {
33037      open(name);
33038      composeActivityDefinitionDynamicValueComponentProperties(element);
33039      close();
33040    }
33041  }
33042
33043  protected void composeActivityDefinitionDynamicValueComponentProperties(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
33044    composeBackboneElementProperties(element);
33045      if (element.hasPathElement()) {
33046        composeStringCore("path", element.getPathElement(), false);
33047        composeStringExtras("path", element.getPathElement(), false);
33048      }
33049      if (element.hasExpression()) {
33050        composeExpression("expression", element.getExpression());
33051      }
33052  }
33053
33054  protected void composeAdministrableProductDefinition(String name, AdministrableProductDefinition element) throws IOException {
33055    if (element != null) {
33056      prop("resourceType", name);
33057      composeAdministrableProductDefinitionProperties(element);
33058    }
33059  }
33060
33061  protected void composeAdministrableProductDefinitionProperties(AdministrableProductDefinition element) throws IOException {
33062    composeDomainResourceProperties(element);
33063      if (element.hasIdentifier()) {
33064        openArray("identifier");
33065        for (Identifier e : element.getIdentifier()) 
33066          composeIdentifier(null, e);
33067        closeArray();
33068      };
33069      if (element.hasSubject()) {
33070        openArray("subject");
33071        for (Reference e : element.getSubject()) 
33072          composeReference(null, e);
33073        closeArray();
33074      };
33075      if (element.hasAdministrableDoseForm()) {
33076        composeCodeableConcept("administrableDoseForm", element.getAdministrableDoseForm());
33077      }
33078      if (element.hasUnitOfPresentation()) {
33079        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
33080      }
33081      if (element.hasProducedFrom()) {
33082        openArray("producedFrom");
33083        for (Reference e : element.getProducedFrom()) 
33084          composeReference(null, e);
33085        closeArray();
33086      };
33087      if (element.hasIngredient()) {
33088        openArray("ingredient");
33089        for (Reference e : element.getIngredient()) 
33090          composeReference(null, e);
33091        closeArray();
33092      };
33093      if (element.hasDevice()) {
33094        openArray("device");
33095        for (Reference e : element.getDevice()) 
33096          composeReference(null, e);
33097        closeArray();
33098      };
33099      if (element.hasCharacteristic()) {
33100        openArray("characteristic");
33101        for (AdministrableProductDefinition.AdministrableProductDefinitionCharacteristicComponent e : element.getCharacteristic()) 
33102          composeAdministrableProductDefinitionCharacteristicComponent(null, e);
33103        closeArray();
33104      };
33105      if (element.hasRouteOfAdministration()) {
33106        openArray("routeOfAdministration");
33107        for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent e : element.getRouteOfAdministration()) 
33108          composeAdministrableProductDefinitionRouteOfAdministrationComponent(null, e);
33109        closeArray();
33110      };
33111  }
33112
33113  protected void composeAdministrableProductDefinitionCharacteristicComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionCharacteristicComponent element) throws IOException {
33114    if (element != null) {
33115      open(name);
33116      composeAdministrableProductDefinitionCharacteristicComponentProperties(element);
33117      close();
33118    }
33119  }
33120
33121  protected void composeAdministrableProductDefinitionCharacteristicComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionCharacteristicComponent element) throws IOException {
33122    composeBackboneElementProperties(element);
33123      if (element.hasCode()) {
33124        composeCodeableConcept("code", element.getCode());
33125      }
33126      if (element.hasValue()) {
33127        composeType("value", element.getValue());
33128      }
33129      if (element.hasStatus()) {
33130        composeCodeableConcept("status", element.getStatus());
33131      }
33132  }
33133
33134  protected void composeAdministrableProductDefinitionRouteOfAdministrationComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent element) throws IOException {
33135    if (element != null) {
33136      open(name);
33137      composeAdministrableProductDefinitionRouteOfAdministrationComponentProperties(element);
33138      close();
33139    }
33140  }
33141
33142  protected void composeAdministrableProductDefinitionRouteOfAdministrationComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent element) throws IOException {
33143    composeBackboneElementProperties(element);
33144      if (element.hasCode()) {
33145        composeCodeableConcept("code", element.getCode());
33146      }
33147      if (element.hasFirstDose()) {
33148        composeQuantity("firstDose", element.getFirstDose());
33149      }
33150      if (element.hasMaxSingleDose()) {
33151        composeQuantity("maxSingleDose", element.getMaxSingleDose());
33152      }
33153      if (element.hasMaxDosePerDay()) {
33154        composeQuantity("maxDosePerDay", element.getMaxDosePerDay());
33155      }
33156      if (element.hasMaxDosePerTreatmentPeriod()) {
33157        composeRatio("maxDosePerTreatmentPeriod", element.getMaxDosePerTreatmentPeriod());
33158      }
33159      if (element.hasMaxTreatmentPeriod()) {
33160        composeDuration("maxTreatmentPeriod", element.getMaxTreatmentPeriod());
33161      }
33162      if (element.hasTargetSpecies()) {
33163        openArray("targetSpecies");
33164        for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent e : element.getTargetSpecies()) 
33165          composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(null, e);
33166        closeArray();
33167      };
33168  }
33169
33170  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
33171    if (element != null) {
33172      open(name);
33173      composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(element);
33174      close();
33175    }
33176  }
33177
33178  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
33179    composeBackboneElementProperties(element);
33180      if (element.hasCode()) {
33181        composeCodeableConcept("code", element.getCode());
33182      }
33183      if (element.hasWithdrawalPeriod()) {
33184        openArray("withdrawalPeriod");
33185        for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent e : element.getWithdrawalPeriod()) 
33186          composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(null, e);
33187        closeArray();
33188      };
33189  }
33190
33191  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
33192    if (element != null) {
33193      open(name);
33194      composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(element);
33195      close();
33196    }
33197  }
33198
33199  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
33200    composeBackboneElementProperties(element);
33201      if (element.hasTissue()) {
33202        composeCodeableConcept("tissue", element.getTissue());
33203      }
33204      if (element.hasValue()) {
33205        composeQuantity("value", element.getValue());
33206      }
33207      if (element.hasSupportingInformationElement()) {
33208        composeStringCore("supportingInformation", element.getSupportingInformationElement(), false);
33209        composeStringExtras("supportingInformation", element.getSupportingInformationElement(), false);
33210      }
33211  }
33212
33213  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
33214    if (element != null) {
33215      prop("resourceType", name);
33216      composeAdverseEventProperties(element);
33217    }
33218  }
33219
33220  protected void composeAdverseEventProperties(AdverseEvent element) throws IOException {
33221    composeDomainResourceProperties(element);
33222      if (element.hasIdentifier()) {
33223        openArray("identifier");
33224        for (Identifier e : element.getIdentifier()) 
33225          composeIdentifier(null, e);
33226        closeArray();
33227      };
33228      if (element.hasStatusElement()) {
33229        composeEnumerationCore("status", element.getStatusElement(), new AdverseEvent.AdverseEventStatusEnumFactory(), false);
33230        composeEnumerationExtras("status", element.getStatusElement(), new AdverseEvent.AdverseEventStatusEnumFactory(), false);
33231      }
33232      if (element.hasActualityElement()) {
33233        composeEnumerationCore("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
33234        composeEnumerationExtras("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
33235      }
33236      if (element.hasCategory()) {
33237        openArray("category");
33238        for (CodeableConcept e : element.getCategory()) 
33239          composeCodeableConcept(null, e);
33240        closeArray();
33241      };
33242      if (element.hasCode()) {
33243        composeCodeableConcept("code", element.getCode());
33244      }
33245      if (element.hasSubject()) {
33246        composeReference("subject", element.getSubject());
33247      }
33248      if (element.hasEncounter()) {
33249        composeReference("encounter", element.getEncounter());
33250      }
33251      if (element.hasOccurrence()) {
33252        composeType("occurrence", element.getOccurrence());
33253      }
33254      if (element.hasDetectedElement()) {
33255        composeDateTimeCore("detected", element.getDetectedElement(), false);
33256        composeDateTimeExtras("detected", element.getDetectedElement(), false);
33257      }
33258      if (element.hasRecordedDateElement()) {
33259        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
33260        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
33261      }
33262      if (element.hasResultingCondition()) {
33263        openArray("resultingCondition");
33264        for (Reference e : element.getResultingCondition()) 
33265          composeReference(null, e);
33266        closeArray();
33267      };
33268      if (element.hasLocation()) {
33269        composeReference("location", element.getLocation());
33270      }
33271      if (element.hasSeriousness()) {
33272        composeCodeableConcept("seriousness", element.getSeriousness());
33273      }
33274      if (element.hasOutcome()) {
33275        composeCodeableConcept("outcome", element.getOutcome());
33276      }
33277      if (element.hasRecorder()) {
33278        composeReference("recorder", element.getRecorder());
33279      }
33280      if (element.hasParticipant()) {
33281        openArray("participant");
33282        for (AdverseEvent.AdverseEventParticipantComponent e : element.getParticipant()) 
33283          composeAdverseEventParticipantComponent(null, e);
33284        closeArray();
33285      };
33286      if (element.hasSuspectEntity()) {
33287        openArray("suspectEntity");
33288        for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
33289          composeAdverseEventSuspectEntityComponent(null, e);
33290        closeArray();
33291      };
33292      if (element.hasContributingFactor()) {
33293        openArray("contributingFactor");
33294        for (AdverseEvent.AdverseEventContributingFactorComponent e : element.getContributingFactor()) 
33295          composeAdverseEventContributingFactorComponent(null, e);
33296        closeArray();
33297      };
33298      if (element.hasPreventiveAction()) {
33299        openArray("preventiveAction");
33300        for (AdverseEvent.AdverseEventPreventiveActionComponent e : element.getPreventiveAction()) 
33301          composeAdverseEventPreventiveActionComponent(null, e);
33302        closeArray();
33303      };
33304      if (element.hasMitigatingAction()) {
33305        openArray("mitigatingAction");
33306        for (AdverseEvent.AdverseEventMitigatingActionComponent e : element.getMitigatingAction()) 
33307          composeAdverseEventMitigatingActionComponent(null, e);
33308        closeArray();
33309      };
33310      if (element.hasSupportingInfo()) {
33311        openArray("supportingInfo");
33312        for (AdverseEvent.AdverseEventSupportingInfoComponent e : element.getSupportingInfo()) 
33313          composeAdverseEventSupportingInfoComponent(null, e);
33314        closeArray();
33315      };
33316      if (element.hasStudy()) {
33317        openArray("study");
33318        for (Reference e : element.getStudy()) 
33319          composeReference(null, e);
33320        closeArray();
33321      };
33322  }
33323
33324  protected void composeAdverseEventParticipantComponent(String name, AdverseEvent.AdverseEventParticipantComponent element) throws IOException {
33325    if (element != null) {
33326      open(name);
33327      composeAdverseEventParticipantComponentProperties(element);
33328      close();
33329    }
33330  }
33331
33332  protected void composeAdverseEventParticipantComponentProperties(AdverseEvent.AdverseEventParticipantComponent element) throws IOException {
33333    composeBackboneElementProperties(element);
33334      if (element.hasFunction()) {
33335        composeCodeableConcept("function", element.getFunction());
33336      }
33337      if (element.hasActor()) {
33338        composeReference("actor", element.getActor());
33339      }
33340  }
33341
33342  protected void composeAdverseEventSuspectEntityComponent(String name, AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
33343    if (element != null) {
33344      open(name);
33345      composeAdverseEventSuspectEntityComponentProperties(element);
33346      close();
33347    }
33348  }
33349
33350  protected void composeAdverseEventSuspectEntityComponentProperties(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
33351    composeBackboneElementProperties(element);
33352      if (element.hasInstance()) {
33353        composeType("instance", element.getInstance());
33354      }
33355      if (element.hasCausality()) {
33356        composeAdverseEventSuspectEntityCausalityComponent("causality", element.getCausality());
33357      }
33358  }
33359
33360  protected void composeAdverseEventSuspectEntityCausalityComponent(String name, AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
33361    if (element != null) {
33362      open(name);
33363      composeAdverseEventSuspectEntityCausalityComponentProperties(element);
33364      close();
33365    }
33366  }
33367
33368  protected void composeAdverseEventSuspectEntityCausalityComponentProperties(AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
33369    composeBackboneElementProperties(element);
33370      if (element.hasAssessmentMethod()) {
33371        composeCodeableConcept("assessmentMethod", element.getAssessmentMethod());
33372      }
33373      if (element.hasEntityRelatedness()) {
33374        composeCodeableConcept("entityRelatedness", element.getEntityRelatedness());
33375      }
33376      if (element.hasAuthor()) {
33377        composeReference("author", element.getAuthor());
33378      }
33379  }
33380
33381  protected void composeAdverseEventContributingFactorComponent(String name, AdverseEvent.AdverseEventContributingFactorComponent element) throws IOException {
33382    if (element != null) {
33383      open(name);
33384      composeAdverseEventContributingFactorComponentProperties(element);
33385      close();
33386    }
33387  }
33388
33389  protected void composeAdverseEventContributingFactorComponentProperties(AdverseEvent.AdverseEventContributingFactorComponent element) throws IOException {
33390    composeBackboneElementProperties(element);
33391      if (element.hasItem()) {
33392        composeType("item", element.getItem());
33393      }
33394  }
33395
33396  protected void composeAdverseEventPreventiveActionComponent(String name, AdverseEvent.AdverseEventPreventiveActionComponent element) throws IOException {
33397    if (element != null) {
33398      open(name);
33399      composeAdverseEventPreventiveActionComponentProperties(element);
33400      close();
33401    }
33402  }
33403
33404  protected void composeAdverseEventPreventiveActionComponentProperties(AdverseEvent.AdverseEventPreventiveActionComponent element) throws IOException {
33405    composeBackboneElementProperties(element);
33406      if (element.hasItem()) {
33407        composeType("item", element.getItem());
33408      }
33409  }
33410
33411  protected void composeAdverseEventMitigatingActionComponent(String name, AdverseEvent.AdverseEventMitigatingActionComponent element) throws IOException {
33412    if (element != null) {
33413      open(name);
33414      composeAdverseEventMitigatingActionComponentProperties(element);
33415      close();
33416    }
33417  }
33418
33419  protected void composeAdverseEventMitigatingActionComponentProperties(AdverseEvent.AdverseEventMitigatingActionComponent element) throws IOException {
33420    composeBackboneElementProperties(element);
33421      if (element.hasItem()) {
33422        composeType("item", element.getItem());
33423      }
33424  }
33425
33426  protected void composeAdverseEventSupportingInfoComponent(String name, AdverseEvent.AdverseEventSupportingInfoComponent element) throws IOException {
33427    if (element != null) {
33428      open(name);
33429      composeAdverseEventSupportingInfoComponentProperties(element);
33430      close();
33431    }
33432  }
33433
33434  protected void composeAdverseEventSupportingInfoComponentProperties(AdverseEvent.AdverseEventSupportingInfoComponent element) throws IOException {
33435    composeBackboneElementProperties(element);
33436      if (element.hasItem()) {
33437        composeType("item", element.getItem());
33438      }
33439  }
33440
33441  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
33442    if (element != null) {
33443      prop("resourceType", name);
33444      composeAllergyIntoleranceProperties(element);
33445    }
33446  }
33447
33448  protected void composeAllergyIntoleranceProperties(AllergyIntolerance element) throws IOException {
33449    composeDomainResourceProperties(element);
33450      if (element.hasIdentifier()) {
33451        openArray("identifier");
33452        for (Identifier e : element.getIdentifier()) 
33453          composeIdentifier(null, e);
33454        closeArray();
33455      };
33456      if (element.hasClinicalStatus()) {
33457        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
33458      }
33459      if (element.hasVerificationStatus()) {
33460        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
33461      }
33462      if (element.hasTypeElement()) {
33463        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
33464        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
33465      }
33466      if (element.hasCategory()) {
33467        openArray("category");
33468        for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
33469          composeEnumerationCore(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
33470        closeArray();
33471        if (anyHasExtras(element.getCategory())) {
33472          openArray("_category");
33473          for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
33474            composeEnumerationExtras(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
33475          closeArray();
33476        }
33477      };
33478      if (element.hasCriticalityElement()) {
33479        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
33480        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
33481      }
33482      if (element.hasCode()) {
33483        composeCodeableConcept("code", element.getCode());
33484      }
33485      if (element.hasPatient()) {
33486        composeReference("patient", element.getPatient());
33487      }
33488      if (element.hasEncounter()) {
33489        composeReference("encounter", element.getEncounter());
33490      }
33491      if (element.hasOnset()) {
33492        composeType("onset", element.getOnset());
33493      }
33494      if (element.hasRecordedDateElement()) {
33495        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
33496        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
33497      }
33498      if (element.hasRecorder()) {
33499        composeReference("recorder", element.getRecorder());
33500      }
33501      if (element.hasAsserter()) {
33502        composeReference("asserter", element.getAsserter());
33503      }
33504      if (element.hasLastOccurrenceElement()) {
33505        composeDateTimeCore("lastOccurrence", element.getLastOccurrenceElement(), false);
33506        composeDateTimeExtras("lastOccurrence", element.getLastOccurrenceElement(), false);
33507      }
33508      if (element.hasNote()) {
33509        openArray("note");
33510        for (Annotation e : element.getNote()) 
33511          composeAnnotation(null, e);
33512        closeArray();
33513      };
33514      if (element.hasReaction()) {
33515        openArray("reaction");
33516        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
33517          composeAllergyIntoleranceReactionComponent(null, e);
33518        closeArray();
33519      };
33520  }
33521
33522  protected void composeAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
33523    if (element != null) {
33524      open(name);
33525      composeAllergyIntoleranceReactionComponentProperties(element);
33526      close();
33527    }
33528  }
33529
33530  protected void composeAllergyIntoleranceReactionComponentProperties(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
33531    composeBackboneElementProperties(element);
33532      if (element.hasSubstance()) {
33533        composeCodeableConcept("substance", element.getSubstance());
33534      }
33535      if (element.hasManifestation()) {
33536        openArray("manifestation");
33537        for (CodeableConcept e : element.getManifestation()) 
33538          composeCodeableConcept(null, e);
33539        closeArray();
33540      };
33541      if (element.hasDescriptionElement()) {
33542        composeStringCore("description", element.getDescriptionElement(), false);
33543        composeStringExtras("description", element.getDescriptionElement(), false);
33544      }
33545      if (element.hasOnsetElement()) {
33546        composeDateTimeCore("onset", element.getOnsetElement(), false);
33547        composeDateTimeExtras("onset", element.getOnsetElement(), false);
33548      }
33549      if (element.hasSeverityElement()) {
33550        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
33551        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
33552      }
33553      if (element.hasExposureRoute()) {
33554        composeCodeableConcept("exposureRoute", element.getExposureRoute());
33555      }
33556      if (element.hasNote()) {
33557        openArray("note");
33558        for (Annotation e : element.getNote()) 
33559          composeAnnotation(null, e);
33560        closeArray();
33561      };
33562  }
33563
33564  protected void composeAppointment(String name, Appointment element) throws IOException {
33565    if (element != null) {
33566      prop("resourceType", name);
33567      composeAppointmentProperties(element);
33568    }
33569  }
33570
33571  protected void composeAppointmentProperties(Appointment element) throws IOException {
33572    composeDomainResourceProperties(element);
33573      if (element.hasIdentifier()) {
33574        openArray("identifier");
33575        for (Identifier e : element.getIdentifier()) 
33576          composeIdentifier(null, e);
33577        closeArray();
33578      };
33579      if (element.hasStatusElement()) {
33580        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
33581        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
33582      }
33583      if (element.hasCancelationReason()) {
33584        composeCodeableConcept("cancelationReason", element.getCancelationReason());
33585      }
33586      if (element.hasServiceCategory()) {
33587        openArray("serviceCategory");
33588        for (CodeableConcept e : element.getServiceCategory()) 
33589          composeCodeableConcept(null, e);
33590        closeArray();
33591      };
33592      if (element.hasServiceType()) {
33593        openArray("serviceType");
33594        for (CodeableConcept e : element.getServiceType()) 
33595          composeCodeableConcept(null, e);
33596        closeArray();
33597      };
33598      if (element.hasSpecialty()) {
33599        openArray("specialty");
33600        for (CodeableConcept e : element.getSpecialty()) 
33601          composeCodeableConcept(null, e);
33602        closeArray();
33603      };
33604      if (element.hasAppointmentType()) {
33605        composeCodeableConcept("appointmentType", element.getAppointmentType());
33606      }
33607      if (element.hasReason()) {
33608        openArray("reason");
33609        for (CodeableReference e : element.getReason()) 
33610          composeCodeableReference(null, e);
33611        closeArray();
33612      };
33613      if (element.hasPriorityElement()) {
33614        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
33615        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
33616      }
33617      if (element.hasDescriptionElement()) {
33618        composeStringCore("description", element.getDescriptionElement(), false);
33619        composeStringExtras("description", element.getDescriptionElement(), false);
33620      }
33621      if (element.hasSupportingInformation()) {
33622        openArray("supportingInformation");
33623        for (Reference e : element.getSupportingInformation()) 
33624          composeReference(null, e);
33625        closeArray();
33626      };
33627      if (element.hasStartElement()) {
33628        composeInstantCore("start", element.getStartElement(), false);
33629        composeInstantExtras("start", element.getStartElement(), false);
33630      }
33631      if (element.hasEndElement()) {
33632        composeInstantCore("end", element.getEndElement(), false);
33633        composeInstantExtras("end", element.getEndElement(), false);
33634      }
33635      if (element.hasMinutesDurationElement()) {
33636        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
33637        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
33638      }
33639      if (element.hasSlot()) {
33640        openArray("slot");
33641        for (Reference e : element.getSlot()) 
33642          composeReference(null, e);
33643        closeArray();
33644      };
33645      if (element.hasCreatedElement()) {
33646        composeDateTimeCore("created", element.getCreatedElement(), false);
33647        composeDateTimeExtras("created", element.getCreatedElement(), false);
33648      }
33649      if (element.hasCommentElement()) {
33650        composeStringCore("comment", element.getCommentElement(), false);
33651        composeStringExtras("comment", element.getCommentElement(), false);
33652      }
33653      if (element.hasPatientInstructionElement()) {
33654        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
33655        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
33656      }
33657      if (element.hasBasedOn()) {
33658        openArray("basedOn");
33659        for (Reference e : element.getBasedOn()) 
33660          composeReference(null, e);
33661        closeArray();
33662      };
33663      if (element.hasParticipant()) {
33664        openArray("participant");
33665        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
33666          composeAppointmentParticipantComponent(null, e);
33667        closeArray();
33668      };
33669      if (element.hasRequestedPeriod()) {
33670        openArray("requestedPeriod");
33671        for (Period e : element.getRequestedPeriod()) 
33672          composePeriod(null, e);
33673        closeArray();
33674      };
33675  }
33676
33677  protected void composeAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
33678    if (element != null) {
33679      open(name);
33680      composeAppointmentParticipantComponentProperties(element);
33681      close();
33682    }
33683  }
33684
33685  protected void composeAppointmentParticipantComponentProperties(Appointment.AppointmentParticipantComponent element) throws IOException {
33686    composeBackboneElementProperties(element);
33687      if (element.hasType()) {
33688        openArray("type");
33689        for (CodeableConcept e : element.getType()) 
33690          composeCodeableConcept(null, e);
33691        closeArray();
33692      };
33693      if (element.hasActor()) {
33694        composeReference("actor", element.getActor());
33695      }
33696      if (element.hasRequiredElement()) {
33697        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
33698        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
33699      }
33700      if (element.hasStatusElement()) {
33701        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ParticipationStatusEnumFactory(), false);
33702        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ParticipationStatusEnumFactory(), false);
33703      }
33704      if (element.hasPeriod()) {
33705        composePeriod("period", element.getPeriod());
33706      }
33707  }
33708
33709  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
33710    if (element != null) {
33711      prop("resourceType", name);
33712      composeAppointmentResponseProperties(element);
33713    }
33714  }
33715
33716  protected void composeAppointmentResponseProperties(AppointmentResponse element) throws IOException {
33717    composeDomainResourceProperties(element);
33718      if (element.hasIdentifier()) {
33719        openArray("identifier");
33720        for (Identifier e : element.getIdentifier()) 
33721          composeIdentifier(null, e);
33722        closeArray();
33723      };
33724      if (element.hasAppointment()) {
33725        composeReference("appointment", element.getAppointment());
33726      }
33727      if (element.hasStartElement()) {
33728        composeInstantCore("start", element.getStartElement(), false);
33729        composeInstantExtras("start", element.getStartElement(), false);
33730      }
33731      if (element.hasEndElement()) {
33732        composeInstantCore("end", element.getEndElement(), false);
33733        composeInstantExtras("end", element.getEndElement(), false);
33734      }
33735      if (element.hasParticipantType()) {
33736        openArray("participantType");
33737        for (CodeableConcept e : element.getParticipantType()) 
33738          composeCodeableConcept(null, e);
33739        closeArray();
33740      };
33741      if (element.hasActor()) {
33742        composeReference("actor", element.getActor());
33743      }
33744      if (element.hasParticipantStatusElement()) {
33745        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new Enumerations.ParticipationStatusEnumFactory(), false);
33746        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new Enumerations.ParticipationStatusEnumFactory(), false);
33747      }
33748      if (element.hasCommentElement()) {
33749        composeStringCore("comment", element.getCommentElement(), false);
33750        composeStringExtras("comment", element.getCommentElement(), false);
33751      }
33752  }
33753
33754  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
33755    if (element != null) {
33756      prop("resourceType", name);
33757      composeAuditEventProperties(element);
33758    }
33759  }
33760
33761  protected void composeAuditEventProperties(AuditEvent element) throws IOException {
33762    composeDomainResourceProperties(element);
33763      if (element.hasType()) {
33764        composeCoding("type", element.getType());
33765      }
33766      if (element.hasSubtype()) {
33767        openArray("subtype");
33768        for (Coding e : element.getSubtype()) 
33769          composeCoding(null, e);
33770        closeArray();
33771      };
33772      if (element.hasActionElement()) {
33773        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
33774        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
33775      }
33776      if (element.hasSeverityElement()) {
33777        composeEnumerationCore("severity", element.getSeverityElement(), new AuditEvent.AuditEventSeverityEnumFactory(), false);
33778        composeEnumerationExtras("severity", element.getSeverityElement(), new AuditEvent.AuditEventSeverityEnumFactory(), false);
33779      }
33780      if (element.hasPeriod()) {
33781        composePeriod("period", element.getPeriod());
33782      }
33783      if (element.hasRecordedElement()) {
33784        composeInstantCore("recorded", element.getRecordedElement(), false);
33785        composeInstantExtras("recorded", element.getRecordedElement(), false);
33786      }
33787      if (element.hasOutcomeElement()) {
33788        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
33789        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
33790      }
33791      if (element.hasOutcomeDescElement()) {
33792        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
33793        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
33794      }
33795      if (element.hasPurposeOfEvent()) {
33796        openArray("purposeOfEvent");
33797        for (CodeableConcept e : element.getPurposeOfEvent()) 
33798          composeCodeableConcept(null, e);
33799        closeArray();
33800      };
33801      if (element.hasAgent()) {
33802        openArray("agent");
33803        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
33804          composeAuditEventAgentComponent(null, e);
33805        closeArray();
33806      };
33807      if (element.hasSource()) {
33808        composeAuditEventSourceComponent("source", element.getSource());
33809      }
33810      if (element.hasEntity()) {
33811        openArray("entity");
33812        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
33813          composeAuditEventEntityComponent(null, e);
33814        closeArray();
33815      };
33816  }
33817
33818  protected void composeAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
33819    if (element != null) {
33820      open(name);
33821      composeAuditEventAgentComponentProperties(element);
33822      close();
33823    }
33824  }
33825
33826  protected void composeAuditEventAgentComponentProperties(AuditEvent.AuditEventAgentComponent element) throws IOException {
33827    composeBackboneElementProperties(element);
33828      if (element.hasType()) {
33829        composeCodeableConcept("type", element.getType());
33830      }
33831      if (element.hasRole()) {
33832        openArray("role");
33833        for (CodeableConcept e : element.getRole()) 
33834          composeCodeableConcept(null, e);
33835        closeArray();
33836      };
33837      if (element.hasWho()) {
33838        composeReference("who", element.getWho());
33839      }
33840      if (element.hasAltIdElement()) {
33841        composeStringCore("altId", element.getAltIdElement(), false);
33842        composeStringExtras("altId", element.getAltIdElement(), false);
33843      }
33844      if (element.hasNameElement()) {
33845        composeStringCore("name", element.getNameElement(), false);
33846        composeStringExtras("name", element.getNameElement(), false);
33847      }
33848      if (element.hasRequestorElement()) {
33849        composeBooleanCore("requestor", element.getRequestorElement(), false);
33850        composeBooleanExtras("requestor", element.getRequestorElement(), false);
33851      }
33852      if (element.hasLocation()) {
33853        composeReference("location", element.getLocation());
33854      }
33855      if (element.hasPolicy()) {
33856        openArray("policy");
33857        for (UriType e : element.getPolicy()) 
33858          composeUriCore(null, e, true);
33859        closeArray();
33860        if (anyHasExtras(element.getPolicy())) {
33861          openArray("_policy");
33862          for (UriType e : element.getPolicy()) 
33863            composeUriExtras(null, e, true);
33864          closeArray();
33865        }
33866      };
33867      if (element.hasMedia()) {
33868        composeCoding("media", element.getMedia());
33869      }
33870      if (element.hasNetwork()) {
33871        composeAuditEventAgentNetworkComponent("network", element.getNetwork());
33872      }
33873      if (element.hasPurposeOfUse()) {
33874        openArray("purposeOfUse");
33875        for (CodeableConcept e : element.getPurposeOfUse()) 
33876          composeCodeableConcept(null, e);
33877        closeArray();
33878      };
33879  }
33880
33881  protected void composeAuditEventAgentNetworkComponent(String name, AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
33882    if (element != null) {
33883      open(name);
33884      composeAuditEventAgentNetworkComponentProperties(element);
33885      close();
33886    }
33887  }
33888
33889  protected void composeAuditEventAgentNetworkComponentProperties(AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
33890    composeBackboneElementProperties(element);
33891      if (element.hasAddressElement()) {
33892        composeStringCore("address", element.getAddressElement(), false);
33893        composeStringExtras("address", element.getAddressElement(), false);
33894      }
33895      if (element.hasTypeElement()) {
33896        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
33897        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
33898      }
33899  }
33900
33901  protected void composeAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
33902    if (element != null) {
33903      open(name);
33904      composeAuditEventSourceComponentProperties(element);
33905      close();
33906    }
33907  }
33908
33909  protected void composeAuditEventSourceComponentProperties(AuditEvent.AuditEventSourceComponent element) throws IOException {
33910    composeBackboneElementProperties(element);
33911      if (element.hasSiteElement()) {
33912        composeStringCore("site", element.getSiteElement(), false);
33913        composeStringExtras("site", element.getSiteElement(), false);
33914      }
33915      if (element.hasObserver()) {
33916        composeReference("observer", element.getObserver());
33917      }
33918      if (element.hasType()) {
33919        openArray("type");
33920        for (Coding e : element.getType()) 
33921          composeCoding(null, e);
33922        closeArray();
33923      };
33924  }
33925
33926  protected void composeAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
33927    if (element != null) {
33928      open(name);
33929      composeAuditEventEntityComponentProperties(element);
33930      close();
33931    }
33932  }
33933
33934  protected void composeAuditEventEntityComponentProperties(AuditEvent.AuditEventEntityComponent element) throws IOException {
33935    composeBackboneElementProperties(element);
33936      if (element.hasWhat()) {
33937        composeReference("what", element.getWhat());
33938      }
33939      if (element.hasType()) {
33940        composeCoding("type", element.getType());
33941      }
33942      if (element.hasRole()) {
33943        composeCoding("role", element.getRole());
33944      }
33945      if (element.hasLifecycle()) {
33946        composeCoding("lifecycle", element.getLifecycle());
33947      }
33948      if (element.hasSecurityLabel()) {
33949        openArray("securityLabel");
33950        for (Coding e : element.getSecurityLabel()) 
33951          composeCoding(null, e);
33952        closeArray();
33953      };
33954      if (element.hasNameElement()) {
33955        composeStringCore("name", element.getNameElement(), false);
33956        composeStringExtras("name", element.getNameElement(), false);
33957      }
33958      if (element.hasQueryElement()) {
33959        composeBase64BinaryCore("query", element.getQueryElement(), false);
33960        composeBase64BinaryExtras("query", element.getQueryElement(), false);
33961      }
33962      if (element.hasDetail()) {
33963        openArray("detail");
33964        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
33965          composeAuditEventEntityDetailComponent(null, e);
33966        closeArray();
33967      };
33968  }
33969
33970  protected void composeAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
33971    if (element != null) {
33972      open(name);
33973      composeAuditEventEntityDetailComponentProperties(element);
33974      close();
33975    }
33976  }
33977
33978  protected void composeAuditEventEntityDetailComponentProperties(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
33979    composeBackboneElementProperties(element);
33980      if (element.hasTypeElement()) {
33981        composeStringCore("type", element.getTypeElement(), false);
33982        composeStringExtras("type", element.getTypeElement(), false);
33983      }
33984      if (element.hasValue()) {
33985        composeType("value", element.getValue());
33986      }
33987  }
33988
33989  protected void composeBasic(String name, Basic element) throws IOException {
33990    if (element != null) {
33991      prop("resourceType", name);
33992      composeBasicProperties(element);
33993    }
33994  }
33995
33996  protected void composeBasicProperties(Basic element) throws IOException {
33997    composeDomainResourceProperties(element);
33998      if (element.hasIdentifier()) {
33999        openArray("identifier");
34000        for (Identifier e : element.getIdentifier()) 
34001          composeIdentifier(null, e);
34002        closeArray();
34003      };
34004      if (element.hasCode()) {
34005        composeCodeableConcept("code", element.getCode());
34006      }
34007      if (element.hasSubject()) {
34008        composeReference("subject", element.getSubject());
34009      }
34010      if (element.hasCreatedElement()) {
34011        composeDateCore("created", element.getCreatedElement(), false);
34012        composeDateExtras("created", element.getCreatedElement(), false);
34013      }
34014      if (element.hasAuthor()) {
34015        composeReference("author", element.getAuthor());
34016      }
34017  }
34018
34019  protected void composeBinary(String name, Binary element) throws IOException {
34020    if (element != null) {
34021      prop("resourceType", name);
34022      composeBinaryProperties(element);
34023    }
34024  }
34025
34026  protected void composeBinaryProperties(Binary element) throws IOException {
34027    composeResourceProperties(element);
34028      if (element.hasContentTypeElement()) {
34029        composeCodeCore("contentType", element.getContentTypeElement(), false);
34030        composeCodeExtras("contentType", element.getContentTypeElement(), false);
34031      }
34032      if (element.hasSecurityContext()) {
34033        composeReference("securityContext", element.getSecurityContext());
34034      }
34035      if (element.hasDataElement()) {
34036        composeBase64BinaryCore("data", element.getDataElement(), false);
34037        composeBase64BinaryExtras("data", element.getDataElement(), false);
34038      }
34039  }
34040
34041  protected void composeBiologicallyDerivedProduct(String name, BiologicallyDerivedProduct element) throws IOException {
34042    if (element != null) {
34043      prop("resourceType", name);
34044      composeBiologicallyDerivedProductProperties(element);
34045    }
34046  }
34047
34048  protected void composeBiologicallyDerivedProductProperties(BiologicallyDerivedProduct element) throws IOException {
34049    composeDomainResourceProperties(element);
34050      if (element.hasIdentifier()) {
34051        openArray("identifier");
34052        for (Identifier e : element.getIdentifier()) 
34053          composeIdentifier(null, e);
34054        closeArray();
34055      };
34056      if (element.hasProductCategoryElement()) {
34057        composeEnumerationCore("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
34058        composeEnumerationExtras("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
34059      }
34060      if (element.hasProductCode()) {
34061        composeCodeableConcept("productCode", element.getProductCode());
34062      }
34063      if (element.hasStatusElement()) {
34064        composeEnumerationCore("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
34065        composeEnumerationExtras("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
34066      }
34067      if (element.hasRequest()) {
34068        openArray("request");
34069        for (Reference e : element.getRequest()) 
34070          composeReference(null, e);
34071        closeArray();
34072      };
34073      if (element.hasQuantityElement()) {
34074        composeIntegerCore("quantity", element.getQuantityElement(), false);
34075        composeIntegerExtras("quantity", element.getQuantityElement(), false);
34076      }
34077      if (element.hasParent()) {
34078        openArray("parent");
34079        for (Reference e : element.getParent()) 
34080          composeReference(null, e);
34081        closeArray();
34082      };
34083      if (element.hasCollection()) {
34084        composeBiologicallyDerivedProductCollectionComponent("collection", element.getCollection());
34085      }
34086      if (element.hasProcessing()) {
34087        openArray("processing");
34088        for (BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent e : element.getProcessing()) 
34089          composeBiologicallyDerivedProductProcessingComponent(null, e);
34090        closeArray();
34091      };
34092      if (element.hasManipulation()) {
34093        composeBiologicallyDerivedProductManipulationComponent("manipulation", element.getManipulation());
34094      }
34095      if (element.hasStorage()) {
34096        openArray("storage");
34097        for (BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent e : element.getStorage()) 
34098          composeBiologicallyDerivedProductStorageComponent(null, e);
34099        closeArray();
34100      };
34101  }
34102
34103  protected void composeBiologicallyDerivedProductCollectionComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
34104    if (element != null) {
34105      open(name);
34106      composeBiologicallyDerivedProductCollectionComponentProperties(element);
34107      close();
34108    }
34109  }
34110
34111  protected void composeBiologicallyDerivedProductCollectionComponentProperties(BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
34112    composeBackboneElementProperties(element);
34113      if (element.hasCollector()) {
34114        composeReference("collector", element.getCollector());
34115      }
34116      if (element.hasSource()) {
34117        composeReference("source", element.getSource());
34118      }
34119      if (element.hasCollected()) {
34120        composeType("collected", element.getCollected());
34121      }
34122  }
34123
34124  protected void composeBiologicallyDerivedProductProcessingComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
34125    if (element != null) {
34126      open(name);
34127      composeBiologicallyDerivedProductProcessingComponentProperties(element);
34128      close();
34129    }
34130  }
34131
34132  protected void composeBiologicallyDerivedProductProcessingComponentProperties(BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
34133    composeBackboneElementProperties(element);
34134      if (element.hasDescriptionElement()) {
34135        composeStringCore("description", element.getDescriptionElement(), false);
34136        composeStringExtras("description", element.getDescriptionElement(), false);
34137      }
34138      if (element.hasProcedure()) {
34139        composeCodeableConcept("procedure", element.getProcedure());
34140      }
34141      if (element.hasAdditive()) {
34142        composeReference("additive", element.getAdditive());
34143      }
34144      if (element.hasTime()) {
34145        composeType("time", element.getTime());
34146      }
34147  }
34148
34149  protected void composeBiologicallyDerivedProductManipulationComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
34150    if (element != null) {
34151      open(name);
34152      composeBiologicallyDerivedProductManipulationComponentProperties(element);
34153      close();
34154    }
34155  }
34156
34157  protected void composeBiologicallyDerivedProductManipulationComponentProperties(BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
34158    composeBackboneElementProperties(element);
34159      if (element.hasDescriptionElement()) {
34160        composeStringCore("description", element.getDescriptionElement(), false);
34161        composeStringExtras("description", element.getDescriptionElement(), false);
34162      }
34163      if (element.hasTime()) {
34164        composeType("time", element.getTime());
34165      }
34166  }
34167
34168  protected void composeBiologicallyDerivedProductStorageComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
34169    if (element != null) {
34170      open(name);
34171      composeBiologicallyDerivedProductStorageComponentProperties(element);
34172      close();
34173    }
34174  }
34175
34176  protected void composeBiologicallyDerivedProductStorageComponentProperties(BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
34177    composeBackboneElementProperties(element);
34178      if (element.hasDescriptionElement()) {
34179        composeStringCore("description", element.getDescriptionElement(), false);
34180        composeStringExtras("description", element.getDescriptionElement(), false);
34181      }
34182      if (element.hasTemperatureElement()) {
34183        composeDecimalCore("temperature", element.getTemperatureElement(), false);
34184        composeDecimalExtras("temperature", element.getTemperatureElement(), false);
34185      }
34186      if (element.hasScaleElement()) {
34187        composeEnumerationCore("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
34188        composeEnumerationExtras("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
34189      }
34190      if (element.hasDuration()) {
34191        composePeriod("duration", element.getDuration());
34192      }
34193  }
34194
34195  protected void composeBodyStructure(String name, BodyStructure element) throws IOException {
34196    if (element != null) {
34197      prop("resourceType", name);
34198      composeBodyStructureProperties(element);
34199    }
34200  }
34201
34202  protected void composeBodyStructureProperties(BodyStructure element) throws IOException {
34203    composeDomainResourceProperties(element);
34204      if (element.hasIdentifier()) {
34205        openArray("identifier");
34206        for (Identifier e : element.getIdentifier()) 
34207          composeIdentifier(null, e);
34208        closeArray();
34209      };
34210      if (element.hasActiveElement()) {
34211        composeBooleanCore("active", element.getActiveElement(), false);
34212        composeBooleanExtras("active", element.getActiveElement(), false);
34213      }
34214      if (element.hasMorphology()) {
34215        composeCodeableConcept("morphology", element.getMorphology());
34216      }
34217      if (element.hasLocation()) {
34218        composeCodeableConcept("location", element.getLocation());
34219      }
34220      if (element.hasLocationQualifier()) {
34221        openArray("locationQualifier");
34222        for (CodeableConcept e : element.getLocationQualifier()) 
34223          composeCodeableConcept(null, e);
34224        closeArray();
34225      };
34226      if (element.hasDescriptionElement()) {
34227        composeStringCore("description", element.getDescriptionElement(), false);
34228        composeStringExtras("description", element.getDescriptionElement(), false);
34229      }
34230      if (element.hasImage()) {
34231        openArray("image");
34232        for (Attachment e : element.getImage()) 
34233          composeAttachment(null, e);
34234        closeArray();
34235      };
34236      if (element.hasPatient()) {
34237        composeReference("patient", element.getPatient());
34238      }
34239  }
34240
34241  protected void composeBundle(String name, Bundle element) throws IOException {
34242    if (element != null) {
34243      prop("resourceType", name);
34244      composeBundleProperties(element);
34245    }
34246  }
34247
34248  protected void composeBundleProperties(Bundle element) throws IOException {
34249    composeResourceProperties(element);
34250      if (element.hasIdentifier()) {
34251        composeIdentifier("identifier", element.getIdentifier());
34252      }
34253      if (element.hasTypeElement()) {
34254        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
34255        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
34256      }
34257      if (element.hasTimestampElement()) {
34258        composeInstantCore("timestamp", element.getTimestampElement(), false);
34259        composeInstantExtras("timestamp", element.getTimestampElement(), false);
34260      }
34261      if (element.hasTotalElement()) {
34262        composeUnsignedIntCore("total", element.getTotalElement(), false);
34263        composeUnsignedIntExtras("total", element.getTotalElement(), false);
34264      }
34265      if (element.hasLink()) {
34266        openArray("link");
34267        for (Bundle.BundleLinkComponent e : element.getLink()) 
34268          composeBundleLinkComponent(null, e);
34269        closeArray();
34270      };
34271      if (element.hasEntry()) {
34272        openArray("entry");
34273        for (Bundle.BundleEntryComponent e : element.getEntry()) 
34274          composeBundleEntryComponent(null, e);
34275        closeArray();
34276      };
34277      if (element.hasSignature()) {
34278        composeSignature("signature", element.getSignature());
34279      }
34280  }
34281
34282  protected void composeBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
34283    if (element != null) {
34284      open(name);
34285      composeBundleLinkComponentProperties(element);
34286      close();
34287    }
34288  }
34289
34290  protected void composeBundleLinkComponentProperties(Bundle.BundleLinkComponent element) throws IOException {
34291    composeBackboneElementProperties(element);
34292      if (element.hasRelationElement()) {
34293        composeStringCore("relation", element.getRelationElement(), false);
34294        composeStringExtras("relation", element.getRelationElement(), false);
34295      }
34296      if (element.hasUrlElement()) {
34297        composeUriCore("url", element.getUrlElement(), false);
34298        composeUriExtras("url", element.getUrlElement(), false);
34299      }
34300  }
34301
34302  protected void composeBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
34303    if (element != null) {
34304      open(name);
34305      composeBundleEntryComponentProperties(element);
34306      close();
34307    }
34308  }
34309
34310  protected void composeBundleEntryComponentProperties(Bundle.BundleEntryComponent element) throws IOException {
34311    composeBackboneElementProperties(element);
34312      if (element.hasLink()) {
34313        openArray("link");
34314        for (Bundle.BundleLinkComponent e : element.getLink()) 
34315          composeBundleLinkComponent(null, e);
34316        closeArray();
34317      };
34318      if (element.hasFullUrlElement()) {
34319        composeUriCore("fullUrl", element.getFullUrlElement(), false);
34320        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
34321      }
34322        if (element.hasResource()) {
34323          open("resource");
34324          composeResource(element.getResource());
34325          close();
34326        }
34327      if (element.hasSearch()) {
34328        composeBundleEntrySearchComponent("search", element.getSearch());
34329      }
34330      if (element.hasRequest()) {
34331        composeBundleEntryRequestComponent("request", element.getRequest());
34332      }
34333      if (element.hasResponse()) {
34334        composeBundleEntryResponseComponent("response", element.getResponse());
34335      }
34336  }
34337
34338  protected void composeBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
34339    if (element != null) {
34340      open(name);
34341      composeBundleEntrySearchComponentProperties(element);
34342      close();
34343    }
34344  }
34345
34346  protected void composeBundleEntrySearchComponentProperties(Bundle.BundleEntrySearchComponent element) throws IOException {
34347    composeBackboneElementProperties(element);
34348      if (element.hasModeElement()) {
34349        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
34350        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
34351      }
34352      if (element.hasScoreElement()) {
34353        composeDecimalCore("score", element.getScoreElement(), false);
34354        composeDecimalExtras("score", element.getScoreElement(), false);
34355      }
34356  }
34357
34358  protected void composeBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
34359    if (element != null) {
34360      open(name);
34361      composeBundleEntryRequestComponentProperties(element);
34362      close();
34363    }
34364  }
34365
34366  protected void composeBundleEntryRequestComponentProperties(Bundle.BundleEntryRequestComponent element) throws IOException {
34367    composeBackboneElementProperties(element);
34368      if (element.hasMethodElement()) {
34369        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
34370        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
34371      }
34372      if (element.hasUrlElement()) {
34373        composeUriCore("url", element.getUrlElement(), false);
34374        composeUriExtras("url", element.getUrlElement(), false);
34375      }
34376      if (element.hasIfNoneMatchElement()) {
34377        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
34378        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
34379      }
34380      if (element.hasIfModifiedSinceElement()) {
34381        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
34382        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
34383      }
34384      if (element.hasIfMatchElement()) {
34385        composeStringCore("ifMatch", element.getIfMatchElement(), false);
34386        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
34387      }
34388      if (element.hasIfNoneExistElement()) {
34389        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
34390        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
34391      }
34392  }
34393
34394  protected void composeBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
34395    if (element != null) {
34396      open(name);
34397      composeBundleEntryResponseComponentProperties(element);
34398      close();
34399    }
34400  }
34401
34402  protected void composeBundleEntryResponseComponentProperties(Bundle.BundleEntryResponseComponent element) throws IOException {
34403    composeBackboneElementProperties(element);
34404      if (element.hasStatusElement()) {
34405        composeStringCore("status", element.getStatusElement(), false);
34406        composeStringExtras("status", element.getStatusElement(), false);
34407      }
34408      if (element.hasLocationElement()) {
34409        composeUriCore("location", element.getLocationElement(), false);
34410        composeUriExtras("location", element.getLocationElement(), false);
34411      }
34412      if (element.hasEtagElement()) {
34413        composeStringCore("etag", element.getEtagElement(), false);
34414        composeStringExtras("etag", element.getEtagElement(), false);
34415      }
34416      if (element.hasLastModifiedElement()) {
34417        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
34418        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
34419      }
34420        if (element.hasOutcome()) {
34421          open("outcome");
34422          composeResource(element.getOutcome());
34423          close();
34424        }
34425  }
34426
34427  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
34428    if (element != null) {
34429      prop("resourceType", name);
34430      composeCapabilityStatementProperties(element);
34431    }
34432  }
34433
34434  protected void composeCapabilityStatementProperties(CapabilityStatement element) throws IOException {
34435    composeCanonicalResourceProperties(element);
34436      if (element.hasUrlElement()) {
34437        composeUriCore("url", element.getUrlElement(), false);
34438        composeUriExtras("url", element.getUrlElement(), false);
34439      }
34440      if (element.hasVersionElement()) {
34441        composeStringCore("version", element.getVersionElement(), false);
34442        composeStringExtras("version", element.getVersionElement(), false);
34443      }
34444      if (element.hasNameElement()) {
34445        composeStringCore("name", element.getNameElement(), false);
34446        composeStringExtras("name", element.getNameElement(), false);
34447      }
34448      if (element.hasTitleElement()) {
34449        composeStringCore("title", element.getTitleElement(), false);
34450        composeStringExtras("title", element.getTitleElement(), false);
34451      }
34452      if (element.hasStatusElement()) {
34453        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34454        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34455      }
34456      if (element.hasExperimentalElement()) {
34457        composeBooleanCore("experimental", element.getExperimentalElement(), false);
34458        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
34459      }
34460      if (element.hasDateElement()) {
34461        composeDateTimeCore("date", element.getDateElement(), false);
34462        composeDateTimeExtras("date", element.getDateElement(), false);
34463      }
34464      if (element.hasPublisherElement()) {
34465        composeStringCore("publisher", element.getPublisherElement(), false);
34466        composeStringExtras("publisher", element.getPublisherElement(), false);
34467      }
34468      if (element.hasContact()) {
34469        openArray("contact");
34470        for (ContactDetail e : element.getContact()) 
34471          composeContactDetail(null, e);
34472        closeArray();
34473      };
34474      if (element.hasDescriptionElement()) {
34475        composeMarkdownCore("description", element.getDescriptionElement(), false);
34476        composeMarkdownExtras("description", element.getDescriptionElement(), false);
34477      }
34478      if (element.hasUseContext()) {
34479        openArray("useContext");
34480        for (UsageContext e : element.getUseContext()) 
34481          composeUsageContext(null, e);
34482        closeArray();
34483      };
34484      if (element.hasJurisdiction()) {
34485        openArray("jurisdiction");
34486        for (CodeableConcept e : element.getJurisdiction()) 
34487          composeCodeableConcept(null, e);
34488        closeArray();
34489      };
34490      if (element.hasPurposeElement()) {
34491        composeMarkdownCore("purpose", element.getPurposeElement(), false);
34492        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
34493      }
34494      if (element.hasCopyrightElement()) {
34495        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
34496        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
34497      }
34498      if (element.hasKindElement()) {
34499        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
34500        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
34501      }
34502      if (element.hasInstantiates()) {
34503        openArray("instantiates");
34504        for (CanonicalType e : element.getInstantiates()) 
34505          composeCanonicalCore(null, e, true);
34506        closeArray();
34507        if (anyHasExtras(element.getInstantiates())) {
34508          openArray("_instantiates");
34509          for (CanonicalType e : element.getInstantiates()) 
34510            composeCanonicalExtras(null, e, true);
34511          closeArray();
34512        }
34513      };
34514      if (element.hasImports()) {
34515        openArray("imports");
34516        for (CanonicalType e : element.getImports()) 
34517          composeCanonicalCore(null, e, true);
34518        closeArray();
34519        if (anyHasExtras(element.getImports())) {
34520          openArray("_imports");
34521          for (CanonicalType e : element.getImports()) 
34522            composeCanonicalExtras(null, e, true);
34523          closeArray();
34524        }
34525      };
34526      if (element.hasSoftware()) {
34527        composeCapabilityStatementSoftwareComponent("software", element.getSoftware());
34528      }
34529      if (element.hasImplementation()) {
34530        composeCapabilityStatementImplementationComponent("implementation", element.getImplementation());
34531      }
34532      if (element.hasFhirVersionElement()) {
34533        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
34534        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
34535      }
34536      if (element.hasFormat()) {
34537        openArray("format");
34538        for (CodeType e : element.getFormat()) 
34539          composeCodeCore(null, e, true);
34540        closeArray();
34541        if (anyHasExtras(element.getFormat())) {
34542          openArray("_format");
34543          for (CodeType e : element.getFormat()) 
34544            composeCodeExtras(null, e, true);
34545          closeArray();
34546        }
34547      };
34548      if (element.hasPatchFormat()) {
34549        openArray("patchFormat");
34550        for (CodeType e : element.getPatchFormat()) 
34551          composeCodeCore(null, e, true);
34552        closeArray();
34553        if (anyHasExtras(element.getPatchFormat())) {
34554          openArray("_patchFormat");
34555          for (CodeType e : element.getPatchFormat()) 
34556            composeCodeExtras(null, e, true);
34557          closeArray();
34558        }
34559      };
34560      if (element.hasImplementationGuide()) {
34561        openArray("implementationGuide");
34562        for (CanonicalType e : element.getImplementationGuide()) 
34563          composeCanonicalCore(null, e, true);
34564        closeArray();
34565        if (anyHasExtras(element.getImplementationGuide())) {
34566          openArray("_implementationGuide");
34567          for (CanonicalType e : element.getImplementationGuide()) 
34568            composeCanonicalExtras(null, e, true);
34569          closeArray();
34570        }
34571      };
34572      if (element.hasRest()) {
34573        openArray("rest");
34574        for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest()) 
34575          composeCapabilityStatementRestComponent(null, e);
34576        closeArray();
34577      };
34578      if (element.hasMessaging()) {
34579        openArray("messaging");
34580        for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
34581          composeCapabilityStatementMessagingComponent(null, e);
34582        closeArray();
34583      };
34584      if (element.hasDocument()) {
34585        openArray("document");
34586        for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
34587          composeCapabilityStatementDocumentComponent(null, e);
34588        closeArray();
34589      };
34590  }
34591
34592  protected void composeCapabilityStatementSoftwareComponent(String name, CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
34593    if (element != null) {
34594      open(name);
34595      composeCapabilityStatementSoftwareComponentProperties(element);
34596      close();
34597    }
34598  }
34599
34600  protected void composeCapabilityStatementSoftwareComponentProperties(CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
34601    composeBackboneElementProperties(element);
34602      if (element.hasNameElement()) {
34603        composeStringCore("name", element.getNameElement(), false);
34604        composeStringExtras("name", element.getNameElement(), false);
34605      }
34606      if (element.hasVersionElement()) {
34607        composeStringCore("version", element.getVersionElement(), false);
34608        composeStringExtras("version", element.getVersionElement(), false);
34609      }
34610      if (element.hasReleaseDateElement()) {
34611        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
34612        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
34613      }
34614  }
34615
34616  protected void composeCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
34617    if (element != null) {
34618      open(name);
34619      composeCapabilityStatementImplementationComponentProperties(element);
34620      close();
34621    }
34622  }
34623
34624  protected void composeCapabilityStatementImplementationComponentProperties(CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
34625    composeBackboneElementProperties(element);
34626      if (element.hasDescriptionElement()) {
34627        composeStringCore("description", element.getDescriptionElement(), false);
34628        composeStringExtras("description", element.getDescriptionElement(), false);
34629      }
34630      if (element.hasUrlElement()) {
34631        composeUrlCore("url", element.getUrlElement(), false);
34632        composeUrlExtras("url", element.getUrlElement(), false);
34633      }
34634      if (element.hasCustodian()) {
34635        composeReference("custodian", element.getCustodian());
34636      }
34637  }
34638
34639  protected void composeCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
34640    if (element != null) {
34641      open(name);
34642      composeCapabilityStatementRestComponentProperties(element);
34643      close();
34644    }
34645  }
34646
34647  protected void composeCapabilityStatementRestComponentProperties(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
34648    composeBackboneElementProperties(element);
34649      if (element.hasModeElement()) {
34650        composeEnumerationCore("mode", element.getModeElement(), new Enumerations.RestfulCapabilityModeEnumFactory(), false);
34651        composeEnumerationExtras("mode", element.getModeElement(), new Enumerations.RestfulCapabilityModeEnumFactory(), false);
34652      }
34653      if (element.hasDocumentationElement()) {
34654        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34655        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34656      }
34657      if (element.hasSecurity()) {
34658        composeCapabilityStatementRestSecurityComponent("security", element.getSecurity());
34659      }
34660      if (element.hasResource()) {
34661        openArray("resource");
34662        for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
34663          composeCapabilityStatementRestResourceComponent(null, e);
34664        closeArray();
34665      };
34666      if (element.hasInteraction()) {
34667        openArray("interaction");
34668        for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
34669          composeSystemInteractionComponent(null, e);
34670        closeArray();
34671      };
34672      if (element.hasSearchParam()) {
34673        openArray("searchParam");
34674        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
34675          composeCapabilityStatementRestResourceSearchParamComponent(null, e);
34676        closeArray();
34677      };
34678      if (element.hasOperation()) {
34679        openArray("operation");
34680        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
34681          composeCapabilityStatementRestResourceOperationComponent(null, e);
34682        closeArray();
34683      };
34684      if (element.hasCompartment()) {
34685        openArray("compartment");
34686        for (CanonicalType e : element.getCompartment()) 
34687          composeCanonicalCore(null, e, true);
34688        closeArray();
34689        if (anyHasExtras(element.getCompartment())) {
34690          openArray("_compartment");
34691          for (CanonicalType e : element.getCompartment()) 
34692            composeCanonicalExtras(null, e, true);
34693          closeArray();
34694        }
34695      };
34696  }
34697
34698  protected void composeCapabilityStatementRestSecurityComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
34699    if (element != null) {
34700      open(name);
34701      composeCapabilityStatementRestSecurityComponentProperties(element);
34702      close();
34703    }
34704  }
34705
34706  protected void composeCapabilityStatementRestSecurityComponentProperties(CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
34707    composeBackboneElementProperties(element);
34708      if (element.hasCorsElement()) {
34709        composeBooleanCore("cors", element.getCorsElement(), false);
34710        composeBooleanExtras("cors", element.getCorsElement(), false);
34711      }
34712      if (element.hasService()) {
34713        openArray("service");
34714        for (CodeableConcept e : element.getService()) 
34715          composeCodeableConcept(null, e);
34716        closeArray();
34717      };
34718      if (element.hasDescriptionElement()) {
34719        composeMarkdownCore("description", element.getDescriptionElement(), false);
34720        composeMarkdownExtras("description", element.getDescriptionElement(), false);
34721      }
34722  }
34723
34724  protected void composeCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
34725    if (element != null) {
34726      open(name);
34727      composeCapabilityStatementRestResourceComponentProperties(element);
34728      close();
34729    }
34730  }
34731
34732  protected void composeCapabilityStatementRestResourceComponentProperties(CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
34733    composeBackboneElementProperties(element);
34734      if (element.hasTypeElement()) {
34735        composeCodeCore("type", element.getTypeElement(), false);
34736        composeCodeExtras("type", element.getTypeElement(), false);
34737      }
34738      if (element.hasProfileElement()) {
34739        composeCanonicalCore("profile", element.getProfileElement(), false);
34740        composeCanonicalExtras("profile", element.getProfileElement(), false);
34741      }
34742      if (element.hasSupportedProfile()) {
34743        openArray("supportedProfile");
34744        for (CanonicalType e : element.getSupportedProfile()) 
34745          composeCanonicalCore(null, e, true);
34746        closeArray();
34747        if (anyHasExtras(element.getSupportedProfile())) {
34748          openArray("_supportedProfile");
34749          for (CanonicalType e : element.getSupportedProfile()) 
34750            composeCanonicalExtras(null, e, true);
34751          closeArray();
34752        }
34753      };
34754      if (element.hasDocumentationElement()) {
34755        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34756        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34757      }
34758      if (element.hasInteraction()) {
34759        openArray("interaction");
34760        for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction()) 
34761          composeResourceInteractionComponent(null, e);
34762        closeArray();
34763      };
34764      if (element.hasVersioningElement()) {
34765        composeEnumerationCore("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
34766        composeEnumerationExtras("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
34767      }
34768      if (element.hasReadHistoryElement()) {
34769        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
34770        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
34771      }
34772      if (element.hasUpdateCreateElement()) {
34773        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
34774        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
34775      }
34776      if (element.hasConditionalCreateElement()) {
34777        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
34778        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
34779      }
34780      if (element.hasConditionalReadElement()) {
34781        composeEnumerationCore("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
34782        composeEnumerationExtras("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
34783      }
34784      if (element.hasConditionalUpdateElement()) {
34785        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
34786        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
34787      }
34788      if (element.hasConditionalDeleteElement()) {
34789        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
34790        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
34791      }
34792      if (element.hasReferencePolicy()) {
34793        openArray("referencePolicy");
34794        for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
34795          composeEnumerationCore(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
34796        closeArray();
34797        if (anyHasExtras(element.getReferencePolicy())) {
34798          openArray("_referencePolicy");
34799          for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
34800            composeEnumerationExtras(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
34801          closeArray();
34802        }
34803      };
34804      if (element.hasSearchInclude()) {
34805        openArray("searchInclude");
34806        for (StringType e : element.getSearchInclude()) 
34807          composeStringCore(null, e, true);
34808        closeArray();
34809        if (anyHasExtras(element.getSearchInclude())) {
34810          openArray("_searchInclude");
34811          for (StringType e : element.getSearchInclude()) 
34812            composeStringExtras(null, e, true);
34813          closeArray();
34814        }
34815      };
34816      if (element.hasSearchRevInclude()) {
34817        openArray("searchRevInclude");
34818        for (StringType e : element.getSearchRevInclude()) 
34819          composeStringCore(null, e, true);
34820        closeArray();
34821        if (anyHasExtras(element.getSearchRevInclude())) {
34822          openArray("_searchRevInclude");
34823          for (StringType e : element.getSearchRevInclude()) 
34824            composeStringExtras(null, e, true);
34825          closeArray();
34826        }
34827      };
34828      if (element.hasSearchParam()) {
34829        openArray("searchParam");
34830        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
34831          composeCapabilityStatementRestResourceSearchParamComponent(null, e);
34832        closeArray();
34833      };
34834      if (element.hasOperation()) {
34835        openArray("operation");
34836        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
34837          composeCapabilityStatementRestResourceOperationComponent(null, e);
34838        closeArray();
34839      };
34840  }
34841
34842  protected void composeResourceInteractionComponent(String name, CapabilityStatement.ResourceInteractionComponent element) throws IOException {
34843    if (element != null) {
34844      open(name);
34845      composeResourceInteractionComponentProperties(element);
34846      close();
34847    }
34848  }
34849
34850  protected void composeResourceInteractionComponentProperties(CapabilityStatement.ResourceInteractionComponent element) throws IOException {
34851    composeBackboneElementProperties(element);
34852      if (element.hasCodeElement()) {
34853        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
34854        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
34855      }
34856      if (element.hasDocumentationElement()) {
34857        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34858        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34859      }
34860  }
34861
34862  protected void composeCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
34863    if (element != null) {
34864      open(name);
34865      composeCapabilityStatementRestResourceSearchParamComponentProperties(element);
34866      close();
34867    }
34868  }
34869
34870  protected void composeCapabilityStatementRestResourceSearchParamComponentProperties(CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
34871    composeBackboneElementProperties(element);
34872      if (element.hasNameElement()) {
34873        composeStringCore("name", element.getNameElement(), false);
34874        composeStringExtras("name", element.getNameElement(), false);
34875      }
34876      if (element.hasDefinitionElement()) {
34877        composeCanonicalCore("definition", element.getDefinitionElement(), false);
34878        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
34879      }
34880      if (element.hasTypeElement()) {
34881        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
34882        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
34883      }
34884      if (element.hasDocumentationElement()) {
34885        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34886        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34887      }
34888  }
34889
34890  protected void composeCapabilityStatementRestResourceOperationComponent(String name, CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
34891    if (element != null) {
34892      open(name);
34893      composeCapabilityStatementRestResourceOperationComponentProperties(element);
34894      close();
34895    }
34896  }
34897
34898  protected void composeCapabilityStatementRestResourceOperationComponentProperties(CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
34899    composeBackboneElementProperties(element);
34900      if (element.hasNameElement()) {
34901        composeStringCore("name", element.getNameElement(), false);
34902        composeStringExtras("name", element.getNameElement(), false);
34903      }
34904      if (element.hasDefinitionElement()) {
34905        composeCanonicalCore("definition", element.getDefinitionElement(), false);
34906        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
34907      }
34908      if (element.hasDocumentationElement()) {
34909        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34910        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34911      }
34912  }
34913
34914  protected void composeSystemInteractionComponent(String name, CapabilityStatement.SystemInteractionComponent element) throws IOException {
34915    if (element != null) {
34916      open(name);
34917      composeSystemInteractionComponentProperties(element);
34918      close();
34919    }
34920  }
34921
34922  protected void composeSystemInteractionComponentProperties(CapabilityStatement.SystemInteractionComponent element) throws IOException {
34923    composeBackboneElementProperties(element);
34924      if (element.hasCodeElement()) {
34925        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
34926        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
34927      }
34928      if (element.hasDocumentationElement()) {
34929        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34930        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34931      }
34932  }
34933
34934  protected void composeCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
34935    if (element != null) {
34936      open(name);
34937      composeCapabilityStatementMessagingComponentProperties(element);
34938      close();
34939    }
34940  }
34941
34942  protected void composeCapabilityStatementMessagingComponentProperties(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
34943    composeBackboneElementProperties(element);
34944      if (element.hasEndpoint()) {
34945        openArray("endpoint");
34946        for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
34947          composeCapabilityStatementMessagingEndpointComponent(null, e);
34948        closeArray();
34949      };
34950      if (element.hasReliableCacheElement()) {
34951        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
34952        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
34953      }
34954      if (element.hasDocumentationElement()) {
34955        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
34956        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
34957      }
34958      if (element.hasSupportedMessage()) {
34959        openArray("supportedMessage");
34960        for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage()) 
34961          composeCapabilityStatementMessagingSupportedMessageComponent(null, e);
34962        closeArray();
34963      };
34964  }
34965
34966  protected void composeCapabilityStatementMessagingEndpointComponent(String name, CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
34967    if (element != null) {
34968      open(name);
34969      composeCapabilityStatementMessagingEndpointComponentProperties(element);
34970      close();
34971    }
34972  }
34973
34974  protected void composeCapabilityStatementMessagingEndpointComponentProperties(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
34975    composeBackboneElementProperties(element);
34976      if (element.hasProtocol()) {
34977        composeCoding("protocol", element.getProtocol());
34978      }
34979      if (element.hasAddressElement()) {
34980        composeUrlCore("address", element.getAddressElement(), false);
34981        composeUrlExtras("address", element.getAddressElement(), false);
34982      }
34983  }
34984
34985  protected void composeCapabilityStatementMessagingSupportedMessageComponent(String name, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
34986    if (element != null) {
34987      open(name);
34988      composeCapabilityStatementMessagingSupportedMessageComponentProperties(element);
34989      close();
34990    }
34991  }
34992
34993  protected void composeCapabilityStatementMessagingSupportedMessageComponentProperties(CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
34994    composeBackboneElementProperties(element);
34995      if (element.hasModeElement()) {
34996        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
34997        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
34998      }
34999      if (element.hasDefinitionElement()) {
35000        composeCanonicalCore("definition", element.getDefinitionElement(), false);
35001        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
35002      }
35003  }
35004
35005  protected void composeCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
35006    if (element != null) {
35007      open(name);
35008      composeCapabilityStatementDocumentComponentProperties(element);
35009      close();
35010    }
35011  }
35012
35013  protected void composeCapabilityStatementDocumentComponentProperties(CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
35014    composeBackboneElementProperties(element);
35015      if (element.hasModeElement()) {
35016        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
35017        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
35018      }
35019      if (element.hasDocumentationElement()) {
35020        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
35021        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
35022      }
35023      if (element.hasProfileElement()) {
35024        composeCanonicalCore("profile", element.getProfileElement(), false);
35025        composeCanonicalExtras("profile", element.getProfileElement(), false);
35026      }
35027  }
35028
35029  protected void composeCapabilityStatement2(String name, CapabilityStatement2 element) throws IOException {
35030    if (element != null) {
35031      prop("resourceType", name);
35032      composeCapabilityStatement2Properties(element);
35033    }
35034  }
35035
35036  protected void composeCapabilityStatement2Properties(CapabilityStatement2 element) throws IOException {
35037    composeCanonicalResourceProperties(element);
35038      if (element.hasUrlElement()) {
35039        composeUriCore("url", element.getUrlElement(), false);
35040        composeUriExtras("url", element.getUrlElement(), false);
35041      }
35042      if (element.hasVersionElement()) {
35043        composeStringCore("version", element.getVersionElement(), false);
35044        composeStringExtras("version", element.getVersionElement(), false);
35045      }
35046      if (element.hasNameElement()) {
35047        composeStringCore("name", element.getNameElement(), false);
35048        composeStringExtras("name", element.getNameElement(), false);
35049      }
35050      if (element.hasTitleElement()) {
35051        composeStringCore("title", element.getTitleElement(), false);
35052        composeStringExtras("title", element.getTitleElement(), false);
35053      }
35054      if (element.hasStatusElement()) {
35055        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35056        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35057      }
35058      if (element.hasExperimentalElement()) {
35059        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35060        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35061      }
35062      if (element.hasDateElement()) {
35063        composeDateTimeCore("date", element.getDateElement(), false);
35064        composeDateTimeExtras("date", element.getDateElement(), false);
35065      }
35066      if (element.hasPublisherElement()) {
35067        composeStringCore("publisher", element.getPublisherElement(), false);
35068        composeStringExtras("publisher", element.getPublisherElement(), false);
35069      }
35070      if (element.hasContact()) {
35071        openArray("contact");
35072        for (ContactDetail e : element.getContact()) 
35073          composeContactDetail(null, e);
35074        closeArray();
35075      };
35076      if (element.hasDescriptionElement()) {
35077        composeMarkdownCore("description", element.getDescriptionElement(), false);
35078        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35079      }
35080      if (element.hasUseContext()) {
35081        openArray("useContext");
35082        for (UsageContext e : element.getUseContext()) 
35083          composeUsageContext(null, e);
35084        closeArray();
35085      };
35086      if (element.hasJurisdiction()) {
35087        openArray("jurisdiction");
35088        for (CodeableConcept e : element.getJurisdiction()) 
35089          composeCodeableConcept(null, e);
35090        closeArray();
35091      };
35092      if (element.hasPurposeElement()) {
35093        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35094        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35095      }
35096      if (element.hasCopyrightElement()) {
35097        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35098        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35099      }
35100      if (element.hasKindElement()) {
35101        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
35102        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
35103      }
35104      if (element.hasInstantiates()) {
35105        openArray("instantiates");
35106        for (CanonicalType e : element.getInstantiates()) 
35107          composeCanonicalCore(null, e, true);
35108        closeArray();
35109        if (anyHasExtras(element.getInstantiates())) {
35110          openArray("_instantiates");
35111          for (CanonicalType e : element.getInstantiates()) 
35112            composeCanonicalExtras(null, e, true);
35113          closeArray();
35114        }
35115      };
35116      if (element.hasImports()) {
35117        openArray("imports");
35118        for (CanonicalType e : element.getImports()) 
35119          composeCanonicalCore(null, e, true);
35120        closeArray();
35121        if (anyHasExtras(element.getImports())) {
35122          openArray("_imports");
35123          for (CanonicalType e : element.getImports()) 
35124            composeCanonicalExtras(null, e, true);
35125          closeArray();
35126        }
35127      };
35128      if (element.hasSoftware()) {
35129        composeCapabilityStatement2SoftwareComponent("software", element.getSoftware());
35130      }
35131      if (element.hasImplementation()) {
35132        composeCapabilityStatement2ImplementationComponent("implementation", element.getImplementation());
35133      }
35134      if (element.hasFhirVersionElement()) {
35135        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
35136        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
35137      }
35138      if (element.hasFormat()) {
35139        openArray("format");
35140        for (CodeType e : element.getFormat()) 
35141          composeCodeCore(null, e, true);
35142        closeArray();
35143        if (anyHasExtras(element.getFormat())) {
35144          openArray("_format");
35145          for (CodeType e : element.getFormat()) 
35146            composeCodeExtras(null, e, true);
35147          closeArray();
35148        }
35149      };
35150      if (element.hasPatchFormat()) {
35151        openArray("patchFormat");
35152        for (CodeType e : element.getPatchFormat()) 
35153          composeCodeCore(null, e, true);
35154        closeArray();
35155        if (anyHasExtras(element.getPatchFormat())) {
35156          openArray("_patchFormat");
35157          for (CodeType e : element.getPatchFormat()) 
35158            composeCodeExtras(null, e, true);
35159          closeArray();
35160        }
35161      };
35162      if (element.hasImplementationGuide()) {
35163        openArray("implementationGuide");
35164        for (CanonicalType e : element.getImplementationGuide()) 
35165          composeCanonicalCore(null, e, true);
35166        closeArray();
35167        if (anyHasExtras(element.getImplementationGuide())) {
35168          openArray("_implementationGuide");
35169          for (CanonicalType e : element.getImplementationGuide()) 
35170            composeCanonicalExtras(null, e, true);
35171          closeArray();
35172        }
35173      };
35174      if (element.hasRest()) {
35175        openArray("rest");
35176        for (CapabilityStatement2.CapabilityStatement2RestComponent e : element.getRest()) 
35177          composeCapabilityStatement2RestComponent(null, e);
35178        closeArray();
35179      };
35180  }
35181
35182  protected void composeCapabilityStatement2SoftwareComponent(String name, CapabilityStatement2.CapabilityStatement2SoftwareComponent element) throws IOException {
35183    if (element != null) {
35184      open(name);
35185      composeCapabilityStatement2SoftwareComponentProperties(element);
35186      close();
35187    }
35188  }
35189
35190  protected void composeCapabilityStatement2SoftwareComponentProperties(CapabilityStatement2.CapabilityStatement2SoftwareComponent element) throws IOException {
35191    composeBackboneElementProperties(element);
35192      if (element.hasNameElement()) {
35193        composeStringCore("name", element.getNameElement(), false);
35194        composeStringExtras("name", element.getNameElement(), false);
35195      }
35196      if (element.hasVersionElement()) {
35197        composeStringCore("version", element.getVersionElement(), false);
35198        composeStringExtras("version", element.getVersionElement(), false);
35199      }
35200      if (element.hasReleaseDateElement()) {
35201        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
35202        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
35203      }
35204  }
35205
35206  protected void composeCapabilityStatement2ImplementationComponent(String name, CapabilityStatement2.CapabilityStatement2ImplementationComponent element) throws IOException {
35207    if (element != null) {
35208      open(name);
35209      composeCapabilityStatement2ImplementationComponentProperties(element);
35210      close();
35211    }
35212  }
35213
35214  protected void composeCapabilityStatement2ImplementationComponentProperties(CapabilityStatement2.CapabilityStatement2ImplementationComponent element) throws IOException {
35215    composeBackboneElementProperties(element);
35216      if (element.hasDescriptionElement()) {
35217        composeStringCore("description", element.getDescriptionElement(), false);
35218        composeStringExtras("description", element.getDescriptionElement(), false);
35219      }
35220      if (element.hasUrlElement()) {
35221        composeUrlCore("url", element.getUrlElement(), false);
35222        composeUrlExtras("url", element.getUrlElement(), false);
35223      }
35224      if (element.hasCustodian()) {
35225        composeReference("custodian", element.getCustodian());
35226      }
35227  }
35228
35229  protected void composeCapabilityStatement2RestComponent(String name, CapabilityStatement2.CapabilityStatement2RestComponent element) throws IOException {
35230    if (element != null) {
35231      open(name);
35232      composeCapabilityStatement2RestComponentProperties(element);
35233      close();
35234    }
35235  }
35236
35237  protected void composeCapabilityStatement2RestComponentProperties(CapabilityStatement2.CapabilityStatement2RestComponent element) throws IOException {
35238    composeBackboneElementProperties(element);
35239      if (element.hasModeElement()) {
35240        composeEnumerationCore("mode", element.getModeElement(), new Enumerations.RestfulCapabilityModeEnumFactory(), false);
35241        composeEnumerationExtras("mode", element.getModeElement(), new Enumerations.RestfulCapabilityModeEnumFactory(), false);
35242      }
35243      if (element.hasDocumentationElement()) {
35244        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
35245        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
35246      }
35247      if (element.hasResource()) {
35248        openArray("resource");
35249        for (CapabilityStatement2.CapabilityStatement2RestResourceComponent e : element.getResource()) 
35250          composeCapabilityStatement2RestResourceComponent(null, e);
35251        closeArray();
35252      };
35253      if (element.hasInteraction()) {
35254        openArray("interaction");
35255        for (CapabilityStatement2.SystemInteractionComponent e : element.getInteraction()) 
35256          composeSystemInteractionComponent(null, e);
35257        closeArray();
35258      };
35259      if (element.hasSearchParam()) {
35260        openArray("searchParam");
35261        for (CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent e : element.getSearchParam()) 
35262          composeCapabilityStatement2RestResourceSearchParamComponent(null, e);
35263        closeArray();
35264      };
35265      if (element.hasOperation()) {
35266        openArray("operation");
35267        for (CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent e : element.getOperation()) 
35268          composeCapabilityStatement2RestResourceOperationComponent(null, e);
35269        closeArray();
35270      };
35271      if (element.hasCompartment()) {
35272        openArray("compartment");
35273        for (CanonicalType e : element.getCompartment()) 
35274          composeCanonicalCore(null, e, true);
35275        closeArray();
35276        if (anyHasExtras(element.getCompartment())) {
35277          openArray("_compartment");
35278          for (CanonicalType e : element.getCompartment()) 
35279            composeCanonicalExtras(null, e, true);
35280          closeArray();
35281        }
35282      };
35283  }
35284
35285  protected void composeCapabilityStatement2RestResourceComponent(String name, CapabilityStatement2.CapabilityStatement2RestResourceComponent element) throws IOException {
35286    if (element != null) {
35287      open(name);
35288      composeCapabilityStatement2RestResourceComponentProperties(element);
35289      close();
35290    }
35291  }
35292
35293  protected void composeCapabilityStatement2RestResourceComponentProperties(CapabilityStatement2.CapabilityStatement2RestResourceComponent element) throws IOException {
35294    composeBackboneElementProperties(element);
35295      if (element.hasTypeElement()) {
35296        composeCodeCore("type", element.getTypeElement(), false);
35297        composeCodeExtras("type", element.getTypeElement(), false);
35298      }
35299      if (element.hasProfileElement()) {
35300        composeCanonicalCore("profile", element.getProfileElement(), false);
35301        composeCanonicalExtras("profile", element.getProfileElement(), false);
35302      }
35303      if (element.hasSupportedProfile()) {
35304        openArray("supportedProfile");
35305        for (CanonicalType e : element.getSupportedProfile()) 
35306          composeCanonicalCore(null, e, true);
35307        closeArray();
35308        if (anyHasExtras(element.getSupportedProfile())) {
35309          openArray("_supportedProfile");
35310          for (CanonicalType e : element.getSupportedProfile()) 
35311            composeCanonicalExtras(null, e, true);
35312          closeArray();
35313        }
35314      };
35315      if (element.hasDocumentationElement()) {
35316        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
35317        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
35318      }
35319      if (element.hasInteraction()) {
35320        openArray("interaction");
35321        for (CapabilityStatement2.ResourceInteractionComponent e : element.getInteraction()) 
35322          composeResourceInteractionComponent(null, e);
35323        closeArray();
35324      };
35325      if (element.hasSearchParam()) {
35326        openArray("searchParam");
35327        for (CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent e : element.getSearchParam()) 
35328          composeCapabilityStatement2RestResourceSearchParamComponent(null, e);
35329        closeArray();
35330      };
35331      if (element.hasOperation()) {
35332        openArray("operation");
35333        for (CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent e : element.getOperation()) 
35334          composeCapabilityStatement2RestResourceOperationComponent(null, e);
35335        closeArray();
35336      };
35337  }
35338
35339  protected void composeResourceInteractionComponent(String name, CapabilityStatement2.ResourceInteractionComponent element) throws IOException {
35340    if (element != null) {
35341      open(name);
35342      composeResourceInteractionComponentProperties(element);
35343      close();
35344    }
35345  }
35346
35347  protected void composeResourceInteractionComponentProperties(CapabilityStatement2.ResourceInteractionComponent element) throws IOException {
35348    composeBackboneElementProperties(element);
35349      if (element.hasCodeElement()) {
35350        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement2.TypeRestfulInteractionEnumFactory(), false);
35351        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement2.TypeRestfulInteractionEnumFactory(), false);
35352      }
35353      if (element.hasDocumentationElement()) {
35354        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
35355        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
35356      }
35357  }
35358
35359  protected void composeCapabilityStatement2RestResourceSearchParamComponent(String name, CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent element) throws IOException {
35360    if (element != null) {
35361      open(name);
35362      composeCapabilityStatement2RestResourceSearchParamComponentProperties(element);
35363      close();
35364    }
35365  }
35366
35367  protected void composeCapabilityStatement2RestResourceSearchParamComponentProperties(CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent element) throws IOException {
35368    composeBackboneElementProperties(element);
35369      if (element.hasNameElement()) {
35370        composeStringCore("name", element.getNameElement(), false);
35371        composeStringExtras("name", element.getNameElement(), false);
35372      }
35373      if (element.hasDefinitionElement()) {
35374        composeCanonicalCore("definition", element.getDefinitionElement(), false);
35375        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
35376      }
35377      if (element.hasTypeElement()) {
35378        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
35379        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
35380      }
35381      if (element.hasDocumentationElement()) {
35382        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
35383        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
35384      }
35385  }
35386
35387  protected void composeCapabilityStatement2RestResourceOperationComponent(String name, CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent element) throws IOException {
35388    if (element != null) {
35389      open(name);
35390      composeCapabilityStatement2RestResourceOperationComponentProperties(element);
35391      close();
35392    }
35393  }
35394
35395  protected void composeCapabilityStatement2RestResourceOperationComponentProperties(CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent element) throws IOException {
35396    composeBackboneElementProperties(element);
35397      if (element.hasNameElement()) {
35398        composeStringCore("name", element.getNameElement(), false);
35399        composeStringExtras("name", element.getNameElement(), false);
35400      }
35401      if (element.hasDefinitionElement()) {
35402        composeCanonicalCore("definition", element.getDefinitionElement(), false);
35403        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
35404      }
35405      if (element.hasDocumentationElement()) {
35406        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
35407        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
35408      }
35409  }
35410
35411  protected void composeSystemInteractionComponent(String name, CapabilityStatement2.SystemInteractionComponent element) throws IOException {
35412    if (element != null) {
35413      open(name);
35414      composeSystemInteractionComponentProperties(element);
35415      close();
35416    }
35417  }
35418
35419  protected void composeSystemInteractionComponentProperties(CapabilityStatement2.SystemInteractionComponent element) throws IOException {
35420    composeBackboneElementProperties(element);
35421      if (element.hasCodeElement()) {
35422        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement2.SystemRestfulInteractionEnumFactory(), false);
35423        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement2.SystemRestfulInteractionEnumFactory(), false);
35424      }
35425      if (element.hasDocumentationElement()) {
35426        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
35427        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
35428      }
35429  }
35430
35431  protected void composeCarePlan(String name, CarePlan element) throws IOException {
35432    if (element != null) {
35433      prop("resourceType", name);
35434      composeCarePlanProperties(element);
35435    }
35436  }
35437
35438  protected void composeCarePlanProperties(CarePlan element) throws IOException {
35439    composeDomainResourceProperties(element);
35440      if (element.hasIdentifier()) {
35441        openArray("identifier");
35442        for (Identifier e : element.getIdentifier()) 
35443          composeIdentifier(null, e);
35444        closeArray();
35445      };
35446      if (element.hasInstantiatesCanonical()) {
35447        openArray("instantiatesCanonical");
35448        for (CanonicalType e : element.getInstantiatesCanonical()) 
35449          composeCanonicalCore(null, e, true);
35450        closeArray();
35451        if (anyHasExtras(element.getInstantiatesCanonical())) {
35452          openArray("_instantiatesCanonical");
35453          for (CanonicalType e : element.getInstantiatesCanonical()) 
35454            composeCanonicalExtras(null, e, true);
35455          closeArray();
35456        }
35457      };
35458      if (element.hasInstantiatesUri()) {
35459        openArray("instantiatesUri");
35460        for (UriType e : element.getInstantiatesUri()) 
35461          composeUriCore(null, e, true);
35462        closeArray();
35463        if (anyHasExtras(element.getInstantiatesUri())) {
35464          openArray("_instantiatesUri");
35465          for (UriType e : element.getInstantiatesUri()) 
35466            composeUriExtras(null, e, true);
35467          closeArray();
35468        }
35469      };
35470      if (element.hasBasedOn()) {
35471        openArray("basedOn");
35472        for (Reference e : element.getBasedOn()) 
35473          composeReference(null, e);
35474        closeArray();
35475      };
35476      if (element.hasReplaces()) {
35477        openArray("replaces");
35478        for (Reference e : element.getReplaces()) 
35479          composeReference(null, e);
35480        closeArray();
35481      };
35482      if (element.hasPartOf()) {
35483        openArray("partOf");
35484        for (Reference e : element.getPartOf()) 
35485          composeReference(null, e);
35486        closeArray();
35487      };
35488      if (element.hasStatusElement()) {
35489        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
35490        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
35491      }
35492      if (element.hasIntentElement()) {
35493        composeEnumerationCore("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
35494        composeEnumerationExtras("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
35495      }
35496      if (element.hasCategory()) {
35497        openArray("category");
35498        for (CodeableConcept e : element.getCategory()) 
35499          composeCodeableConcept(null, e);
35500        closeArray();
35501      };
35502      if (element.hasTitleElement()) {
35503        composeStringCore("title", element.getTitleElement(), false);
35504        composeStringExtras("title", element.getTitleElement(), false);
35505      }
35506      if (element.hasDescriptionElement()) {
35507        composeStringCore("description", element.getDescriptionElement(), false);
35508        composeStringExtras("description", element.getDescriptionElement(), false);
35509      }
35510      if (element.hasSubject()) {
35511        composeReference("subject", element.getSubject());
35512      }
35513      if (element.hasEncounter()) {
35514        composeReference("encounter", element.getEncounter());
35515      }
35516      if (element.hasPeriod()) {
35517        composePeriod("period", element.getPeriod());
35518      }
35519      if (element.hasCreatedElement()) {
35520        composeDateTimeCore("created", element.getCreatedElement(), false);
35521        composeDateTimeExtras("created", element.getCreatedElement(), false);
35522      }
35523      if (element.hasAuthor()) {
35524        composeReference("author", element.getAuthor());
35525      }
35526      if (element.hasContributor()) {
35527        openArray("contributor");
35528        for (Reference e : element.getContributor()) 
35529          composeReference(null, e);
35530        closeArray();
35531      };
35532      if (element.hasCareTeam()) {
35533        openArray("careTeam");
35534        for (Reference e : element.getCareTeam()) 
35535          composeReference(null, e);
35536        closeArray();
35537      };
35538      if (element.hasAddresses()) {
35539        openArray("addresses");
35540        for (CodeableReference e : element.getAddresses()) 
35541          composeCodeableReference(null, e);
35542        closeArray();
35543      };
35544      if (element.hasSupportingInfo()) {
35545        openArray("supportingInfo");
35546        for (Reference e : element.getSupportingInfo()) 
35547          composeReference(null, e);
35548        closeArray();
35549      };
35550      if (element.hasGoal()) {
35551        openArray("goal");
35552        for (Reference e : element.getGoal()) 
35553          composeReference(null, e);
35554        closeArray();
35555      };
35556      if (element.hasActivity()) {
35557        openArray("activity");
35558        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
35559          composeCarePlanActivityComponent(null, e);
35560        closeArray();
35561      };
35562      if (element.hasNote()) {
35563        openArray("note");
35564        for (Annotation e : element.getNote()) 
35565          composeAnnotation(null, e);
35566        closeArray();
35567      };
35568  }
35569
35570  protected void composeCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
35571    if (element != null) {
35572      open(name);
35573      composeCarePlanActivityComponentProperties(element);
35574      close();
35575    }
35576  }
35577
35578  protected void composeCarePlanActivityComponentProperties(CarePlan.CarePlanActivityComponent element) throws IOException {
35579    composeBackboneElementProperties(element);
35580      if (element.hasOutcome()) {
35581        openArray("outcome");
35582        for (CodeableReference e : element.getOutcome()) 
35583          composeCodeableReference(null, e);
35584        closeArray();
35585      };
35586      if (element.hasProgress()) {
35587        openArray("progress");
35588        for (Annotation e : element.getProgress()) 
35589          composeAnnotation(null, e);
35590        closeArray();
35591      };
35592      if (element.hasReference()) {
35593        composeReference("reference", element.getReference());
35594      }
35595      if (element.hasDetail()) {
35596        composeCarePlanActivityDetailComponent("detail", element.getDetail());
35597      }
35598  }
35599
35600  protected void composeCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
35601    if (element != null) {
35602      open(name);
35603      composeCarePlanActivityDetailComponentProperties(element);
35604      close();
35605    }
35606  }
35607
35608  protected void composeCarePlanActivityDetailComponentProperties(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
35609    composeBackboneElementProperties(element);
35610      if (element.hasKindElement()) {
35611        composeEnumerationCore("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
35612        composeEnumerationExtras("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
35613      }
35614      if (element.hasInstantiatesCanonical()) {
35615        openArray("instantiatesCanonical");
35616        for (CanonicalType e : element.getInstantiatesCanonical()) 
35617          composeCanonicalCore(null, e, true);
35618        closeArray();
35619        if (anyHasExtras(element.getInstantiatesCanonical())) {
35620          openArray("_instantiatesCanonical");
35621          for (CanonicalType e : element.getInstantiatesCanonical()) 
35622            composeCanonicalExtras(null, e, true);
35623          closeArray();
35624        }
35625      };
35626      if (element.hasInstantiatesUri()) {
35627        openArray("instantiatesUri");
35628        for (UriType e : element.getInstantiatesUri()) 
35629          composeUriCore(null, e, true);
35630        closeArray();
35631        if (anyHasExtras(element.getInstantiatesUri())) {
35632          openArray("_instantiatesUri");
35633          for (UriType e : element.getInstantiatesUri()) 
35634            composeUriExtras(null, e, true);
35635          closeArray();
35636        }
35637      };
35638      if (element.hasCode()) {
35639        composeCodeableConcept("code", element.getCode());
35640      }
35641      if (element.hasReason()) {
35642        openArray("reason");
35643        for (CodeableReference e : element.getReason()) 
35644          composeCodeableReference(null, e);
35645        closeArray();
35646      };
35647      if (element.hasGoal()) {
35648        openArray("goal");
35649        for (Reference e : element.getGoal()) 
35650          composeReference(null, e);
35651        closeArray();
35652      };
35653      if (element.hasStatusElement()) {
35654        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
35655        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
35656      }
35657      if (element.hasStatusReason()) {
35658        composeCodeableConcept("statusReason", element.getStatusReason());
35659      }
35660      if (element.hasDoNotPerformElement()) {
35661        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
35662        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
35663      }
35664      if (element.hasScheduled()) {
35665        composeType("scheduled", element.getScheduled());
35666      }
35667      if (element.hasLocation()) {
35668        composeReference("location", element.getLocation());
35669      }
35670      if (element.hasReported()) {
35671        composeType("reported", element.getReported());
35672      }
35673      if (element.hasPerformer()) {
35674        openArray("performer");
35675        for (Reference e : element.getPerformer()) 
35676          composeReference(null, e);
35677        closeArray();
35678      };
35679      if (element.hasProduct()) {
35680        composeType("product", element.getProduct());
35681      }
35682      if (element.hasDailyAmount()) {
35683        composeQuantity("dailyAmount", element.getDailyAmount());
35684      }
35685      if (element.hasQuantity()) {
35686        composeQuantity("quantity", element.getQuantity());
35687      }
35688      if (element.hasDescriptionElement()) {
35689        composeStringCore("description", element.getDescriptionElement(), false);
35690        composeStringExtras("description", element.getDescriptionElement(), false);
35691      }
35692  }
35693
35694  protected void composeCareTeam(String name, CareTeam element) throws IOException {
35695    if (element != null) {
35696      prop("resourceType", name);
35697      composeCareTeamProperties(element);
35698    }
35699  }
35700
35701  protected void composeCareTeamProperties(CareTeam element) throws IOException {
35702    composeDomainResourceProperties(element);
35703      if (element.hasIdentifier()) {
35704        openArray("identifier");
35705        for (Identifier e : element.getIdentifier()) 
35706          composeIdentifier(null, e);
35707        closeArray();
35708      };
35709      if (element.hasStatusElement()) {
35710        composeEnumerationCore("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
35711        composeEnumerationExtras("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
35712      }
35713      if (element.hasCategory()) {
35714        openArray("category");
35715        for (CodeableConcept e : element.getCategory()) 
35716          composeCodeableConcept(null, e);
35717        closeArray();
35718      };
35719      if (element.hasNameElement()) {
35720        composeStringCore("name", element.getNameElement(), false);
35721        composeStringExtras("name", element.getNameElement(), false);
35722      }
35723      if (element.hasSubject()) {
35724        composeReference("subject", element.getSubject());
35725      }
35726      if (element.hasPeriod()) {
35727        composePeriod("period", element.getPeriod());
35728      }
35729      if (element.hasParticipant()) {
35730        openArray("participant");
35731        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
35732          composeCareTeamParticipantComponent(null, e);
35733        closeArray();
35734      };
35735      if (element.hasReason()) {
35736        openArray("reason");
35737        for (CodeableReference e : element.getReason()) 
35738          composeCodeableReference(null, e);
35739        closeArray();
35740      };
35741      if (element.hasManagingOrganization()) {
35742        openArray("managingOrganization");
35743        for (Reference e : element.getManagingOrganization()) 
35744          composeReference(null, e);
35745        closeArray();
35746      };
35747      if (element.hasTelecom()) {
35748        openArray("telecom");
35749        for (ContactPoint e : element.getTelecom()) 
35750          composeContactPoint(null, e);
35751        closeArray();
35752      };
35753      if (element.hasNote()) {
35754        openArray("note");
35755        for (Annotation e : element.getNote()) 
35756          composeAnnotation(null, e);
35757        closeArray();
35758      };
35759  }
35760
35761  protected void composeCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
35762    if (element != null) {
35763      open(name);
35764      composeCareTeamParticipantComponentProperties(element);
35765      close();
35766    }
35767  }
35768
35769  protected void composeCareTeamParticipantComponentProperties(CareTeam.CareTeamParticipantComponent element) throws IOException {
35770    composeBackboneElementProperties(element);
35771      if (element.hasRole()) {
35772        composeCodeableConcept("role", element.getRole());
35773      }
35774      if (element.hasMember()) {
35775        composeReference("member", element.getMember());
35776      }
35777      if (element.hasOnBehalfOf()) {
35778        composeReference("onBehalfOf", element.getOnBehalfOf());
35779      }
35780      if (element.hasCoverage()) {
35781        composeType("coverage", element.getCoverage());
35782      }
35783  }
35784
35785  protected void composeCatalogEntry(String name, CatalogEntry element) throws IOException {
35786    if (element != null) {
35787      prop("resourceType", name);
35788      composeCatalogEntryProperties(element);
35789    }
35790  }
35791
35792  protected void composeCatalogEntryProperties(CatalogEntry element) throws IOException {
35793    composeDomainResourceProperties(element);
35794      if (element.hasIdentifier()) {
35795        openArray("identifier");
35796        for (Identifier e : element.getIdentifier()) 
35797          composeIdentifier(null, e);
35798        closeArray();
35799      };
35800      if (element.hasNameElement()) {
35801        composeStringCore("name", element.getNameElement(), false);
35802        composeStringExtras("name", element.getNameElement(), false);
35803      }
35804      if (element.hasTypeElement()) {
35805        composeEnumerationCore("type", element.getTypeElement(), new CatalogEntry.CatalogEntryTypeEnumFactory(), false);
35806        composeEnumerationExtras("type", element.getTypeElement(), new CatalogEntry.CatalogEntryTypeEnumFactory(), false);
35807      }
35808      if (element.hasStatusElement()) {
35809        composeEnumerationCore("status", element.getStatusElement(), new CatalogEntry.CatalogEntryStatusEnumFactory(), false);
35810        composeEnumerationExtras("status", element.getStatusElement(), new CatalogEntry.CatalogEntryStatusEnumFactory(), false);
35811      }
35812      if (element.hasEffectivePeriod()) {
35813        composePeriod("effectivePeriod", element.getEffectivePeriod());
35814      }
35815      if (element.hasOrderableElement()) {
35816        composeBooleanCore("orderable", element.getOrderableElement(), false);
35817        composeBooleanExtras("orderable", element.getOrderableElement(), false);
35818      }
35819      if (element.hasReferencedItem()) {
35820        composeReference("referencedItem", element.getReferencedItem());
35821      }
35822      if (element.hasRelatedEntry()) {
35823        openArray("relatedEntry");
35824        for (CatalogEntry.CatalogEntryRelatedEntryComponent e : element.getRelatedEntry()) 
35825          composeCatalogEntryRelatedEntryComponent(null, e);
35826        closeArray();
35827      };
35828      if (element.hasUpdatedBy()) {
35829        composeReference("updatedBy", element.getUpdatedBy());
35830      }
35831      if (element.hasNote()) {
35832        openArray("note");
35833        for (Annotation e : element.getNote()) 
35834          composeAnnotation(null, e);
35835        closeArray();
35836      };
35837      if (element.hasEstimatedDuration()) {
35838        composeDuration("estimatedDuration", element.getEstimatedDuration());
35839      }
35840      if (element.hasBillingCode()) {
35841        openArray("billingCode");
35842        for (CodeableConcept e : element.getBillingCode()) 
35843          composeCodeableConcept(null, e);
35844        closeArray();
35845      };
35846      if (element.hasBillingSummaryElement()) {
35847        composeStringCore("billingSummary", element.getBillingSummaryElement(), false);
35848        composeStringExtras("billingSummary", element.getBillingSummaryElement(), false);
35849      }
35850      if (element.hasScheduleSummaryElement()) {
35851        composeStringCore("scheduleSummary", element.getScheduleSummaryElement(), false);
35852        composeStringExtras("scheduleSummary", element.getScheduleSummaryElement(), false);
35853      }
35854      if (element.hasLimitationSummaryElement()) {
35855        composeStringCore("limitationSummary", element.getLimitationSummaryElement(), false);
35856        composeStringExtras("limitationSummary", element.getLimitationSummaryElement(), false);
35857      }
35858      if (element.hasRegulatorySummaryElement()) {
35859        composeStringCore("regulatorySummary", element.getRegulatorySummaryElement(), false);
35860        composeStringExtras("regulatorySummary", element.getRegulatorySummaryElement(), false);
35861      }
35862  }
35863
35864  protected void composeCatalogEntryRelatedEntryComponent(String name, CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
35865    if (element != null) {
35866      open(name);
35867      composeCatalogEntryRelatedEntryComponentProperties(element);
35868      close();
35869    }
35870  }
35871
35872  protected void composeCatalogEntryRelatedEntryComponentProperties(CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
35873    composeBackboneElementProperties(element);
35874      if (element.hasRelationshipElement()) {
35875        composeEnumerationCore("relationship", element.getRelationshipElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
35876        composeEnumerationExtras("relationship", element.getRelationshipElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
35877      }
35878      if (element.hasTarget()) {
35879        composeReference("target", element.getTarget());
35880      }
35881  }
35882
35883  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
35884    if (element != null) {
35885      prop("resourceType", name);
35886      composeChargeItemProperties(element);
35887    }
35888  }
35889
35890  protected void composeChargeItemProperties(ChargeItem element) throws IOException {
35891    composeDomainResourceProperties(element);
35892      if (element.hasIdentifier()) {
35893        openArray("identifier");
35894        for (Identifier e : element.getIdentifier()) 
35895          composeIdentifier(null, e);
35896        closeArray();
35897      };
35898      if (element.hasDefinitionUri()) {
35899        openArray("definitionUri");
35900        for (UriType e : element.getDefinitionUri()) 
35901          composeUriCore(null, e, true);
35902        closeArray();
35903        if (anyHasExtras(element.getDefinitionUri())) {
35904          openArray("_definitionUri");
35905          for (UriType e : element.getDefinitionUri()) 
35906            composeUriExtras(null, e, true);
35907          closeArray();
35908        }
35909      };
35910      if (element.hasDefinitionCanonical()) {
35911        openArray("definitionCanonical");
35912        for (CanonicalType e : element.getDefinitionCanonical()) 
35913          composeCanonicalCore(null, e, true);
35914        closeArray();
35915        if (anyHasExtras(element.getDefinitionCanonical())) {
35916          openArray("_definitionCanonical");
35917          for (CanonicalType e : element.getDefinitionCanonical()) 
35918            composeCanonicalExtras(null, e, true);
35919          closeArray();
35920        }
35921      };
35922      if (element.hasStatusElement()) {
35923        composeEnumerationCore("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
35924        composeEnumerationExtras("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
35925      }
35926      if (element.hasPartOf()) {
35927        openArray("partOf");
35928        for (Reference e : element.getPartOf()) 
35929          composeReference(null, e);
35930        closeArray();
35931      };
35932      if (element.hasCode()) {
35933        composeCodeableConcept("code", element.getCode());
35934      }
35935      if (element.hasSubject()) {
35936        composeReference("subject", element.getSubject());
35937      }
35938      if (element.hasContext()) {
35939        composeReference("context", element.getContext());
35940      }
35941      if (element.hasOccurrence()) {
35942        composeType("occurrence", element.getOccurrence());
35943      }
35944      if (element.hasPerformer()) {
35945        openArray("performer");
35946        for (ChargeItem.ChargeItemPerformerComponent e : element.getPerformer()) 
35947          composeChargeItemPerformerComponent(null, e);
35948        closeArray();
35949      };
35950      if (element.hasPerformingOrganization()) {
35951        composeReference("performingOrganization", element.getPerformingOrganization());
35952      }
35953      if (element.hasRequestingOrganization()) {
35954        composeReference("requestingOrganization", element.getRequestingOrganization());
35955      }
35956      if (element.hasCostCenter()) {
35957        composeReference("costCenter", element.getCostCenter());
35958      }
35959      if (element.hasQuantity()) {
35960        composeQuantity("quantity", element.getQuantity());
35961      }
35962      if (element.hasBodysite()) {
35963        openArray("bodysite");
35964        for (CodeableConcept e : element.getBodysite()) 
35965          composeCodeableConcept(null, e);
35966        closeArray();
35967      };
35968      if (element.hasFactorOverrideElement()) {
35969        composeDecimalCore("factorOverride", element.getFactorOverrideElement(), false);
35970        composeDecimalExtras("factorOverride", element.getFactorOverrideElement(), false);
35971      }
35972      if (element.hasPriceOverride()) {
35973        composeMoney("priceOverride", element.getPriceOverride());
35974      }
35975      if (element.hasOverrideReasonElement()) {
35976        composeStringCore("overrideReason", element.getOverrideReasonElement(), false);
35977        composeStringExtras("overrideReason", element.getOverrideReasonElement(), false);
35978      }
35979      if (element.hasEnterer()) {
35980        composeReference("enterer", element.getEnterer());
35981      }
35982      if (element.hasEnteredDateElement()) {
35983        composeDateTimeCore("enteredDate", element.getEnteredDateElement(), false);
35984        composeDateTimeExtras("enteredDate", element.getEnteredDateElement(), false);
35985      }
35986      if (element.hasReason()) {
35987        openArray("reason");
35988        for (CodeableConcept e : element.getReason()) 
35989          composeCodeableConcept(null, e);
35990        closeArray();
35991      };
35992      if (element.hasService()) {
35993        openArray("service");
35994        for (Reference e : element.getService()) 
35995          composeReference(null, e);
35996        closeArray();
35997      };
35998      if (element.hasProduct()) {
35999        composeType("product", element.getProduct());
36000      }
36001      if (element.hasAccount()) {
36002        openArray("account");
36003        for (Reference e : element.getAccount()) 
36004          composeReference(null, e);
36005        closeArray();
36006      };
36007      if (element.hasNote()) {
36008        openArray("note");
36009        for (Annotation e : element.getNote()) 
36010          composeAnnotation(null, e);
36011        closeArray();
36012      };
36013      if (element.hasSupportingInformation()) {
36014        openArray("supportingInformation");
36015        for (Reference e : element.getSupportingInformation()) 
36016          composeReference(null, e);
36017        closeArray();
36018      };
36019  }
36020
36021  protected void composeChargeItemPerformerComponent(String name, ChargeItem.ChargeItemPerformerComponent element) throws IOException {
36022    if (element != null) {
36023      open(name);
36024      composeChargeItemPerformerComponentProperties(element);
36025      close();
36026    }
36027  }
36028
36029  protected void composeChargeItemPerformerComponentProperties(ChargeItem.ChargeItemPerformerComponent element) throws IOException {
36030    composeBackboneElementProperties(element);
36031      if (element.hasFunction()) {
36032        composeCodeableConcept("function", element.getFunction());
36033      }
36034      if (element.hasActor()) {
36035        composeReference("actor", element.getActor());
36036      }
36037  }
36038
36039  protected void composeChargeItemDefinition(String name, ChargeItemDefinition element) throws IOException {
36040    if (element != null) {
36041      prop("resourceType", name);
36042      composeChargeItemDefinitionProperties(element);
36043    }
36044  }
36045
36046  protected void composeChargeItemDefinitionProperties(ChargeItemDefinition element) throws IOException {
36047    composeMetadataResourceProperties(element);
36048      if (element.hasUrlElement()) {
36049        composeUriCore("url", element.getUrlElement(), false);
36050        composeUriExtras("url", element.getUrlElement(), false);
36051      }
36052      if (element.hasIdentifier()) {
36053        openArray("identifier");
36054        for (Identifier e : element.getIdentifier()) 
36055          composeIdentifier(null, e);
36056        closeArray();
36057      };
36058      if (element.hasVersionElement()) {
36059        composeStringCore("version", element.getVersionElement(), false);
36060        composeStringExtras("version", element.getVersionElement(), false);
36061      }
36062      if (element.hasTitleElement()) {
36063        composeStringCore("title", element.getTitleElement(), false);
36064        composeStringExtras("title", element.getTitleElement(), false);
36065      }
36066      if (element.hasDerivedFromUri()) {
36067        openArray("derivedFromUri");
36068        for (UriType e : element.getDerivedFromUri()) 
36069          composeUriCore(null, e, true);
36070        closeArray();
36071        if (anyHasExtras(element.getDerivedFromUri())) {
36072          openArray("_derivedFromUri");
36073          for (UriType e : element.getDerivedFromUri()) 
36074            composeUriExtras(null, e, true);
36075          closeArray();
36076        }
36077      };
36078      if (element.hasPartOf()) {
36079        openArray("partOf");
36080        for (CanonicalType e : element.getPartOf()) 
36081          composeCanonicalCore(null, e, true);
36082        closeArray();
36083        if (anyHasExtras(element.getPartOf())) {
36084          openArray("_partOf");
36085          for (CanonicalType e : element.getPartOf()) 
36086            composeCanonicalExtras(null, e, true);
36087          closeArray();
36088        }
36089      };
36090      if (element.hasReplaces()) {
36091        openArray("replaces");
36092        for (CanonicalType e : element.getReplaces()) 
36093          composeCanonicalCore(null, e, true);
36094        closeArray();
36095        if (anyHasExtras(element.getReplaces())) {
36096          openArray("_replaces");
36097          for (CanonicalType e : element.getReplaces()) 
36098            composeCanonicalExtras(null, e, true);
36099          closeArray();
36100        }
36101      };
36102      if (element.hasStatusElement()) {
36103        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
36104        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
36105      }
36106      if (element.hasExperimentalElement()) {
36107        composeBooleanCore("experimental", element.getExperimentalElement(), false);
36108        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
36109      }
36110      if (element.hasDateElement()) {
36111        composeDateTimeCore("date", element.getDateElement(), false);
36112        composeDateTimeExtras("date", element.getDateElement(), false);
36113      }
36114      if (element.hasPublisherElement()) {
36115        composeStringCore("publisher", element.getPublisherElement(), false);
36116        composeStringExtras("publisher", element.getPublisherElement(), false);
36117      }
36118      if (element.hasContact()) {
36119        openArray("contact");
36120        for (ContactDetail e : element.getContact()) 
36121          composeContactDetail(null, e);
36122        closeArray();
36123      };
36124      if (element.hasDescriptionElement()) {
36125        composeMarkdownCore("description", element.getDescriptionElement(), false);
36126        composeMarkdownExtras("description", element.getDescriptionElement(), false);
36127      }
36128      if (element.hasUseContext()) {
36129        openArray("useContext");
36130        for (UsageContext e : element.getUseContext()) 
36131          composeUsageContext(null, e);
36132        closeArray();
36133      };
36134      if (element.hasJurisdiction()) {
36135        openArray("jurisdiction");
36136        for (CodeableConcept e : element.getJurisdiction()) 
36137          composeCodeableConcept(null, e);
36138        closeArray();
36139      };
36140      if (element.hasCopyrightElement()) {
36141        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
36142        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
36143      }
36144      if (element.hasApprovalDateElement()) {
36145        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
36146        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
36147      }
36148      if (element.hasLastReviewDateElement()) {
36149        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
36150        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
36151      }
36152      if (element.hasEffectivePeriod()) {
36153        composePeriod("effectivePeriod", element.getEffectivePeriod());
36154      }
36155      if (element.hasCode()) {
36156        composeCodeableConcept("code", element.getCode());
36157      }
36158      if (element.hasInstance()) {
36159        openArray("instance");
36160        for (Reference e : element.getInstance()) 
36161          composeReference(null, e);
36162        closeArray();
36163      };
36164      if (element.hasApplicability()) {
36165        openArray("applicability");
36166        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
36167          composeChargeItemDefinitionApplicabilityComponent(null, e);
36168        closeArray();
36169      };
36170      if (element.hasPropertyGroup()) {
36171        openArray("propertyGroup");
36172        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent e : element.getPropertyGroup()) 
36173          composeChargeItemDefinitionPropertyGroupComponent(null, e);
36174        closeArray();
36175      };
36176  }
36177
36178  protected void composeChargeItemDefinitionApplicabilityComponent(String name, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
36179    if (element != null) {
36180      open(name);
36181      composeChargeItemDefinitionApplicabilityComponentProperties(element);
36182      close();
36183    }
36184  }
36185
36186  protected void composeChargeItemDefinitionApplicabilityComponentProperties(ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
36187    composeBackboneElementProperties(element);
36188      if (element.hasDescriptionElement()) {
36189        composeStringCore("description", element.getDescriptionElement(), false);
36190        composeStringExtras("description", element.getDescriptionElement(), false);
36191      }
36192      if (element.hasLanguageElement()) {
36193        composeStringCore("language", element.getLanguageElement(), false);
36194        composeStringExtras("language", element.getLanguageElement(), false);
36195      }
36196      if (element.hasExpressionElement()) {
36197        composeStringCore("expression", element.getExpressionElement(), false);
36198        composeStringExtras("expression", element.getExpressionElement(), false);
36199      }
36200  }
36201
36202  protected void composeChargeItemDefinitionPropertyGroupComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
36203    if (element != null) {
36204      open(name);
36205      composeChargeItemDefinitionPropertyGroupComponentProperties(element);
36206      close();
36207    }
36208  }
36209
36210  protected void composeChargeItemDefinitionPropertyGroupComponentProperties(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
36211    composeBackboneElementProperties(element);
36212      if (element.hasApplicability()) {
36213        openArray("applicability");
36214        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
36215          composeChargeItemDefinitionApplicabilityComponent(null, e);
36216        closeArray();
36217      };
36218      if (element.hasPriceComponent()) {
36219        openArray("priceComponent");
36220        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent e : element.getPriceComponent()) 
36221          composeChargeItemDefinitionPropertyGroupPriceComponentComponent(null, e);
36222        closeArray();
36223      };
36224  }
36225
36226  protected void composeChargeItemDefinitionPropertyGroupPriceComponentComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
36227    if (element != null) {
36228      open(name);
36229      composeChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(element);
36230      close();
36231    }
36232  }
36233
36234  protected void composeChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
36235    composeBackboneElementProperties(element);
36236      if (element.hasTypeElement()) {
36237        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.InvoicePriceComponentTypeEnumFactory(), false);
36238        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.InvoicePriceComponentTypeEnumFactory(), false);
36239      }
36240      if (element.hasCode()) {
36241        composeCodeableConcept("code", element.getCode());
36242      }
36243      if (element.hasFactorElement()) {
36244        composeDecimalCore("factor", element.getFactorElement(), false);
36245        composeDecimalExtras("factor", element.getFactorElement(), false);
36246      }
36247      if (element.hasAmount()) {
36248        composeMoney("amount", element.getAmount());
36249      }
36250  }
36251
36252  protected void composeClaim(String name, Claim element) throws IOException {
36253    if (element != null) {
36254      prop("resourceType", name);
36255      composeClaimProperties(element);
36256    }
36257  }
36258
36259  protected void composeClaimProperties(Claim element) throws IOException {
36260    composeDomainResourceProperties(element);
36261      if (element.hasIdentifier()) {
36262        openArray("identifier");
36263        for (Identifier e : element.getIdentifier()) 
36264          composeIdentifier(null, e);
36265        closeArray();
36266      };
36267      if (element.hasStatusElement()) {
36268        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
36269        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
36270      }
36271      if (element.hasType()) {
36272        composeCodeableConcept("type", element.getType());
36273      }
36274      if (element.hasSubType()) {
36275        composeCodeableConcept("subType", element.getSubType());
36276      }
36277      if (element.hasUseElement()) {
36278        composeEnumerationCore("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
36279        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
36280      }
36281      if (element.hasPatient()) {
36282        composeReference("patient", element.getPatient());
36283      }
36284      if (element.hasBillablePeriod()) {
36285        composePeriod("billablePeriod", element.getBillablePeriod());
36286      }
36287      if (element.hasCreatedElement()) {
36288        composeDateTimeCore("created", element.getCreatedElement(), false);
36289        composeDateTimeExtras("created", element.getCreatedElement(), false);
36290      }
36291      if (element.hasEnterer()) {
36292        composeReference("enterer", element.getEnterer());
36293      }
36294      if (element.hasInsurer()) {
36295        composeReference("insurer", element.getInsurer());
36296      }
36297      if (element.hasProvider()) {
36298        composeReference("provider", element.getProvider());
36299      }
36300      if (element.hasPriority()) {
36301        composeCodeableConcept("priority", element.getPriority());
36302      }
36303      if (element.hasFundsReserve()) {
36304        composeCodeableConcept("fundsReserve", element.getFundsReserve());
36305      }
36306      if (element.hasRelated()) {
36307        openArray("related");
36308        for (Claim.RelatedClaimComponent e : element.getRelated()) 
36309          composeRelatedClaimComponent(null, e);
36310        closeArray();
36311      };
36312      if (element.hasPrescription()) {
36313        composeReference("prescription", element.getPrescription());
36314      }
36315      if (element.hasOriginalPrescription()) {
36316        composeReference("originalPrescription", element.getOriginalPrescription());
36317      }
36318      if (element.hasPayee()) {
36319        composePayeeComponent("payee", element.getPayee());
36320      }
36321      if (element.hasReferral()) {
36322        composeReference("referral", element.getReferral());
36323      }
36324      if (element.hasFacility()) {
36325        composeReference("facility", element.getFacility());
36326      }
36327      if (element.hasCareTeam()) {
36328        openArray("careTeam");
36329        for (Claim.CareTeamComponent e : element.getCareTeam()) 
36330          composeCareTeamComponent(null, e);
36331        closeArray();
36332      };
36333      if (element.hasSupportingInfo()) {
36334        openArray("supportingInfo");
36335        for (Claim.SupportingInformationComponent e : element.getSupportingInfo()) 
36336          composeSupportingInformationComponent(null, e);
36337        closeArray();
36338      };
36339      if (element.hasDiagnosis()) {
36340        openArray("diagnosis");
36341        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
36342          composeDiagnosisComponent(null, e);
36343        closeArray();
36344      };
36345      if (element.hasProcedure()) {
36346        openArray("procedure");
36347        for (Claim.ProcedureComponent e : element.getProcedure()) 
36348          composeProcedureComponent(null, e);
36349        closeArray();
36350      };
36351      if (element.hasInsurance()) {
36352        openArray("insurance");
36353        for (Claim.InsuranceComponent e : element.getInsurance()) 
36354          composeInsuranceComponent(null, e);
36355        closeArray();
36356      };
36357      if (element.hasAccident()) {
36358        composeAccidentComponent("accident", element.getAccident());
36359      }
36360      if (element.hasItem()) {
36361        openArray("item");
36362        for (Claim.ItemComponent e : element.getItem()) 
36363          composeItemComponent(null, e);
36364        closeArray();
36365      };
36366      if (element.hasTotal()) {
36367        composeMoney("total", element.getTotal());
36368      }
36369  }
36370
36371  protected void composeRelatedClaimComponent(String name, Claim.RelatedClaimComponent element) throws IOException {
36372    if (element != null) {
36373      open(name);
36374      composeRelatedClaimComponentProperties(element);
36375      close();
36376    }
36377  }
36378
36379  protected void composeRelatedClaimComponentProperties(Claim.RelatedClaimComponent element) throws IOException {
36380    composeBackboneElementProperties(element);
36381      if (element.hasClaim()) {
36382        composeReference("claim", element.getClaim());
36383      }
36384      if (element.hasRelationship()) {
36385        composeCodeableConcept("relationship", element.getRelationship());
36386      }
36387      if (element.hasReference()) {
36388        composeIdentifier("reference", element.getReference());
36389      }
36390  }
36391
36392  protected void composePayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
36393    if (element != null) {
36394      open(name);
36395      composePayeeComponentProperties(element);
36396      close();
36397    }
36398  }
36399
36400  protected void composePayeeComponentProperties(Claim.PayeeComponent element) throws IOException {
36401    composeBackboneElementProperties(element);
36402      if (element.hasType()) {
36403        composeCodeableConcept("type", element.getType());
36404      }
36405      if (element.hasParty()) {
36406        composeReference("party", element.getParty());
36407      }
36408  }
36409
36410  protected void composeCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
36411    if (element != null) {
36412      open(name);
36413      composeCareTeamComponentProperties(element);
36414      close();
36415    }
36416  }
36417
36418  protected void composeCareTeamComponentProperties(Claim.CareTeamComponent element) throws IOException {
36419    composeBackboneElementProperties(element);
36420      if (element.hasSequenceElement()) {
36421        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36422        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36423      }
36424      if (element.hasProvider()) {
36425        composeReference("provider", element.getProvider());
36426      }
36427      if (element.hasResponsibleElement()) {
36428        composeBooleanCore("responsible", element.getResponsibleElement(), false);
36429        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
36430      }
36431      if (element.hasRole()) {
36432        composeCodeableConcept("role", element.getRole());
36433      }
36434      if (element.hasQualification()) {
36435        composeCodeableConcept("qualification", element.getQualification());
36436      }
36437  }
36438
36439  protected void composeSupportingInformationComponent(String name, Claim.SupportingInformationComponent element) throws IOException {
36440    if (element != null) {
36441      open(name);
36442      composeSupportingInformationComponentProperties(element);
36443      close();
36444    }
36445  }
36446
36447  protected void composeSupportingInformationComponentProperties(Claim.SupportingInformationComponent element) throws IOException {
36448    composeBackboneElementProperties(element);
36449      if (element.hasSequenceElement()) {
36450        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36451        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36452      }
36453      if (element.hasCategory()) {
36454        composeCodeableConcept("category", element.getCategory());
36455      }
36456      if (element.hasCode()) {
36457        composeCodeableConcept("code", element.getCode());
36458      }
36459      if (element.hasTiming()) {
36460        composeType("timing", element.getTiming());
36461      }
36462      if (element.hasValue()) {
36463        composeType("value", element.getValue());
36464      }
36465      if (element.hasReason()) {
36466        composeCodeableConcept("reason", element.getReason());
36467      }
36468  }
36469
36470  protected void composeDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
36471    if (element != null) {
36472      open(name);
36473      composeDiagnosisComponentProperties(element);
36474      close();
36475    }
36476  }
36477
36478  protected void composeDiagnosisComponentProperties(Claim.DiagnosisComponent element) throws IOException {
36479    composeBackboneElementProperties(element);
36480      if (element.hasSequenceElement()) {
36481        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36482        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36483      }
36484      if (element.hasDiagnosis()) {
36485        composeType("diagnosis", element.getDiagnosis());
36486      }
36487      if (element.hasType()) {
36488        openArray("type");
36489        for (CodeableConcept e : element.getType()) 
36490          composeCodeableConcept(null, e);
36491        closeArray();
36492      };
36493      if (element.hasOnAdmission()) {
36494        composeCodeableConcept("onAdmission", element.getOnAdmission());
36495      }
36496      if (element.hasPackageCode()) {
36497        composeCodeableConcept("packageCode", element.getPackageCode());
36498      }
36499  }
36500
36501  protected void composeProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
36502    if (element != null) {
36503      open(name);
36504      composeProcedureComponentProperties(element);
36505      close();
36506    }
36507  }
36508
36509  protected void composeProcedureComponentProperties(Claim.ProcedureComponent element) throws IOException {
36510    composeBackboneElementProperties(element);
36511      if (element.hasSequenceElement()) {
36512        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36513        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36514      }
36515      if (element.hasType()) {
36516        openArray("type");
36517        for (CodeableConcept e : element.getType()) 
36518          composeCodeableConcept(null, e);
36519        closeArray();
36520      };
36521      if (element.hasDateElement()) {
36522        composeDateTimeCore("date", element.getDateElement(), false);
36523        composeDateTimeExtras("date", element.getDateElement(), false);
36524      }
36525      if (element.hasProcedure()) {
36526        composeType("procedure", element.getProcedure());
36527      }
36528      if (element.hasUdi()) {
36529        openArray("udi");
36530        for (Reference e : element.getUdi()) 
36531          composeReference(null, e);
36532        closeArray();
36533      };
36534  }
36535
36536  protected void composeInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
36537    if (element != null) {
36538      open(name);
36539      composeInsuranceComponentProperties(element);
36540      close();
36541    }
36542  }
36543
36544  protected void composeInsuranceComponentProperties(Claim.InsuranceComponent element) throws IOException {
36545    composeBackboneElementProperties(element);
36546      if (element.hasSequenceElement()) {
36547        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36548        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36549      }
36550      if (element.hasFocalElement()) {
36551        composeBooleanCore("focal", element.getFocalElement(), false);
36552        composeBooleanExtras("focal", element.getFocalElement(), false);
36553      }
36554      if (element.hasIdentifier()) {
36555        composeIdentifier("identifier", element.getIdentifier());
36556      }
36557      if (element.hasCoverage()) {
36558        composeReference("coverage", element.getCoverage());
36559      }
36560      if (element.hasBusinessArrangementElement()) {
36561        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
36562        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
36563      }
36564      if (element.hasPreAuthRef()) {
36565        openArray("preAuthRef");
36566        for (StringType e : element.getPreAuthRef()) 
36567          composeStringCore(null, e, true);
36568        closeArray();
36569        if (anyHasExtras(element.getPreAuthRef())) {
36570          openArray("_preAuthRef");
36571          for (StringType e : element.getPreAuthRef()) 
36572            composeStringExtras(null, e, true);
36573          closeArray();
36574        }
36575      };
36576      if (element.hasClaimResponse()) {
36577        composeReference("claimResponse", element.getClaimResponse());
36578      }
36579  }
36580
36581  protected void composeAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
36582    if (element != null) {
36583      open(name);
36584      composeAccidentComponentProperties(element);
36585      close();
36586    }
36587  }
36588
36589  protected void composeAccidentComponentProperties(Claim.AccidentComponent element) throws IOException {
36590    composeBackboneElementProperties(element);
36591      if (element.hasDateElement()) {
36592        composeDateCore("date", element.getDateElement(), false);
36593        composeDateExtras("date", element.getDateElement(), false);
36594      }
36595      if (element.hasType()) {
36596        composeCodeableConcept("type", element.getType());
36597      }
36598      if (element.hasLocation()) {
36599        composeType("location", element.getLocation());
36600      }
36601  }
36602
36603  protected void composeItemComponent(String name, Claim.ItemComponent element) throws IOException {
36604    if (element != null) {
36605      open(name);
36606      composeItemComponentProperties(element);
36607      close();
36608    }
36609  }
36610
36611  protected void composeItemComponentProperties(Claim.ItemComponent element) throws IOException {
36612    composeBackboneElementProperties(element);
36613      if (element.hasSequenceElement()) {
36614        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36615        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36616      }
36617      if (element.hasCareTeamSequence()) {
36618        openArray("careTeamSequence");
36619        for (PositiveIntType e : element.getCareTeamSequence()) 
36620          composePositiveIntCore(null, e, true);
36621        closeArray();
36622        if (anyHasExtras(element.getCareTeamSequence())) {
36623          openArray("_careTeamSequence");
36624          for (PositiveIntType e : element.getCareTeamSequence()) 
36625            composePositiveIntExtras(null, e, true);
36626          closeArray();
36627        }
36628      };
36629      if (element.hasDiagnosisSequence()) {
36630        openArray("diagnosisSequence");
36631        for (PositiveIntType e : element.getDiagnosisSequence()) 
36632          composePositiveIntCore(null, e, true);
36633        closeArray();
36634        if (anyHasExtras(element.getDiagnosisSequence())) {
36635          openArray("_diagnosisSequence");
36636          for (PositiveIntType e : element.getDiagnosisSequence()) 
36637            composePositiveIntExtras(null, e, true);
36638          closeArray();
36639        }
36640      };
36641      if (element.hasProcedureSequence()) {
36642        openArray("procedureSequence");
36643        for (PositiveIntType e : element.getProcedureSequence()) 
36644          composePositiveIntCore(null, e, true);
36645        closeArray();
36646        if (anyHasExtras(element.getProcedureSequence())) {
36647          openArray("_procedureSequence");
36648          for (PositiveIntType e : element.getProcedureSequence()) 
36649            composePositiveIntExtras(null, e, true);
36650          closeArray();
36651        }
36652      };
36653      if (element.hasInformationSequence()) {
36654        openArray("informationSequence");
36655        for (PositiveIntType e : element.getInformationSequence()) 
36656          composePositiveIntCore(null, e, true);
36657        closeArray();
36658        if (anyHasExtras(element.getInformationSequence())) {
36659          openArray("_informationSequence");
36660          for (PositiveIntType e : element.getInformationSequence()) 
36661            composePositiveIntExtras(null, e, true);
36662          closeArray();
36663        }
36664      };
36665      if (element.hasRevenue()) {
36666        composeCodeableConcept("revenue", element.getRevenue());
36667      }
36668      if (element.hasCategory()) {
36669        composeCodeableConcept("category", element.getCategory());
36670      }
36671      if (element.hasProductOrService()) {
36672        composeCodeableConcept("productOrService", element.getProductOrService());
36673      }
36674      if (element.hasModifier()) {
36675        openArray("modifier");
36676        for (CodeableConcept e : element.getModifier()) 
36677          composeCodeableConcept(null, e);
36678        closeArray();
36679      };
36680      if (element.hasProgramCode()) {
36681        openArray("programCode");
36682        for (CodeableConcept e : element.getProgramCode()) 
36683          composeCodeableConcept(null, e);
36684        closeArray();
36685      };
36686      if (element.hasServiced()) {
36687        composeType("serviced", element.getServiced());
36688      }
36689      if (element.hasLocation()) {
36690        composeType("location", element.getLocation());
36691      }
36692      if (element.hasQuantity()) {
36693        composeQuantity("quantity", element.getQuantity());
36694      }
36695      if (element.hasUnitPrice()) {
36696        composeMoney("unitPrice", element.getUnitPrice());
36697      }
36698      if (element.hasFactorElement()) {
36699        composeDecimalCore("factor", element.getFactorElement(), false);
36700        composeDecimalExtras("factor", element.getFactorElement(), false);
36701      }
36702      if (element.hasNet()) {
36703        composeMoney("net", element.getNet());
36704      }
36705      if (element.hasUdi()) {
36706        openArray("udi");
36707        for (Reference e : element.getUdi()) 
36708          composeReference(null, e);
36709        closeArray();
36710      };
36711      if (element.hasBodySite()) {
36712        composeCodeableConcept("bodySite", element.getBodySite());
36713      }
36714      if (element.hasSubSite()) {
36715        openArray("subSite");
36716        for (CodeableConcept e : element.getSubSite()) 
36717          composeCodeableConcept(null, e);
36718        closeArray();
36719      };
36720      if (element.hasEncounter()) {
36721        openArray("encounter");
36722        for (Reference e : element.getEncounter()) 
36723          composeReference(null, e);
36724        closeArray();
36725      };
36726      if (element.hasDetail()) {
36727        openArray("detail");
36728        for (Claim.DetailComponent e : element.getDetail()) 
36729          composeDetailComponent(null, e);
36730        closeArray();
36731      };
36732  }
36733
36734  protected void composeDetailComponent(String name, Claim.DetailComponent element) throws IOException {
36735    if (element != null) {
36736      open(name);
36737      composeDetailComponentProperties(element);
36738      close();
36739    }
36740  }
36741
36742  protected void composeDetailComponentProperties(Claim.DetailComponent element) throws IOException {
36743    composeBackboneElementProperties(element);
36744      if (element.hasSequenceElement()) {
36745        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36746        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36747      }
36748      if (element.hasRevenue()) {
36749        composeCodeableConcept("revenue", element.getRevenue());
36750      }
36751      if (element.hasCategory()) {
36752        composeCodeableConcept("category", element.getCategory());
36753      }
36754      if (element.hasProductOrService()) {
36755        composeCodeableConcept("productOrService", element.getProductOrService());
36756      }
36757      if (element.hasModifier()) {
36758        openArray("modifier");
36759        for (CodeableConcept e : element.getModifier()) 
36760          composeCodeableConcept(null, e);
36761        closeArray();
36762      };
36763      if (element.hasProgramCode()) {
36764        openArray("programCode");
36765        for (CodeableConcept e : element.getProgramCode()) 
36766          composeCodeableConcept(null, e);
36767        closeArray();
36768      };
36769      if (element.hasQuantity()) {
36770        composeQuantity("quantity", element.getQuantity());
36771      }
36772      if (element.hasUnitPrice()) {
36773        composeMoney("unitPrice", element.getUnitPrice());
36774      }
36775      if (element.hasFactorElement()) {
36776        composeDecimalCore("factor", element.getFactorElement(), false);
36777        composeDecimalExtras("factor", element.getFactorElement(), false);
36778      }
36779      if (element.hasNet()) {
36780        composeMoney("net", element.getNet());
36781      }
36782      if (element.hasUdi()) {
36783        openArray("udi");
36784        for (Reference e : element.getUdi()) 
36785          composeReference(null, e);
36786        closeArray();
36787      };
36788      if (element.hasSubDetail()) {
36789        openArray("subDetail");
36790        for (Claim.SubDetailComponent e : element.getSubDetail()) 
36791          composeSubDetailComponent(null, e);
36792        closeArray();
36793      };
36794  }
36795
36796  protected void composeSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
36797    if (element != null) {
36798      open(name);
36799      composeSubDetailComponentProperties(element);
36800      close();
36801    }
36802  }
36803
36804  protected void composeSubDetailComponentProperties(Claim.SubDetailComponent element) throws IOException {
36805    composeBackboneElementProperties(element);
36806      if (element.hasSequenceElement()) {
36807        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36808        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36809      }
36810      if (element.hasRevenue()) {
36811        composeCodeableConcept("revenue", element.getRevenue());
36812      }
36813      if (element.hasCategory()) {
36814        composeCodeableConcept("category", element.getCategory());
36815      }
36816      if (element.hasProductOrService()) {
36817        composeCodeableConcept("productOrService", element.getProductOrService());
36818      }
36819      if (element.hasModifier()) {
36820        openArray("modifier");
36821        for (CodeableConcept e : element.getModifier()) 
36822          composeCodeableConcept(null, e);
36823        closeArray();
36824      };
36825      if (element.hasProgramCode()) {
36826        openArray("programCode");
36827        for (CodeableConcept e : element.getProgramCode()) 
36828          composeCodeableConcept(null, e);
36829        closeArray();
36830      };
36831      if (element.hasQuantity()) {
36832        composeQuantity("quantity", element.getQuantity());
36833      }
36834      if (element.hasUnitPrice()) {
36835        composeMoney("unitPrice", element.getUnitPrice());
36836      }
36837      if (element.hasFactorElement()) {
36838        composeDecimalCore("factor", element.getFactorElement(), false);
36839        composeDecimalExtras("factor", element.getFactorElement(), false);
36840      }
36841      if (element.hasNet()) {
36842        composeMoney("net", element.getNet());
36843      }
36844      if (element.hasUdi()) {
36845        openArray("udi");
36846        for (Reference e : element.getUdi()) 
36847          composeReference(null, e);
36848        closeArray();
36849      };
36850  }
36851
36852  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
36853    if (element != null) {
36854      prop("resourceType", name);
36855      composeClaimResponseProperties(element);
36856    }
36857  }
36858
36859  protected void composeClaimResponseProperties(ClaimResponse element) throws IOException {
36860    composeDomainResourceProperties(element);
36861      if (element.hasIdentifier()) {
36862        openArray("identifier");
36863        for (Identifier e : element.getIdentifier()) 
36864          composeIdentifier(null, e);
36865        closeArray();
36866      };
36867      if (element.hasStatusElement()) {
36868        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
36869        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
36870      }
36871      if (element.hasType()) {
36872        composeCodeableConcept("type", element.getType());
36873      }
36874      if (element.hasSubType()) {
36875        composeCodeableConcept("subType", element.getSubType());
36876      }
36877      if (element.hasUseElement()) {
36878        composeEnumerationCore("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
36879        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
36880      }
36881      if (element.hasPatient()) {
36882        composeReference("patient", element.getPatient());
36883      }
36884      if (element.hasCreatedElement()) {
36885        composeDateTimeCore("created", element.getCreatedElement(), false);
36886        composeDateTimeExtras("created", element.getCreatedElement(), false);
36887      }
36888      if (element.hasInsurer()) {
36889        composeReference("insurer", element.getInsurer());
36890      }
36891      if (element.hasRequestor()) {
36892        composeReference("requestor", element.getRequestor());
36893      }
36894      if (element.hasRequest()) {
36895        composeReference("request", element.getRequest());
36896      }
36897      if (element.hasOutcomeElement()) {
36898        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
36899        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
36900      }
36901      if (element.hasDispositionElement()) {
36902        composeStringCore("disposition", element.getDispositionElement(), false);
36903        composeStringExtras("disposition", element.getDispositionElement(), false);
36904      }
36905      if (element.hasPreAuthRefElement()) {
36906        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
36907        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
36908      }
36909      if (element.hasPreAuthPeriod()) {
36910        composePeriod("preAuthPeriod", element.getPreAuthPeriod());
36911      }
36912      if (element.hasPayeeType()) {
36913        composeCodeableConcept("payeeType", element.getPayeeType());
36914      }
36915      if (element.hasItem()) {
36916        openArray("item");
36917        for (ClaimResponse.ItemComponent e : element.getItem()) 
36918          composeItemComponent(null, e);
36919        closeArray();
36920      };
36921      if (element.hasAddItem()) {
36922        openArray("addItem");
36923        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
36924          composeAddedItemComponent(null, e);
36925        closeArray();
36926      };
36927      if (element.hasAdjudication()) {
36928        openArray("adjudication");
36929        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
36930          composeAdjudicationComponent(null, e);
36931        closeArray();
36932      };
36933      if (element.hasTotal()) {
36934        openArray("total");
36935        for (ClaimResponse.TotalComponent e : element.getTotal()) 
36936          composeTotalComponent(null, e);
36937        closeArray();
36938      };
36939      if (element.hasPayment()) {
36940        composePaymentComponent("payment", element.getPayment());
36941      }
36942      if (element.hasFundsReserve()) {
36943        composeCodeableConcept("fundsReserve", element.getFundsReserve());
36944      }
36945      if (element.hasFormCode()) {
36946        composeCodeableConcept("formCode", element.getFormCode());
36947      }
36948      if (element.hasForm()) {
36949        composeAttachment("form", element.getForm());
36950      }
36951      if (element.hasProcessNote()) {
36952        openArray("processNote");
36953        for (ClaimResponse.NoteComponent e : element.getProcessNote()) 
36954          composeNoteComponent(null, e);
36955        closeArray();
36956      };
36957      if (element.hasCommunicationRequest()) {
36958        openArray("communicationRequest");
36959        for (Reference e : element.getCommunicationRequest()) 
36960          composeReference(null, e);
36961        closeArray();
36962      };
36963      if (element.hasInsurance()) {
36964        openArray("insurance");
36965        for (ClaimResponse.InsuranceComponent e : element.getInsurance()) 
36966          composeInsuranceComponent(null, e);
36967        closeArray();
36968      };
36969      if (element.hasError()) {
36970        openArray("error");
36971        for (ClaimResponse.ErrorComponent e : element.getError()) 
36972          composeErrorComponent(null, e);
36973        closeArray();
36974      };
36975  }
36976
36977  protected void composeItemComponent(String name, ClaimResponse.ItemComponent element) throws IOException {
36978    if (element != null) {
36979      open(name);
36980      composeItemComponentProperties(element);
36981      close();
36982    }
36983  }
36984
36985  protected void composeItemComponentProperties(ClaimResponse.ItemComponent element) throws IOException {
36986    composeBackboneElementProperties(element);
36987      if (element.hasItemSequenceElement()) {
36988        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
36989        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
36990      }
36991      if (element.hasNoteNumber()) {
36992        openArray("noteNumber");
36993        for (PositiveIntType e : element.getNoteNumber()) 
36994          composePositiveIntCore(null, e, true);
36995        closeArray();
36996        if (anyHasExtras(element.getNoteNumber())) {
36997          openArray("_noteNumber");
36998          for (PositiveIntType e : element.getNoteNumber()) 
36999            composePositiveIntExtras(null, e, true);
37000          closeArray();
37001        }
37002      };
37003      if (element.hasAdjudication()) {
37004        openArray("adjudication");
37005        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
37006          composeAdjudicationComponent(null, e);
37007        closeArray();
37008      };
37009      if (element.hasDetail()) {
37010        openArray("detail");
37011        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
37012          composeItemDetailComponent(null, e);
37013        closeArray();
37014      };
37015  }
37016
37017  protected void composeAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element) throws IOException {
37018    if (element != null) {
37019      open(name);
37020      composeAdjudicationComponentProperties(element);
37021      close();
37022    }
37023  }
37024
37025  protected void composeAdjudicationComponentProperties(ClaimResponse.AdjudicationComponent element) throws IOException {
37026    composeBackboneElementProperties(element);
37027      if (element.hasCategory()) {
37028        composeCodeableConcept("category", element.getCategory());
37029      }
37030      if (element.hasReason()) {
37031        composeCodeableConcept("reason", element.getReason());
37032      }
37033      if (element.hasAmount()) {
37034        composeMoney("amount", element.getAmount());
37035      }
37036      if (element.hasValueElement()) {
37037        composeDecimalCore("value", element.getValueElement(), false);
37038        composeDecimalExtras("value", element.getValueElement(), false);
37039      }
37040  }
37041
37042  protected void composeItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
37043    if (element != null) {
37044      open(name);
37045      composeItemDetailComponentProperties(element);
37046      close();
37047    }
37048  }
37049
37050  protected void composeItemDetailComponentProperties(ClaimResponse.ItemDetailComponent element) throws IOException {
37051    composeBackboneElementProperties(element);
37052      if (element.hasDetailSequenceElement()) {
37053        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
37054        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
37055      }
37056      if (element.hasNoteNumber()) {
37057        openArray("noteNumber");
37058        for (PositiveIntType e : element.getNoteNumber()) 
37059          composePositiveIntCore(null, e, true);
37060        closeArray();
37061        if (anyHasExtras(element.getNoteNumber())) {
37062          openArray("_noteNumber");
37063          for (PositiveIntType e : element.getNoteNumber()) 
37064            composePositiveIntExtras(null, e, true);
37065          closeArray();
37066        }
37067      };
37068      if (element.hasAdjudication()) {
37069        openArray("adjudication");
37070        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
37071          composeAdjudicationComponent(null, e);
37072        closeArray();
37073      };
37074      if (element.hasSubDetail()) {
37075        openArray("subDetail");
37076        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
37077          composeSubDetailComponent(null, e);
37078        closeArray();
37079      };
37080  }
37081
37082  protected void composeSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
37083    if (element != null) {
37084      open(name);
37085      composeSubDetailComponentProperties(element);
37086      close();
37087    }
37088  }
37089
37090  protected void composeSubDetailComponentProperties(ClaimResponse.SubDetailComponent element) throws IOException {
37091    composeBackboneElementProperties(element);
37092      if (element.hasSubDetailSequenceElement()) {
37093        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
37094        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
37095      }
37096      if (element.hasNoteNumber()) {
37097        openArray("noteNumber");
37098        for (PositiveIntType e : element.getNoteNumber()) 
37099          composePositiveIntCore(null, e, true);
37100        closeArray();
37101        if (anyHasExtras(element.getNoteNumber())) {
37102          openArray("_noteNumber");
37103          for (PositiveIntType e : element.getNoteNumber()) 
37104            composePositiveIntExtras(null, e, true);
37105          closeArray();
37106        }
37107      };
37108      if (element.hasAdjudication()) {
37109        openArray("adjudication");
37110        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
37111          composeAdjudicationComponent(null, e);
37112        closeArray();
37113      };
37114  }
37115
37116  protected void composeAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
37117    if (element != null) {
37118      open(name);
37119      composeAddedItemComponentProperties(element);
37120      close();
37121    }
37122  }
37123
37124  protected void composeAddedItemComponentProperties(ClaimResponse.AddedItemComponent element) throws IOException {
37125    composeBackboneElementProperties(element);
37126      if (element.hasItemSequence()) {
37127        openArray("itemSequence");
37128        for (PositiveIntType e : element.getItemSequence()) 
37129          composePositiveIntCore(null, e, true);
37130        closeArray();
37131        if (anyHasExtras(element.getItemSequence())) {
37132          openArray("_itemSequence");
37133          for (PositiveIntType e : element.getItemSequence()) 
37134            composePositiveIntExtras(null, e, true);
37135          closeArray();
37136        }
37137      };
37138      if (element.hasDetailSequence()) {
37139        openArray("detailSequence");
37140        for (PositiveIntType e : element.getDetailSequence()) 
37141          composePositiveIntCore(null, e, true);
37142        closeArray();
37143        if (anyHasExtras(element.getDetailSequence())) {
37144          openArray("_detailSequence");
37145          for (PositiveIntType e : element.getDetailSequence()) 
37146            composePositiveIntExtras(null, e, true);
37147          closeArray();
37148        }
37149      };
37150      if (element.hasSubdetailSequence()) {
37151        openArray("subdetailSequence");
37152        for (PositiveIntType e : element.getSubdetailSequence()) 
37153          composePositiveIntCore(null, e, true);
37154        closeArray();
37155        if (anyHasExtras(element.getSubdetailSequence())) {
37156          openArray("_subdetailSequence");
37157          for (PositiveIntType e : element.getSubdetailSequence()) 
37158            composePositiveIntExtras(null, e, true);
37159          closeArray();
37160        }
37161      };
37162      if (element.hasProvider()) {
37163        openArray("provider");
37164        for (Reference e : element.getProvider()) 
37165          composeReference(null, e);
37166        closeArray();
37167      };
37168      if (element.hasProductOrService()) {
37169        composeCodeableConcept("productOrService", element.getProductOrService());
37170      }
37171      if (element.hasModifier()) {
37172        openArray("modifier");
37173        for (CodeableConcept e : element.getModifier()) 
37174          composeCodeableConcept(null, e);
37175        closeArray();
37176      };
37177      if (element.hasProgramCode()) {
37178        openArray("programCode");
37179        for (CodeableConcept e : element.getProgramCode()) 
37180          composeCodeableConcept(null, e);
37181        closeArray();
37182      };
37183      if (element.hasServiced()) {
37184        composeType("serviced", element.getServiced());
37185      }
37186      if (element.hasLocation()) {
37187        composeType("location", element.getLocation());
37188      }
37189      if (element.hasQuantity()) {
37190        composeQuantity("quantity", element.getQuantity());
37191      }
37192      if (element.hasUnitPrice()) {
37193        composeMoney("unitPrice", element.getUnitPrice());
37194      }
37195      if (element.hasFactorElement()) {
37196        composeDecimalCore("factor", element.getFactorElement(), false);
37197        composeDecimalExtras("factor", element.getFactorElement(), false);
37198      }
37199      if (element.hasNet()) {
37200        composeMoney("net", element.getNet());
37201      }
37202      if (element.hasBodySite()) {
37203        composeCodeableConcept("bodySite", element.getBodySite());
37204      }
37205      if (element.hasSubSite()) {
37206        openArray("subSite");
37207        for (CodeableConcept e : element.getSubSite()) 
37208          composeCodeableConcept(null, e);
37209        closeArray();
37210      };
37211      if (element.hasNoteNumber()) {
37212        openArray("noteNumber");
37213        for (PositiveIntType e : element.getNoteNumber()) 
37214          composePositiveIntCore(null, e, true);
37215        closeArray();
37216        if (anyHasExtras(element.getNoteNumber())) {
37217          openArray("_noteNumber");
37218          for (PositiveIntType e : element.getNoteNumber()) 
37219            composePositiveIntExtras(null, e, true);
37220          closeArray();
37221        }
37222      };
37223      if (element.hasAdjudication()) {
37224        openArray("adjudication");
37225        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
37226          composeAdjudicationComponent(null, e);
37227        closeArray();
37228      };
37229      if (element.hasDetail()) {
37230        openArray("detail");
37231        for (ClaimResponse.AddedItemDetailComponent e : element.getDetail()) 
37232          composeAddedItemDetailComponent(null, e);
37233        closeArray();
37234      };
37235  }
37236
37237  protected void composeAddedItemDetailComponent(String name, ClaimResponse.AddedItemDetailComponent element) throws IOException {
37238    if (element != null) {
37239      open(name);
37240      composeAddedItemDetailComponentProperties(element);
37241      close();
37242    }
37243  }
37244
37245  protected void composeAddedItemDetailComponentProperties(ClaimResponse.AddedItemDetailComponent element) throws IOException {
37246    composeBackboneElementProperties(element);
37247      if (element.hasProductOrService()) {
37248        composeCodeableConcept("productOrService", element.getProductOrService());
37249      }
37250      if (element.hasModifier()) {
37251        openArray("modifier");
37252        for (CodeableConcept e : element.getModifier()) 
37253          composeCodeableConcept(null, e);
37254        closeArray();
37255      };
37256      if (element.hasQuantity()) {
37257        composeQuantity("quantity", element.getQuantity());
37258      }
37259      if (element.hasUnitPrice()) {
37260        composeMoney("unitPrice", element.getUnitPrice());
37261      }
37262      if (element.hasFactorElement()) {
37263        composeDecimalCore("factor", element.getFactorElement(), false);
37264        composeDecimalExtras("factor", element.getFactorElement(), false);
37265      }
37266      if (element.hasNet()) {
37267        composeMoney("net", element.getNet());
37268      }
37269      if (element.hasNoteNumber()) {
37270        openArray("noteNumber");
37271        for (PositiveIntType e : element.getNoteNumber()) 
37272          composePositiveIntCore(null, e, true);
37273        closeArray();
37274        if (anyHasExtras(element.getNoteNumber())) {
37275          openArray("_noteNumber");
37276          for (PositiveIntType e : element.getNoteNumber()) 
37277            composePositiveIntExtras(null, e, true);
37278          closeArray();
37279        }
37280      };
37281      if (element.hasAdjudication()) {
37282        openArray("adjudication");
37283        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
37284          composeAdjudicationComponent(null, e);
37285        closeArray();
37286      };
37287      if (element.hasSubDetail()) {
37288        openArray("subDetail");
37289        for (ClaimResponse.AddedItemSubDetailComponent e : element.getSubDetail()) 
37290          composeAddedItemSubDetailComponent(null, e);
37291        closeArray();
37292      };
37293  }
37294
37295  protected void composeAddedItemSubDetailComponent(String name, ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
37296    if (element != null) {
37297      open(name);
37298      composeAddedItemSubDetailComponentProperties(element);
37299      close();
37300    }
37301  }
37302
37303  protected void composeAddedItemSubDetailComponentProperties(ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
37304    composeBackboneElementProperties(element);
37305      if (element.hasProductOrService()) {
37306        composeCodeableConcept("productOrService", element.getProductOrService());
37307      }
37308      if (element.hasModifier()) {
37309        openArray("modifier");
37310        for (CodeableConcept e : element.getModifier()) 
37311          composeCodeableConcept(null, e);
37312        closeArray();
37313      };
37314      if (element.hasQuantity()) {
37315        composeQuantity("quantity", element.getQuantity());
37316      }
37317      if (element.hasUnitPrice()) {
37318        composeMoney("unitPrice", element.getUnitPrice());
37319      }
37320      if (element.hasFactorElement()) {
37321        composeDecimalCore("factor", element.getFactorElement(), false);
37322        composeDecimalExtras("factor", element.getFactorElement(), false);
37323      }
37324      if (element.hasNet()) {
37325        composeMoney("net", element.getNet());
37326      }
37327      if (element.hasNoteNumber()) {
37328        openArray("noteNumber");
37329        for (PositiveIntType e : element.getNoteNumber()) 
37330          composePositiveIntCore(null, e, true);
37331        closeArray();
37332        if (anyHasExtras(element.getNoteNumber())) {
37333          openArray("_noteNumber");
37334          for (PositiveIntType e : element.getNoteNumber()) 
37335            composePositiveIntExtras(null, e, true);
37336          closeArray();
37337        }
37338      };
37339      if (element.hasAdjudication()) {
37340        openArray("adjudication");
37341        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
37342          composeAdjudicationComponent(null, e);
37343        closeArray();
37344      };
37345  }
37346
37347  protected void composeTotalComponent(String name, ClaimResponse.TotalComponent element) throws IOException {
37348    if (element != null) {
37349      open(name);
37350      composeTotalComponentProperties(element);
37351      close();
37352    }
37353  }
37354
37355  protected void composeTotalComponentProperties(ClaimResponse.TotalComponent element) throws IOException {
37356    composeBackboneElementProperties(element);
37357      if (element.hasCategory()) {
37358        composeCodeableConcept("category", element.getCategory());
37359      }
37360      if (element.hasAmount()) {
37361        composeMoney("amount", element.getAmount());
37362      }
37363  }
37364
37365  protected void composePaymentComponent(String name, ClaimResponse.PaymentComponent element) throws IOException {
37366    if (element != null) {
37367      open(name);
37368      composePaymentComponentProperties(element);
37369      close();
37370    }
37371  }
37372
37373  protected void composePaymentComponentProperties(ClaimResponse.PaymentComponent element) throws IOException {
37374    composeBackboneElementProperties(element);
37375      if (element.hasType()) {
37376        composeCodeableConcept("type", element.getType());
37377      }
37378      if (element.hasAdjustment()) {
37379        composeMoney("adjustment", element.getAdjustment());
37380      }
37381      if (element.hasAdjustmentReason()) {
37382        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
37383      }
37384      if (element.hasDateElement()) {
37385        composeDateCore("date", element.getDateElement(), false);
37386        composeDateExtras("date", element.getDateElement(), false);
37387      }
37388      if (element.hasAmount()) {
37389        composeMoney("amount", element.getAmount());
37390      }
37391      if (element.hasIdentifier()) {
37392        composeIdentifier("identifier", element.getIdentifier());
37393      }
37394  }
37395
37396  protected void composeNoteComponent(String name, ClaimResponse.NoteComponent element) throws IOException {
37397    if (element != null) {
37398      open(name);
37399      composeNoteComponentProperties(element);
37400      close();
37401    }
37402  }
37403
37404  protected void composeNoteComponentProperties(ClaimResponse.NoteComponent element) throws IOException {
37405    composeBackboneElementProperties(element);
37406      if (element.hasNumberElement()) {
37407        composePositiveIntCore("number", element.getNumberElement(), false);
37408        composePositiveIntExtras("number", element.getNumberElement(), false);
37409      }
37410      if (element.hasTypeElement()) {
37411        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
37412        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
37413      }
37414      if (element.hasTextElement()) {
37415        composeStringCore("text", element.getTextElement(), false);
37416        composeStringExtras("text", element.getTextElement(), false);
37417      }
37418      if (element.hasLanguage()) {
37419        composeCodeableConcept("language", element.getLanguage());
37420      }
37421  }
37422
37423  protected void composeInsuranceComponent(String name, ClaimResponse.InsuranceComponent element) throws IOException {
37424    if (element != null) {
37425      open(name);
37426      composeInsuranceComponentProperties(element);
37427      close();
37428    }
37429  }
37430
37431  protected void composeInsuranceComponentProperties(ClaimResponse.InsuranceComponent element) throws IOException {
37432    composeBackboneElementProperties(element);
37433      if (element.hasSequenceElement()) {
37434        composePositiveIntCore("sequence", element.getSequenceElement(), false);
37435        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
37436      }
37437      if (element.hasFocalElement()) {
37438        composeBooleanCore("focal", element.getFocalElement(), false);
37439        composeBooleanExtras("focal", element.getFocalElement(), false);
37440      }
37441      if (element.hasCoverage()) {
37442        composeReference("coverage", element.getCoverage());
37443      }
37444      if (element.hasBusinessArrangementElement()) {
37445        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
37446        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
37447      }
37448      if (element.hasClaimResponse()) {
37449        composeReference("claimResponse", element.getClaimResponse());
37450      }
37451  }
37452
37453  protected void composeErrorComponent(String name, ClaimResponse.ErrorComponent element) throws IOException {
37454    if (element != null) {
37455      open(name);
37456      composeErrorComponentProperties(element);
37457      close();
37458    }
37459  }
37460
37461  protected void composeErrorComponentProperties(ClaimResponse.ErrorComponent element) throws IOException {
37462    composeBackboneElementProperties(element);
37463      if (element.hasItemSequenceElement()) {
37464        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
37465        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
37466      }
37467      if (element.hasDetailSequenceElement()) {
37468        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
37469        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
37470      }
37471      if (element.hasSubDetailSequenceElement()) {
37472        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
37473        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
37474      }
37475      if (element.hasCode()) {
37476        composeCodeableConcept("code", element.getCode());
37477      }
37478  }
37479
37480  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
37481    if (element != null) {
37482      prop("resourceType", name);
37483      composeClinicalImpressionProperties(element);
37484    }
37485  }
37486
37487  protected void composeClinicalImpressionProperties(ClinicalImpression element) throws IOException {
37488    composeDomainResourceProperties(element);
37489      if (element.hasIdentifier()) {
37490        openArray("identifier");
37491        for (Identifier e : element.getIdentifier()) 
37492          composeIdentifier(null, e);
37493        closeArray();
37494      };
37495      if (element.hasStatusElement()) {
37496        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
37497        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
37498      }
37499      if (element.hasStatusReason()) {
37500        composeCodeableConcept("statusReason", element.getStatusReason());
37501      }
37502      if (element.hasDescriptionElement()) {
37503        composeStringCore("description", element.getDescriptionElement(), false);
37504        composeStringExtras("description", element.getDescriptionElement(), false);
37505      }
37506      if (element.hasSubject()) {
37507        composeReference("subject", element.getSubject());
37508      }
37509      if (element.hasEncounter()) {
37510        composeReference("encounter", element.getEncounter());
37511      }
37512      if (element.hasEffective()) {
37513        composeType("effective", element.getEffective());
37514      }
37515      if (element.hasDateElement()) {
37516        composeDateTimeCore("date", element.getDateElement(), false);
37517        composeDateTimeExtras("date", element.getDateElement(), false);
37518      }
37519      if (element.hasPerformer()) {
37520        composeReference("performer", element.getPerformer());
37521      }
37522      if (element.hasPrevious()) {
37523        composeReference("previous", element.getPrevious());
37524      }
37525      if (element.hasProblem()) {
37526        openArray("problem");
37527        for (Reference e : element.getProblem()) 
37528          composeReference(null, e);
37529        closeArray();
37530      };
37531      if (element.hasProtocol()) {
37532        openArray("protocol");
37533        for (UriType e : element.getProtocol()) 
37534          composeUriCore(null, e, true);
37535        closeArray();
37536        if (anyHasExtras(element.getProtocol())) {
37537          openArray("_protocol");
37538          for (UriType e : element.getProtocol()) 
37539            composeUriExtras(null, e, true);
37540          closeArray();
37541        }
37542      };
37543      if (element.hasSummaryElement()) {
37544        composeStringCore("summary", element.getSummaryElement(), false);
37545        composeStringExtras("summary", element.getSummaryElement(), false);
37546      }
37547      if (element.hasFinding()) {
37548        openArray("finding");
37549        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
37550          composeClinicalImpressionFindingComponent(null, e);
37551        closeArray();
37552      };
37553      if (element.hasPrognosisCodeableConcept()) {
37554        openArray("prognosisCodeableConcept");
37555        for (CodeableConcept e : element.getPrognosisCodeableConcept()) 
37556          composeCodeableConcept(null, e);
37557        closeArray();
37558      };
37559      if (element.hasPrognosisReference()) {
37560        openArray("prognosisReference");
37561        for (Reference e : element.getPrognosisReference()) 
37562          composeReference(null, e);
37563        closeArray();
37564      };
37565      if (element.hasSupportingInfo()) {
37566        openArray("supportingInfo");
37567        for (Reference e : element.getSupportingInfo()) 
37568          composeReference(null, e);
37569        closeArray();
37570      };
37571      if (element.hasNote()) {
37572        openArray("note");
37573        for (Annotation e : element.getNote()) 
37574          composeAnnotation(null, e);
37575        closeArray();
37576      };
37577  }
37578
37579  protected void composeClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
37580    if (element != null) {
37581      open(name);
37582      composeClinicalImpressionFindingComponentProperties(element);
37583      close();
37584    }
37585  }
37586
37587  protected void composeClinicalImpressionFindingComponentProperties(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
37588    composeBackboneElementProperties(element);
37589      if (element.hasItem()) {
37590        composeCodeableReference("item", element.getItem());
37591      }
37592      if (element.hasBasisElement()) {
37593        composeStringCore("basis", element.getBasisElement(), false);
37594        composeStringExtras("basis", element.getBasisElement(), false);
37595      }
37596  }
37597
37598  protected void composeClinicalUseIssue(String name, ClinicalUseIssue element) throws IOException {
37599    if (element != null) {
37600      prop("resourceType", name);
37601      composeClinicalUseIssueProperties(element);
37602    }
37603  }
37604
37605  protected void composeClinicalUseIssueProperties(ClinicalUseIssue element) throws IOException {
37606    composeDomainResourceProperties(element);
37607      if (element.hasIdentifier()) {
37608        openArray("identifier");
37609        for (Identifier e : element.getIdentifier()) 
37610          composeIdentifier(null, e);
37611        closeArray();
37612      };
37613      if (element.hasTypeElement()) {
37614        composeEnumerationCore("type", element.getTypeElement(), new ClinicalUseIssue.ClinicalUseIssueTypeEnumFactory(), false);
37615        composeEnumerationExtras("type", element.getTypeElement(), new ClinicalUseIssue.ClinicalUseIssueTypeEnumFactory(), false);
37616      }
37617      if (element.hasSubject()) {
37618        openArray("subject");
37619        for (Reference e : element.getSubject()) 
37620          composeReference(null, e);
37621        closeArray();
37622      };
37623      if (element.hasStatus()) {
37624        composeCodeableConcept("status", element.getStatus());
37625      }
37626      if (element.hasDescriptionElement()) {
37627        composeMarkdownCore("description", element.getDescriptionElement(), false);
37628        composeMarkdownExtras("description", element.getDescriptionElement(), false);
37629      }
37630      if (element.hasContraindication()) {
37631        composeClinicalUseIssueContraindicationComponent("contraindication", element.getContraindication());
37632      }
37633      if (element.hasIndication()) {
37634        composeClinicalUseIssueIndicationComponent("indication", element.getIndication());
37635      }
37636      if (element.hasInteraction()) {
37637        composeClinicalUseIssueInteractionComponent("interaction", element.getInteraction());
37638      }
37639      if (element.hasPopulation()) {
37640        openArray("population");
37641        for (Population e : element.getPopulation()) 
37642          composePopulation(null, e);
37643        closeArray();
37644      };
37645      if (element.hasUndesirableEffect()) {
37646        composeClinicalUseIssueUndesirableEffectComponent("undesirableEffect", element.getUndesirableEffect());
37647      }
37648  }
37649
37650  protected void composeClinicalUseIssueContraindicationComponent(String name, ClinicalUseIssue.ClinicalUseIssueContraindicationComponent element) throws IOException {
37651    if (element != null) {
37652      open(name);
37653      composeClinicalUseIssueContraindicationComponentProperties(element);
37654      close();
37655    }
37656  }
37657
37658  protected void composeClinicalUseIssueContraindicationComponentProperties(ClinicalUseIssue.ClinicalUseIssueContraindicationComponent element) throws IOException {
37659    composeBackboneElementProperties(element);
37660      if (element.hasDiseaseSymptomProcedure()) {
37661        composeCodeableConcept("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
37662      }
37663      if (element.hasDiseaseStatus()) {
37664        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
37665      }
37666      if (element.hasComorbidity()) {
37667        openArray("comorbidity");
37668        for (CodeableConcept e : element.getComorbidity()) 
37669          composeCodeableConcept(null, e);
37670        closeArray();
37671      };
37672      if (element.hasIndication()) {
37673        openArray("indication");
37674        for (Reference e : element.getIndication()) 
37675          composeReference(null, e);
37676        closeArray();
37677      };
37678      if (element.hasOtherTherapy()) {
37679        openArray("otherTherapy");
37680        for (ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
37681          composeClinicalUseIssueContraindicationOtherTherapyComponent(null, e);
37682        closeArray();
37683      };
37684  }
37685
37686  protected void composeClinicalUseIssueContraindicationOtherTherapyComponent(String name, ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent element) throws IOException {
37687    if (element != null) {
37688      open(name);
37689      composeClinicalUseIssueContraindicationOtherTherapyComponentProperties(element);
37690      close();
37691    }
37692  }
37693
37694  protected void composeClinicalUseIssueContraindicationOtherTherapyComponentProperties(ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent element) throws IOException {
37695    composeBackboneElementProperties(element);
37696      if (element.hasTherapyRelationshipType()) {
37697        composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
37698      }
37699      if (element.hasMedication()) {
37700        composeType("medication", element.getMedication());
37701      }
37702  }
37703
37704  protected void composeClinicalUseIssueIndicationComponent(String name, ClinicalUseIssue.ClinicalUseIssueIndicationComponent element) throws IOException {
37705    if (element != null) {
37706      open(name);
37707      composeClinicalUseIssueIndicationComponentProperties(element);
37708      close();
37709    }
37710  }
37711
37712  protected void composeClinicalUseIssueIndicationComponentProperties(ClinicalUseIssue.ClinicalUseIssueIndicationComponent element) throws IOException {
37713    composeBackboneElementProperties(element);
37714      if (element.hasDiseaseSymptomProcedure()) {
37715        composeCodeableConcept("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
37716      }
37717      if (element.hasDiseaseStatus()) {
37718        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
37719      }
37720      if (element.hasComorbidity()) {
37721        openArray("comorbidity");
37722        for (CodeableConcept e : element.getComorbidity()) 
37723          composeCodeableConcept(null, e);
37724        closeArray();
37725      };
37726      if (element.hasIntendedEffect()) {
37727        composeCodeableConcept("intendedEffect", element.getIntendedEffect());
37728      }
37729      if (element.hasDuration()) {
37730        composeQuantity("duration", element.getDuration());
37731      }
37732      if (element.hasUndesirableEffect()) {
37733        openArray("undesirableEffect");
37734        for (Reference e : element.getUndesirableEffect()) 
37735          composeReference(null, e);
37736        closeArray();
37737      };
37738      if (element.hasOtherTherapy()) {
37739        openArray("otherTherapy");
37740        for (ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
37741          composeClinicalUseIssueContraindicationOtherTherapyComponent(null, e);
37742        closeArray();
37743      };
37744  }
37745
37746  protected void composeClinicalUseIssueInteractionComponent(String name, ClinicalUseIssue.ClinicalUseIssueInteractionComponent element) throws IOException {
37747    if (element != null) {
37748      open(name);
37749      composeClinicalUseIssueInteractionComponentProperties(element);
37750      close();
37751    }
37752  }
37753
37754  protected void composeClinicalUseIssueInteractionComponentProperties(ClinicalUseIssue.ClinicalUseIssueInteractionComponent element) throws IOException {
37755    composeBackboneElementProperties(element);
37756      if (element.hasInteractant()) {
37757        openArray("interactant");
37758        for (ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent e : element.getInteractant()) 
37759          composeClinicalUseIssueInteractionInteractantComponent(null, e);
37760        closeArray();
37761      };
37762      if (element.hasType()) {
37763        composeCodeableConcept("type", element.getType());
37764      }
37765      if (element.hasEffect()) {
37766        composeCodeableConcept("effect", element.getEffect());
37767      }
37768      if (element.hasIncidence()) {
37769        composeCodeableConcept("incidence", element.getIncidence());
37770      }
37771      if (element.hasManagement()) {
37772        composeCodeableConcept("management", element.getManagement());
37773      }
37774  }
37775
37776  protected void composeClinicalUseIssueInteractionInteractantComponent(String name, ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent element) throws IOException {
37777    if (element != null) {
37778      open(name);
37779      composeClinicalUseIssueInteractionInteractantComponentProperties(element);
37780      close();
37781    }
37782  }
37783
37784  protected void composeClinicalUseIssueInteractionInteractantComponentProperties(ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent element) throws IOException {
37785    composeBackboneElementProperties(element);
37786      if (element.hasItem()) {
37787        composeType("item", element.getItem());
37788      }
37789  }
37790
37791  protected void composeClinicalUseIssueUndesirableEffectComponent(String name, ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent element) throws IOException {
37792    if (element != null) {
37793      open(name);
37794      composeClinicalUseIssueUndesirableEffectComponentProperties(element);
37795      close();
37796    }
37797  }
37798
37799  protected void composeClinicalUseIssueUndesirableEffectComponentProperties(ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent element) throws IOException {
37800    composeBackboneElementProperties(element);
37801      if (element.hasSymptomConditionEffect()) {
37802        composeCodeableConcept("symptomConditionEffect", element.getSymptomConditionEffect());
37803      }
37804      if (element.hasClassification()) {
37805        composeCodeableConcept("classification", element.getClassification());
37806      }
37807      if (element.hasFrequencyOfOccurrence()) {
37808        composeCodeableConcept("frequencyOfOccurrence", element.getFrequencyOfOccurrence());
37809      }
37810  }
37811
37812  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
37813    if (element != null) {
37814      prop("resourceType", name);
37815      composeCodeSystemProperties(element);
37816    }
37817  }
37818
37819  protected void composeCodeSystemProperties(CodeSystem element) throws IOException {
37820    composeCanonicalResourceProperties(element);
37821      if (element.hasUrlElement()) {
37822        composeUriCore("url", element.getUrlElement(), false);
37823        composeUriExtras("url", element.getUrlElement(), false);
37824      }
37825      if (element.hasIdentifier()) {
37826        openArray("identifier");
37827        for (Identifier e : element.getIdentifier()) 
37828          composeIdentifier(null, e);
37829        closeArray();
37830      };
37831      if (element.hasVersionElement()) {
37832        composeStringCore("version", element.getVersionElement(), false);
37833        composeStringExtras("version", element.getVersionElement(), false);
37834      }
37835      if (element.hasNameElement()) {
37836        composeStringCore("name", element.getNameElement(), false);
37837        composeStringExtras("name", element.getNameElement(), false);
37838      }
37839      if (element.hasTitleElement()) {
37840        composeStringCore("title", element.getTitleElement(), false);
37841        composeStringExtras("title", element.getTitleElement(), false);
37842      }
37843      if (element.hasStatusElement()) {
37844        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37845        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37846      }
37847      if (element.hasExperimentalElement()) {
37848        composeBooleanCore("experimental", element.getExperimentalElement(), false);
37849        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
37850      }
37851      if (element.hasDateElement()) {
37852        composeDateTimeCore("date", element.getDateElement(), false);
37853        composeDateTimeExtras("date", element.getDateElement(), false);
37854      }
37855      if (element.hasPublisherElement()) {
37856        composeStringCore("publisher", element.getPublisherElement(), false);
37857        composeStringExtras("publisher", element.getPublisherElement(), false);
37858      }
37859      if (element.hasContact()) {
37860        openArray("contact");
37861        for (ContactDetail e : element.getContact()) 
37862          composeContactDetail(null, e);
37863        closeArray();
37864      };
37865      if (element.hasDescriptionElement()) {
37866        composeMarkdownCore("description", element.getDescriptionElement(), false);
37867        composeMarkdownExtras("description", element.getDescriptionElement(), false);
37868      }
37869      if (element.hasUseContext()) {
37870        openArray("useContext");
37871        for (UsageContext e : element.getUseContext()) 
37872          composeUsageContext(null, e);
37873        closeArray();
37874      };
37875      if (element.hasJurisdiction()) {
37876        openArray("jurisdiction");
37877        for (CodeableConcept e : element.getJurisdiction()) 
37878          composeCodeableConcept(null, e);
37879        closeArray();
37880      };
37881      if (element.hasPurposeElement()) {
37882        composeMarkdownCore("purpose", element.getPurposeElement(), false);
37883        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
37884      }
37885      if (element.hasCopyrightElement()) {
37886        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
37887        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
37888      }
37889      if (element.hasCaseSensitiveElement()) {
37890        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
37891        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
37892      }
37893      if (element.hasValueSetElement()) {
37894        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
37895        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
37896      }
37897      if (element.hasHierarchyMeaningElement()) {
37898        composeEnumerationCore("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
37899        composeEnumerationExtras("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
37900      }
37901      if (element.hasCompositionalElement()) {
37902        composeBooleanCore("compositional", element.getCompositionalElement(), false);
37903        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
37904      }
37905      if (element.hasVersionNeededElement()) {
37906        composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
37907        composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
37908      }
37909      if (element.hasContentElement()) {
37910        composeEnumerationCore("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
37911        composeEnumerationExtras("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
37912      }
37913      if (element.hasSupplementsElement()) {
37914        composeCanonicalCore("supplements", element.getSupplementsElement(), false);
37915        composeCanonicalExtras("supplements", element.getSupplementsElement(), false);
37916      }
37917      if (element.hasCountElement()) {
37918        composeUnsignedIntCore("count", element.getCountElement(), false);
37919        composeUnsignedIntExtras("count", element.getCountElement(), false);
37920      }
37921      if (element.hasFilter()) {
37922        openArray("filter");
37923        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
37924          composeCodeSystemFilterComponent(null, e);
37925        closeArray();
37926      };
37927      if (element.hasProperty()) {
37928        openArray("property");
37929        for (CodeSystem.PropertyComponent e : element.getProperty()) 
37930          composePropertyComponent(null, e);
37931        closeArray();
37932      };
37933      if (element.hasConcept()) {
37934        openArray("concept");
37935        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
37936          composeConceptDefinitionComponent(null, e);
37937        closeArray();
37938      };
37939  }
37940
37941  protected void composeCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
37942    if (element != null) {
37943      open(name);
37944      composeCodeSystemFilterComponentProperties(element);
37945      close();
37946    }
37947  }
37948
37949  protected void composeCodeSystemFilterComponentProperties(CodeSystem.CodeSystemFilterComponent element) throws IOException {
37950    composeBackboneElementProperties(element);
37951      if (element.hasCodeElement()) {
37952        composeCodeCore("code", element.getCodeElement(), false);
37953        composeCodeExtras("code", element.getCodeElement(), false);
37954      }
37955      if (element.hasDescriptionElement()) {
37956        composeStringCore("description", element.getDescriptionElement(), false);
37957        composeStringExtras("description", element.getDescriptionElement(), false);
37958      }
37959      if (element.hasOperator()) {
37960        openArray("operator");
37961        for (Enumeration<Enumerations.FilterOperator> e : element.getOperator()) 
37962          composeEnumerationCore(null, e, new Enumerations.FilterOperatorEnumFactory(), true);
37963        closeArray();
37964        if (anyHasExtras(element.getOperator())) {
37965          openArray("_operator");
37966          for (Enumeration<Enumerations.FilterOperator> e : element.getOperator()) 
37967            composeEnumerationExtras(null, e, new Enumerations.FilterOperatorEnumFactory(), true);
37968          closeArray();
37969        }
37970      };
37971      if (element.hasValueElement()) {
37972        composeStringCore("value", element.getValueElement(), false);
37973        composeStringExtras("value", element.getValueElement(), false);
37974      }
37975  }
37976
37977  protected void composePropertyComponent(String name, CodeSystem.PropertyComponent element) throws IOException {
37978    if (element != null) {
37979      open(name);
37980      composePropertyComponentProperties(element);
37981      close();
37982    }
37983  }
37984
37985  protected void composePropertyComponentProperties(CodeSystem.PropertyComponent element) throws IOException {
37986    composeBackboneElementProperties(element);
37987      if (element.hasCodeElement()) {
37988        composeCodeCore("code", element.getCodeElement(), false);
37989        composeCodeExtras("code", element.getCodeElement(), false);
37990      }
37991      if (element.hasUriElement()) {
37992        composeUriCore("uri", element.getUriElement(), false);
37993        composeUriExtras("uri", element.getUriElement(), false);
37994      }
37995      if (element.hasDescriptionElement()) {
37996        composeStringCore("description", element.getDescriptionElement(), false);
37997        composeStringExtras("description", element.getDescriptionElement(), false);
37998      }
37999      if (element.hasTypeElement()) {
38000        composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
38001        composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
38002      }
38003  }
38004
38005  protected void composeConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
38006    if (element != null) {
38007      open(name);
38008      composeConceptDefinitionComponentProperties(element);
38009      close();
38010    }
38011  }
38012
38013  protected void composeConceptDefinitionComponentProperties(CodeSystem.ConceptDefinitionComponent element) throws IOException {
38014    composeBackboneElementProperties(element);
38015      if (element.hasCodeElement()) {
38016        composeCodeCore("code", element.getCodeElement(), false);
38017        composeCodeExtras("code", element.getCodeElement(), false);
38018      }
38019      if (element.hasDisplayElement()) {
38020        composeStringCore("display", element.getDisplayElement(), false);
38021        composeStringExtras("display", element.getDisplayElement(), false);
38022      }
38023      if (element.hasDefinitionElement()) {
38024        composeStringCore("definition", element.getDefinitionElement(), false);
38025        composeStringExtras("definition", element.getDefinitionElement(), false);
38026      }
38027      if (element.hasDesignation()) {
38028        openArray("designation");
38029        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
38030          composeConceptDefinitionDesignationComponent(null, e);
38031        closeArray();
38032      };
38033      if (element.hasProperty()) {
38034        openArray("property");
38035        for (CodeSystem.ConceptPropertyComponent e : element.getProperty()) 
38036          composeConceptPropertyComponent(null, e);
38037        closeArray();
38038      };
38039      if (element.hasConcept()) {
38040        openArray("concept");
38041        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
38042          composeConceptDefinitionComponent(null, e);
38043        closeArray();
38044      };
38045  }
38046
38047  protected void composeConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
38048    if (element != null) {
38049      open(name);
38050      composeConceptDefinitionDesignationComponentProperties(element);
38051      close();
38052    }
38053  }
38054
38055  protected void composeConceptDefinitionDesignationComponentProperties(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
38056    composeBackboneElementProperties(element);
38057      if (element.hasLanguageElement()) {
38058        composeCodeCore("language", element.getLanguageElement(), false);
38059        composeCodeExtras("language", element.getLanguageElement(), false);
38060      }
38061      if (element.hasUse()) {
38062        composeCoding("use", element.getUse());
38063      }
38064      if (element.hasValueElement()) {
38065        composeStringCore("value", element.getValueElement(), false);
38066        composeStringExtras("value", element.getValueElement(), false);
38067      }
38068  }
38069
38070  protected void composeConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element) throws IOException {
38071    if (element != null) {
38072      open(name);
38073      composeConceptPropertyComponentProperties(element);
38074      close();
38075    }
38076  }
38077
38078  protected void composeConceptPropertyComponentProperties(CodeSystem.ConceptPropertyComponent element) throws IOException {
38079    composeBackboneElementProperties(element);
38080      if (element.hasCodeElement()) {
38081        composeCodeCore("code", element.getCodeElement(), false);
38082        composeCodeExtras("code", element.getCodeElement(), false);
38083      }
38084      if (element.hasValue()) {
38085        composeType("value", element.getValue());
38086      }
38087  }
38088
38089  protected void composeCommunication(String name, Communication element) throws IOException {
38090    if (element != null) {
38091      prop("resourceType", name);
38092      composeCommunicationProperties(element);
38093    }
38094  }
38095
38096  protected void composeCommunicationProperties(Communication element) throws IOException {
38097    composeDomainResourceProperties(element);
38098      if (element.hasIdentifier()) {
38099        openArray("identifier");
38100        for (Identifier e : element.getIdentifier()) 
38101          composeIdentifier(null, e);
38102        closeArray();
38103      };
38104      if (element.hasInstantiatesCanonical()) {
38105        openArray("instantiatesCanonical");
38106        for (CanonicalType e : element.getInstantiatesCanonical()) 
38107          composeCanonicalCore(null, e, true);
38108        closeArray();
38109        if (anyHasExtras(element.getInstantiatesCanonical())) {
38110          openArray("_instantiatesCanonical");
38111          for (CanonicalType e : element.getInstantiatesCanonical()) 
38112            composeCanonicalExtras(null, e, true);
38113          closeArray();
38114        }
38115      };
38116      if (element.hasInstantiatesUri()) {
38117        openArray("instantiatesUri");
38118        for (UriType e : element.getInstantiatesUri()) 
38119          composeUriCore(null, e, true);
38120        closeArray();
38121        if (anyHasExtras(element.getInstantiatesUri())) {
38122          openArray("_instantiatesUri");
38123          for (UriType e : element.getInstantiatesUri()) 
38124            composeUriExtras(null, e, true);
38125          closeArray();
38126        }
38127      };
38128      if (element.hasBasedOn()) {
38129        openArray("basedOn");
38130        for (Reference e : element.getBasedOn()) 
38131          composeReference(null, e);
38132        closeArray();
38133      };
38134      if (element.hasPartOf()) {
38135        openArray("partOf");
38136        for (Reference e : element.getPartOf()) 
38137          composeReference(null, e);
38138        closeArray();
38139      };
38140      if (element.hasInResponseTo()) {
38141        openArray("inResponseTo");
38142        for (Reference e : element.getInResponseTo()) 
38143          composeReference(null, e);
38144        closeArray();
38145      };
38146      if (element.hasStatusElement()) {
38147        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
38148        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
38149      }
38150      if (element.hasStatusReason()) {
38151        composeCodeableConcept("statusReason", element.getStatusReason());
38152      }
38153      if (element.hasCategory()) {
38154        openArray("category");
38155        for (CodeableConcept e : element.getCategory()) 
38156          composeCodeableConcept(null, e);
38157        closeArray();
38158      };
38159      if (element.hasPriorityElement()) {
38160        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
38161        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
38162      }
38163      if (element.hasMedium()) {
38164        openArray("medium");
38165        for (CodeableConcept e : element.getMedium()) 
38166          composeCodeableConcept(null, e);
38167        closeArray();
38168      };
38169      if (element.hasSubject()) {
38170        composeReference("subject", element.getSubject());
38171      }
38172      if (element.hasTopic()) {
38173        composeCodeableConcept("topic", element.getTopic());
38174      }
38175      if (element.hasAbout()) {
38176        openArray("about");
38177        for (Reference e : element.getAbout()) 
38178          composeReference(null, e);
38179        closeArray();
38180      };
38181      if (element.hasEncounter()) {
38182        composeReference("encounter", element.getEncounter());
38183      }
38184      if (element.hasSentElement()) {
38185        composeDateTimeCore("sent", element.getSentElement(), false);
38186        composeDateTimeExtras("sent", element.getSentElement(), false);
38187      }
38188      if (element.hasReceivedElement()) {
38189        composeDateTimeCore("received", element.getReceivedElement(), false);
38190        composeDateTimeExtras("received", element.getReceivedElement(), false);
38191      }
38192      if (element.hasRecipient()) {
38193        openArray("recipient");
38194        for (Reference e : element.getRecipient()) 
38195          composeReference(null, e);
38196        closeArray();
38197      };
38198      if (element.hasSender()) {
38199        composeReference("sender", element.getSender());
38200      }
38201      if (element.hasReason()) {
38202        openArray("reason");
38203        for (CodeableReference e : element.getReason()) 
38204          composeCodeableReference(null, e);
38205        closeArray();
38206      };
38207      if (element.hasPayload()) {
38208        openArray("payload");
38209        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
38210          composeCommunicationPayloadComponent(null, e);
38211        closeArray();
38212      };
38213      if (element.hasNote()) {
38214        openArray("note");
38215        for (Annotation e : element.getNote()) 
38216          composeAnnotation(null, e);
38217        closeArray();
38218      };
38219  }
38220
38221  protected void composeCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
38222    if (element != null) {
38223      open(name);
38224      composeCommunicationPayloadComponentProperties(element);
38225      close();
38226    }
38227  }
38228
38229  protected void composeCommunicationPayloadComponentProperties(Communication.CommunicationPayloadComponent element) throws IOException {
38230    composeBackboneElementProperties(element);
38231      if (element.hasContent()) {
38232        composeType("content", element.getContent());
38233      }
38234  }
38235
38236  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
38237    if (element != null) {
38238      prop("resourceType", name);
38239      composeCommunicationRequestProperties(element);
38240    }
38241  }
38242
38243  protected void composeCommunicationRequestProperties(CommunicationRequest element) throws IOException {
38244    composeDomainResourceProperties(element);
38245      if (element.hasIdentifier()) {
38246        openArray("identifier");
38247        for (Identifier e : element.getIdentifier()) 
38248          composeIdentifier(null, e);
38249        closeArray();
38250      };
38251      if (element.hasBasedOn()) {
38252        openArray("basedOn");
38253        for (Reference e : element.getBasedOn()) 
38254          composeReference(null, e);
38255        closeArray();
38256      };
38257      if (element.hasReplaces()) {
38258        openArray("replaces");
38259        for (Reference e : element.getReplaces()) 
38260          composeReference(null, e);
38261        closeArray();
38262      };
38263      if (element.hasGroupIdentifier()) {
38264        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
38265      }
38266      if (element.hasStatusElement()) {
38267        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
38268        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
38269      }
38270      if (element.hasStatusReason()) {
38271        composeCodeableConcept("statusReason", element.getStatusReason());
38272      }
38273      if (element.hasCategory()) {
38274        openArray("category");
38275        for (CodeableConcept e : element.getCategory()) 
38276          composeCodeableConcept(null, e);
38277        closeArray();
38278      };
38279      if (element.hasPriorityElement()) {
38280        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
38281        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
38282      }
38283      if (element.hasDoNotPerformElement()) {
38284        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
38285        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
38286      }
38287      if (element.hasMedium()) {
38288        openArray("medium");
38289        for (CodeableConcept e : element.getMedium()) 
38290          composeCodeableConcept(null, e);
38291        closeArray();
38292      };
38293      if (element.hasSubject()) {
38294        composeReference("subject", element.getSubject());
38295      }
38296      if (element.hasAbout()) {
38297        openArray("about");
38298        for (Reference e : element.getAbout()) 
38299          composeReference(null, e);
38300        closeArray();
38301      };
38302      if (element.hasEncounter()) {
38303        composeReference("encounter", element.getEncounter());
38304      }
38305      if (element.hasPayload()) {
38306        openArray("payload");
38307        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
38308          composeCommunicationRequestPayloadComponent(null, e);
38309        closeArray();
38310      };
38311      if (element.hasOccurrence()) {
38312        composeType("occurrence", element.getOccurrence());
38313      }
38314      if (element.hasAuthoredOnElement()) {
38315        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
38316        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
38317      }
38318      if (element.hasRequester()) {
38319        composeReference("requester", element.getRequester());
38320      }
38321      if (element.hasRecipient()) {
38322        openArray("recipient");
38323        for (Reference e : element.getRecipient()) 
38324          composeReference(null, e);
38325        closeArray();
38326      };
38327      if (element.hasInformationProvider()) {
38328        openArray("informationProvider");
38329        for (Reference e : element.getInformationProvider()) 
38330          composeReference(null, e);
38331        closeArray();
38332      };
38333      if (element.hasReason()) {
38334        openArray("reason");
38335        for (CodeableReference e : element.getReason()) 
38336          composeCodeableReference(null, e);
38337        closeArray();
38338      };
38339      if (element.hasNote()) {
38340        openArray("note");
38341        for (Annotation e : element.getNote()) 
38342          composeAnnotation(null, e);
38343        closeArray();
38344      };
38345  }
38346
38347  protected void composeCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
38348    if (element != null) {
38349      open(name);
38350      composeCommunicationRequestPayloadComponentProperties(element);
38351      close();
38352    }
38353  }
38354
38355  protected void composeCommunicationRequestPayloadComponentProperties(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
38356    composeBackboneElementProperties(element);
38357      if (element.hasContent()) {
38358        composeType("content", element.getContent());
38359      }
38360  }
38361
38362  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
38363    if (element != null) {
38364      prop("resourceType", name);
38365      composeCompartmentDefinitionProperties(element);
38366    }
38367  }
38368
38369  protected void composeCompartmentDefinitionProperties(CompartmentDefinition element) throws IOException {
38370    composeCanonicalResourceProperties(element);
38371      if (element.hasUrlElement()) {
38372        composeUriCore("url", element.getUrlElement(), false);
38373        composeUriExtras("url", element.getUrlElement(), false);
38374      }
38375      if (element.hasVersionElement()) {
38376        composeStringCore("version", element.getVersionElement(), false);
38377        composeStringExtras("version", element.getVersionElement(), false);
38378      }
38379      if (element.hasNameElement()) {
38380        composeStringCore("name", element.getNameElement(), false);
38381        composeStringExtras("name", element.getNameElement(), false);
38382      }
38383      if (element.hasStatusElement()) {
38384        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38385        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38386      }
38387      if (element.hasExperimentalElement()) {
38388        composeBooleanCore("experimental", element.getExperimentalElement(), false);
38389        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38390      }
38391      if (element.hasDateElement()) {
38392        composeDateTimeCore("date", element.getDateElement(), false);
38393        composeDateTimeExtras("date", element.getDateElement(), false);
38394      }
38395      if (element.hasPublisherElement()) {
38396        composeStringCore("publisher", element.getPublisherElement(), false);
38397        composeStringExtras("publisher", element.getPublisherElement(), false);
38398      }
38399      if (element.hasContact()) {
38400        openArray("contact");
38401        for (ContactDetail e : element.getContact()) 
38402          composeContactDetail(null, e);
38403        closeArray();
38404      };
38405      if (element.hasDescriptionElement()) {
38406        composeMarkdownCore("description", element.getDescriptionElement(), false);
38407        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38408      }
38409      if (element.hasUseContext()) {
38410        openArray("useContext");
38411        for (UsageContext e : element.getUseContext()) 
38412          composeUsageContext(null, e);
38413        closeArray();
38414      };
38415      if (element.hasPurposeElement()) {
38416        composeMarkdownCore("purpose", element.getPurposeElement(), false);
38417        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
38418      }
38419      if (element.hasCodeElement()) {
38420        composeEnumerationCore("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
38421        composeEnumerationExtras("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
38422      }
38423      if (element.hasSearchElement()) {
38424        composeBooleanCore("search", element.getSearchElement(), false);
38425        composeBooleanExtras("search", element.getSearchElement(), false);
38426      }
38427      if (element.hasResource()) {
38428        openArray("resource");
38429        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
38430          composeCompartmentDefinitionResourceComponent(null, e);
38431        closeArray();
38432      };
38433  }
38434
38435  protected void composeCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
38436    if (element != null) {
38437      open(name);
38438      composeCompartmentDefinitionResourceComponentProperties(element);
38439      close();
38440    }
38441  }
38442
38443  protected void composeCompartmentDefinitionResourceComponentProperties(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
38444    composeBackboneElementProperties(element);
38445      if (element.hasCodeElement()) {
38446        composeCodeCore("code", element.getCodeElement(), false);
38447        composeCodeExtras("code", element.getCodeElement(), false);
38448      }
38449      if (element.hasParam()) {
38450        openArray("param");
38451        for (StringType e : element.getParam()) 
38452          composeStringCore(null, e, true);
38453        closeArray();
38454        if (anyHasExtras(element.getParam())) {
38455          openArray("_param");
38456          for (StringType e : element.getParam()) 
38457            composeStringExtras(null, e, true);
38458          closeArray();
38459        }
38460      };
38461      if (element.hasDocumentationElement()) {
38462        composeStringCore("documentation", element.getDocumentationElement(), false);
38463        composeStringExtras("documentation", element.getDocumentationElement(), false);
38464      }
38465  }
38466
38467  protected void composeComposition(String name, Composition element) throws IOException {
38468    if (element != null) {
38469      prop("resourceType", name);
38470      composeCompositionProperties(element);
38471    }
38472  }
38473
38474  protected void composeCompositionProperties(Composition element) throws IOException {
38475    composeDomainResourceProperties(element);
38476      if (element.hasIdentifier()) {
38477        composeIdentifier("identifier", element.getIdentifier());
38478      }
38479      if (element.hasStatusElement()) {
38480        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
38481        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
38482      }
38483      if (element.hasType()) {
38484        composeCodeableConcept("type", element.getType());
38485      }
38486      if (element.hasCategory()) {
38487        openArray("category");
38488        for (CodeableConcept e : element.getCategory()) 
38489          composeCodeableConcept(null, e);
38490        closeArray();
38491      };
38492      if (element.hasSubject()) {
38493        composeReference("subject", element.getSubject());
38494      }
38495      if (element.hasEncounter()) {
38496        composeReference("encounter", element.getEncounter());
38497      }
38498      if (element.hasDateElement()) {
38499        composeDateTimeCore("date", element.getDateElement(), false);
38500        composeDateTimeExtras("date", element.getDateElement(), false);
38501      }
38502      if (element.hasAuthor()) {
38503        openArray("author");
38504        for (Reference e : element.getAuthor()) 
38505          composeReference(null, e);
38506        closeArray();
38507      };
38508      if (element.hasTitleElement()) {
38509        composeStringCore("title", element.getTitleElement(), false);
38510        composeStringExtras("title", element.getTitleElement(), false);
38511      }
38512      if (element.hasConfidentialityElement()) {
38513        composeEnumerationCore("confidentiality", element.getConfidentialityElement(), new Composition.V3ConfidentialityClassificationEnumFactory(), false);
38514        composeEnumerationExtras("confidentiality", element.getConfidentialityElement(), new Composition.V3ConfidentialityClassificationEnumFactory(), false);
38515      }
38516      if (element.hasAttester()) {
38517        openArray("attester");
38518        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
38519          composeCompositionAttesterComponent(null, e);
38520        closeArray();
38521      };
38522      if (element.hasCustodian()) {
38523        composeReference("custodian", element.getCustodian());
38524      }
38525      if (element.hasRelatesTo()) {
38526        openArray("relatesTo");
38527        for (Composition.CompositionRelatesToComponent e : element.getRelatesTo()) 
38528          composeCompositionRelatesToComponent(null, e);
38529        closeArray();
38530      };
38531      if (element.hasEvent()) {
38532        openArray("event");
38533        for (Composition.CompositionEventComponent e : element.getEvent()) 
38534          composeCompositionEventComponent(null, e);
38535        closeArray();
38536      };
38537      if (element.hasSection()) {
38538        openArray("section");
38539        for (Composition.SectionComponent e : element.getSection()) 
38540          composeSectionComponent(null, e);
38541        closeArray();
38542      };
38543  }
38544
38545  protected void composeCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
38546    if (element != null) {
38547      open(name);
38548      composeCompositionAttesterComponentProperties(element);
38549      close();
38550    }
38551  }
38552
38553  protected void composeCompositionAttesterComponentProperties(Composition.CompositionAttesterComponent element) throws IOException {
38554    composeBackboneElementProperties(element);
38555      if (element.hasModeElement()) {
38556        composeEnumerationCore("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
38557        composeEnumerationExtras("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
38558      }
38559      if (element.hasTimeElement()) {
38560        composeDateTimeCore("time", element.getTimeElement(), false);
38561        composeDateTimeExtras("time", element.getTimeElement(), false);
38562      }
38563      if (element.hasParty()) {
38564        composeReference("party", element.getParty());
38565      }
38566  }
38567
38568  protected void composeCompositionRelatesToComponent(String name, Composition.CompositionRelatesToComponent element) throws IOException {
38569    if (element != null) {
38570      open(name);
38571      composeCompositionRelatesToComponentProperties(element);
38572      close();
38573    }
38574  }
38575
38576  protected void composeCompositionRelatesToComponentProperties(Composition.CompositionRelatesToComponent element) throws IOException {
38577    composeBackboneElementProperties(element);
38578      if (element.hasCodeElement()) {
38579        composeEnumerationCore("code", element.getCodeElement(), new Enumerations.DocumentRelationshipTypeEnumFactory(), false);
38580        composeEnumerationExtras("code", element.getCodeElement(), new Enumerations.DocumentRelationshipTypeEnumFactory(), false);
38581      }
38582      if (element.hasTarget()) {
38583        composeType("target", element.getTarget());
38584      }
38585  }
38586
38587  protected void composeCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
38588    if (element != null) {
38589      open(name);
38590      composeCompositionEventComponentProperties(element);
38591      close();
38592    }
38593  }
38594
38595  protected void composeCompositionEventComponentProperties(Composition.CompositionEventComponent element) throws IOException {
38596    composeBackboneElementProperties(element);
38597      if (element.hasCode()) {
38598        openArray("code");
38599        for (CodeableConcept e : element.getCode()) 
38600          composeCodeableConcept(null, e);
38601        closeArray();
38602      };
38603      if (element.hasPeriod()) {
38604        composePeriod("period", element.getPeriod());
38605      }
38606      if (element.hasDetail()) {
38607        openArray("detail");
38608        for (Reference e : element.getDetail()) 
38609          composeReference(null, e);
38610        closeArray();
38611      };
38612  }
38613
38614  protected void composeSectionComponent(String name, Composition.SectionComponent element) throws IOException {
38615    if (element != null) {
38616      open(name);
38617      composeSectionComponentProperties(element);
38618      close();
38619    }
38620  }
38621
38622  protected void composeSectionComponentProperties(Composition.SectionComponent element) throws IOException {
38623    composeBackboneElementProperties(element);
38624      if (element.hasTitleElement()) {
38625        composeStringCore("title", element.getTitleElement(), false);
38626        composeStringExtras("title", element.getTitleElement(), false);
38627      }
38628      if (element.hasCode()) {
38629        composeCodeableConcept("code", element.getCode());
38630      }
38631      if (element.hasAuthor()) {
38632        openArray("author");
38633        for (Reference e : element.getAuthor()) 
38634          composeReference(null, e);
38635        closeArray();
38636      };
38637      if (element.hasFocus()) {
38638        composeReference("focus", element.getFocus());
38639      }
38640      if (element.hasText()) {
38641        composeNarrative("text", element.getText());
38642      }
38643      if (element.hasModeElement()) {
38644        composeEnumerationCore("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
38645        composeEnumerationExtras("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
38646      }
38647      if (element.hasOrderedBy()) {
38648        composeCodeableConcept("orderedBy", element.getOrderedBy());
38649      }
38650      if (element.hasEntry()) {
38651        openArray("entry");
38652        for (Reference e : element.getEntry()) 
38653          composeReference(null, e);
38654        closeArray();
38655      };
38656      if (element.hasEmptyReason()) {
38657        composeCodeableConcept("emptyReason", element.getEmptyReason());
38658      }
38659      if (element.hasSection()) {
38660        openArray("section");
38661        for (Composition.SectionComponent e : element.getSection()) 
38662          composeSectionComponent(null, e);
38663        closeArray();
38664      };
38665  }
38666
38667  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
38668    if (element != null) {
38669      prop("resourceType", name);
38670      composeConceptMapProperties(element);
38671    }
38672  }
38673
38674  protected void composeConceptMapProperties(ConceptMap element) throws IOException {
38675    composeCanonicalResourceProperties(element);
38676      if (element.hasUrlElement()) {
38677        composeUriCore("url", element.getUrlElement(), false);
38678        composeUriExtras("url", element.getUrlElement(), false);
38679      }
38680      if (element.hasIdentifier()) {
38681        composeIdentifier("identifier", element.getIdentifierFirstRep());
38682      }
38683      if (element.hasVersionElement()) {
38684        composeStringCore("version", element.getVersionElement(), false);
38685        composeStringExtras("version", element.getVersionElement(), false);
38686      }
38687      if (element.hasNameElement()) {
38688        composeStringCore("name", element.getNameElement(), false);
38689        composeStringExtras("name", element.getNameElement(), false);
38690      }
38691      if (element.hasTitleElement()) {
38692        composeStringCore("title", element.getTitleElement(), false);
38693        composeStringExtras("title", element.getTitleElement(), false);
38694      }
38695      if (element.hasStatusElement()) {
38696        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38697        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38698      }
38699      if (element.hasExperimentalElement()) {
38700        composeBooleanCore("experimental", element.getExperimentalElement(), false);
38701        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38702      }
38703      if (element.hasDateElement()) {
38704        composeDateTimeCore("date", element.getDateElement(), false);
38705        composeDateTimeExtras("date", element.getDateElement(), false);
38706      }
38707      if (element.hasPublisherElement()) {
38708        composeStringCore("publisher", element.getPublisherElement(), false);
38709        composeStringExtras("publisher", element.getPublisherElement(), false);
38710      }
38711      if (element.hasContact()) {
38712        openArray("contact");
38713        for (ContactDetail e : element.getContact()) 
38714          composeContactDetail(null, e);
38715        closeArray();
38716      };
38717      if (element.hasDescriptionElement()) {
38718        composeMarkdownCore("description", element.getDescriptionElement(), false);
38719        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38720      }
38721      if (element.hasUseContext()) {
38722        openArray("useContext");
38723        for (UsageContext e : element.getUseContext()) 
38724          composeUsageContext(null, e);
38725        closeArray();
38726      };
38727      if (element.hasJurisdiction()) {
38728        openArray("jurisdiction");
38729        for (CodeableConcept e : element.getJurisdiction()) 
38730          composeCodeableConcept(null, e);
38731        closeArray();
38732      };
38733      if (element.hasPurposeElement()) {
38734        composeMarkdownCore("purpose", element.getPurposeElement(), false);
38735        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
38736      }
38737      if (element.hasCopyrightElement()) {
38738        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
38739        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
38740      }
38741      if (element.hasSource()) {
38742        composeType("source", element.getSource());
38743      }
38744      if (element.hasTarget()) {
38745        composeType("target", element.getTarget());
38746      }
38747      if (element.hasGroup()) {
38748        openArray("group");
38749        for (ConceptMap.ConceptMapGroupComponent e : element.getGroup()) 
38750          composeConceptMapGroupComponent(null, e);
38751        closeArray();
38752      };
38753  }
38754
38755  protected void composeConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
38756    if (element != null) {
38757      open(name);
38758      composeConceptMapGroupComponentProperties(element);
38759      close();
38760    }
38761  }
38762
38763  protected void composeConceptMapGroupComponentProperties(ConceptMap.ConceptMapGroupComponent element) throws IOException {
38764    composeBackboneElementProperties(element);
38765      if (element.hasSourceElement()) {
38766        composeUriCore("source", element.getSourceElement(), false);
38767        composeUriExtras("source", element.getSourceElement(), false);
38768      }
38769      if (element.hasSourceVersionElement()) {
38770        composeStringCore("sourceVersion", element.getSourceVersionElement(), false);
38771        composeStringExtras("sourceVersion", element.getSourceVersionElement(), false);
38772      }
38773      if (element.hasTargetElement()) {
38774        composeUriCore("target", element.getTargetElement(), false);
38775        composeUriExtras("target", element.getTargetElement(), false);
38776      }
38777      if (element.hasTargetVersionElement()) {
38778        composeStringCore("targetVersion", element.getTargetVersionElement(), false);
38779        composeStringExtras("targetVersion", element.getTargetVersionElement(), false);
38780      }
38781      if (element.hasElement()) {
38782        openArray("element");
38783        for (ConceptMap.SourceElementComponent e : element.getElement()) 
38784          composeSourceElementComponent(null, e);
38785        closeArray();
38786      };
38787      if (element.hasUnmapped()) {
38788        composeConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
38789      }
38790  }
38791
38792  protected void composeSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
38793    if (element != null) {
38794      open(name);
38795      composeSourceElementComponentProperties(element);
38796      close();
38797    }
38798  }
38799
38800  protected void composeSourceElementComponentProperties(ConceptMap.SourceElementComponent element) throws IOException {
38801    composeBackboneElementProperties(element);
38802      if (element.hasCodeElement()) {
38803        composeCodeCore("code", element.getCodeElement(), false);
38804        composeCodeExtras("code", element.getCodeElement(), false);
38805      }
38806      if (element.hasDisplayElement()) {
38807        composeStringCore("display", element.getDisplayElement(), false);
38808        composeStringExtras("display", element.getDisplayElement(), false);
38809      }
38810      if (element.hasNoMapElement()) {
38811        composeBooleanCore("noMap", element.getNoMapElement(), false);
38812        composeBooleanExtras("noMap", element.getNoMapElement(), false);
38813      }
38814      if (element.hasTarget()) {
38815        openArray("target");
38816        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
38817          composeTargetElementComponent(null, e);
38818        closeArray();
38819      };
38820  }
38821
38822  protected void composeTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
38823    if (element != null) {
38824      open(name);
38825      composeTargetElementComponentProperties(element);
38826      close();
38827    }
38828  }
38829
38830  protected void composeTargetElementComponentProperties(ConceptMap.TargetElementComponent element) throws IOException {
38831    composeBackboneElementProperties(element);
38832      if (element.hasCodeElement()) {
38833        composeCodeCore("code", element.getCodeElement(), false);
38834        composeCodeExtras("code", element.getCodeElement(), false);
38835      }
38836      if (element.hasDisplayElement()) {
38837        composeStringCore("display", element.getDisplayElement(), false);
38838        composeStringExtras("display", element.getDisplayElement(), false);
38839      }
38840      if (element.hasRelationshipElement()) {
38841        composeEnumerationCore("relationship", element.getRelationshipElement(), new Enumerations.ConceptMapRelationshipEnumFactory(), false);
38842        composeEnumerationExtras("relationship", element.getRelationshipElement(), new Enumerations.ConceptMapRelationshipEnumFactory(), false);
38843      }
38844      if (element.hasCommentElement()) {
38845        composeStringCore("comment", element.getCommentElement(), false);
38846        composeStringExtras("comment", element.getCommentElement(), false);
38847      }
38848      if (element.hasDependsOn()) {
38849        openArray("dependsOn");
38850        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
38851          composeOtherElementComponent(null, e);
38852        closeArray();
38853      };
38854      if (element.hasProduct()) {
38855        openArray("product");
38856        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
38857          composeOtherElementComponent(null, e);
38858        closeArray();
38859      };
38860  }
38861
38862  protected void composeOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
38863    if (element != null) {
38864      open(name);
38865      composeOtherElementComponentProperties(element);
38866      close();
38867    }
38868  }
38869
38870  protected void composeOtherElementComponentProperties(ConceptMap.OtherElementComponent element) throws IOException {
38871    composeBackboneElementProperties(element);
38872      if (element.hasPropertyElement()) {
38873        composeUriCore("property", element.getPropertyElement(), false);
38874        composeUriExtras("property", element.getPropertyElement(), false);
38875      }
38876      if (element.hasSystemElement()) {
38877        composeCanonicalCore("system", element.getSystemElement(), false);
38878        composeCanonicalExtras("system", element.getSystemElement(), false);
38879      }
38880      if (element.hasValueElement()) {
38881        composeStringCore("value", element.getValueElement(), false);
38882        composeStringExtras("value", element.getValueElement(), false);
38883      }
38884      if (element.hasDisplayElement()) {
38885        composeStringCore("display", element.getDisplayElement(), false);
38886        composeStringExtras("display", element.getDisplayElement(), false);
38887      }
38888  }
38889
38890  protected void composeConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
38891    if (element != null) {
38892      open(name);
38893      composeConceptMapGroupUnmappedComponentProperties(element);
38894      close();
38895    }
38896  }
38897
38898  protected void composeConceptMapGroupUnmappedComponentProperties(ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
38899    composeBackboneElementProperties(element);
38900      if (element.hasModeElement()) {
38901        composeEnumerationCore("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
38902        composeEnumerationExtras("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
38903      }
38904      if (element.hasCodeElement()) {
38905        composeCodeCore("code", element.getCodeElement(), false);
38906        composeCodeExtras("code", element.getCodeElement(), false);
38907      }
38908      if (element.hasDisplayElement()) {
38909        composeStringCore("display", element.getDisplayElement(), false);
38910        composeStringExtras("display", element.getDisplayElement(), false);
38911      }
38912      if (element.hasUrlElement()) {
38913        composeCanonicalCore("url", element.getUrlElement(), false);
38914        composeCanonicalExtras("url", element.getUrlElement(), false);
38915      }
38916  }
38917
38918  protected void composeCondition(String name, Condition element) throws IOException {
38919    if (element != null) {
38920      prop("resourceType", name);
38921      composeConditionProperties(element);
38922    }
38923  }
38924
38925  protected void composeConditionProperties(Condition element) throws IOException {
38926    composeDomainResourceProperties(element);
38927      if (element.hasIdentifier()) {
38928        openArray("identifier");
38929        for (Identifier e : element.getIdentifier()) 
38930          composeIdentifier(null, e);
38931        closeArray();
38932      };
38933      if (element.hasClinicalStatus()) {
38934        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
38935      }
38936      if (element.hasVerificationStatus()) {
38937        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
38938      }
38939      if (element.hasCategory()) {
38940        openArray("category");
38941        for (CodeableConcept e : element.getCategory()) 
38942          composeCodeableConcept(null, e);
38943        closeArray();
38944      };
38945      if (element.hasSeverity()) {
38946        composeCodeableConcept("severity", element.getSeverity());
38947      }
38948      if (element.hasCode()) {
38949        composeCodeableConcept("code", element.getCode());
38950      }
38951      if (element.hasBodySite()) {
38952        openArray("bodySite");
38953        for (CodeableConcept e : element.getBodySite()) 
38954          composeCodeableConcept(null, e);
38955        closeArray();
38956      };
38957      if (element.hasSubject()) {
38958        composeReference("subject", element.getSubject());
38959      }
38960      if (element.hasEncounter()) {
38961        composeReference("encounter", element.getEncounter());
38962      }
38963      if (element.hasOnset()) {
38964        composeType("onset", element.getOnset());
38965      }
38966      if (element.hasAbatement()) {
38967        composeType("abatement", element.getAbatement());
38968      }
38969      if (element.hasRecordedDateElement()) {
38970        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
38971        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
38972      }
38973      if (element.hasRecorder()) {
38974        composeReference("recorder", element.getRecorder());
38975      }
38976      if (element.hasAsserter()) {
38977        composeReference("asserter", element.getAsserter());
38978      }
38979      if (element.hasStage()) {
38980        openArray("stage");
38981        for (Condition.ConditionStageComponent e : element.getStage()) 
38982          composeConditionStageComponent(null, e);
38983        closeArray();
38984      };
38985      if (element.hasEvidence()) {
38986        openArray("evidence");
38987        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
38988          composeConditionEvidenceComponent(null, e);
38989        closeArray();
38990      };
38991      if (element.hasNote()) {
38992        openArray("note");
38993        for (Annotation e : element.getNote()) 
38994          composeAnnotation(null, e);
38995        closeArray();
38996      };
38997  }
38998
38999  protected void composeConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
39000    if (element != null) {
39001      open(name);
39002      composeConditionStageComponentProperties(element);
39003      close();
39004    }
39005  }
39006
39007  protected void composeConditionStageComponentProperties(Condition.ConditionStageComponent element) throws IOException {
39008    composeBackboneElementProperties(element);
39009      if (element.hasSummary()) {
39010        composeCodeableConcept("summary", element.getSummary());
39011      }
39012      if (element.hasAssessment()) {
39013        openArray("assessment");
39014        for (Reference e : element.getAssessment()) 
39015          composeReference(null, e);
39016        closeArray();
39017      };
39018      if (element.hasType()) {
39019        composeCodeableConcept("type", element.getType());
39020      }
39021  }
39022
39023  protected void composeConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
39024    if (element != null) {
39025      open(name);
39026      composeConditionEvidenceComponentProperties(element);
39027      close();
39028    }
39029  }
39030
39031  protected void composeConditionEvidenceComponentProperties(Condition.ConditionEvidenceComponent element) throws IOException {
39032    composeBackboneElementProperties(element);
39033      if (element.hasCode()) {
39034        openArray("code");
39035        for (CodeableConcept e : element.getCode()) 
39036          composeCodeableConcept(null, e);
39037        closeArray();
39038      };
39039      if (element.hasDetail()) {
39040        openArray("detail");
39041        for (Reference e : element.getDetail()) 
39042          composeReference(null, e);
39043        closeArray();
39044      };
39045  }
39046
39047  protected void composeConditionDefinition(String name, ConditionDefinition element) throws IOException {
39048    if (element != null) {
39049      prop("resourceType", name);
39050      composeConditionDefinitionProperties(element);
39051    }
39052  }
39053
39054  protected void composeConditionDefinitionProperties(ConditionDefinition element) throws IOException {
39055    composeMetadataResourceProperties(element);
39056      if (element.hasUrlElement()) {
39057        composeUriCore("url", element.getUrlElement(), false);
39058        composeUriExtras("url", element.getUrlElement(), false);
39059      }
39060      if (element.hasIdentifier()) {
39061        openArray("identifier");
39062        for (Identifier e : element.getIdentifier()) 
39063          composeIdentifier(null, e);
39064        closeArray();
39065      };
39066      if (element.hasVersionElement()) {
39067        composeStringCore("version", element.getVersionElement(), false);
39068        composeStringExtras("version", element.getVersionElement(), false);
39069      }
39070      if (element.hasNameElement()) {
39071        composeStringCore("name", element.getNameElement(), false);
39072        composeStringExtras("name", element.getNameElement(), false);
39073      }
39074      if (element.hasTitleElement()) {
39075        composeStringCore("title", element.getTitleElement(), false);
39076        composeStringExtras("title", element.getTitleElement(), false);
39077      }
39078      if (element.hasSubtitleElement()) {
39079        composeStringCore("subtitle", element.getSubtitleElement(), false);
39080        composeStringExtras("subtitle", element.getSubtitleElement(), false);
39081      }
39082      if (element.hasStatusElement()) {
39083        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39084        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39085      }
39086      if (element.hasExperimentalElement()) {
39087        composeBooleanCore("experimental", element.getExperimentalElement(), false);
39088        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
39089      }
39090      if (element.hasDateElement()) {
39091        composeDateTimeCore("date", element.getDateElement(), false);
39092        composeDateTimeExtras("date", element.getDateElement(), false);
39093      }
39094      if (element.hasPublisherElement()) {
39095        composeStringCore("publisher", element.getPublisherElement(), false);
39096        composeStringExtras("publisher", element.getPublisherElement(), false);
39097      }
39098      if (element.hasContact()) {
39099        openArray("contact");
39100        for (ContactDetail e : element.getContact()) 
39101          composeContactDetail(null, e);
39102        closeArray();
39103      };
39104      if (element.hasDescriptionElement()) {
39105        composeMarkdownCore("description", element.getDescriptionElement(), false);
39106        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39107      }
39108      if (element.hasUseContext()) {
39109        openArray("useContext");
39110        for (UsageContext e : element.getUseContext()) 
39111          composeUsageContext(null, e);
39112        closeArray();
39113      };
39114      if (element.hasJurisdiction()) {
39115        openArray("jurisdiction");
39116        for (CodeableConcept e : element.getJurisdiction()) 
39117          composeCodeableConcept(null, e);
39118        closeArray();
39119      };
39120      if (element.hasCode()) {
39121        composeCodeableConcept("code", element.getCode());
39122      }
39123      if (element.hasSeverity()) {
39124        composeCodeableConcept("severity", element.getSeverity());
39125      }
39126      if (element.hasBodySite()) {
39127        composeCodeableConcept("bodySite", element.getBodySite());
39128      }
39129      if (element.hasStage()) {
39130        composeCodeableConcept("stage", element.getStage());
39131      }
39132      if (element.hasHasSeverityElement()) {
39133        composeBooleanCore("hasSeverity", element.getHasSeverityElement(), false);
39134        composeBooleanExtras("hasSeverity", element.getHasSeverityElement(), false);
39135      }
39136      if (element.hasHasBodySiteElement()) {
39137        composeBooleanCore("hasBodySite", element.getHasBodySiteElement(), false);
39138        composeBooleanExtras("hasBodySite", element.getHasBodySiteElement(), false);
39139      }
39140      if (element.hasHasStageElement()) {
39141        composeBooleanCore("hasStage", element.getHasStageElement(), false);
39142        composeBooleanExtras("hasStage", element.getHasStageElement(), false);
39143      }
39144      if (element.hasDefinition()) {
39145        openArray("definition");
39146        for (UriType e : element.getDefinition()) 
39147          composeUriCore(null, e, true);
39148        closeArray();
39149        if (anyHasExtras(element.getDefinition())) {
39150          openArray("_definition");
39151          for (UriType e : element.getDefinition()) 
39152            composeUriExtras(null, e, true);
39153          closeArray();
39154        }
39155      };
39156      if (element.hasObservation()) {
39157        openArray("observation");
39158        for (ConditionDefinition.ConditionDefinitionObservationComponent e : element.getObservation()) 
39159          composeConditionDefinitionObservationComponent(null, e);
39160        closeArray();
39161      };
39162      if (element.hasMedication()) {
39163        openArray("medication");
39164        for (ConditionDefinition.ConditionDefinitionMedicationComponent e : element.getMedication()) 
39165          composeConditionDefinitionMedicationComponent(null, e);
39166        closeArray();
39167      };
39168      if (element.hasPrecondition()) {
39169        openArray("precondition");
39170        for (ConditionDefinition.ConditionDefinitionPreconditionComponent e : element.getPrecondition()) 
39171          composeConditionDefinitionPreconditionComponent(null, e);
39172        closeArray();
39173      };
39174      if (element.hasTeam()) {
39175        openArray("team");
39176        for (Reference e : element.getTeam()) 
39177          composeReference(null, e);
39178        closeArray();
39179      };
39180      if (element.hasQuestionnaire()) {
39181        openArray("questionnaire");
39182        for (ConditionDefinition.ConditionDefinitionQuestionnaireComponent e : element.getQuestionnaire()) 
39183          composeConditionDefinitionQuestionnaireComponent(null, e);
39184        closeArray();
39185      };
39186      if (element.hasPlan()) {
39187        openArray("plan");
39188        for (ConditionDefinition.ConditionDefinitionPlanComponent e : element.getPlan()) 
39189          composeConditionDefinitionPlanComponent(null, e);
39190        closeArray();
39191      };
39192  }
39193
39194  protected void composeConditionDefinitionObservationComponent(String name, ConditionDefinition.ConditionDefinitionObservationComponent element) throws IOException {
39195    if (element != null) {
39196      open(name);
39197      composeConditionDefinitionObservationComponentProperties(element);
39198      close();
39199    }
39200  }
39201
39202  protected void composeConditionDefinitionObservationComponentProperties(ConditionDefinition.ConditionDefinitionObservationComponent element) throws IOException {
39203    composeBackboneElementProperties(element);
39204      if (element.hasCategory()) {
39205        composeCodeableConcept("category", element.getCategory());
39206      }
39207      if (element.hasCode()) {
39208        composeCodeableConcept("code", element.getCode());
39209      }
39210  }
39211
39212  protected void composeConditionDefinitionMedicationComponent(String name, ConditionDefinition.ConditionDefinitionMedicationComponent element) throws IOException {
39213    if (element != null) {
39214      open(name);
39215      composeConditionDefinitionMedicationComponentProperties(element);
39216      close();
39217    }
39218  }
39219
39220  protected void composeConditionDefinitionMedicationComponentProperties(ConditionDefinition.ConditionDefinitionMedicationComponent element) throws IOException {
39221    composeBackboneElementProperties(element);
39222      if (element.hasCategory()) {
39223        composeCodeableConcept("category", element.getCategory());
39224      }
39225      if (element.hasCode()) {
39226        composeCodeableConcept("code", element.getCode());
39227      }
39228  }
39229
39230  protected void composeConditionDefinitionPreconditionComponent(String name, ConditionDefinition.ConditionDefinitionPreconditionComponent element) throws IOException {
39231    if (element != null) {
39232      open(name);
39233      composeConditionDefinitionPreconditionComponentProperties(element);
39234      close();
39235    }
39236  }
39237
39238  protected void composeConditionDefinitionPreconditionComponentProperties(ConditionDefinition.ConditionDefinitionPreconditionComponent element) throws IOException {
39239    composeBackboneElementProperties(element);
39240      if (element.hasTypeElement()) {
39241        composeEnumerationCore("type", element.getTypeElement(), new ConditionDefinition.ConditionPreconditionTypeEnumFactory(), false);
39242        composeEnumerationExtras("type", element.getTypeElement(), new ConditionDefinition.ConditionPreconditionTypeEnumFactory(), false);
39243      }
39244      if (element.hasCode()) {
39245        composeCodeableConcept("code", element.getCode());
39246      }
39247      if (element.hasValue()) {
39248        composeType("value", element.getValue());
39249      }
39250  }
39251
39252  protected void composeConditionDefinitionQuestionnaireComponent(String name, ConditionDefinition.ConditionDefinitionQuestionnaireComponent element) throws IOException {
39253    if (element != null) {
39254      open(name);
39255      composeConditionDefinitionQuestionnaireComponentProperties(element);
39256      close();
39257    }
39258  }
39259
39260  protected void composeConditionDefinitionQuestionnaireComponentProperties(ConditionDefinition.ConditionDefinitionQuestionnaireComponent element) throws IOException {
39261    composeBackboneElementProperties(element);
39262      if (element.hasPurposeElement()) {
39263        composeEnumerationCore("purpose", element.getPurposeElement(), new ConditionDefinition.ConditionQuestionnairePurposeEnumFactory(), false);
39264        composeEnumerationExtras("purpose", element.getPurposeElement(), new ConditionDefinition.ConditionQuestionnairePurposeEnumFactory(), false);
39265      }
39266      if (element.hasReference()) {
39267        composeReference("reference", element.getReference());
39268      }
39269  }
39270
39271  protected void composeConditionDefinitionPlanComponent(String name, ConditionDefinition.ConditionDefinitionPlanComponent element) throws IOException {
39272    if (element != null) {
39273      open(name);
39274      composeConditionDefinitionPlanComponentProperties(element);
39275      close();
39276    }
39277  }
39278
39279  protected void composeConditionDefinitionPlanComponentProperties(ConditionDefinition.ConditionDefinitionPlanComponent element) throws IOException {
39280    composeBackboneElementProperties(element);
39281      if (element.hasRole()) {
39282        composeCodeableConcept("role", element.getRole());
39283      }
39284      if (element.hasReference()) {
39285        composeReference("reference", element.getReference());
39286      }
39287  }
39288
39289  protected void composeConsent(String name, Consent element) throws IOException {
39290    if (element != null) {
39291      prop("resourceType", name);
39292      composeConsentProperties(element);
39293    }
39294  }
39295
39296  protected void composeConsentProperties(Consent element) throws IOException {
39297    composeDomainResourceProperties(element);
39298      if (element.hasIdentifier()) {
39299        openArray("identifier");
39300        for (Identifier e : element.getIdentifier()) 
39301          composeIdentifier(null, e);
39302        closeArray();
39303      };
39304      if (element.hasStatusElement()) {
39305        composeEnumerationCore("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
39306        composeEnumerationExtras("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
39307      }
39308      if (element.hasScope()) {
39309        composeCodeableConcept("scope", element.getScope());
39310      }
39311      if (element.hasCategory()) {
39312        openArray("category");
39313        for (CodeableConcept e : element.getCategory()) 
39314          composeCodeableConcept(null, e);
39315        closeArray();
39316      };
39317      if (element.hasPatient()) {
39318        composeReference("patient", element.getPatient());
39319      }
39320      if (element.hasDateTimeElement()) {
39321        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
39322        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
39323      }
39324      if (element.hasPerformer()) {
39325        openArray("performer");
39326        for (Reference e : element.getPerformer()) 
39327          composeReference(null, e);
39328        closeArray();
39329      };
39330      if (element.hasOrganization()) {
39331        openArray("organization");
39332        for (Reference e : element.getOrganization()) 
39333          composeReference(null, e);
39334        closeArray();
39335      };
39336      if (element.hasSourceAttachment()) {
39337        openArray("sourceAttachment");
39338        for (Attachment e : element.getSourceAttachment()) 
39339          composeAttachment(null, e);
39340        closeArray();
39341      };
39342      if (element.hasSourceReference()) {
39343        openArray("sourceReference");
39344        for (Reference e : element.getSourceReference()) 
39345          composeReference(null, e);
39346        closeArray();
39347      };
39348      if (element.hasPolicy()) {
39349        openArray("policy");
39350        for (Consent.ConsentPolicyComponent e : element.getPolicy()) 
39351          composeConsentPolicyComponent(null, e);
39352        closeArray();
39353      };
39354      if (element.hasPolicyRule()) {
39355        composeCodeableConcept("policyRule", element.getPolicyRule());
39356      }
39357      if (element.hasVerification()) {
39358        openArray("verification");
39359        for (Consent.ConsentVerificationComponent e : element.getVerification()) 
39360          composeConsentVerificationComponent(null, e);
39361        closeArray();
39362      };
39363      if (element.hasProvision()) {
39364        composeProvisionComponent("provision", element.getProvision());
39365      }
39366  }
39367
39368  protected void composeConsentPolicyComponent(String name, Consent.ConsentPolicyComponent element) throws IOException {
39369    if (element != null) {
39370      open(name);
39371      composeConsentPolicyComponentProperties(element);
39372      close();
39373    }
39374  }
39375
39376  protected void composeConsentPolicyComponentProperties(Consent.ConsentPolicyComponent element) throws IOException {
39377    composeBackboneElementProperties(element);
39378      if (element.hasAuthorityElement()) {
39379        composeUriCore("authority", element.getAuthorityElement(), false);
39380        composeUriExtras("authority", element.getAuthorityElement(), false);
39381      }
39382      if (element.hasUriElement()) {
39383        composeUriCore("uri", element.getUriElement(), false);
39384        composeUriExtras("uri", element.getUriElement(), false);
39385      }
39386  }
39387
39388  protected void composeConsentVerificationComponent(String name, Consent.ConsentVerificationComponent element) throws IOException {
39389    if (element != null) {
39390      open(name);
39391      composeConsentVerificationComponentProperties(element);
39392      close();
39393    }
39394  }
39395
39396  protected void composeConsentVerificationComponentProperties(Consent.ConsentVerificationComponent element) throws IOException {
39397    composeBackboneElementProperties(element);
39398      if (element.hasVerifiedElement()) {
39399        composeBooleanCore("verified", element.getVerifiedElement(), false);
39400        composeBooleanExtras("verified", element.getVerifiedElement(), false);
39401      }
39402      if (element.hasVerificationType()) {
39403        composeCodeableConcept("verificationType", element.getVerificationType());
39404      }
39405      if (element.hasVerifiedBy()) {
39406        composeReference("verifiedBy", element.getVerifiedBy());
39407      }
39408      if (element.hasVerifiedWith()) {
39409        composeReference("verifiedWith", element.getVerifiedWith());
39410      }
39411      if (element.hasVerificationDate()) {
39412        openArray("verificationDate");
39413        for (DateTimeType e : element.getVerificationDate()) 
39414          composeDateTimeCore(null, e, true);
39415        closeArray();
39416        if (anyHasExtras(element.getVerificationDate())) {
39417          openArray("_verificationDate");
39418          for (DateTimeType e : element.getVerificationDate()) 
39419            composeDateTimeExtras(null, e, true);
39420          closeArray();
39421        }
39422      };
39423  }
39424
39425  protected void composeProvisionComponent(String name, Consent.ProvisionComponent element) throws IOException {
39426    if (element != null) {
39427      open(name);
39428      composeProvisionComponentProperties(element);
39429      close();
39430    }
39431  }
39432
39433  protected void composeProvisionComponentProperties(Consent.ProvisionComponent element) throws IOException {
39434    composeBackboneElementProperties(element);
39435      if (element.hasTypeElement()) {
39436        composeEnumerationCore("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
39437        composeEnumerationExtras("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
39438      }
39439      if (element.hasPeriod()) {
39440        composePeriod("period", element.getPeriod());
39441      }
39442      if (element.hasActor()) {
39443        openArray("actor");
39444        for (Consent.ProvisionActorComponent e : element.getActor()) 
39445          composeProvisionActorComponent(null, e);
39446        closeArray();
39447      };
39448      if (element.hasAction()) {
39449        openArray("action");
39450        for (CodeableConcept e : element.getAction()) 
39451          composeCodeableConcept(null, e);
39452        closeArray();
39453      };
39454      if (element.hasSecurityLabel()) {
39455        openArray("securityLabel");
39456        for (Coding e : element.getSecurityLabel()) 
39457          composeCoding(null, e);
39458        closeArray();
39459      };
39460      if (element.hasPurpose()) {
39461        openArray("purpose");
39462        for (Coding e : element.getPurpose()) 
39463          composeCoding(null, e);
39464        closeArray();
39465      };
39466      if (element.hasClass_()) {
39467        openArray("class");
39468        for (Coding e : element.getClass_()) 
39469          composeCoding(null, e);
39470        closeArray();
39471      };
39472      if (element.hasCode()) {
39473        openArray("code");
39474        for (CodeableConcept e : element.getCode()) 
39475          composeCodeableConcept(null, e);
39476        closeArray();
39477      };
39478      if (element.hasDataPeriod()) {
39479        composePeriod("dataPeriod", element.getDataPeriod());
39480      }
39481      if (element.hasData()) {
39482        openArray("data");
39483        for (Consent.ProvisionDataComponent e : element.getData()) 
39484          composeProvisionDataComponent(null, e);
39485        closeArray();
39486      };
39487      if (element.hasProvision()) {
39488        openArray("provision");
39489        for (Consent.ProvisionComponent e : element.getProvision()) 
39490          composeProvisionComponent(null, e);
39491        closeArray();
39492      };
39493  }
39494
39495  protected void composeProvisionActorComponent(String name, Consent.ProvisionActorComponent element) throws IOException {
39496    if (element != null) {
39497      open(name);
39498      composeProvisionActorComponentProperties(element);
39499      close();
39500    }
39501  }
39502
39503  protected void composeProvisionActorComponentProperties(Consent.ProvisionActorComponent element) throws IOException {
39504    composeBackboneElementProperties(element);
39505      if (element.hasRole()) {
39506        composeCodeableConcept("role", element.getRole());
39507      }
39508      if (element.hasReference()) {
39509        composeReference("reference", element.getReference());
39510      }
39511  }
39512
39513  protected void composeProvisionDataComponent(String name, Consent.ProvisionDataComponent element) throws IOException {
39514    if (element != null) {
39515      open(name);
39516      composeProvisionDataComponentProperties(element);
39517      close();
39518    }
39519  }
39520
39521  protected void composeProvisionDataComponentProperties(Consent.ProvisionDataComponent element) throws IOException {
39522    composeBackboneElementProperties(element);
39523      if (element.hasMeaningElement()) {
39524        composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
39525        composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
39526      }
39527      if (element.hasReference()) {
39528        composeReference("reference", element.getReference());
39529      }
39530  }
39531
39532  protected void composeContract(String name, Contract element) throws IOException {
39533    if (element != null) {
39534      prop("resourceType", name);
39535      composeContractProperties(element);
39536    }
39537  }
39538
39539  protected void composeContractProperties(Contract element) throws IOException {
39540    composeDomainResourceProperties(element);
39541      if (element.hasIdentifier()) {
39542        openArray("identifier");
39543        for (Identifier e : element.getIdentifier()) 
39544          composeIdentifier(null, e);
39545        closeArray();
39546      };
39547      if (element.hasUrlElement()) {
39548        composeUriCore("url", element.getUrlElement(), false);
39549        composeUriExtras("url", element.getUrlElement(), false);
39550      }
39551      if (element.hasVersionElement()) {
39552        composeStringCore("version", element.getVersionElement(), false);
39553        composeStringExtras("version", element.getVersionElement(), false);
39554      }
39555      if (element.hasStatusElement()) {
39556        composeEnumerationCore("status", element.getStatusElement(), new Contract.ContractResourceStatusCodesEnumFactory(), false);
39557        composeEnumerationExtras("status", element.getStatusElement(), new Contract.ContractResourceStatusCodesEnumFactory(), false);
39558      }
39559      if (element.hasLegalState()) {
39560        composeCodeableConcept("legalState", element.getLegalState());
39561      }
39562      if (element.hasInstantiatesCanonical()) {
39563        composeReference("instantiatesCanonical", element.getInstantiatesCanonical());
39564      }
39565      if (element.hasInstantiatesUriElement()) {
39566        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
39567        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
39568      }
39569      if (element.hasContentDerivative()) {
39570        composeCodeableConcept("contentDerivative", element.getContentDerivative());
39571      }
39572      if (element.hasIssuedElement()) {
39573        composeDateTimeCore("issued", element.getIssuedElement(), false);
39574        composeDateTimeExtras("issued", element.getIssuedElement(), false);
39575      }
39576      if (element.hasApplies()) {
39577        composePeriod("applies", element.getApplies());
39578      }
39579      if (element.hasExpirationType()) {
39580        composeCodeableConcept("expirationType", element.getExpirationType());
39581      }
39582      if (element.hasSubject()) {
39583        openArray("subject");
39584        for (Reference e : element.getSubject()) 
39585          composeReference(null, e);
39586        closeArray();
39587      };
39588      if (element.hasAuthority()) {
39589        openArray("authority");
39590        for (Reference e : element.getAuthority()) 
39591          composeReference(null, e);
39592        closeArray();
39593      };
39594      if (element.hasDomain()) {
39595        openArray("domain");
39596        for (Reference e : element.getDomain()) 
39597          composeReference(null, e);
39598        closeArray();
39599      };
39600      if (element.hasSite()) {
39601        openArray("site");
39602        for (Reference e : element.getSite()) 
39603          composeReference(null, e);
39604        closeArray();
39605      };
39606      if (element.hasNameElement()) {
39607        composeStringCore("name", element.getNameElement(), false);
39608        composeStringExtras("name", element.getNameElement(), false);
39609      }
39610      if (element.hasTitleElement()) {
39611        composeStringCore("title", element.getTitleElement(), false);
39612        composeStringExtras("title", element.getTitleElement(), false);
39613      }
39614      if (element.hasSubtitleElement()) {
39615        composeStringCore("subtitle", element.getSubtitleElement(), false);
39616        composeStringExtras("subtitle", element.getSubtitleElement(), false);
39617      }
39618      if (element.hasAlias()) {
39619        openArray("alias");
39620        for (StringType e : element.getAlias()) 
39621          composeStringCore(null, e, true);
39622        closeArray();
39623        if (anyHasExtras(element.getAlias())) {
39624          openArray("_alias");
39625          for (StringType e : element.getAlias()) 
39626            composeStringExtras(null, e, true);
39627          closeArray();
39628        }
39629      };
39630      if (element.hasAuthor()) {
39631        composeReference("author", element.getAuthor());
39632      }
39633      if (element.hasScope()) {
39634        composeCodeableConcept("scope", element.getScope());
39635      }
39636      if (element.hasTopic()) {
39637        composeType("topic", element.getTopic());
39638      }
39639      if (element.hasType()) {
39640        composeCodeableConcept("type", element.getType());
39641      }
39642      if (element.hasSubType()) {
39643        openArray("subType");
39644        for (CodeableConcept e : element.getSubType()) 
39645          composeCodeableConcept(null, e);
39646        closeArray();
39647      };
39648      if (element.hasContentDefinition()) {
39649        composeContentDefinitionComponent("contentDefinition", element.getContentDefinition());
39650      }
39651      if (element.hasTerm()) {
39652        openArray("term");
39653        for (Contract.TermComponent e : element.getTerm()) 
39654          composeTermComponent(null, e);
39655        closeArray();
39656      };
39657      if (element.hasSupportingInfo()) {
39658        openArray("supportingInfo");
39659        for (Reference e : element.getSupportingInfo()) 
39660          composeReference(null, e);
39661        closeArray();
39662      };
39663      if (element.hasRelevantHistory()) {
39664        openArray("relevantHistory");
39665        for (Reference e : element.getRelevantHistory()) 
39666          composeReference(null, e);
39667        closeArray();
39668      };
39669      if (element.hasSigner()) {
39670        openArray("signer");
39671        for (Contract.SignatoryComponent e : element.getSigner()) 
39672          composeSignatoryComponent(null, e);
39673        closeArray();
39674      };
39675      if (element.hasFriendly()) {
39676        openArray("friendly");
39677        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
39678          composeFriendlyLanguageComponent(null, e);
39679        closeArray();
39680      };
39681      if (element.hasLegal()) {
39682        openArray("legal");
39683        for (Contract.LegalLanguageComponent e : element.getLegal()) 
39684          composeLegalLanguageComponent(null, e);
39685        closeArray();
39686      };
39687      if (element.hasRule()) {
39688        openArray("rule");
39689        for (Contract.ComputableLanguageComponent e : element.getRule()) 
39690          composeComputableLanguageComponent(null, e);
39691        closeArray();
39692      };
39693      if (element.hasLegallyBinding()) {
39694        composeType("legallyBinding", element.getLegallyBinding());
39695      }
39696  }
39697
39698  protected void composeContentDefinitionComponent(String name, Contract.ContentDefinitionComponent element) throws IOException {
39699    if (element != null) {
39700      open(name);
39701      composeContentDefinitionComponentProperties(element);
39702      close();
39703    }
39704  }
39705
39706  protected void composeContentDefinitionComponentProperties(Contract.ContentDefinitionComponent element) throws IOException {
39707    composeBackboneElementProperties(element);
39708      if (element.hasType()) {
39709        composeCodeableConcept("type", element.getType());
39710      }
39711      if (element.hasSubType()) {
39712        composeCodeableConcept("subType", element.getSubType());
39713      }
39714      if (element.hasPublisher()) {
39715        composeReference("publisher", element.getPublisher());
39716      }
39717      if (element.hasPublicationDateElement()) {
39718        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
39719        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
39720      }
39721      if (element.hasPublicationStatusElement()) {
39722        composeEnumerationCore("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractResourcePublicationStatusCodesEnumFactory(), false);
39723        composeEnumerationExtras("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractResourcePublicationStatusCodesEnumFactory(), false);
39724      }
39725      if (element.hasCopyrightElement()) {
39726        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39727        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39728      }
39729  }
39730
39731  protected void composeTermComponent(String name, Contract.TermComponent element) throws IOException {
39732    if (element != null) {
39733      open(name);
39734      composeTermComponentProperties(element);
39735      close();
39736    }
39737  }
39738
39739  protected void composeTermComponentProperties(Contract.TermComponent element) throws IOException {
39740    composeBackboneElementProperties(element);
39741      if (element.hasIdentifier()) {
39742        composeIdentifier("identifier", element.getIdentifier());
39743      }
39744      if (element.hasIssuedElement()) {
39745        composeDateTimeCore("issued", element.getIssuedElement(), false);
39746        composeDateTimeExtras("issued", element.getIssuedElement(), false);
39747      }
39748      if (element.hasApplies()) {
39749        composePeriod("applies", element.getApplies());
39750      }
39751      if (element.hasTopic()) {
39752        composeType("topic", element.getTopic());
39753      }
39754      if (element.hasType()) {
39755        composeCodeableConcept("type", element.getType());
39756      }
39757      if (element.hasSubType()) {
39758        composeCodeableConcept("subType", element.getSubType());
39759      }
39760      if (element.hasTextElement()) {
39761        composeStringCore("text", element.getTextElement(), false);
39762        composeStringExtras("text", element.getTextElement(), false);
39763      }
39764      if (element.hasSecurityLabel()) {
39765        openArray("securityLabel");
39766        for (Contract.SecurityLabelComponent e : element.getSecurityLabel()) 
39767          composeSecurityLabelComponent(null, e);
39768        closeArray();
39769      };
39770      if (element.hasOffer()) {
39771        composeContractOfferComponent("offer", element.getOffer());
39772      }
39773      if (element.hasAsset()) {
39774        openArray("asset");
39775        for (Contract.ContractAssetComponent e : element.getAsset()) 
39776          composeContractAssetComponent(null, e);
39777        closeArray();
39778      };
39779      if (element.hasAction()) {
39780        openArray("action");
39781        for (Contract.ActionComponent e : element.getAction()) 
39782          composeActionComponent(null, e);
39783        closeArray();
39784      };
39785      if (element.hasGroup()) {
39786        openArray("group");
39787        for (Contract.TermComponent e : element.getGroup()) 
39788          composeTermComponent(null, e);
39789        closeArray();
39790      };
39791  }
39792
39793  protected void composeSecurityLabelComponent(String name, Contract.SecurityLabelComponent element) throws IOException {
39794    if (element != null) {
39795      open(name);
39796      composeSecurityLabelComponentProperties(element);
39797      close();
39798    }
39799  }
39800
39801  protected void composeSecurityLabelComponentProperties(Contract.SecurityLabelComponent element) throws IOException {
39802    composeBackboneElementProperties(element);
39803      if (element.hasNumber()) {
39804        openArray("number");
39805        for (UnsignedIntType e : element.getNumber()) 
39806          composeUnsignedIntCore(null, e, true);
39807        closeArray();
39808        if (anyHasExtras(element.getNumber())) {
39809          openArray("_number");
39810          for (UnsignedIntType e : element.getNumber()) 
39811            composeUnsignedIntExtras(null, e, true);
39812          closeArray();
39813        }
39814      };
39815      if (element.hasClassification()) {
39816        composeCoding("classification", element.getClassification());
39817      }
39818      if (element.hasCategory()) {
39819        openArray("category");
39820        for (Coding e : element.getCategory()) 
39821          composeCoding(null, e);
39822        closeArray();
39823      };
39824      if (element.hasControl()) {
39825        openArray("control");
39826        for (Coding e : element.getControl()) 
39827          composeCoding(null, e);
39828        closeArray();
39829      };
39830  }
39831
39832  protected void composeContractOfferComponent(String name, Contract.ContractOfferComponent element) throws IOException {
39833    if (element != null) {
39834      open(name);
39835      composeContractOfferComponentProperties(element);
39836      close();
39837    }
39838  }
39839
39840  protected void composeContractOfferComponentProperties(Contract.ContractOfferComponent element) throws IOException {
39841    composeBackboneElementProperties(element);
39842      if (element.hasIdentifier()) {
39843        openArray("identifier");
39844        for (Identifier e : element.getIdentifier()) 
39845          composeIdentifier(null, e);
39846        closeArray();
39847      };
39848      if (element.hasParty()) {
39849        openArray("party");
39850        for (Contract.ContractPartyComponent e : element.getParty()) 
39851          composeContractPartyComponent(null, e);
39852        closeArray();
39853      };
39854      if (element.hasTopic()) {
39855        composeReference("topic", element.getTopic());
39856      }
39857      if (element.hasType()) {
39858        composeCodeableConcept("type", element.getType());
39859      }
39860      if (element.hasDecision()) {
39861        composeCodeableConcept("decision", element.getDecision());
39862      }
39863      if (element.hasDecisionMode()) {
39864        openArray("decisionMode");
39865        for (CodeableConcept e : element.getDecisionMode()) 
39866          composeCodeableConcept(null, e);
39867        closeArray();
39868      };
39869      if (element.hasAnswer()) {
39870        openArray("answer");
39871        for (Contract.AnswerComponent e : element.getAnswer()) 
39872          composeAnswerComponent(null, e);
39873        closeArray();
39874      };
39875      if (element.hasTextElement()) {
39876        composeStringCore("text", element.getTextElement(), false);
39877        composeStringExtras("text", element.getTextElement(), false);
39878      }
39879      if (element.hasLinkId()) {
39880        openArray("linkId");
39881        for (StringType e : element.getLinkId()) 
39882          composeStringCore(null, e, true);
39883        closeArray();
39884        if (anyHasExtras(element.getLinkId())) {
39885          openArray("_linkId");
39886          for (StringType e : element.getLinkId()) 
39887            composeStringExtras(null, e, true);
39888          closeArray();
39889        }
39890      };
39891      if (element.hasSecurityLabelNumber()) {
39892        openArray("securityLabelNumber");
39893        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
39894          composeUnsignedIntCore(null, e, true);
39895        closeArray();
39896        if (anyHasExtras(element.getSecurityLabelNumber())) {
39897          openArray("_securityLabelNumber");
39898          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
39899            composeUnsignedIntExtras(null, e, true);
39900          closeArray();
39901        }
39902      };
39903  }
39904
39905  protected void composeContractPartyComponent(String name, Contract.ContractPartyComponent element) throws IOException {
39906    if (element != null) {
39907      open(name);
39908      composeContractPartyComponentProperties(element);
39909      close();
39910    }
39911  }
39912
39913  protected void composeContractPartyComponentProperties(Contract.ContractPartyComponent element) throws IOException {
39914    composeBackboneElementProperties(element);
39915      if (element.hasReference()) {
39916        openArray("reference");
39917        for (Reference e : element.getReference()) 
39918          composeReference(null, e);
39919        closeArray();
39920      };
39921      if (element.hasRole()) {
39922        composeCodeableConcept("role", element.getRole());
39923      }
39924  }
39925
39926  protected void composeAnswerComponent(String name, Contract.AnswerComponent element) throws IOException {
39927    if (element != null) {
39928      open(name);
39929      composeAnswerComponentProperties(element);
39930      close();
39931    }
39932  }
39933
39934  protected void composeAnswerComponentProperties(Contract.AnswerComponent element) throws IOException {
39935    composeBackboneElementProperties(element);
39936      if (element.hasValue()) {
39937        composeType("value", element.getValue());
39938      }
39939  }
39940
39941  protected void composeContractAssetComponent(String name, Contract.ContractAssetComponent element) throws IOException {
39942    if (element != null) {
39943      open(name);
39944      composeContractAssetComponentProperties(element);
39945      close();
39946    }
39947  }
39948
39949  protected void composeContractAssetComponentProperties(Contract.ContractAssetComponent element) throws IOException {
39950    composeBackboneElementProperties(element);
39951      if (element.hasScope()) {
39952        composeCodeableConcept("scope", element.getScope());
39953      }
39954      if (element.hasType()) {
39955        openArray("type");
39956        for (CodeableConcept e : element.getType()) 
39957          composeCodeableConcept(null, e);
39958        closeArray();
39959      };
39960      if (element.hasTypeReference()) {
39961        openArray("typeReference");
39962        for (Reference e : element.getTypeReference()) 
39963          composeReference(null, e);
39964        closeArray();
39965      };
39966      if (element.hasSubtype()) {
39967        openArray("subtype");
39968        for (CodeableConcept e : element.getSubtype()) 
39969          composeCodeableConcept(null, e);
39970        closeArray();
39971      };
39972      if (element.hasRelationship()) {
39973        composeCoding("relationship", element.getRelationship());
39974      }
39975      if (element.hasContext()) {
39976        openArray("context");
39977        for (Contract.AssetContextComponent e : element.getContext()) 
39978          composeAssetContextComponent(null, e);
39979        closeArray();
39980      };
39981      if (element.hasConditionElement()) {
39982        composeStringCore("condition", element.getConditionElement(), false);
39983        composeStringExtras("condition", element.getConditionElement(), false);
39984      }
39985      if (element.hasPeriodType()) {
39986        openArray("periodType");
39987        for (CodeableConcept e : element.getPeriodType()) 
39988          composeCodeableConcept(null, e);
39989        closeArray();
39990      };
39991      if (element.hasPeriod()) {
39992        openArray("period");
39993        for (Period e : element.getPeriod()) 
39994          composePeriod(null, e);
39995        closeArray();
39996      };
39997      if (element.hasUsePeriod()) {
39998        openArray("usePeriod");
39999        for (Period e : element.getUsePeriod()) 
40000          composePeriod(null, e);
40001        closeArray();
40002      };
40003      if (element.hasTextElement()) {
40004        composeStringCore("text", element.getTextElement(), false);
40005        composeStringExtras("text", element.getTextElement(), false);
40006      }
40007      if (element.hasLinkId()) {
40008        openArray("linkId");
40009        for (StringType e : element.getLinkId()) 
40010          composeStringCore(null, e, true);
40011        closeArray();
40012        if (anyHasExtras(element.getLinkId())) {
40013          openArray("_linkId");
40014          for (StringType e : element.getLinkId()) 
40015            composeStringExtras(null, e, true);
40016          closeArray();
40017        }
40018      };
40019      if (element.hasAnswer()) {
40020        openArray("answer");
40021        for (Contract.AnswerComponent e : element.getAnswer()) 
40022          composeAnswerComponent(null, e);
40023        closeArray();
40024      };
40025      if (element.hasSecurityLabelNumber()) {
40026        openArray("securityLabelNumber");
40027        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
40028          composeUnsignedIntCore(null, e, true);
40029        closeArray();
40030        if (anyHasExtras(element.getSecurityLabelNumber())) {
40031          openArray("_securityLabelNumber");
40032          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
40033            composeUnsignedIntExtras(null, e, true);
40034          closeArray();
40035        }
40036      };
40037      if (element.hasValuedItem()) {
40038        openArray("valuedItem");
40039        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
40040          composeValuedItemComponent(null, e);
40041        closeArray();
40042      };
40043  }
40044
40045  protected void composeAssetContextComponent(String name, Contract.AssetContextComponent element) throws IOException {
40046    if (element != null) {
40047      open(name);
40048      composeAssetContextComponentProperties(element);
40049      close();
40050    }
40051  }
40052
40053  protected void composeAssetContextComponentProperties(Contract.AssetContextComponent element) throws IOException {
40054    composeBackboneElementProperties(element);
40055      if (element.hasReference()) {
40056        composeReference("reference", element.getReference());
40057      }
40058      if (element.hasCode()) {
40059        openArray("code");
40060        for (CodeableConcept e : element.getCode()) 
40061          composeCodeableConcept(null, e);
40062        closeArray();
40063      };
40064      if (element.hasTextElement()) {
40065        composeStringCore("text", element.getTextElement(), false);
40066        composeStringExtras("text", element.getTextElement(), false);
40067      }
40068  }
40069
40070  protected void composeValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
40071    if (element != null) {
40072      open(name);
40073      composeValuedItemComponentProperties(element);
40074      close();
40075    }
40076  }
40077
40078  protected void composeValuedItemComponentProperties(Contract.ValuedItemComponent element) throws IOException {
40079    composeBackboneElementProperties(element);
40080      if (element.hasEntity()) {
40081        composeType("entity", element.getEntity());
40082      }
40083      if (element.hasIdentifier()) {
40084        composeIdentifier("identifier", element.getIdentifier());
40085      }
40086      if (element.hasEffectiveTimeElement()) {
40087        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
40088        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
40089      }
40090      if (element.hasQuantity()) {
40091        composeQuantity("quantity", element.getQuantity());
40092      }
40093      if (element.hasUnitPrice()) {
40094        composeMoney("unitPrice", element.getUnitPrice());
40095      }
40096      if (element.hasFactorElement()) {
40097        composeDecimalCore("factor", element.getFactorElement(), false);
40098        composeDecimalExtras("factor", element.getFactorElement(), false);
40099      }
40100      if (element.hasPointsElement()) {
40101        composeDecimalCore("points", element.getPointsElement(), false);
40102        composeDecimalExtras("points", element.getPointsElement(), false);
40103      }
40104      if (element.hasNet()) {
40105        composeMoney("net", element.getNet());
40106      }
40107      if (element.hasPaymentElement()) {
40108        composeStringCore("payment", element.getPaymentElement(), false);
40109        composeStringExtras("payment", element.getPaymentElement(), false);
40110      }
40111      if (element.hasPaymentDateElement()) {
40112        composeDateTimeCore("paymentDate", element.getPaymentDateElement(), false);
40113        composeDateTimeExtras("paymentDate", element.getPaymentDateElement(), false);
40114      }
40115      if (element.hasResponsible()) {
40116        composeReference("responsible", element.getResponsible());
40117      }
40118      if (element.hasRecipient()) {
40119        composeReference("recipient", element.getRecipient());
40120      }
40121      if (element.hasLinkId()) {
40122        openArray("linkId");
40123        for (StringType e : element.getLinkId()) 
40124          composeStringCore(null, e, true);
40125        closeArray();
40126        if (anyHasExtras(element.getLinkId())) {
40127          openArray("_linkId");
40128          for (StringType e : element.getLinkId()) 
40129            composeStringExtras(null, e, true);
40130          closeArray();
40131        }
40132      };
40133      if (element.hasSecurityLabelNumber()) {
40134        openArray("securityLabelNumber");
40135        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
40136          composeUnsignedIntCore(null, e, true);
40137        closeArray();
40138        if (anyHasExtras(element.getSecurityLabelNumber())) {
40139          openArray("_securityLabelNumber");
40140          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
40141            composeUnsignedIntExtras(null, e, true);
40142          closeArray();
40143        }
40144      };
40145  }
40146
40147  protected void composeActionComponent(String name, Contract.ActionComponent element) throws IOException {
40148    if (element != null) {
40149      open(name);
40150      composeActionComponentProperties(element);
40151      close();
40152    }
40153  }
40154
40155  protected void composeActionComponentProperties(Contract.ActionComponent element) throws IOException {
40156    composeBackboneElementProperties(element);
40157      if (element.hasDoNotPerformElement()) {
40158        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
40159        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
40160      }
40161      if (element.hasType()) {
40162        composeCodeableConcept("type", element.getType());
40163      }
40164      if (element.hasSubject()) {
40165        openArray("subject");
40166        for (Contract.ActionSubjectComponent e : element.getSubject()) 
40167          composeActionSubjectComponent(null, e);
40168        closeArray();
40169      };
40170      if (element.hasIntent()) {
40171        composeCodeableConcept("intent", element.getIntent());
40172      }
40173      if (element.hasLinkId()) {
40174        openArray("linkId");
40175        for (StringType e : element.getLinkId()) 
40176          composeStringCore(null, e, true);
40177        closeArray();
40178        if (anyHasExtras(element.getLinkId())) {
40179          openArray("_linkId");
40180          for (StringType e : element.getLinkId()) 
40181            composeStringExtras(null, e, true);
40182          closeArray();
40183        }
40184      };
40185      if (element.hasStatus()) {
40186        composeCodeableConcept("status", element.getStatus());
40187      }
40188      if (element.hasContext()) {
40189        composeReference("context", element.getContext());
40190      }
40191      if (element.hasContextLinkId()) {
40192        openArray("contextLinkId");
40193        for (StringType e : element.getContextLinkId()) 
40194          composeStringCore(null, e, true);
40195        closeArray();
40196        if (anyHasExtras(element.getContextLinkId())) {
40197          openArray("_contextLinkId");
40198          for (StringType e : element.getContextLinkId()) 
40199            composeStringExtras(null, e, true);
40200          closeArray();
40201        }
40202      };
40203      if (element.hasOccurrence()) {
40204        composeType("occurrence", element.getOccurrence());
40205      }
40206      if (element.hasRequester()) {
40207        openArray("requester");
40208        for (Reference e : element.getRequester()) 
40209          composeReference(null, e);
40210        closeArray();
40211      };
40212      if (element.hasRequesterLinkId()) {
40213        openArray("requesterLinkId");
40214        for (StringType e : element.getRequesterLinkId()) 
40215          composeStringCore(null, e, true);
40216        closeArray();
40217        if (anyHasExtras(element.getRequesterLinkId())) {
40218          openArray("_requesterLinkId");
40219          for (StringType e : element.getRequesterLinkId()) 
40220            composeStringExtras(null, e, true);
40221          closeArray();
40222        }
40223      };
40224      if (element.hasPerformerType()) {
40225        openArray("performerType");
40226        for (CodeableConcept e : element.getPerformerType()) 
40227          composeCodeableConcept(null, e);
40228        closeArray();
40229      };
40230      if (element.hasPerformerRole()) {
40231        composeCodeableConcept("performerRole", element.getPerformerRole());
40232      }
40233      if (element.hasPerformer()) {
40234        composeReference("performer", element.getPerformer());
40235      }
40236      if (element.hasPerformerLinkId()) {
40237        openArray("performerLinkId");
40238        for (StringType e : element.getPerformerLinkId()) 
40239          composeStringCore(null, e, true);
40240        closeArray();
40241        if (anyHasExtras(element.getPerformerLinkId())) {
40242          openArray("_performerLinkId");
40243          for (StringType e : element.getPerformerLinkId()) 
40244            composeStringExtras(null, e, true);
40245          closeArray();
40246        }
40247      };
40248      if (element.hasReason()) {
40249        openArray("reason");
40250        for (CodeableReference e : element.getReason()) 
40251          composeCodeableReference(null, e);
40252        closeArray();
40253      };
40254      if (element.hasReasonLinkId()) {
40255        openArray("reasonLinkId");
40256        for (StringType e : element.getReasonLinkId()) 
40257          composeStringCore(null, e, true);
40258        closeArray();
40259        if (anyHasExtras(element.getReasonLinkId())) {
40260          openArray("_reasonLinkId");
40261          for (StringType e : element.getReasonLinkId()) 
40262            composeStringExtras(null, e, true);
40263          closeArray();
40264        }
40265      };
40266      if (element.hasNote()) {
40267        openArray("note");
40268        for (Annotation e : element.getNote()) 
40269          composeAnnotation(null, e);
40270        closeArray();
40271      };
40272      if (element.hasSecurityLabelNumber()) {
40273        openArray("securityLabelNumber");
40274        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
40275          composeUnsignedIntCore(null, e, true);
40276        closeArray();
40277        if (anyHasExtras(element.getSecurityLabelNumber())) {
40278          openArray("_securityLabelNumber");
40279          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
40280            composeUnsignedIntExtras(null, e, true);
40281          closeArray();
40282        }
40283      };
40284  }
40285
40286  protected void composeActionSubjectComponent(String name, Contract.ActionSubjectComponent element) throws IOException {
40287    if (element != null) {
40288      open(name);
40289      composeActionSubjectComponentProperties(element);
40290      close();
40291    }
40292  }
40293
40294  protected void composeActionSubjectComponentProperties(Contract.ActionSubjectComponent element) throws IOException {
40295    composeBackboneElementProperties(element);
40296      if (element.hasReference()) {
40297        openArray("reference");
40298        for (Reference e : element.getReference()) 
40299          composeReference(null, e);
40300        closeArray();
40301      };
40302      if (element.hasRole()) {
40303        composeCodeableConcept("role", element.getRole());
40304      }
40305  }
40306
40307  protected void composeSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
40308    if (element != null) {
40309      open(name);
40310      composeSignatoryComponentProperties(element);
40311      close();
40312    }
40313  }
40314
40315  protected void composeSignatoryComponentProperties(Contract.SignatoryComponent element) throws IOException {
40316    composeBackboneElementProperties(element);
40317      if (element.hasType()) {
40318        composeCoding("type", element.getType());
40319      }
40320      if (element.hasParty()) {
40321        composeReference("party", element.getParty());
40322      }
40323      if (element.hasSignature()) {
40324        openArray("signature");
40325        for (Signature e : element.getSignature()) 
40326          composeSignature(null, e);
40327        closeArray();
40328      };
40329  }
40330
40331  protected void composeFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
40332    if (element != null) {
40333      open(name);
40334      composeFriendlyLanguageComponentProperties(element);
40335      close();
40336    }
40337  }
40338
40339  protected void composeFriendlyLanguageComponentProperties(Contract.FriendlyLanguageComponent element) throws IOException {
40340    composeBackboneElementProperties(element);
40341      if (element.hasContent()) {
40342        composeType("content", element.getContent());
40343      }
40344  }
40345
40346  protected void composeLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
40347    if (element != null) {
40348      open(name);
40349      composeLegalLanguageComponentProperties(element);
40350      close();
40351    }
40352  }
40353
40354  protected void composeLegalLanguageComponentProperties(Contract.LegalLanguageComponent element) throws IOException {
40355    composeBackboneElementProperties(element);
40356      if (element.hasContent()) {
40357        composeType("content", element.getContent());
40358      }
40359  }
40360
40361  protected void composeComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
40362    if (element != null) {
40363      open(name);
40364      composeComputableLanguageComponentProperties(element);
40365      close();
40366    }
40367  }
40368
40369  protected void composeComputableLanguageComponentProperties(Contract.ComputableLanguageComponent element) throws IOException {
40370    composeBackboneElementProperties(element);
40371      if (element.hasContent()) {
40372        composeType("content", element.getContent());
40373      }
40374  }
40375
40376  protected void composeCoverage(String name, Coverage element) throws IOException {
40377    if (element != null) {
40378      prop("resourceType", name);
40379      composeCoverageProperties(element);
40380    }
40381  }
40382
40383  protected void composeCoverageProperties(Coverage element) throws IOException {
40384    composeDomainResourceProperties(element);
40385      if (element.hasIdentifier()) {
40386        openArray("identifier");
40387        for (Identifier e : element.getIdentifier()) 
40388          composeIdentifier(null, e);
40389        closeArray();
40390      };
40391      if (element.hasStatusElement()) {
40392        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
40393        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
40394      }
40395      if (element.hasType()) {
40396        composeCodeableConcept("type", element.getType());
40397      }
40398      if (element.hasPolicyHolder()) {
40399        composeReference("policyHolder", element.getPolicyHolder());
40400      }
40401      if (element.hasSubscriber()) {
40402        composeReference("subscriber", element.getSubscriber());
40403      }
40404      if (element.hasSubscriberId()) {
40405        composeIdentifier("subscriberId", element.getSubscriberId());
40406      }
40407      if (element.hasBeneficiary()) {
40408        composeReference("beneficiary", element.getBeneficiary());
40409      }
40410      if (element.hasDependentElement()) {
40411        composeStringCore("dependent", element.getDependentElement(), false);
40412        composeStringExtras("dependent", element.getDependentElement(), false);
40413      }
40414      if (element.hasRelationship()) {
40415        composeCodeableConcept("relationship", element.getRelationship());
40416      }
40417      if (element.hasPeriod()) {
40418        composePeriod("period", element.getPeriod());
40419      }
40420      if (element.hasPayor()) {
40421        openArray("payor");
40422        for (Reference e : element.getPayor()) 
40423          composeReference(null, e);
40424        closeArray();
40425      };
40426      if (element.hasClass_()) {
40427        openArray("class");
40428        for (Coverage.ClassComponent e : element.getClass_()) 
40429          composeClassComponent(null, e);
40430        closeArray();
40431      };
40432      if (element.hasOrderElement()) {
40433        composePositiveIntCore("order", element.getOrderElement(), false);
40434        composePositiveIntExtras("order", element.getOrderElement(), false);
40435      }
40436      if (element.hasNetworkElement()) {
40437        composeStringCore("network", element.getNetworkElement(), false);
40438        composeStringExtras("network", element.getNetworkElement(), false);
40439      }
40440      if (element.hasCostToBeneficiary()) {
40441        openArray("costToBeneficiary");
40442        for (Coverage.CostToBeneficiaryComponent e : element.getCostToBeneficiary()) 
40443          composeCostToBeneficiaryComponent(null, e);
40444        closeArray();
40445      };
40446      if (element.hasSubrogationElement()) {
40447        composeBooleanCore("subrogation", element.getSubrogationElement(), false);
40448        composeBooleanExtras("subrogation", element.getSubrogationElement(), false);
40449      }
40450      if (element.hasContract()) {
40451        openArray("contract");
40452        for (Reference e : element.getContract()) 
40453          composeReference(null, e);
40454        closeArray();
40455      };
40456  }
40457
40458  protected void composeClassComponent(String name, Coverage.ClassComponent element) throws IOException {
40459    if (element != null) {
40460      open(name);
40461      composeClassComponentProperties(element);
40462      close();
40463    }
40464  }
40465
40466  protected void composeClassComponentProperties(Coverage.ClassComponent element) throws IOException {
40467    composeBackboneElementProperties(element);
40468      if (element.hasType()) {
40469        composeCodeableConcept("type", element.getType());
40470      }
40471      if (element.hasValueElement()) {
40472        composeStringCore("value", element.getValueElement(), false);
40473        composeStringExtras("value", element.getValueElement(), false);
40474      }
40475      if (element.hasNameElement()) {
40476        composeStringCore("name", element.getNameElement(), false);
40477        composeStringExtras("name", element.getNameElement(), false);
40478      }
40479  }
40480
40481  protected void composeCostToBeneficiaryComponent(String name, Coverage.CostToBeneficiaryComponent element) throws IOException {
40482    if (element != null) {
40483      open(name);
40484      composeCostToBeneficiaryComponentProperties(element);
40485      close();
40486    }
40487  }
40488
40489  protected void composeCostToBeneficiaryComponentProperties(Coverage.CostToBeneficiaryComponent element) throws IOException {
40490    composeBackboneElementProperties(element);
40491      if (element.hasType()) {
40492        composeCodeableConcept("type", element.getType());
40493      }
40494      if (element.hasValue()) {
40495        composeType("value", element.getValue());
40496      }
40497      if (element.hasException()) {
40498        openArray("exception");
40499        for (Coverage.ExemptionComponent e : element.getException()) 
40500          composeExemptionComponent(null, e);
40501        closeArray();
40502      };
40503  }
40504
40505  protected void composeExemptionComponent(String name, Coverage.ExemptionComponent element) throws IOException {
40506    if (element != null) {
40507      open(name);
40508      composeExemptionComponentProperties(element);
40509      close();
40510    }
40511  }
40512
40513  protected void composeExemptionComponentProperties(Coverage.ExemptionComponent element) throws IOException {
40514    composeBackboneElementProperties(element);
40515      if (element.hasType()) {
40516        composeCodeableConcept("type", element.getType());
40517      }
40518      if (element.hasPeriod()) {
40519        composePeriod("period", element.getPeriod());
40520      }
40521  }
40522
40523  protected void composeCoverageEligibilityRequest(String name, CoverageEligibilityRequest element) throws IOException {
40524    if (element != null) {
40525      prop("resourceType", name);
40526      composeCoverageEligibilityRequestProperties(element);
40527    }
40528  }
40529
40530  protected void composeCoverageEligibilityRequestProperties(CoverageEligibilityRequest element) throws IOException {
40531    composeDomainResourceProperties(element);
40532      if (element.hasIdentifier()) {
40533        openArray("identifier");
40534        for (Identifier e : element.getIdentifier()) 
40535          composeIdentifier(null, e);
40536        closeArray();
40537      };
40538      if (element.hasStatusElement()) {
40539        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
40540        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
40541      }
40542      if (element.hasPriority()) {
40543        composeCodeableConcept("priority", element.getPriority());
40544      }
40545      if (element.hasPurpose()) {
40546        openArray("purpose");
40547        for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
40548          composeEnumerationCore(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
40549        closeArray();
40550        if (anyHasExtras(element.getPurpose())) {
40551          openArray("_purpose");
40552          for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
40553            composeEnumerationExtras(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
40554          closeArray();
40555        }
40556      };
40557      if (element.hasPatient()) {
40558        composeReference("patient", element.getPatient());
40559      }
40560      if (element.hasServiced()) {
40561        composeType("serviced", element.getServiced());
40562      }
40563      if (element.hasCreatedElement()) {
40564        composeDateTimeCore("created", element.getCreatedElement(), false);
40565        composeDateTimeExtras("created", element.getCreatedElement(), false);
40566      }
40567      if (element.hasEnterer()) {
40568        composeReference("enterer", element.getEnterer());
40569      }
40570      if (element.hasProvider()) {
40571        composeReference("provider", element.getProvider());
40572      }
40573      if (element.hasInsurer()) {
40574        composeReference("insurer", element.getInsurer());
40575      }
40576      if (element.hasFacility()) {
40577        composeReference("facility", element.getFacility());
40578      }
40579      if (element.hasSupportingInfo()) {
40580        openArray("supportingInfo");
40581        for (CoverageEligibilityRequest.SupportingInformationComponent e : element.getSupportingInfo()) 
40582          composeSupportingInformationComponent(null, e);
40583        closeArray();
40584      };
40585      if (element.hasInsurance()) {
40586        openArray("insurance");
40587        for (CoverageEligibilityRequest.InsuranceComponent e : element.getInsurance()) 
40588          composeInsuranceComponent(null, e);
40589        closeArray();
40590      };
40591      if (element.hasItem()) {
40592        openArray("item");
40593        for (CoverageEligibilityRequest.DetailsComponent e : element.getItem()) 
40594          composeDetailsComponent(null, e);
40595        closeArray();
40596      };
40597  }
40598
40599  protected void composeSupportingInformationComponent(String name, CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
40600    if (element != null) {
40601      open(name);
40602      composeSupportingInformationComponentProperties(element);
40603      close();
40604    }
40605  }
40606
40607  protected void composeSupportingInformationComponentProperties(CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
40608    composeBackboneElementProperties(element);
40609      if (element.hasSequenceElement()) {
40610        composePositiveIntCore("sequence", element.getSequenceElement(), false);
40611        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
40612      }
40613      if (element.hasInformation()) {
40614        composeReference("information", element.getInformation());
40615      }
40616      if (element.hasAppliesToAllElement()) {
40617        composeBooleanCore("appliesToAll", element.getAppliesToAllElement(), false);
40618        composeBooleanExtras("appliesToAll", element.getAppliesToAllElement(), false);
40619      }
40620  }
40621
40622  protected void composeInsuranceComponent(String name, CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
40623    if (element != null) {
40624      open(name);
40625      composeInsuranceComponentProperties(element);
40626      close();
40627    }
40628  }
40629
40630  protected void composeInsuranceComponentProperties(CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
40631    composeBackboneElementProperties(element);
40632      if (element.hasFocalElement()) {
40633        composeBooleanCore("focal", element.getFocalElement(), false);
40634        composeBooleanExtras("focal", element.getFocalElement(), false);
40635      }
40636      if (element.hasCoverage()) {
40637        composeReference("coverage", element.getCoverage());
40638      }
40639      if (element.hasBusinessArrangementElement()) {
40640        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
40641        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
40642      }
40643  }
40644
40645  protected void composeDetailsComponent(String name, CoverageEligibilityRequest.DetailsComponent element) throws IOException {
40646    if (element != null) {
40647      open(name);
40648      composeDetailsComponentProperties(element);
40649      close();
40650    }
40651  }
40652
40653  protected void composeDetailsComponentProperties(CoverageEligibilityRequest.DetailsComponent element) throws IOException {
40654    composeBackboneElementProperties(element);
40655      if (element.hasSupportingInfoSequence()) {
40656        openArray("supportingInfoSequence");
40657        for (PositiveIntType e : element.getSupportingInfoSequence()) 
40658          composePositiveIntCore(null, e, true);
40659        closeArray();
40660        if (anyHasExtras(element.getSupportingInfoSequence())) {
40661          openArray("_supportingInfoSequence");
40662          for (PositiveIntType e : element.getSupportingInfoSequence()) 
40663            composePositiveIntExtras(null, e, true);
40664          closeArray();
40665        }
40666      };
40667      if (element.hasCategory()) {
40668        composeCodeableConcept("category", element.getCategory());
40669      }
40670      if (element.hasProductOrService()) {
40671        composeCodeableConcept("productOrService", element.getProductOrService());
40672      }
40673      if (element.hasModifier()) {
40674        openArray("modifier");
40675        for (CodeableConcept e : element.getModifier()) 
40676          composeCodeableConcept(null, e);
40677        closeArray();
40678      };
40679      if (element.hasProvider()) {
40680        composeReference("provider", element.getProvider());
40681      }
40682      if (element.hasQuantity()) {
40683        composeQuantity("quantity", element.getQuantity());
40684      }
40685      if (element.hasUnitPrice()) {
40686        composeMoney("unitPrice", element.getUnitPrice());
40687      }
40688      if (element.hasFacility()) {
40689        composeReference("facility", element.getFacility());
40690      }
40691      if (element.hasDiagnosis()) {
40692        openArray("diagnosis");
40693        for (CoverageEligibilityRequest.DiagnosisComponent e : element.getDiagnosis()) 
40694          composeDiagnosisComponent(null, e);
40695        closeArray();
40696      };
40697      if (element.hasDetail()) {
40698        openArray("detail");
40699        for (Reference e : element.getDetail()) 
40700          composeReference(null, e);
40701        closeArray();
40702      };
40703  }
40704
40705  protected void composeDiagnosisComponent(String name, CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
40706    if (element != null) {
40707      open(name);
40708      composeDiagnosisComponentProperties(element);
40709      close();
40710    }
40711  }
40712
40713  protected void composeDiagnosisComponentProperties(CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
40714    composeBackboneElementProperties(element);
40715      if (element.hasDiagnosis()) {
40716        composeType("diagnosis", element.getDiagnosis());
40717      }
40718  }
40719
40720  protected void composeCoverageEligibilityResponse(String name, CoverageEligibilityResponse element) throws IOException {
40721    if (element != null) {
40722      prop("resourceType", name);
40723      composeCoverageEligibilityResponseProperties(element);
40724    }
40725  }
40726
40727  protected void composeCoverageEligibilityResponseProperties(CoverageEligibilityResponse element) throws IOException {
40728    composeDomainResourceProperties(element);
40729      if (element.hasIdentifier()) {
40730        openArray("identifier");
40731        for (Identifier e : element.getIdentifier()) 
40732          composeIdentifier(null, e);
40733        closeArray();
40734      };
40735      if (element.hasStatusElement()) {
40736        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
40737        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
40738      }
40739      if (element.hasPurpose()) {
40740        openArray("purpose");
40741        for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
40742          composeEnumerationCore(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
40743        closeArray();
40744        if (anyHasExtras(element.getPurpose())) {
40745          openArray("_purpose");
40746          for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
40747            composeEnumerationExtras(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
40748          closeArray();
40749        }
40750      };
40751      if (element.hasPatient()) {
40752        composeReference("patient", element.getPatient());
40753      }
40754      if (element.hasServiced()) {
40755        composeType("serviced", element.getServiced());
40756      }
40757      if (element.hasCreatedElement()) {
40758        composeDateTimeCore("created", element.getCreatedElement(), false);
40759        composeDateTimeExtras("created", element.getCreatedElement(), false);
40760      }
40761      if (element.hasRequestor()) {
40762        composeReference("requestor", element.getRequestor());
40763      }
40764      if (element.hasRequest()) {
40765        composeReference("request", element.getRequest());
40766      }
40767      if (element.hasOutcomeElement()) {
40768        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
40769        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
40770      }
40771      if (element.hasDispositionElement()) {
40772        composeStringCore("disposition", element.getDispositionElement(), false);
40773        composeStringExtras("disposition", element.getDispositionElement(), false);
40774      }
40775      if (element.hasInsurer()) {
40776        composeReference("insurer", element.getInsurer());
40777      }
40778      if (element.hasInsurance()) {
40779        openArray("insurance");
40780        for (CoverageEligibilityResponse.InsuranceComponent e : element.getInsurance()) 
40781          composeInsuranceComponent(null, e);
40782        closeArray();
40783      };
40784      if (element.hasPreAuthRefElement()) {
40785        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
40786        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
40787      }
40788      if (element.hasForm()) {
40789        composeCodeableConcept("form", element.getForm());
40790      }
40791      if (element.hasError()) {
40792        openArray("error");
40793        for (CoverageEligibilityResponse.ErrorsComponent e : element.getError()) 
40794          composeErrorsComponent(null, e);
40795        closeArray();
40796      };
40797  }
40798
40799  protected void composeInsuranceComponent(String name, CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
40800    if (element != null) {
40801      open(name);
40802      composeInsuranceComponentProperties(element);
40803      close();
40804    }
40805  }
40806
40807  protected void composeInsuranceComponentProperties(CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
40808    composeBackboneElementProperties(element);
40809      if (element.hasCoverage()) {
40810        composeReference("coverage", element.getCoverage());
40811      }
40812      if (element.hasInforceElement()) {
40813        composeBooleanCore("inforce", element.getInforceElement(), false);
40814        composeBooleanExtras("inforce", element.getInforceElement(), false);
40815      }
40816      if (element.hasBenefitPeriod()) {
40817        composePeriod("benefitPeriod", element.getBenefitPeriod());
40818      }
40819      if (element.hasItem()) {
40820        openArray("item");
40821        for (CoverageEligibilityResponse.ItemsComponent e : element.getItem()) 
40822          composeItemsComponent(null, e);
40823        closeArray();
40824      };
40825  }
40826
40827  protected void composeItemsComponent(String name, CoverageEligibilityResponse.ItemsComponent element) throws IOException {
40828    if (element != null) {
40829      open(name);
40830      composeItemsComponentProperties(element);
40831      close();
40832    }
40833  }
40834
40835  protected void composeItemsComponentProperties(CoverageEligibilityResponse.ItemsComponent element) throws IOException {
40836    composeBackboneElementProperties(element);
40837      if (element.hasCategory()) {
40838        composeCodeableConcept("category", element.getCategory());
40839      }
40840      if (element.hasProductOrService()) {
40841        composeCodeableConcept("productOrService", element.getProductOrService());
40842      }
40843      if (element.hasModifier()) {
40844        openArray("modifier");
40845        for (CodeableConcept e : element.getModifier()) 
40846          composeCodeableConcept(null, e);
40847        closeArray();
40848      };
40849      if (element.hasProvider()) {
40850        composeReference("provider", element.getProvider());
40851      }
40852      if (element.hasExcludedElement()) {
40853        composeBooleanCore("excluded", element.getExcludedElement(), false);
40854        composeBooleanExtras("excluded", element.getExcludedElement(), false);
40855      }
40856      if (element.hasNameElement()) {
40857        composeStringCore("name", element.getNameElement(), false);
40858        composeStringExtras("name", element.getNameElement(), false);
40859      }
40860      if (element.hasDescriptionElement()) {
40861        composeStringCore("description", element.getDescriptionElement(), false);
40862        composeStringExtras("description", element.getDescriptionElement(), false);
40863      }
40864      if (element.hasNetwork()) {
40865        composeCodeableConcept("network", element.getNetwork());
40866      }
40867      if (element.hasUnit()) {
40868        composeCodeableConcept("unit", element.getUnit());
40869      }
40870      if (element.hasTerm()) {
40871        composeCodeableConcept("term", element.getTerm());
40872      }
40873      if (element.hasBenefit()) {
40874        openArray("benefit");
40875        for (CoverageEligibilityResponse.BenefitComponent e : element.getBenefit()) 
40876          composeBenefitComponent(null, e);
40877        closeArray();
40878      };
40879      if (element.hasAuthorizationRequiredElement()) {
40880        composeBooleanCore("authorizationRequired", element.getAuthorizationRequiredElement(), false);
40881        composeBooleanExtras("authorizationRequired", element.getAuthorizationRequiredElement(), false);
40882      }
40883      if (element.hasAuthorizationSupporting()) {
40884        openArray("authorizationSupporting");
40885        for (CodeableConcept e : element.getAuthorizationSupporting()) 
40886          composeCodeableConcept(null, e);
40887        closeArray();
40888      };
40889      if (element.hasAuthorizationUrlElement()) {
40890        composeUriCore("authorizationUrl", element.getAuthorizationUrlElement(), false);
40891        composeUriExtras("authorizationUrl", element.getAuthorizationUrlElement(), false);
40892      }
40893  }
40894
40895  protected void composeBenefitComponent(String name, CoverageEligibilityResponse.BenefitComponent element) throws IOException {
40896    if (element != null) {
40897      open(name);
40898      composeBenefitComponentProperties(element);
40899      close();
40900    }
40901  }
40902
40903  protected void composeBenefitComponentProperties(CoverageEligibilityResponse.BenefitComponent element) throws IOException {
40904    composeBackboneElementProperties(element);
40905      if (element.hasType()) {
40906        composeCodeableConcept("type", element.getType());
40907      }
40908      if (element.hasAllowed()) {
40909        composeType("allowed", element.getAllowed());
40910      }
40911      if (element.hasUsed()) {
40912        composeType("used", element.getUsed());
40913      }
40914  }
40915
40916  protected void composeErrorsComponent(String name, CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
40917    if (element != null) {
40918      open(name);
40919      composeErrorsComponentProperties(element);
40920      close();
40921    }
40922  }
40923
40924  protected void composeErrorsComponentProperties(CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
40925    composeBackboneElementProperties(element);
40926      if (element.hasCode()) {
40927        composeCodeableConcept("code", element.getCode());
40928      }
40929  }
40930
40931  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
40932    if (element != null) {
40933      prop("resourceType", name);
40934      composeDetectedIssueProperties(element);
40935    }
40936  }
40937
40938  protected void composeDetectedIssueProperties(DetectedIssue element) throws IOException {
40939    composeDomainResourceProperties(element);
40940      if (element.hasIdentifier()) {
40941        openArray("identifier");
40942        for (Identifier e : element.getIdentifier()) 
40943          composeIdentifier(null, e);
40944        closeArray();
40945      };
40946      if (element.hasStatusElement()) {
40947        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
40948        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
40949      }
40950      if (element.hasCode()) {
40951        composeCodeableConcept("code", element.getCode());
40952      }
40953      if (element.hasSeverityElement()) {
40954        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
40955        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
40956      }
40957      if (element.hasPatient()) {
40958        composeReference("patient", element.getPatient());
40959      }
40960      if (element.hasIdentified()) {
40961        composeType("identified", element.getIdentified());
40962      }
40963      if (element.hasAuthor()) {
40964        composeReference("author", element.getAuthor());
40965      }
40966      if (element.hasImplicated()) {
40967        openArray("implicated");
40968        for (Reference e : element.getImplicated()) 
40969          composeReference(null, e);
40970        closeArray();
40971      };
40972      if (element.hasEvidence()) {
40973        openArray("evidence");
40974        for (DetectedIssue.DetectedIssueEvidenceComponent e : element.getEvidence()) 
40975          composeDetectedIssueEvidenceComponent(null, e);
40976        closeArray();
40977      };
40978      if (element.hasDetailElement()) {
40979        composeStringCore("detail", element.getDetailElement(), false);
40980        composeStringExtras("detail", element.getDetailElement(), false);
40981      }
40982      if (element.hasReferenceElement()) {
40983        composeUriCore("reference", element.getReferenceElement(), false);
40984        composeUriExtras("reference", element.getReferenceElement(), false);
40985      }
40986      if (element.hasMitigation()) {
40987        openArray("mitigation");
40988        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
40989          composeDetectedIssueMitigationComponent(null, e);
40990        closeArray();
40991      };
40992  }
40993
40994  protected void composeDetectedIssueEvidenceComponent(String name, DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
40995    if (element != null) {
40996      open(name);
40997      composeDetectedIssueEvidenceComponentProperties(element);
40998      close();
40999    }
41000  }
41001
41002  protected void composeDetectedIssueEvidenceComponentProperties(DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
41003    composeBackboneElementProperties(element);
41004      if (element.hasCode()) {
41005        openArray("code");
41006        for (CodeableConcept e : element.getCode()) 
41007          composeCodeableConcept(null, e);
41008        closeArray();
41009      };
41010      if (element.hasDetail()) {
41011        openArray("detail");
41012        for (Reference e : element.getDetail()) 
41013          composeReference(null, e);
41014        closeArray();
41015      };
41016  }
41017
41018  protected void composeDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
41019    if (element != null) {
41020      open(name);
41021      composeDetectedIssueMitigationComponentProperties(element);
41022      close();
41023    }
41024  }
41025
41026  protected void composeDetectedIssueMitigationComponentProperties(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
41027    composeBackboneElementProperties(element);
41028      if (element.hasAction()) {
41029        composeCodeableConcept("action", element.getAction());
41030      }
41031      if (element.hasDateElement()) {
41032        composeDateTimeCore("date", element.getDateElement(), false);
41033        composeDateTimeExtras("date", element.getDateElement(), false);
41034      }
41035      if (element.hasAuthor()) {
41036        composeReference("author", element.getAuthor());
41037      }
41038  }
41039
41040  protected void composeDevice(String name, Device element) throws IOException {
41041    if (element != null) {
41042      prop("resourceType", name);
41043      composeDeviceProperties(element);
41044    }
41045  }
41046
41047  protected void composeDeviceProperties(Device element) throws IOException {
41048    composeDomainResourceProperties(element);
41049      if (element.hasIdentifier()) {
41050        openArray("identifier");
41051        for (Identifier e : element.getIdentifier()) 
41052          composeIdentifier(null, e);
41053        closeArray();
41054      };
41055      if (element.hasDefinition()) {
41056        composeReference("definition", element.getDefinition());
41057      }
41058      if (element.hasUdiCarrier()) {
41059        openArray("udiCarrier");
41060        for (Device.DeviceUdiCarrierComponent e : element.getUdiCarrier()) 
41061          composeDeviceUdiCarrierComponent(null, e);
41062        closeArray();
41063      };
41064      if (element.hasStatusElement()) {
41065        composeEnumerationCore("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
41066        composeEnumerationExtras("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
41067      }
41068      if (element.hasStatusReason()) {
41069        openArray("statusReason");
41070        for (CodeableConcept e : element.getStatusReason()) 
41071          composeCodeableConcept(null, e);
41072        closeArray();
41073      };
41074      if (element.hasDistinctIdentifierElement()) {
41075        composeStringCore("distinctIdentifier", element.getDistinctIdentifierElement(), false);
41076        composeStringExtras("distinctIdentifier", element.getDistinctIdentifierElement(), false);
41077      }
41078      if (element.hasManufacturerElement()) {
41079        composeStringCore("manufacturer", element.getManufacturerElement(), false);
41080        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
41081      }
41082      if (element.hasManufactureDateElement()) {
41083        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
41084        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
41085      }
41086      if (element.hasExpirationDateElement()) {
41087        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
41088        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
41089      }
41090      if (element.hasLotNumberElement()) {
41091        composeStringCore("lotNumber", element.getLotNumberElement(), false);
41092        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
41093      }
41094      if (element.hasSerialNumberElement()) {
41095        composeStringCore("serialNumber", element.getSerialNumberElement(), false);
41096        composeStringExtras("serialNumber", element.getSerialNumberElement(), false);
41097      }
41098      if (element.hasDeviceName()) {
41099        openArray("deviceName");
41100        for (Device.DeviceDeviceNameComponent e : element.getDeviceName()) 
41101          composeDeviceDeviceNameComponent(null, e);
41102        closeArray();
41103      };
41104      if (element.hasModelNumberElement()) {
41105        composeStringCore("modelNumber", element.getModelNumberElement(), false);
41106        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
41107      }
41108      if (element.hasPartNumberElement()) {
41109        composeStringCore("partNumber", element.getPartNumberElement(), false);
41110        composeStringExtras("partNumber", element.getPartNumberElement(), false);
41111      }
41112      if (element.hasType()) {
41113        composeCodeableConcept("type", element.getType());
41114      }
41115      if (element.hasSpecialization()) {
41116        openArray("specialization");
41117        for (Device.DeviceSpecializationComponent e : element.getSpecialization()) 
41118          composeDeviceSpecializationComponent(null, e);
41119        closeArray();
41120      };
41121      if (element.hasVersion()) {
41122        openArray("version");
41123        for (Device.DeviceVersionComponent e : element.getVersion()) 
41124          composeDeviceVersionComponent(null, e);
41125        closeArray();
41126      };
41127      if (element.hasProperty()) {
41128        openArray("property");
41129        for (Device.DevicePropertyComponent e : element.getProperty()) 
41130          composeDevicePropertyComponent(null, e);
41131        closeArray();
41132      };
41133      if (element.hasPatient()) {
41134        composeReference("patient", element.getPatient());
41135      }
41136      if (element.hasOwner()) {
41137        composeReference("owner", element.getOwner());
41138      }
41139      if (element.hasContact()) {
41140        openArray("contact");
41141        for (ContactPoint e : element.getContact()) 
41142          composeContactPoint(null, e);
41143        closeArray();
41144      };
41145      if (element.hasLocation()) {
41146        composeReference("location", element.getLocation());
41147      }
41148      if (element.hasUrlElement()) {
41149        composeUriCore("url", element.getUrlElement(), false);
41150        composeUriExtras("url", element.getUrlElement(), false);
41151      }
41152      if (element.hasNote()) {
41153        openArray("note");
41154        for (Annotation e : element.getNote()) 
41155          composeAnnotation(null, e);
41156        closeArray();
41157      };
41158      if (element.hasSafety()) {
41159        openArray("safety");
41160        for (CodeableConcept e : element.getSafety()) 
41161          composeCodeableConcept(null, e);
41162        closeArray();
41163      };
41164      if (element.hasParent()) {
41165        composeReference("parent", element.getParent());
41166      }
41167  }
41168
41169  protected void composeDeviceUdiCarrierComponent(String name, Device.DeviceUdiCarrierComponent element) throws IOException {
41170    if (element != null) {
41171      open(name);
41172      composeDeviceUdiCarrierComponentProperties(element);
41173      close();
41174    }
41175  }
41176
41177  protected void composeDeviceUdiCarrierComponentProperties(Device.DeviceUdiCarrierComponent element) throws IOException {
41178    composeBackboneElementProperties(element);
41179      if (element.hasDeviceIdentifierElement()) {
41180        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
41181        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
41182      }
41183      if (element.hasIssuerElement()) {
41184        composeUriCore("issuer", element.getIssuerElement(), false);
41185        composeUriExtras("issuer", element.getIssuerElement(), false);
41186      }
41187      if (element.hasJurisdictionElement()) {
41188        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
41189        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
41190      }
41191      if (element.hasCarrierAIDCElement()) {
41192        composeBase64BinaryCore("carrierAIDC", element.getCarrierAIDCElement(), false);
41193        composeBase64BinaryExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
41194      }
41195      if (element.hasCarrierHRFElement()) {
41196        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
41197        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
41198      }
41199      if (element.hasEntryTypeElement()) {
41200        composeEnumerationCore("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
41201        composeEnumerationExtras("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
41202      }
41203  }
41204
41205  protected void composeDeviceDeviceNameComponent(String name, Device.DeviceDeviceNameComponent element) throws IOException {
41206    if (element != null) {
41207      open(name);
41208      composeDeviceDeviceNameComponentProperties(element);
41209      close();
41210    }
41211  }
41212
41213  protected void composeDeviceDeviceNameComponentProperties(Device.DeviceDeviceNameComponent element) throws IOException {
41214    composeBackboneElementProperties(element);
41215      if (element.hasNameElement()) {
41216        composeStringCore("name", element.getNameElement(), false);
41217        composeStringExtras("name", element.getNameElement(), false);
41218      }
41219      if (element.hasTypeElement()) {
41220        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
41221        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
41222      }
41223  }
41224
41225  protected void composeDeviceSpecializationComponent(String name, Device.DeviceSpecializationComponent element) throws IOException {
41226    if (element != null) {
41227      open(name);
41228      composeDeviceSpecializationComponentProperties(element);
41229      close();
41230    }
41231  }
41232
41233  protected void composeDeviceSpecializationComponentProperties(Device.DeviceSpecializationComponent element) throws IOException {
41234    composeBackboneElementProperties(element);
41235      if (element.hasSystemType()) {
41236        composeCodeableConcept("systemType", element.getSystemType());
41237      }
41238      if (element.hasVersionElement()) {
41239        composeStringCore("version", element.getVersionElement(), false);
41240        composeStringExtras("version", element.getVersionElement(), false);
41241      }
41242  }
41243
41244  protected void composeDeviceVersionComponent(String name, Device.DeviceVersionComponent element) throws IOException {
41245    if (element != null) {
41246      open(name);
41247      composeDeviceVersionComponentProperties(element);
41248      close();
41249    }
41250  }
41251
41252  protected void composeDeviceVersionComponentProperties(Device.DeviceVersionComponent element) throws IOException {
41253    composeBackboneElementProperties(element);
41254      if (element.hasType()) {
41255        composeCodeableConcept("type", element.getType());
41256      }
41257      if (element.hasComponent()) {
41258        composeIdentifier("component", element.getComponent());
41259      }
41260      if (element.hasValueElement()) {
41261        composeStringCore("value", element.getValueElement(), false);
41262        composeStringExtras("value", element.getValueElement(), false);
41263      }
41264  }
41265
41266  protected void composeDevicePropertyComponent(String name, Device.DevicePropertyComponent element) throws IOException {
41267    if (element != null) {
41268      open(name);
41269      composeDevicePropertyComponentProperties(element);
41270      close();
41271    }
41272  }
41273
41274  protected void composeDevicePropertyComponentProperties(Device.DevicePropertyComponent element) throws IOException {
41275    composeBackboneElementProperties(element);
41276      if (element.hasType()) {
41277        composeCodeableConcept("type", element.getType());
41278      }
41279      if (element.hasValueQuantity()) {
41280        openArray("valueQuantity");
41281        for (Quantity e : element.getValueQuantity()) 
41282          composeQuantity(null, e);
41283        closeArray();
41284      };
41285      if (element.hasValueCode()) {
41286        openArray("valueCode");
41287        for (CodeableConcept e : element.getValueCode()) 
41288          composeCodeableConcept(null, e);
41289        closeArray();
41290      };
41291  }
41292
41293  protected void composeDeviceDefinition(String name, DeviceDefinition element) throws IOException {
41294    if (element != null) {
41295      prop("resourceType", name);
41296      composeDeviceDefinitionProperties(element);
41297    }
41298  }
41299
41300  protected void composeDeviceDefinitionProperties(DeviceDefinition element) throws IOException {
41301    composeDomainResourceProperties(element);
41302      if (element.hasIdentifier()) {
41303        openArray("identifier");
41304        for (Identifier e : element.getIdentifier()) 
41305          composeIdentifier(null, e);
41306        closeArray();
41307      };
41308      if (element.hasUdiDeviceIdentifier()) {
41309        openArray("udiDeviceIdentifier");
41310        for (DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent e : element.getUdiDeviceIdentifier()) 
41311          composeDeviceDefinitionUdiDeviceIdentifierComponent(null, e);
41312        closeArray();
41313      };
41314      if (element.hasManufacturer()) {
41315        composeType("manufacturer", element.getManufacturer());
41316      }
41317      if (element.hasDeviceName()) {
41318        openArray("deviceName");
41319        for (DeviceDefinition.DeviceDefinitionDeviceNameComponent e : element.getDeviceName()) 
41320          composeDeviceDefinitionDeviceNameComponent(null, e);
41321        closeArray();
41322      };
41323      if (element.hasModelNumberElement()) {
41324        composeStringCore("modelNumber", element.getModelNumberElement(), false);
41325        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
41326      }
41327      if (element.hasType()) {
41328        composeCodeableConcept("type", element.getType());
41329      }
41330      if (element.hasSpecialization()) {
41331        openArray("specialization");
41332        for (DeviceDefinition.DeviceDefinitionSpecializationComponent e : element.getSpecialization()) 
41333          composeDeviceDefinitionSpecializationComponent(null, e);
41334        closeArray();
41335      };
41336      if (element.hasVersion()) {
41337        openArray("version");
41338        for (StringType e : element.getVersion()) 
41339          composeStringCore(null, e, true);
41340        closeArray();
41341        if (anyHasExtras(element.getVersion())) {
41342          openArray("_version");
41343          for (StringType e : element.getVersion()) 
41344            composeStringExtras(null, e, true);
41345          closeArray();
41346        }
41347      };
41348      if (element.hasSafety()) {
41349        openArray("safety");
41350        for (CodeableConcept e : element.getSafety()) 
41351          composeCodeableConcept(null, e);
41352        closeArray();
41353      };
41354      if (element.hasShelfLifeStorage()) {
41355        openArray("shelfLifeStorage");
41356        for (ProductShelfLife e : element.getShelfLifeStorage()) 
41357          composeProductShelfLife(null, e);
41358        closeArray();
41359      };
41360      if (element.hasPhysicalCharacteristics()) {
41361        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
41362      }
41363      if (element.hasLanguageCode()) {
41364        openArray("languageCode");
41365        for (CodeableConcept e : element.getLanguageCode()) 
41366          composeCodeableConcept(null, e);
41367        closeArray();
41368      };
41369      if (element.hasCapability()) {
41370        openArray("capability");
41371        for (DeviceDefinition.DeviceDefinitionCapabilityComponent e : element.getCapability()) 
41372          composeDeviceDefinitionCapabilityComponent(null, e);
41373        closeArray();
41374      };
41375      if (element.hasProperty()) {
41376        openArray("property");
41377        for (DeviceDefinition.DeviceDefinitionPropertyComponent e : element.getProperty()) 
41378          composeDeviceDefinitionPropertyComponent(null, e);
41379        closeArray();
41380      };
41381      if (element.hasOwner()) {
41382        composeReference("owner", element.getOwner());
41383      }
41384      if (element.hasContact()) {
41385        openArray("contact");
41386        for (ContactPoint e : element.getContact()) 
41387          composeContactPoint(null, e);
41388        closeArray();
41389      };
41390      if (element.hasUrlElement()) {
41391        composeUriCore("url", element.getUrlElement(), false);
41392        composeUriExtras("url", element.getUrlElement(), false);
41393      }
41394      if (element.hasOnlineInformationElement()) {
41395        composeUriCore("onlineInformation", element.getOnlineInformationElement(), false);
41396        composeUriExtras("onlineInformation", element.getOnlineInformationElement(), false);
41397      }
41398      if (element.hasNote()) {
41399        openArray("note");
41400        for (Annotation e : element.getNote()) 
41401          composeAnnotation(null, e);
41402        closeArray();
41403      };
41404      if (element.hasQuantity()) {
41405        composeQuantity("quantity", element.getQuantity());
41406      }
41407      if (element.hasParentDevice()) {
41408        composeReference("parentDevice", element.getParentDevice());
41409      }
41410      if (element.hasMaterial()) {
41411        openArray("material");
41412        for (DeviceDefinition.DeviceDefinitionMaterialComponent e : element.getMaterial()) 
41413          composeDeviceDefinitionMaterialComponent(null, e);
41414        closeArray();
41415      };
41416  }
41417
41418  protected void composeDeviceDefinitionUdiDeviceIdentifierComponent(String name, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
41419    if (element != null) {
41420      open(name);
41421      composeDeviceDefinitionUdiDeviceIdentifierComponentProperties(element);
41422      close();
41423    }
41424  }
41425
41426  protected void composeDeviceDefinitionUdiDeviceIdentifierComponentProperties(DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
41427    composeBackboneElementProperties(element);
41428      if (element.hasDeviceIdentifierElement()) {
41429        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
41430        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
41431      }
41432      if (element.hasIssuerElement()) {
41433        composeUriCore("issuer", element.getIssuerElement(), false);
41434        composeUriExtras("issuer", element.getIssuerElement(), false);
41435      }
41436      if (element.hasJurisdictionElement()) {
41437        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
41438        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
41439      }
41440  }
41441
41442  protected void composeDeviceDefinitionDeviceNameComponent(String name, DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
41443    if (element != null) {
41444      open(name);
41445      composeDeviceDefinitionDeviceNameComponentProperties(element);
41446      close();
41447    }
41448  }
41449
41450  protected void composeDeviceDefinitionDeviceNameComponentProperties(DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
41451    composeBackboneElementProperties(element);
41452      if (element.hasNameElement()) {
41453        composeStringCore("name", element.getNameElement(), false);
41454        composeStringExtras("name", element.getNameElement(), false);
41455      }
41456      if (element.hasTypeElement()) {
41457        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
41458        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.DeviceNameTypeEnumFactory(), false);
41459      }
41460  }
41461
41462  protected void composeDeviceDefinitionSpecializationComponent(String name, DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
41463    if (element != null) {
41464      open(name);
41465      composeDeviceDefinitionSpecializationComponentProperties(element);
41466      close();
41467    }
41468  }
41469
41470  protected void composeDeviceDefinitionSpecializationComponentProperties(DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
41471    composeBackboneElementProperties(element);
41472      if (element.hasSystemTypeElement()) {
41473        composeStringCore("systemType", element.getSystemTypeElement(), false);
41474        composeStringExtras("systemType", element.getSystemTypeElement(), false);
41475      }
41476      if (element.hasVersionElement()) {
41477        composeStringCore("version", element.getVersionElement(), false);
41478        composeStringExtras("version", element.getVersionElement(), false);
41479      }
41480  }
41481
41482  protected void composeDeviceDefinitionCapabilityComponent(String name, DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
41483    if (element != null) {
41484      open(name);
41485      composeDeviceDefinitionCapabilityComponentProperties(element);
41486      close();
41487    }
41488  }
41489
41490  protected void composeDeviceDefinitionCapabilityComponentProperties(DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
41491    composeBackboneElementProperties(element);
41492      if (element.hasType()) {
41493        composeCodeableConcept("type", element.getType());
41494      }
41495      if (element.hasDescription()) {
41496        openArray("description");
41497        for (CodeableConcept e : element.getDescription()) 
41498          composeCodeableConcept(null, e);
41499        closeArray();
41500      };
41501  }
41502
41503  protected void composeDeviceDefinitionPropertyComponent(String name, DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
41504    if (element != null) {
41505      open(name);
41506      composeDeviceDefinitionPropertyComponentProperties(element);
41507      close();
41508    }
41509  }
41510
41511  protected void composeDeviceDefinitionPropertyComponentProperties(DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
41512    composeBackboneElementProperties(element);
41513      if (element.hasType()) {
41514        composeCodeableConcept("type", element.getType());
41515      }
41516      if (element.hasValueQuantity()) {
41517        openArray("valueQuantity");
41518        for (Quantity e : element.getValueQuantity()) 
41519          composeQuantity(null, e);
41520        closeArray();
41521      };
41522      if (element.hasValueCode()) {
41523        openArray("valueCode");
41524        for (CodeableConcept e : element.getValueCode()) 
41525          composeCodeableConcept(null, e);
41526        closeArray();
41527      };
41528  }
41529
41530  protected void composeDeviceDefinitionMaterialComponent(String name, DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
41531    if (element != null) {
41532      open(name);
41533      composeDeviceDefinitionMaterialComponentProperties(element);
41534      close();
41535    }
41536  }
41537
41538  protected void composeDeviceDefinitionMaterialComponentProperties(DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
41539    composeBackboneElementProperties(element);
41540      if (element.hasSubstance()) {
41541        composeCodeableConcept("substance", element.getSubstance());
41542      }
41543      if (element.hasAlternateElement()) {
41544        composeBooleanCore("alternate", element.getAlternateElement(), false);
41545        composeBooleanExtras("alternate", element.getAlternateElement(), false);
41546      }
41547      if (element.hasAllergenicIndicatorElement()) {
41548        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
41549        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
41550      }
41551  }
41552
41553  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
41554    if (element != null) {
41555      prop("resourceType", name);
41556      composeDeviceMetricProperties(element);
41557    }
41558  }
41559
41560  protected void composeDeviceMetricProperties(DeviceMetric element) throws IOException {
41561    composeDomainResourceProperties(element);
41562      if (element.hasIdentifier()) {
41563        openArray("identifier");
41564        for (Identifier e : element.getIdentifier()) 
41565          composeIdentifier(null, e);
41566        closeArray();
41567      };
41568      if (element.hasType()) {
41569        composeCodeableConcept("type", element.getType());
41570      }
41571      if (element.hasUnit()) {
41572        composeCodeableConcept("unit", element.getUnit());
41573      }
41574      if (element.hasSource()) {
41575        composeReference("source", element.getSource());
41576      }
41577      if (element.hasParent()) {
41578        composeReference("parent", element.getParent());
41579      }
41580      if (element.hasOperationalStatusElement()) {
41581        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
41582        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
41583      }
41584      if (element.hasColorElement()) {
41585        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
41586        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
41587      }
41588      if (element.hasCategoryElement()) {
41589        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
41590        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
41591      }
41592      if (element.hasMeasurementPeriod()) {
41593        composeTiming("measurementPeriod", element.getMeasurementPeriod());
41594      }
41595      if (element.hasCalibration()) {
41596        openArray("calibration");
41597        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
41598          composeDeviceMetricCalibrationComponent(null, e);
41599        closeArray();
41600      };
41601  }
41602
41603  protected void composeDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
41604    if (element != null) {
41605      open(name);
41606      composeDeviceMetricCalibrationComponentProperties(element);
41607      close();
41608    }
41609  }
41610
41611  protected void composeDeviceMetricCalibrationComponentProperties(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
41612    composeBackboneElementProperties(element);
41613      if (element.hasTypeElement()) {
41614        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
41615        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
41616      }
41617      if (element.hasStateElement()) {
41618        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
41619        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
41620      }
41621      if (element.hasTimeElement()) {
41622        composeInstantCore("time", element.getTimeElement(), false);
41623        composeInstantExtras("time", element.getTimeElement(), false);
41624      }
41625  }
41626
41627  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
41628    if (element != null) {
41629      prop("resourceType", name);
41630      composeDeviceRequestProperties(element);
41631    }
41632  }
41633
41634  protected void composeDeviceRequestProperties(DeviceRequest element) throws IOException {
41635    composeDomainResourceProperties(element);
41636      if (element.hasIdentifier()) {
41637        openArray("identifier");
41638        for (Identifier e : element.getIdentifier()) 
41639          composeIdentifier(null, e);
41640        closeArray();
41641      };
41642      if (element.hasInstantiatesCanonical()) {
41643        openArray("instantiatesCanonical");
41644        for (CanonicalType e : element.getInstantiatesCanonical()) 
41645          composeCanonicalCore(null, e, true);
41646        closeArray();
41647        if (anyHasExtras(element.getInstantiatesCanonical())) {
41648          openArray("_instantiatesCanonical");
41649          for (CanonicalType e : element.getInstantiatesCanonical()) 
41650            composeCanonicalExtras(null, e, true);
41651          closeArray();
41652        }
41653      };
41654      if (element.hasInstantiatesUri()) {
41655        openArray("instantiatesUri");
41656        for (UriType e : element.getInstantiatesUri()) 
41657          composeUriCore(null, e, true);
41658        closeArray();
41659        if (anyHasExtras(element.getInstantiatesUri())) {
41660          openArray("_instantiatesUri");
41661          for (UriType e : element.getInstantiatesUri()) 
41662            composeUriExtras(null, e, true);
41663          closeArray();
41664        }
41665      };
41666      if (element.hasBasedOn()) {
41667        openArray("basedOn");
41668        for (Reference e : element.getBasedOn()) 
41669          composeReference(null, e);
41670        closeArray();
41671      };
41672      if (element.hasPriorRequest()) {
41673        openArray("priorRequest");
41674        for (Reference e : element.getPriorRequest()) 
41675          composeReference(null, e);
41676        closeArray();
41677      };
41678      if (element.hasGroupIdentifier()) {
41679        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
41680      }
41681      if (element.hasStatusElement()) {
41682        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
41683        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
41684      }
41685      if (element.hasIntentElement()) {
41686        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
41687        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
41688      }
41689      if (element.hasPriorityElement()) {
41690        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
41691        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
41692      }
41693      if (element.hasCode()) {
41694        composeType("code", element.getCode());
41695      }
41696      if (element.hasParameter()) {
41697        openArray("parameter");
41698        for (DeviceRequest.DeviceRequestParameterComponent e : element.getParameter()) 
41699          composeDeviceRequestParameterComponent(null, e);
41700        closeArray();
41701      };
41702      if (element.hasSubject()) {
41703        composeReference("subject", element.getSubject());
41704      }
41705      if (element.hasEncounter()) {
41706        composeReference("encounter", element.getEncounter());
41707      }
41708      if (element.hasOccurrence()) {
41709        composeType("occurrence", element.getOccurrence());
41710      }
41711      if (element.hasAuthoredOnElement()) {
41712        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
41713        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
41714      }
41715      if (element.hasRequester()) {
41716        composeReference("requester", element.getRequester());
41717      }
41718      if (element.hasPerformerType()) {
41719        composeCodeableConcept("performerType", element.getPerformerType());
41720      }
41721      if (element.hasPerformer()) {
41722        composeReference("performer", element.getPerformer());
41723      }
41724      if (element.hasReason()) {
41725        openArray("reason");
41726        for (CodeableReference e : element.getReason()) 
41727          composeCodeableReference(null, e);
41728        closeArray();
41729      };
41730      if (element.hasInsurance()) {
41731        openArray("insurance");
41732        for (Reference e : element.getInsurance()) 
41733          composeReference(null, e);
41734        closeArray();
41735      };
41736      if (element.hasSupportingInfo()) {
41737        openArray("supportingInfo");
41738        for (Reference e : element.getSupportingInfo()) 
41739          composeReference(null, e);
41740        closeArray();
41741      };
41742      if (element.hasNote()) {
41743        openArray("note");
41744        for (Annotation e : element.getNote()) 
41745          composeAnnotation(null, e);
41746        closeArray();
41747      };
41748      if (element.hasRelevantHistory()) {
41749        openArray("relevantHistory");
41750        for (Reference e : element.getRelevantHistory()) 
41751          composeReference(null, e);
41752        closeArray();
41753      };
41754  }
41755
41756  protected void composeDeviceRequestParameterComponent(String name, DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
41757    if (element != null) {
41758      open(name);
41759      composeDeviceRequestParameterComponentProperties(element);
41760      close();
41761    }
41762  }
41763
41764  protected void composeDeviceRequestParameterComponentProperties(DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
41765    composeBackboneElementProperties(element);
41766      if (element.hasCode()) {
41767        composeCodeableConcept("code", element.getCode());
41768      }
41769      if (element.hasValue()) {
41770        composeType("value", element.getValue());
41771      }
41772  }
41773
41774  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
41775    if (element != null) {
41776      prop("resourceType", name);
41777      composeDeviceUseStatementProperties(element);
41778    }
41779  }
41780
41781  protected void composeDeviceUseStatementProperties(DeviceUseStatement element) throws IOException {
41782    composeDomainResourceProperties(element);
41783      if (element.hasIdentifier()) {
41784        openArray("identifier");
41785        for (Identifier e : element.getIdentifier()) 
41786          composeIdentifier(null, e);
41787        closeArray();
41788      };
41789      if (element.hasBasedOn()) {
41790        openArray("basedOn");
41791        for (Reference e : element.getBasedOn()) 
41792          composeReference(null, e);
41793        closeArray();
41794      };
41795      if (element.hasStatusElement()) {
41796        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
41797        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
41798      }
41799      if (element.hasSubject()) {
41800        composeReference("subject", element.getSubject());
41801      }
41802      if (element.hasDerivedFrom()) {
41803        openArray("derivedFrom");
41804        for (Reference e : element.getDerivedFrom()) 
41805          composeReference(null, e);
41806        closeArray();
41807      };
41808      if (element.hasTiming()) {
41809        composeType("timing", element.getTiming());
41810      }
41811      if (element.hasRecordedOnElement()) {
41812        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
41813        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
41814      }
41815      if (element.hasSource()) {
41816        composeReference("source", element.getSource());
41817      }
41818      if (element.hasDevice()) {
41819        composeReference("device", element.getDevice());
41820      }
41821      if (element.hasReason()) {
41822        openArray("reason");
41823        for (CodeableReference e : element.getReason()) 
41824          composeCodeableReference(null, e);
41825        closeArray();
41826      };
41827      if (element.hasBodySite()) {
41828        composeCodeableConcept("bodySite", element.getBodySite());
41829      }
41830      if (element.hasNote()) {
41831        openArray("note");
41832        for (Annotation e : element.getNote()) 
41833          composeAnnotation(null, e);
41834        closeArray();
41835      };
41836  }
41837
41838  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
41839    if (element != null) {
41840      prop("resourceType", name);
41841      composeDiagnosticReportProperties(element);
41842    }
41843  }
41844
41845  protected void composeDiagnosticReportProperties(DiagnosticReport element) throws IOException {
41846    composeDomainResourceProperties(element);
41847      if (element.hasIdentifier()) {
41848        openArray("identifier");
41849        for (Identifier e : element.getIdentifier()) 
41850          composeIdentifier(null, e);
41851        closeArray();
41852      };
41853      if (element.hasBasedOn()) {
41854        openArray("basedOn");
41855        for (Reference e : element.getBasedOn()) 
41856          composeReference(null, e);
41857        closeArray();
41858      };
41859      if (element.hasStatusElement()) {
41860        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
41861        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
41862      }
41863      if (element.hasCategory()) {
41864        openArray("category");
41865        for (CodeableConcept e : element.getCategory()) 
41866          composeCodeableConcept(null, e);
41867        closeArray();
41868      };
41869      if (element.hasCode()) {
41870        composeCodeableConcept("code", element.getCode());
41871      }
41872      if (element.hasSubject()) {
41873        composeReference("subject", element.getSubject());
41874      }
41875      if (element.hasEncounter()) {
41876        composeReference("encounter", element.getEncounter());
41877      }
41878      if (element.hasEffective()) {
41879        composeType("effective", element.getEffective());
41880      }
41881      if (element.hasIssuedElement()) {
41882        composeInstantCore("issued", element.getIssuedElement(), false);
41883        composeInstantExtras("issued", element.getIssuedElement(), false);
41884      }
41885      if (element.hasPerformer()) {
41886        openArray("performer");
41887        for (Reference e : element.getPerformer()) 
41888          composeReference(null, e);
41889        closeArray();
41890      };
41891      if (element.hasResultsInterpreter()) {
41892        openArray("resultsInterpreter");
41893        for (Reference e : element.getResultsInterpreter()) 
41894          composeReference(null, e);
41895        closeArray();
41896      };
41897      if (element.hasSpecimen()) {
41898        openArray("specimen");
41899        for (Reference e : element.getSpecimen()) 
41900          composeReference(null, e);
41901        closeArray();
41902      };
41903      if (element.hasResult()) {
41904        openArray("result");
41905        for (Reference e : element.getResult()) 
41906          composeReference(null, e);
41907        closeArray();
41908      };
41909      if (element.hasImagingStudy()) {
41910        openArray("imagingStudy");
41911        for (Reference e : element.getImagingStudy()) 
41912          composeReference(null, e);
41913        closeArray();
41914      };
41915      if (element.hasMedia()) {
41916        openArray("media");
41917        for (DiagnosticReport.DiagnosticReportMediaComponent e : element.getMedia()) 
41918          composeDiagnosticReportMediaComponent(null, e);
41919        closeArray();
41920      };
41921      if (element.hasConclusionElement()) {
41922        composeStringCore("conclusion", element.getConclusionElement(), false);
41923        composeStringExtras("conclusion", element.getConclusionElement(), false);
41924      }
41925      if (element.hasConclusionCode()) {
41926        openArray("conclusionCode");
41927        for (CodeableConcept e : element.getConclusionCode()) 
41928          composeCodeableConcept(null, e);
41929        closeArray();
41930      };
41931      if (element.hasPresentedForm()) {
41932        openArray("presentedForm");
41933        for (Attachment e : element.getPresentedForm()) 
41934          composeAttachment(null, e);
41935        closeArray();
41936      };
41937  }
41938
41939  protected void composeDiagnosticReportMediaComponent(String name, DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
41940    if (element != null) {
41941      open(name);
41942      composeDiagnosticReportMediaComponentProperties(element);
41943      close();
41944    }
41945  }
41946
41947  protected void composeDiagnosticReportMediaComponentProperties(DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
41948    composeBackboneElementProperties(element);
41949      if (element.hasCommentElement()) {
41950        composeStringCore("comment", element.getCommentElement(), false);
41951        composeStringExtras("comment", element.getCommentElement(), false);
41952      }
41953      if (element.hasLink()) {
41954        composeReference("link", element.getLink());
41955      }
41956  }
41957
41958  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
41959    if (element != null) {
41960      prop("resourceType", name);
41961      composeDocumentManifestProperties(element);
41962    }
41963  }
41964
41965  protected void composeDocumentManifestProperties(DocumentManifest element) throws IOException {
41966    composeDomainResourceProperties(element);
41967      if (element.hasMasterIdentifier()) {
41968        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
41969      }
41970      if (element.hasIdentifier()) {
41971        openArray("identifier");
41972        for (Identifier e : element.getIdentifier()) 
41973          composeIdentifier(null, e);
41974        closeArray();
41975      };
41976      if (element.hasStatusElement()) {
41977        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
41978        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
41979      }
41980      if (element.hasType()) {
41981        composeCodeableConcept("type", element.getType());
41982      }
41983      if (element.hasSubject()) {
41984        composeReference("subject", element.getSubject());
41985      }
41986      if (element.hasCreatedElement()) {
41987        composeDateTimeCore("created", element.getCreatedElement(), false);
41988        composeDateTimeExtras("created", element.getCreatedElement(), false);
41989      }
41990      if (element.hasAuthor()) {
41991        openArray("author");
41992        for (Reference e : element.getAuthor()) 
41993          composeReference(null, e);
41994        closeArray();
41995      };
41996      if (element.hasRecipient()) {
41997        openArray("recipient");
41998        for (Reference e : element.getRecipient()) 
41999          composeReference(null, e);
42000        closeArray();
42001      };
42002      if (element.hasSourceElement()) {
42003        composeUriCore("source", element.getSourceElement(), false);
42004        composeUriExtras("source", element.getSourceElement(), false);
42005      }
42006      if (element.hasDescriptionElement()) {
42007        composeStringCore("description", element.getDescriptionElement(), false);
42008        composeStringExtras("description", element.getDescriptionElement(), false);
42009      }
42010      if (element.hasContent()) {
42011        openArray("content");
42012        for (Reference e : element.getContent()) 
42013          composeReference(null, e);
42014        closeArray();
42015      };
42016      if (element.hasRelated()) {
42017        openArray("related");
42018        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
42019          composeDocumentManifestRelatedComponent(null, e);
42020        closeArray();
42021      };
42022  }
42023
42024  protected void composeDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
42025    if (element != null) {
42026      open(name);
42027      composeDocumentManifestRelatedComponentProperties(element);
42028      close();
42029    }
42030  }
42031
42032  protected void composeDocumentManifestRelatedComponentProperties(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
42033    composeBackboneElementProperties(element);
42034      if (element.hasIdentifier()) {
42035        composeIdentifier("identifier", element.getIdentifier());
42036      }
42037      if (element.hasRef()) {
42038        composeReference("ref", element.getRef());
42039      }
42040  }
42041
42042  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
42043    if (element != null) {
42044      prop("resourceType", name);
42045      composeDocumentReferenceProperties(element);
42046    }
42047  }
42048
42049  protected void composeDocumentReferenceProperties(DocumentReference element) throws IOException {
42050    composeDomainResourceProperties(element);
42051      if (element.hasMasterIdentifier()) {
42052        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
42053      }
42054      if (element.hasIdentifier()) {
42055        openArray("identifier");
42056        for (Identifier e : element.getIdentifier()) 
42057          composeIdentifier(null, e);
42058        closeArray();
42059      };
42060      if (element.hasStatusElement()) {
42061        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
42062        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
42063      }
42064      if (element.hasDocStatusElement()) {
42065        composeEnumerationCore("docStatus", element.getDocStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
42066        composeEnumerationExtras("docStatus", element.getDocStatusElement(), new Enumerations.CompositionStatusEnumFactory(), false);
42067      }
42068      if (element.hasType()) {
42069        composeCodeableConcept("type", element.getType());
42070      }
42071      if (element.hasCategory()) {
42072        openArray("category");
42073        for (CodeableConcept e : element.getCategory()) 
42074          composeCodeableConcept(null, e);
42075        closeArray();
42076      };
42077      if (element.hasSubject()) {
42078        composeReference("subject", element.getSubject());
42079      }
42080      if (element.hasDateElement()) {
42081        composeInstantCore("date", element.getDateElement(), false);
42082        composeInstantExtras("date", element.getDateElement(), false);
42083      }
42084      if (element.hasAuthor()) {
42085        openArray("author");
42086        for (Reference e : element.getAuthor()) 
42087          composeReference(null, e);
42088        closeArray();
42089      };
42090      if (element.hasAuthenticator()) {
42091        composeReference("authenticator", element.getAuthenticator());
42092      }
42093      if (element.hasCustodian()) {
42094        composeReference("custodian", element.getCustodian());
42095      }
42096      if (element.hasRelatesTo()) {
42097        openArray("relatesTo");
42098        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
42099          composeDocumentReferenceRelatesToComponent(null, e);
42100        closeArray();
42101      };
42102      if (element.hasDescriptionElement()) {
42103        composeStringCore("description", element.getDescriptionElement(), false);
42104        composeStringExtras("description", element.getDescriptionElement(), false);
42105      }
42106      if (element.hasSecurityLabel()) {
42107        openArray("securityLabel");
42108        for (CodeableConcept e : element.getSecurityLabel()) 
42109          composeCodeableConcept(null, e);
42110        closeArray();
42111      };
42112      if (element.hasContent()) {
42113        openArray("content");
42114        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
42115          composeDocumentReferenceContentComponent(null, e);
42116        closeArray();
42117      };
42118      if (element.hasContext()) {
42119        composeDocumentReferenceContextComponent("context", element.getContext());
42120      }
42121  }
42122
42123  protected void composeDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
42124    if (element != null) {
42125      open(name);
42126      composeDocumentReferenceRelatesToComponentProperties(element);
42127      close();
42128    }
42129  }
42130
42131  protected void composeDocumentReferenceRelatesToComponentProperties(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
42132    composeBackboneElementProperties(element);
42133      if (element.hasCodeElement()) {
42134        composeEnumerationCore("code", element.getCodeElement(), new Enumerations.DocumentRelationshipTypeEnumFactory(), false);
42135        composeEnumerationExtras("code", element.getCodeElement(), new Enumerations.DocumentRelationshipTypeEnumFactory(), false);
42136      }
42137      if (element.hasTarget()) {
42138        composeReference("target", element.getTarget());
42139      }
42140  }
42141
42142  protected void composeDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
42143    if (element != null) {
42144      open(name);
42145      composeDocumentReferenceContentComponentProperties(element);
42146      close();
42147    }
42148  }
42149
42150  protected void composeDocumentReferenceContentComponentProperties(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
42151    composeBackboneElementProperties(element);
42152      if (element.hasAttachment()) {
42153        composeAttachment("attachment", element.getAttachment());
42154      }
42155      if (element.hasFormat()) {
42156        composeCoding("format", element.getFormat());
42157      }
42158  }
42159
42160  protected void composeDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
42161    if (element != null) {
42162      open(name);
42163      composeDocumentReferenceContextComponentProperties(element);
42164      close();
42165    }
42166  }
42167
42168  protected void composeDocumentReferenceContextComponentProperties(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
42169    composeBackboneElementProperties(element);
42170      if (element.hasEncounter()) {
42171        openArray("encounter");
42172        for (Reference e : element.getEncounter()) 
42173          composeReference(null, e);
42174        closeArray();
42175      };
42176      if (element.hasEvent()) {
42177        openArray("event");
42178        for (CodeableConcept e : element.getEvent()) 
42179          composeCodeableConcept(null, e);
42180        closeArray();
42181      };
42182      if (element.hasPeriod()) {
42183        composePeriod("period", element.getPeriod());
42184      }
42185      if (element.hasFacilityType()) {
42186        composeCodeableConcept("facilityType", element.getFacilityType());
42187      }
42188      if (element.hasPracticeSetting()) {
42189        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
42190      }
42191      if (element.hasSourcePatientInfo()) {
42192        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
42193      }
42194      if (element.hasRelated()) {
42195        openArray("related");
42196        for (Reference e : element.getRelated()) 
42197          composeReference(null, e);
42198        closeArray();
42199      };
42200      if (element.hasBasedOn()) {
42201        openArray("basedOn");
42202        for (Reference e : element.getBasedOn()) 
42203          composeReference(null, e);
42204        closeArray();
42205      };
42206  }
42207
42208  protected void composeEncounter(String name, Encounter element) throws IOException {
42209    if (element != null) {
42210      prop("resourceType", name);
42211      composeEncounterProperties(element);
42212    }
42213  }
42214
42215  protected void composeEncounterProperties(Encounter element) throws IOException {
42216    composeDomainResourceProperties(element);
42217      if (element.hasIdentifier()) {
42218        openArray("identifier");
42219        for (Identifier e : element.getIdentifier()) 
42220          composeIdentifier(null, e);
42221        closeArray();
42222      };
42223      if (element.hasStatusElement()) {
42224        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
42225        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
42226      }
42227      if (element.hasStatusHistory()) {
42228        openArray("statusHistory");
42229        for (Encounter.StatusHistoryComponent e : element.getStatusHistory()) 
42230          composeStatusHistoryComponent(null, e);
42231        closeArray();
42232      };
42233      if (element.hasClass_()) {
42234        composeCoding("class", element.getClass_());
42235      }
42236      if (element.hasClassHistory()) {
42237        openArray("classHistory");
42238        for (Encounter.ClassHistoryComponent e : element.getClassHistory()) 
42239          composeClassHistoryComponent(null, e);
42240        closeArray();
42241      };
42242      if (element.hasType()) {
42243        openArray("type");
42244        for (CodeableConcept e : element.getType()) 
42245          composeCodeableConcept(null, e);
42246        closeArray();
42247      };
42248      if (element.hasServiceType()) {
42249        composeCodeableConcept("serviceType", element.getServiceType());
42250      }
42251      if (element.hasPriority()) {
42252        composeCodeableConcept("priority", element.getPriority());
42253      }
42254      if (element.hasSubject()) {
42255        composeReference("subject", element.getSubject());
42256      }
42257      if (element.hasSubjectStatus()) {
42258        composeCodeableConcept("subjectStatus", element.getSubjectStatus());
42259      }
42260      if (element.hasEpisodeOfCare()) {
42261        openArray("episodeOfCare");
42262        for (Reference e : element.getEpisodeOfCare()) 
42263          composeReference(null, e);
42264        closeArray();
42265      };
42266      if (element.hasBasedOn()) {
42267        openArray("basedOn");
42268        for (Reference e : element.getBasedOn()) 
42269          composeReference(null, e);
42270        closeArray();
42271      };
42272      if (element.hasParticipant()) {
42273        openArray("participant");
42274        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
42275          composeEncounterParticipantComponent(null, e);
42276        closeArray();
42277      };
42278      if (element.hasAppointment()) {
42279        openArray("appointment");
42280        for (Reference e : element.getAppointment()) 
42281          composeReference(null, e);
42282        closeArray();
42283      };
42284      if (element.hasPeriod()) {
42285        composePeriod("period", element.getPeriod());
42286      }
42287      if (element.hasLength()) {
42288        composeDuration("length", element.getLength());
42289      }
42290      if (element.hasReason()) {
42291        openArray("reason");
42292        for (CodeableReference e : element.getReason()) 
42293          composeCodeableReference(null, e);
42294        closeArray();
42295      };
42296      if (element.hasDiagnosis()) {
42297        openArray("diagnosis");
42298        for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
42299          composeDiagnosisComponent(null, e);
42300        closeArray();
42301      };
42302      if (element.hasAccount()) {
42303        openArray("account");
42304        for (Reference e : element.getAccount()) 
42305          composeReference(null, e);
42306        closeArray();
42307      };
42308      if (element.hasHospitalization()) {
42309        composeEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
42310      }
42311      if (element.hasLocation()) {
42312        openArray("location");
42313        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
42314          composeEncounterLocationComponent(null, e);
42315        closeArray();
42316      };
42317      if (element.hasServiceProvider()) {
42318        composeReference("serviceProvider", element.getServiceProvider());
42319      }
42320      if (element.hasPartOf()) {
42321        composeReference("partOf", element.getPartOf());
42322      }
42323  }
42324
42325  protected void composeStatusHistoryComponent(String name, Encounter.StatusHistoryComponent element) throws IOException {
42326    if (element != null) {
42327      open(name);
42328      composeStatusHistoryComponentProperties(element);
42329      close();
42330    }
42331  }
42332
42333  protected void composeStatusHistoryComponentProperties(Encounter.StatusHistoryComponent element) throws IOException {
42334    composeBackboneElementProperties(element);
42335      if (element.hasStatusElement()) {
42336        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
42337        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
42338      }
42339      if (element.hasPeriod()) {
42340        composePeriod("period", element.getPeriod());
42341      }
42342  }
42343
42344  protected void composeClassHistoryComponent(String name, Encounter.ClassHistoryComponent element) throws IOException {
42345    if (element != null) {
42346      open(name);
42347      composeClassHistoryComponentProperties(element);
42348      close();
42349    }
42350  }
42351
42352  protected void composeClassHistoryComponentProperties(Encounter.ClassHistoryComponent element) throws IOException {
42353    composeBackboneElementProperties(element);
42354      if (element.hasClass_()) {
42355        composeCoding("class", element.getClass_());
42356      }
42357      if (element.hasPeriod()) {
42358        composePeriod("period", element.getPeriod());
42359      }
42360  }
42361
42362  protected void composeEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
42363    if (element != null) {
42364      open(name);
42365      composeEncounterParticipantComponentProperties(element);
42366      close();
42367    }
42368  }
42369
42370  protected void composeEncounterParticipantComponentProperties(Encounter.EncounterParticipantComponent element) throws IOException {
42371    composeBackboneElementProperties(element);
42372      if (element.hasType()) {
42373        openArray("type");
42374        for (CodeableConcept e : element.getType()) 
42375          composeCodeableConcept(null, e);
42376        closeArray();
42377      };
42378      if (element.hasPeriod()) {
42379        composePeriod("period", element.getPeriod());
42380      }
42381      if (element.hasIndividual()) {
42382        composeReference("individual", element.getIndividual());
42383      }
42384  }
42385
42386  protected void composeDiagnosisComponent(String name, Encounter.DiagnosisComponent element) throws IOException {
42387    if (element != null) {
42388      open(name);
42389      composeDiagnosisComponentProperties(element);
42390      close();
42391    }
42392  }
42393
42394  protected void composeDiagnosisComponentProperties(Encounter.DiagnosisComponent element) throws IOException {
42395    composeBackboneElementProperties(element);
42396      if (element.hasCondition()) {
42397        composeReference("condition", element.getCondition());
42398      }
42399      if (element.hasUse()) {
42400        composeCodeableConcept("use", element.getUse());
42401      }
42402      if (element.hasRankElement()) {
42403        composePositiveIntCore("rank", element.getRankElement(), false);
42404        composePositiveIntExtras("rank", element.getRankElement(), false);
42405      }
42406  }
42407
42408  protected void composeEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
42409    if (element != null) {
42410      open(name);
42411      composeEncounterHospitalizationComponentProperties(element);
42412      close();
42413    }
42414  }
42415
42416  protected void composeEncounterHospitalizationComponentProperties(Encounter.EncounterHospitalizationComponent element) throws IOException {
42417    composeBackboneElementProperties(element);
42418      if (element.hasPreAdmissionIdentifier()) {
42419        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
42420      }
42421      if (element.hasOrigin()) {
42422        composeReference("origin", element.getOrigin());
42423      }
42424      if (element.hasAdmitSource()) {
42425        composeCodeableConcept("admitSource", element.getAdmitSource());
42426      }
42427      if (element.hasReAdmission()) {
42428        composeCodeableConcept("reAdmission", element.getReAdmission());
42429      }
42430      if (element.hasDietPreference()) {
42431        openArray("dietPreference");
42432        for (CodeableConcept e : element.getDietPreference()) 
42433          composeCodeableConcept(null, e);
42434        closeArray();
42435      };
42436      if (element.hasSpecialCourtesy()) {
42437        openArray("specialCourtesy");
42438        for (CodeableConcept e : element.getSpecialCourtesy()) 
42439          composeCodeableConcept(null, e);
42440        closeArray();
42441      };
42442      if (element.hasSpecialArrangement()) {
42443        openArray("specialArrangement");
42444        for (CodeableConcept e : element.getSpecialArrangement()) 
42445          composeCodeableConcept(null, e);
42446        closeArray();
42447      };
42448      if (element.hasDestination()) {
42449        composeReference("destination", element.getDestination());
42450      }
42451      if (element.hasDischargeDisposition()) {
42452        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
42453      }
42454  }
42455
42456  protected void composeEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
42457    if (element != null) {
42458      open(name);
42459      composeEncounterLocationComponentProperties(element);
42460      close();
42461    }
42462  }
42463
42464  protected void composeEncounterLocationComponentProperties(Encounter.EncounterLocationComponent element) throws IOException {
42465    composeBackboneElementProperties(element);
42466      if (element.hasLocation()) {
42467        composeReference("location", element.getLocation());
42468      }
42469      if (element.hasStatusElement()) {
42470        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
42471        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
42472      }
42473      if (element.hasPhysicalType()) {
42474        composeCodeableConcept("physicalType", element.getPhysicalType());
42475      }
42476      if (element.hasPeriod()) {
42477        composePeriod("period", element.getPeriod());
42478      }
42479  }
42480
42481  protected void composeEndpoint(String name, Endpoint element) throws IOException {
42482    if (element != null) {
42483      prop("resourceType", name);
42484      composeEndpointProperties(element);
42485    }
42486  }
42487
42488  protected void composeEndpointProperties(Endpoint element) throws IOException {
42489    composeDomainResourceProperties(element);
42490      if (element.hasIdentifier()) {
42491        openArray("identifier");
42492        for (Identifier e : element.getIdentifier()) 
42493          composeIdentifier(null, e);
42494        closeArray();
42495      };
42496      if (element.hasStatusElement()) {
42497        composeEnumerationCore("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
42498        composeEnumerationExtras("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
42499      }
42500      if (element.hasConnectionType()) {
42501        composeCoding("connectionType", element.getConnectionType());
42502      }
42503      if (element.hasNameElement()) {
42504        composeStringCore("name", element.getNameElement(), false);
42505        composeStringExtras("name", element.getNameElement(), false);
42506      }
42507      if (element.hasManagingOrganization()) {
42508        composeReference("managingOrganization", element.getManagingOrganization());
42509      }
42510      if (element.hasContact()) {
42511        openArray("contact");
42512        for (ContactPoint e : element.getContact()) 
42513          composeContactPoint(null, e);
42514        closeArray();
42515      };
42516      if (element.hasPeriod()) {
42517        composePeriod("period", element.getPeriod());
42518      }
42519      if (element.hasPayloadType()) {
42520        openArray("payloadType");
42521        for (CodeableConcept e : element.getPayloadType()) 
42522          composeCodeableConcept(null, e);
42523        closeArray();
42524      };
42525      if (element.hasPayloadMimeType()) {
42526        openArray("payloadMimeType");
42527        for (CodeType e : element.getPayloadMimeType()) 
42528          composeCodeCore(null, e, true);
42529        closeArray();
42530        if (anyHasExtras(element.getPayloadMimeType())) {
42531          openArray("_payloadMimeType");
42532          for (CodeType e : element.getPayloadMimeType()) 
42533            composeCodeExtras(null, e, true);
42534          closeArray();
42535        }
42536      };
42537      if (element.hasAddressElement()) {
42538        composeUrlCore("address", element.getAddressElement(), false);
42539        composeUrlExtras("address", element.getAddressElement(), false);
42540      }
42541      if (element.hasHeader()) {
42542        openArray("header");
42543        for (StringType e : element.getHeader()) 
42544          composeStringCore(null, e, true);
42545        closeArray();
42546        if (anyHasExtras(element.getHeader())) {
42547          openArray("_header");
42548          for (StringType e : element.getHeader()) 
42549            composeStringExtras(null, e, true);
42550          closeArray();
42551        }
42552      };
42553  }
42554
42555  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
42556    if (element != null) {
42557      prop("resourceType", name);
42558      composeEnrollmentRequestProperties(element);
42559    }
42560  }
42561
42562  protected void composeEnrollmentRequestProperties(EnrollmentRequest element) throws IOException {
42563    composeDomainResourceProperties(element);
42564      if (element.hasIdentifier()) {
42565        openArray("identifier");
42566        for (Identifier e : element.getIdentifier()) 
42567          composeIdentifier(null, e);
42568        closeArray();
42569      };
42570      if (element.hasStatusElement()) {
42571        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
42572        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
42573      }
42574      if (element.hasCreatedElement()) {
42575        composeDateTimeCore("created", element.getCreatedElement(), false);
42576        composeDateTimeExtras("created", element.getCreatedElement(), false);
42577      }
42578      if (element.hasInsurer()) {
42579        composeReference("insurer", element.getInsurer());
42580      }
42581      if (element.hasProvider()) {
42582        composeReference("provider", element.getProvider());
42583      }
42584      if (element.hasCandidate()) {
42585        composeReference("candidate", element.getCandidate());
42586      }
42587      if (element.hasCoverage()) {
42588        composeReference("coverage", element.getCoverage());
42589      }
42590  }
42591
42592  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
42593    if (element != null) {
42594      prop("resourceType", name);
42595      composeEnrollmentResponseProperties(element);
42596    }
42597  }
42598
42599  protected void composeEnrollmentResponseProperties(EnrollmentResponse element) throws IOException {
42600    composeDomainResourceProperties(element);
42601      if (element.hasIdentifier()) {
42602        openArray("identifier");
42603        for (Identifier e : element.getIdentifier()) 
42604          composeIdentifier(null, e);
42605        closeArray();
42606      };
42607      if (element.hasStatusElement()) {
42608        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
42609        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
42610      }
42611      if (element.hasRequest()) {
42612        composeReference("request", element.getRequest());
42613      }
42614      if (element.hasOutcomeElement()) {
42615        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
42616        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
42617      }
42618      if (element.hasDispositionElement()) {
42619        composeStringCore("disposition", element.getDispositionElement(), false);
42620        composeStringExtras("disposition", element.getDispositionElement(), false);
42621      }
42622      if (element.hasCreatedElement()) {
42623        composeDateTimeCore("created", element.getCreatedElement(), false);
42624        composeDateTimeExtras("created", element.getCreatedElement(), false);
42625      }
42626      if (element.hasOrganization()) {
42627        composeReference("organization", element.getOrganization());
42628      }
42629      if (element.hasRequestProvider()) {
42630        composeReference("requestProvider", element.getRequestProvider());
42631      }
42632  }
42633
42634  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
42635    if (element != null) {
42636      prop("resourceType", name);
42637      composeEpisodeOfCareProperties(element);
42638    }
42639  }
42640
42641  protected void composeEpisodeOfCareProperties(EpisodeOfCare element) throws IOException {
42642    composeDomainResourceProperties(element);
42643      if (element.hasIdentifier()) {
42644        openArray("identifier");
42645        for (Identifier e : element.getIdentifier()) 
42646          composeIdentifier(null, e);
42647        closeArray();
42648      };
42649      if (element.hasStatusElement()) {
42650        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
42651        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
42652      }
42653      if (element.hasStatusHistory()) {
42654        openArray("statusHistory");
42655        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
42656          composeEpisodeOfCareStatusHistoryComponent(null, e);
42657        closeArray();
42658      };
42659      if (element.hasType()) {
42660        openArray("type");
42661        for (CodeableConcept e : element.getType()) 
42662          composeCodeableConcept(null, e);
42663        closeArray();
42664      };
42665      if (element.hasDiagnosis()) {
42666        openArray("diagnosis");
42667        for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis()) 
42668          composeDiagnosisComponent(null, e);
42669        closeArray();
42670      };
42671      if (element.hasPatient()) {
42672        composeReference("patient", element.getPatient());
42673      }
42674      if (element.hasManagingOrganization()) {
42675        composeReference("managingOrganization", element.getManagingOrganization());
42676      }
42677      if (element.hasPeriod()) {
42678        composePeriod("period", element.getPeriod());
42679      }
42680      if (element.hasReferralRequest()) {
42681        openArray("referralRequest");
42682        for (Reference e : element.getReferralRequest()) 
42683          composeReference(null, e);
42684        closeArray();
42685      };
42686      if (element.hasCareManager()) {
42687        composeReference("careManager", element.getCareManager());
42688      }
42689      if (element.hasTeam()) {
42690        openArray("team");
42691        for (Reference e : element.getTeam()) 
42692          composeReference(null, e);
42693        closeArray();
42694      };
42695      if (element.hasAccount()) {
42696        openArray("account");
42697        for (Reference e : element.getAccount()) 
42698          composeReference(null, e);
42699        closeArray();
42700      };
42701  }
42702
42703  protected void composeEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
42704    if (element != null) {
42705      open(name);
42706      composeEpisodeOfCareStatusHistoryComponentProperties(element);
42707      close();
42708    }
42709  }
42710
42711  protected void composeEpisodeOfCareStatusHistoryComponentProperties(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
42712    composeBackboneElementProperties(element);
42713      if (element.hasStatusElement()) {
42714        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
42715        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
42716      }
42717      if (element.hasPeriod()) {
42718        composePeriod("period", element.getPeriod());
42719      }
42720  }
42721
42722  protected void composeDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element) throws IOException {
42723    if (element != null) {
42724      open(name);
42725      composeDiagnosisComponentProperties(element);
42726      close();
42727    }
42728  }
42729
42730  protected void composeDiagnosisComponentProperties(EpisodeOfCare.DiagnosisComponent element) throws IOException {
42731    composeBackboneElementProperties(element);
42732      if (element.hasCondition()) {
42733        composeReference("condition", element.getCondition());
42734      }
42735      if (element.hasRole()) {
42736        composeCodeableConcept("role", element.getRole());
42737      }
42738      if (element.hasRankElement()) {
42739        composePositiveIntCore("rank", element.getRankElement(), false);
42740        composePositiveIntExtras("rank", element.getRankElement(), false);
42741      }
42742  }
42743
42744  protected void composeEventDefinition(String name, EventDefinition element) throws IOException {
42745    if (element != null) {
42746      prop("resourceType", name);
42747      composeEventDefinitionProperties(element);
42748    }
42749  }
42750
42751  protected void composeEventDefinitionProperties(EventDefinition element) throws IOException {
42752    composeMetadataResourceProperties(element);
42753      if (element.hasUrlElement()) {
42754        composeUriCore("url", element.getUrlElement(), false);
42755        composeUriExtras("url", element.getUrlElement(), false);
42756      }
42757      if (element.hasIdentifier()) {
42758        openArray("identifier");
42759        for (Identifier e : element.getIdentifier()) 
42760          composeIdentifier(null, e);
42761        closeArray();
42762      };
42763      if (element.hasVersionElement()) {
42764        composeStringCore("version", element.getVersionElement(), false);
42765        composeStringExtras("version", element.getVersionElement(), false);
42766      }
42767      if (element.hasNameElement()) {
42768        composeStringCore("name", element.getNameElement(), false);
42769        composeStringExtras("name", element.getNameElement(), false);
42770      }
42771      if (element.hasTitleElement()) {
42772        composeStringCore("title", element.getTitleElement(), false);
42773        composeStringExtras("title", element.getTitleElement(), false);
42774      }
42775      if (element.hasSubtitleElement()) {
42776        composeStringCore("subtitle", element.getSubtitleElement(), false);
42777        composeStringExtras("subtitle", element.getSubtitleElement(), false);
42778      }
42779      if (element.hasStatusElement()) {
42780        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42781        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42782      }
42783      if (element.hasExperimentalElement()) {
42784        composeBooleanCore("experimental", element.getExperimentalElement(), false);
42785        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
42786      }
42787      if (element.hasSubject()) {
42788        composeType("subject", element.getSubject());
42789      }
42790      if (element.hasDateElement()) {
42791        composeDateTimeCore("date", element.getDateElement(), false);
42792        composeDateTimeExtras("date", element.getDateElement(), false);
42793      }
42794      if (element.hasPublisherElement()) {
42795        composeStringCore("publisher", element.getPublisherElement(), false);
42796        composeStringExtras("publisher", element.getPublisherElement(), false);
42797      }
42798      if (element.hasContact()) {
42799        openArray("contact");
42800        for (ContactDetail e : element.getContact()) 
42801          composeContactDetail(null, e);
42802        closeArray();
42803      };
42804      if (element.hasDescriptionElement()) {
42805        composeMarkdownCore("description", element.getDescriptionElement(), false);
42806        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42807      }
42808      if (element.hasUseContext()) {
42809        openArray("useContext");
42810        for (UsageContext e : element.getUseContext()) 
42811          composeUsageContext(null, e);
42812        closeArray();
42813      };
42814      if (element.hasJurisdiction()) {
42815        openArray("jurisdiction");
42816        for (CodeableConcept e : element.getJurisdiction()) 
42817          composeCodeableConcept(null, e);
42818        closeArray();
42819      };
42820      if (element.hasPurposeElement()) {
42821        composeMarkdownCore("purpose", element.getPurposeElement(), false);
42822        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
42823      }
42824      if (element.hasUsageElement()) {
42825        composeStringCore("usage", element.getUsageElement(), false);
42826        composeStringExtras("usage", element.getUsageElement(), false);
42827      }
42828      if (element.hasCopyrightElement()) {
42829        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
42830        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
42831      }
42832      if (element.hasApprovalDateElement()) {
42833        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
42834        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
42835      }
42836      if (element.hasLastReviewDateElement()) {
42837        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
42838        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
42839      }
42840      if (element.hasEffectivePeriod()) {
42841        composePeriod("effectivePeriod", element.getEffectivePeriod());
42842      }
42843      if (element.hasTopic()) {
42844        openArray("topic");
42845        for (CodeableConcept e : element.getTopic()) 
42846          composeCodeableConcept(null, e);
42847        closeArray();
42848      };
42849      if (element.hasAuthor()) {
42850        openArray("author");
42851        for (ContactDetail e : element.getAuthor()) 
42852          composeContactDetail(null, e);
42853        closeArray();
42854      };
42855      if (element.hasEditor()) {
42856        openArray("editor");
42857        for (ContactDetail e : element.getEditor()) 
42858          composeContactDetail(null, e);
42859        closeArray();
42860      };
42861      if (element.hasReviewer()) {
42862        openArray("reviewer");
42863        for (ContactDetail e : element.getReviewer()) 
42864          composeContactDetail(null, e);
42865        closeArray();
42866      };
42867      if (element.hasEndorser()) {
42868        openArray("endorser");
42869        for (ContactDetail e : element.getEndorser()) 
42870          composeContactDetail(null, e);
42871        closeArray();
42872      };
42873      if (element.hasRelatedArtifact()) {
42874        openArray("relatedArtifact");
42875        for (RelatedArtifact e : element.getRelatedArtifact()) 
42876          composeRelatedArtifact(null, e);
42877        closeArray();
42878      };
42879      if (element.hasTrigger()) {
42880        openArray("trigger");
42881        for (TriggerDefinition e : element.getTrigger()) 
42882          composeTriggerDefinition(null, e);
42883        closeArray();
42884      };
42885  }
42886
42887  protected void composeEvidence(String name, Evidence element) throws IOException {
42888    if (element != null) {
42889      prop("resourceType", name);
42890      composeEvidenceProperties(element);
42891    }
42892  }
42893
42894  protected void composeEvidenceProperties(Evidence element) throws IOException {
42895    composeMetadataResourceProperties(element);
42896      if (element.hasUrlElement()) {
42897        composeUriCore("url", element.getUrlElement(), false);
42898        composeUriExtras("url", element.getUrlElement(), false);
42899      }
42900      if (element.hasIdentifier()) {
42901        openArray("identifier");
42902        for (Identifier e : element.getIdentifier()) 
42903          composeIdentifier(null, e);
42904        closeArray();
42905      };
42906      if (element.hasVersionElement()) {
42907        composeStringCore("version", element.getVersionElement(), false);
42908        composeStringExtras("version", element.getVersionElement(), false);
42909      }
42910      if (element.hasTitleElement()) {
42911        composeStringCore("title", element.getTitleElement(), false);
42912        composeStringExtras("title", element.getTitleElement(), false);
42913      }
42914      if (element.hasStatusElement()) {
42915        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42916        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42917      }
42918      if (element.hasDateElement()) {
42919        composeDateTimeCore("date", element.getDateElement(), false);
42920        composeDateTimeExtras("date", element.getDateElement(), false);
42921      }
42922      if (element.hasUseContext()) {
42923        openArray("useContext");
42924        for (UsageContext e : element.getUseContext()) 
42925          composeUsageContext(null, e);
42926        closeArray();
42927      };
42928      if (element.hasApprovalDateElement()) {
42929        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
42930        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
42931      }
42932      if (element.hasLastReviewDateElement()) {
42933        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
42934        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
42935      }
42936      if (element.hasContributor()) {
42937        openArray("contributor");
42938        for (Contributor e : element.getContributor()) 
42939          composeContributor(null, e);
42940        closeArray();
42941      };
42942      if (element.hasRelatedArtifact()) {
42943        openArray("relatedArtifact");
42944        for (RelatedArtifact e : element.getRelatedArtifact()) 
42945          composeRelatedArtifact(null, e);
42946        closeArray();
42947      };
42948      if (element.hasDescriptionElement()) {
42949        composeMarkdownCore("description", element.getDescriptionElement(), false);
42950        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42951      }
42952      if (element.hasAssertionElement()) {
42953        composeMarkdownCore("assertion", element.getAssertionElement(), false);
42954        composeMarkdownExtras("assertion", element.getAssertionElement(), false);
42955      }
42956      if (element.hasNote()) {
42957        openArray("note");
42958        for (Annotation e : element.getNote()) 
42959          composeAnnotation(null, e);
42960        closeArray();
42961      };
42962      if (element.hasReferentGroup()) {
42963        composeEvidenceReferentGroupComponent("referentGroup", element.getReferentGroup());
42964      }
42965      if (element.hasVariableDefinition()) {
42966        openArray("variableDefinition");
42967        for (Evidence.EvidenceVariableDefinitionComponent e : element.getVariableDefinition()) 
42968          composeEvidenceVariableDefinitionComponent(null, e);
42969        closeArray();
42970      };
42971      if (element.hasSynthesisType()) {
42972        composeCodeableConcept("synthesisType", element.getSynthesisType());
42973      }
42974      if (element.hasStudyType()) {
42975        composeCodeableConcept("studyType", element.getStudyType());
42976      }
42977      if (element.hasStatistic()) {
42978        openArray("statistic");
42979        for (Statistic e : element.getStatistic()) 
42980          composeStatistic(null, e);
42981        closeArray();
42982      };
42983      if (element.hasDistribution()) {
42984        openArray("distribution");
42985        for (OrderedDistribution e : element.getDistribution()) 
42986          composeOrderedDistribution(null, e);
42987        closeArray();
42988      };
42989      if (element.hasCertainty()) {
42990        openArray("certainty");
42991        for (Evidence.EvidenceCertaintyComponent e : element.getCertainty()) 
42992          composeEvidenceCertaintyComponent(null, e);
42993        closeArray();
42994      };
42995  }
42996
42997  protected void composeEvidenceReferentGroupComponent(String name, Evidence.EvidenceReferentGroupComponent element) throws IOException {
42998    if (element != null) {
42999      open(name);
43000      composeEvidenceReferentGroupComponentProperties(element);
43001      close();
43002    }
43003  }
43004
43005  protected void composeEvidenceReferentGroupComponentProperties(Evidence.EvidenceReferentGroupComponent element) throws IOException {
43006    composeBackboneElementProperties(element);
43007      if (element.hasDescriptionElement()) {
43008        composeMarkdownCore("description", element.getDescriptionElement(), false);
43009        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43010      }
43011      if (element.hasNote()) {
43012        openArray("note");
43013        for (Annotation e : element.getNote()) 
43014          composeAnnotation(null, e);
43015        closeArray();
43016      };
43017      if (element.hasEvidenceSource()) {
43018        composeReference("evidenceSource", element.getEvidenceSource());
43019      }
43020      if (element.hasIntendedGroup()) {
43021        composeReference("intendedGroup", element.getIntendedGroup());
43022      }
43023      if (element.hasDirectnessMatch()) {
43024        composeCodeableConcept("directnessMatch", element.getDirectnessMatch());
43025      }
43026  }
43027
43028  protected void composeEvidenceVariableDefinitionComponent(String name, Evidence.EvidenceVariableDefinitionComponent element) throws IOException {
43029    if (element != null) {
43030      open(name);
43031      composeEvidenceVariableDefinitionComponentProperties(element);
43032      close();
43033    }
43034  }
43035
43036  protected void composeEvidenceVariableDefinitionComponentProperties(Evidence.EvidenceVariableDefinitionComponent element) throws IOException {
43037    composeBackboneElementProperties(element);
43038      if (element.hasDescriptionElement()) {
43039        composeMarkdownCore("description", element.getDescriptionElement(), false);
43040        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43041      }
43042      if (element.hasNote()) {
43043        openArray("note");
43044        for (Annotation e : element.getNote()) 
43045          composeAnnotation(null, e);
43046        closeArray();
43047      };
43048      if (element.hasVariableRole()) {
43049        composeCodeableConcept("variableRole", element.getVariableRole());
43050      }
43051      if (element.hasActualDefinition()) {
43052        composeReference("actualDefinition", element.getActualDefinition());
43053      }
43054      if (element.hasIntendedDefinition()) {
43055        composeReference("intendedDefinition", element.getIntendedDefinition());
43056      }
43057      if (element.hasDirectnessMatch()) {
43058        composeCodeableConcept("directnessMatch", element.getDirectnessMatch());
43059      }
43060  }
43061
43062  protected void composeEvidenceCertaintyComponent(String name, Evidence.EvidenceCertaintyComponent element) throws IOException {
43063    if (element != null) {
43064      open(name);
43065      composeEvidenceCertaintyComponentProperties(element);
43066      close();
43067    }
43068  }
43069
43070  protected void composeEvidenceCertaintyComponentProperties(Evidence.EvidenceCertaintyComponent element) throws IOException {
43071    composeBackboneElementProperties(element);
43072      if (element.hasDescriptionElement()) {
43073        composeStringCore("description", element.getDescriptionElement(), false);
43074        composeStringExtras("description", element.getDescriptionElement(), false);
43075      }
43076      if (element.hasNote()) {
43077        composeAnnotation("note", element.getNote());
43078      }
43079      if (element.hasRating()) {
43080        openArray("rating");
43081        for (CodeableConcept e : element.getRating()) 
43082          composeCodeableConcept(null, e);
43083        closeArray();
43084      };
43085      if (element.hasCertaintySubcomponent()) {
43086        openArray("certaintySubcomponent");
43087        for (Evidence.EvidenceCertaintyCertaintySubcomponentComponent e : element.getCertaintySubcomponent()) 
43088          composeEvidenceCertaintyCertaintySubcomponentComponent(null, e);
43089        closeArray();
43090      };
43091  }
43092
43093  protected void composeEvidenceCertaintyCertaintySubcomponentComponent(String name, Evidence.EvidenceCertaintyCertaintySubcomponentComponent element) throws IOException {
43094    if (element != null) {
43095      open(name);
43096      composeEvidenceCertaintyCertaintySubcomponentComponentProperties(element);
43097      close();
43098    }
43099  }
43100
43101  protected void composeEvidenceCertaintyCertaintySubcomponentComponentProperties(Evidence.EvidenceCertaintyCertaintySubcomponentComponent element) throws IOException {
43102    composeBackboneElementProperties(element);
43103      if (element.hasDescriptionElement()) {
43104        composeStringCore("description", element.getDescriptionElement(), false);
43105        composeStringExtras("description", element.getDescriptionElement(), false);
43106      }
43107      if (element.hasNote()) {
43108        composeAnnotation("note", element.getNote());
43109      }
43110      if (element.hasType()) {
43111        openArray("type");
43112        for (CodeableConcept e : element.getType()) 
43113          composeCodeableConcept(null, e);
43114        closeArray();
43115      };
43116      if (element.hasRating()) {
43117        openArray("rating");
43118        for (CodeableConcept e : element.getRating()) 
43119          composeCodeableConcept(null, e);
43120        closeArray();
43121      };
43122  }
43123
43124  protected void composeEvidenceVariable(String name, EvidenceVariable element) throws IOException {
43125    if (element != null) {
43126      prop("resourceType", name);
43127      composeEvidenceVariableProperties(element);
43128    }
43129  }
43130
43131  protected void composeEvidenceVariableProperties(EvidenceVariable element) throws IOException {
43132    composeMetadataResourceProperties(element);
43133      if (element.hasUrlElement()) {
43134        composeUriCore("url", element.getUrlElement(), false);
43135        composeUriExtras("url", element.getUrlElement(), false);
43136      }
43137      if (element.hasIdentifier()) {
43138        openArray("identifier");
43139        for (Identifier e : element.getIdentifier()) 
43140          composeIdentifier(null, e);
43141        closeArray();
43142      };
43143      if (element.hasVersionElement()) {
43144        composeStringCore("version", element.getVersionElement(), false);
43145        composeStringExtras("version", element.getVersionElement(), false);
43146      }
43147      if (element.hasNameElement()) {
43148        composeStringCore("name", element.getNameElement(), false);
43149        composeStringExtras("name", element.getNameElement(), false);
43150      }
43151      if (element.hasTitleElement()) {
43152        composeStringCore("title", element.getTitleElement(), false);
43153        composeStringExtras("title", element.getTitleElement(), false);
43154      }
43155      if (element.hasShortTitleElement()) {
43156        composeStringCore("shortTitle", element.getShortTitleElement(), false);
43157        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
43158      }
43159      if (element.hasSubtitleElement()) {
43160        composeStringCore("subtitle", element.getSubtitleElement(), false);
43161        composeStringExtras("subtitle", element.getSubtitleElement(), false);
43162      }
43163      if (element.hasStatusElement()) {
43164        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43165        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43166      }
43167      if (element.hasDateElement()) {
43168        composeDateTimeCore("date", element.getDateElement(), false);
43169        composeDateTimeExtras("date", element.getDateElement(), false);
43170      }
43171      if (element.hasPublisherElement()) {
43172        composeStringCore("publisher", element.getPublisherElement(), false);
43173        composeStringExtras("publisher", element.getPublisherElement(), false);
43174      }
43175      if (element.hasContact()) {
43176        openArray("contact");
43177        for (ContactDetail e : element.getContact()) 
43178          composeContactDetail(null, e);
43179        closeArray();
43180      };
43181      if (element.hasDescriptionElement()) {
43182        composeMarkdownCore("description", element.getDescriptionElement(), false);
43183        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43184      }
43185      if (element.hasNote()) {
43186        openArray("note");
43187        for (Annotation e : element.getNote()) 
43188          composeAnnotation(null, e);
43189        closeArray();
43190      };
43191      if (element.hasUseContext()) {
43192        openArray("useContext");
43193        for (UsageContext e : element.getUseContext()) 
43194          composeUsageContext(null, e);
43195        closeArray();
43196      };
43197      if (element.hasJurisdiction()) {
43198        openArray("jurisdiction");
43199        for (CodeableConcept e : element.getJurisdiction()) 
43200          composeCodeableConcept(null, e);
43201        closeArray();
43202      };
43203      if (element.hasCopyrightElement()) {
43204        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
43205        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
43206      }
43207      if (element.hasApprovalDateElement()) {
43208        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
43209        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
43210      }
43211      if (element.hasLastReviewDateElement()) {
43212        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
43213        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
43214      }
43215      if (element.hasEffectivePeriod()) {
43216        composePeriod("effectivePeriod", element.getEffectivePeriod());
43217      }
43218      if (element.hasTopic()) {
43219        openArray("topic");
43220        for (CodeableConcept e : element.getTopic()) 
43221          composeCodeableConcept(null, e);
43222        closeArray();
43223      };
43224      if (element.hasAuthor()) {
43225        openArray("author");
43226        for (ContactDetail e : element.getAuthor()) 
43227          composeContactDetail(null, e);
43228        closeArray();
43229      };
43230      if (element.hasEditor()) {
43231        openArray("editor");
43232        for (ContactDetail e : element.getEditor()) 
43233          composeContactDetail(null, e);
43234        closeArray();
43235      };
43236      if (element.hasReviewer()) {
43237        openArray("reviewer");
43238        for (ContactDetail e : element.getReviewer()) 
43239          composeContactDetail(null, e);
43240        closeArray();
43241      };
43242      if (element.hasEndorser()) {
43243        openArray("endorser");
43244        for (ContactDetail e : element.getEndorser()) 
43245          composeContactDetail(null, e);
43246        closeArray();
43247      };
43248      if (element.hasRelatedArtifact()) {
43249        openArray("relatedArtifact");
43250        for (RelatedArtifact e : element.getRelatedArtifact()) 
43251          composeRelatedArtifact(null, e);
43252        closeArray();
43253      };
43254      if (element.hasTypeElement()) {
43255        composeEnumerationCore("type", element.getTypeElement(), new EvidenceVariable.EvidenceVariableTypeEnumFactory(), false);
43256        composeEnumerationExtras("type", element.getTypeElement(), new EvidenceVariable.EvidenceVariableTypeEnumFactory(), false);
43257      }
43258      if (element.hasActualElement()) {
43259        composeBooleanCore("actual", element.getActualElement(), false);
43260        composeBooleanExtras("actual", element.getActualElement(), false);
43261      }
43262      if (element.hasCharacteristic()) {
43263        openArray("characteristic");
43264        for (EvidenceVariable.EvidenceVariableCharacteristicComponent e : element.getCharacteristic()) 
43265          composeEvidenceVariableCharacteristicComponent(null, e);
43266        closeArray();
43267      };
43268  }
43269
43270  protected void composeEvidenceVariableCharacteristicComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
43271    if (element != null) {
43272      open(name);
43273      composeEvidenceVariableCharacteristicComponentProperties(element);
43274      close();
43275    }
43276  }
43277
43278  protected void composeEvidenceVariableCharacteristicComponentProperties(EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
43279    composeBackboneElementProperties(element);
43280      if (element.hasDescriptionElement()) {
43281        composeStringCore("description", element.getDescriptionElement(), false);
43282        composeStringExtras("description", element.getDescriptionElement(), false);
43283      }
43284      if (element.hasDefinition()) {
43285        composeType("definition", element.getDefinition());
43286      }
43287      if (element.hasMethod()) {
43288        composeCodeableConcept("method", element.getMethod());
43289      }
43290      if (element.hasDevice()) {
43291        composeReference("device", element.getDevice());
43292      }
43293      if (element.hasBooleanSet()) {
43294        openArray("booleanSet");
43295        for (StringType e : element.getBooleanSet()) 
43296          composeStringCore(null, e, true);
43297        closeArray();
43298        if (anyHasExtras(element.getBooleanSet())) {
43299          openArray("_booleanSet");
43300          for (StringType e : element.getBooleanSet()) 
43301            composeStringExtras(null, e, true);
43302          closeArray();
43303        }
43304      };
43305      if (element.hasExcludeElement()) {
43306        composeBooleanCore("exclude", element.getExcludeElement(), false);
43307        composeBooleanExtras("exclude", element.getExcludeElement(), false);
43308      }
43309      if (element.hasParticipantEffective()) {
43310        composeType("participantEffective", element.getParticipantEffective());
43311      }
43312      if (element.hasTimeFromStart()) {
43313        composeDuration("timeFromStart", element.getTimeFromStart());
43314      }
43315      if (element.hasGroupMeasureElement()) {
43316        composeEnumerationCore("groupMeasure", element.getGroupMeasureElement(), new EvidenceVariable.GroupMeasureEnumFactory(), false);
43317        composeEnumerationExtras("groupMeasure", element.getGroupMeasureElement(), new EvidenceVariable.GroupMeasureEnumFactory(), false);
43318      }
43319  }
43320
43321  protected void composeExampleScenario(String name, ExampleScenario element) throws IOException {
43322    if (element != null) {
43323      prop("resourceType", name);
43324      composeExampleScenarioProperties(element);
43325    }
43326  }
43327
43328  protected void composeExampleScenarioProperties(ExampleScenario element) throws IOException {
43329    composeCanonicalResourceProperties(element);
43330      if (element.hasUrlElement()) {
43331        composeUriCore("url", element.getUrlElement(), false);
43332        composeUriExtras("url", element.getUrlElement(), false);
43333      }
43334      if (element.hasIdentifier()) {
43335        openArray("identifier");
43336        for (Identifier e : element.getIdentifier()) 
43337          composeIdentifier(null, e);
43338        closeArray();
43339      };
43340      if (element.hasVersionElement()) {
43341        composeStringCore("version", element.getVersionElement(), false);
43342        composeStringExtras("version", element.getVersionElement(), false);
43343      }
43344      if (element.hasNameElement()) {
43345        composeStringCore("name", element.getNameElement(), false);
43346        composeStringExtras("name", element.getNameElement(), false);
43347      }
43348      if (element.hasStatusElement()) {
43349        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43350        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43351      }
43352      if (element.hasExperimentalElement()) {
43353        composeBooleanCore("experimental", element.getExperimentalElement(), false);
43354        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
43355      }
43356      if (element.hasDateElement()) {
43357        composeDateTimeCore("date", element.getDateElement(), false);
43358        composeDateTimeExtras("date", element.getDateElement(), false);
43359      }
43360      if (element.hasPublisherElement()) {
43361        composeStringCore("publisher", element.getPublisherElement(), false);
43362        composeStringExtras("publisher", element.getPublisherElement(), false);
43363      }
43364      if (element.hasContact()) {
43365        openArray("contact");
43366        for (ContactDetail e : element.getContact()) 
43367          composeContactDetail(null, e);
43368        closeArray();
43369      };
43370      if (element.hasUseContext()) {
43371        openArray("useContext");
43372        for (UsageContext e : element.getUseContext()) 
43373          composeUsageContext(null, e);
43374        closeArray();
43375      };
43376      if (element.hasJurisdiction()) {
43377        openArray("jurisdiction");
43378        for (CodeableConcept e : element.getJurisdiction()) 
43379          composeCodeableConcept(null, e);
43380        closeArray();
43381      };
43382      if (element.hasPurposeElement()) {
43383        composeMarkdownCore("purpose", element.getPurposeElement(), false);
43384        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
43385      }
43386      if (element.hasCopyrightElement()) {
43387        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
43388        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
43389      }
43390      if (element.hasActor()) {
43391        openArray("actor");
43392        for (ExampleScenario.ExampleScenarioActorComponent e : element.getActor()) 
43393          composeExampleScenarioActorComponent(null, e);
43394        closeArray();
43395      };
43396      if (element.hasInstance()) {
43397        openArray("instance");
43398        for (ExampleScenario.ExampleScenarioInstanceComponent e : element.getInstance()) 
43399          composeExampleScenarioInstanceComponent(null, e);
43400        closeArray();
43401      };
43402      if (element.hasProcess()) {
43403        openArray("process");
43404        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
43405          composeExampleScenarioProcessComponent(null, e);
43406        closeArray();
43407      };
43408      if (element.hasWorkflow()) {
43409        openArray("workflow");
43410        for (CanonicalType e : element.getWorkflow()) 
43411          composeCanonicalCore(null, e, true);
43412        closeArray();
43413        if (anyHasExtras(element.getWorkflow())) {
43414          openArray("_workflow");
43415          for (CanonicalType e : element.getWorkflow()) 
43416            composeCanonicalExtras(null, e, true);
43417          closeArray();
43418        }
43419      };
43420  }
43421
43422  protected void composeExampleScenarioActorComponent(String name, ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
43423    if (element != null) {
43424      open(name);
43425      composeExampleScenarioActorComponentProperties(element);
43426      close();
43427    }
43428  }
43429
43430  protected void composeExampleScenarioActorComponentProperties(ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
43431    composeBackboneElementProperties(element);
43432      if (element.hasActorIdElement()) {
43433        composeStringCore("actorId", element.getActorIdElement(), false);
43434        composeStringExtras("actorId", element.getActorIdElement(), false);
43435      }
43436      if (element.hasTypeElement()) {
43437        composeEnumerationCore("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
43438        composeEnumerationExtras("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
43439      }
43440      if (element.hasNameElement()) {
43441        composeStringCore("name", element.getNameElement(), false);
43442        composeStringExtras("name", element.getNameElement(), false);
43443      }
43444      if (element.hasDescriptionElement()) {
43445        composeMarkdownCore("description", element.getDescriptionElement(), false);
43446        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43447      }
43448  }
43449
43450  protected void composeExampleScenarioInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
43451    if (element != null) {
43452      open(name);
43453      composeExampleScenarioInstanceComponentProperties(element);
43454      close();
43455    }
43456  }
43457
43458  protected void composeExampleScenarioInstanceComponentProperties(ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
43459    composeBackboneElementProperties(element);
43460      if (element.hasResourceIdElement()) {
43461        composeStringCore("resourceId", element.getResourceIdElement(), false);
43462        composeStringExtras("resourceId", element.getResourceIdElement(), false);
43463      }
43464      if (element.hasResourceTypeElement()) {
43465        composeCodeCore("resourceType", element.getResourceTypeElement(), false);
43466        composeCodeExtras("resourceType", element.getResourceTypeElement(), false);
43467      }
43468      if (element.hasNameElement()) {
43469        composeStringCore("name", element.getNameElement(), false);
43470        composeStringExtras("name", element.getNameElement(), false);
43471      }
43472      if (element.hasDescriptionElement()) {
43473        composeMarkdownCore("description", element.getDescriptionElement(), false);
43474        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43475      }
43476      if (element.hasVersion()) {
43477        openArray("version");
43478        for (ExampleScenario.ExampleScenarioInstanceVersionComponent e : element.getVersion()) 
43479          composeExampleScenarioInstanceVersionComponent(null, e);
43480        closeArray();
43481      };
43482      if (element.hasContainedInstance()) {
43483        openArray("containedInstance");
43484        for (ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent e : element.getContainedInstance()) 
43485          composeExampleScenarioInstanceContainedInstanceComponent(null, e);
43486        closeArray();
43487      };
43488  }
43489
43490  protected void composeExampleScenarioInstanceVersionComponent(String name, ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
43491    if (element != null) {
43492      open(name);
43493      composeExampleScenarioInstanceVersionComponentProperties(element);
43494      close();
43495    }
43496  }
43497
43498  protected void composeExampleScenarioInstanceVersionComponentProperties(ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
43499    composeBackboneElementProperties(element);
43500      if (element.hasVersionIdElement()) {
43501        composeStringCore("versionId", element.getVersionIdElement(), false);
43502        composeStringExtras("versionId", element.getVersionIdElement(), false);
43503      }
43504      if (element.hasDescriptionElement()) {
43505        composeMarkdownCore("description", element.getDescriptionElement(), false);
43506        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43507      }
43508  }
43509
43510  protected void composeExampleScenarioInstanceContainedInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
43511    if (element != null) {
43512      open(name);
43513      composeExampleScenarioInstanceContainedInstanceComponentProperties(element);
43514      close();
43515    }
43516  }
43517
43518  protected void composeExampleScenarioInstanceContainedInstanceComponentProperties(ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
43519    composeBackboneElementProperties(element);
43520      if (element.hasResourceIdElement()) {
43521        composeStringCore("resourceId", element.getResourceIdElement(), false);
43522        composeStringExtras("resourceId", element.getResourceIdElement(), false);
43523      }
43524      if (element.hasVersionIdElement()) {
43525        composeStringCore("versionId", element.getVersionIdElement(), false);
43526        composeStringExtras("versionId", element.getVersionIdElement(), false);
43527      }
43528  }
43529
43530  protected void composeExampleScenarioProcessComponent(String name, ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
43531    if (element != null) {
43532      open(name);
43533      composeExampleScenarioProcessComponentProperties(element);
43534      close();
43535    }
43536  }
43537
43538  protected void composeExampleScenarioProcessComponentProperties(ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
43539    composeBackboneElementProperties(element);
43540      if (element.hasTitleElement()) {
43541        composeStringCore("title", element.getTitleElement(), false);
43542        composeStringExtras("title", element.getTitleElement(), false);
43543      }
43544      if (element.hasDescriptionElement()) {
43545        composeMarkdownCore("description", element.getDescriptionElement(), false);
43546        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43547      }
43548      if (element.hasPreConditionsElement()) {
43549        composeMarkdownCore("preConditions", element.getPreConditionsElement(), false);
43550        composeMarkdownExtras("preConditions", element.getPreConditionsElement(), false);
43551      }
43552      if (element.hasPostConditionsElement()) {
43553        composeMarkdownCore("postConditions", element.getPostConditionsElement(), false);
43554        composeMarkdownExtras("postConditions", element.getPostConditionsElement(), false);
43555      }
43556      if (element.hasStep()) {
43557        openArray("step");
43558        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
43559          composeExampleScenarioProcessStepComponent(null, e);
43560        closeArray();
43561      };
43562  }
43563
43564  protected void composeExampleScenarioProcessStepComponent(String name, ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
43565    if (element != null) {
43566      open(name);
43567      composeExampleScenarioProcessStepComponentProperties(element);
43568      close();
43569    }
43570  }
43571
43572  protected void composeExampleScenarioProcessStepComponentProperties(ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
43573    composeBackboneElementProperties(element);
43574      if (element.hasProcess()) {
43575        openArray("process");
43576        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
43577          composeExampleScenarioProcessComponent(null, e);
43578        closeArray();
43579      };
43580      if (element.hasPauseElement()) {
43581        composeBooleanCore("pause", element.getPauseElement(), false);
43582        composeBooleanExtras("pause", element.getPauseElement(), false);
43583      }
43584      if (element.hasOperation()) {
43585        composeExampleScenarioProcessStepOperationComponent("operation", element.getOperation());
43586      }
43587      if (element.hasAlternative()) {
43588        openArray("alternative");
43589        for (ExampleScenario.ExampleScenarioProcessStepAlternativeComponent e : element.getAlternative()) 
43590          composeExampleScenarioProcessStepAlternativeComponent(null, e);
43591        closeArray();
43592      };
43593  }
43594
43595  protected void composeExampleScenarioProcessStepOperationComponent(String name, ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
43596    if (element != null) {
43597      open(name);
43598      composeExampleScenarioProcessStepOperationComponentProperties(element);
43599      close();
43600    }
43601  }
43602
43603  protected void composeExampleScenarioProcessStepOperationComponentProperties(ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
43604    composeBackboneElementProperties(element);
43605      if (element.hasNumberElement()) {
43606        composeStringCore("number", element.getNumberElement(), false);
43607        composeStringExtras("number", element.getNumberElement(), false);
43608      }
43609      if (element.hasTypeElement()) {
43610        composeStringCore("type", element.getTypeElement(), false);
43611        composeStringExtras("type", element.getTypeElement(), false);
43612      }
43613      if (element.hasNameElement()) {
43614        composeStringCore("name", element.getNameElement(), false);
43615        composeStringExtras("name", element.getNameElement(), false);
43616      }
43617      if (element.hasInitiatorElement()) {
43618        composeStringCore("initiator", element.getInitiatorElement(), false);
43619        composeStringExtras("initiator", element.getInitiatorElement(), false);
43620      }
43621      if (element.hasReceiverElement()) {
43622        composeStringCore("receiver", element.getReceiverElement(), false);
43623        composeStringExtras("receiver", element.getReceiverElement(), false);
43624      }
43625      if (element.hasDescriptionElement()) {
43626        composeMarkdownCore("description", element.getDescriptionElement(), false);
43627        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43628      }
43629      if (element.hasInitiatorActiveElement()) {
43630        composeBooleanCore("initiatorActive", element.getInitiatorActiveElement(), false);
43631        composeBooleanExtras("initiatorActive", element.getInitiatorActiveElement(), false);
43632      }
43633      if (element.hasReceiverActiveElement()) {
43634        composeBooleanCore("receiverActive", element.getReceiverActiveElement(), false);
43635        composeBooleanExtras("receiverActive", element.getReceiverActiveElement(), false);
43636      }
43637      if (element.hasRequest()) {
43638        composeExampleScenarioInstanceContainedInstanceComponent("request", element.getRequest());
43639      }
43640      if (element.hasResponse()) {
43641        composeExampleScenarioInstanceContainedInstanceComponent("response", element.getResponse());
43642      }
43643  }
43644
43645  protected void composeExampleScenarioProcessStepAlternativeComponent(String name, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
43646    if (element != null) {
43647      open(name);
43648      composeExampleScenarioProcessStepAlternativeComponentProperties(element);
43649      close();
43650    }
43651  }
43652
43653  protected void composeExampleScenarioProcessStepAlternativeComponentProperties(ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
43654    composeBackboneElementProperties(element);
43655      if (element.hasTitleElement()) {
43656        composeStringCore("title", element.getTitleElement(), false);
43657        composeStringExtras("title", element.getTitleElement(), false);
43658      }
43659      if (element.hasDescriptionElement()) {
43660        composeMarkdownCore("description", element.getDescriptionElement(), false);
43661        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43662      }
43663      if (element.hasStep()) {
43664        openArray("step");
43665        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
43666          composeExampleScenarioProcessStepComponent(null, e);
43667        closeArray();
43668      };
43669  }
43670
43671  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
43672    if (element != null) {
43673      prop("resourceType", name);
43674      composeExplanationOfBenefitProperties(element);
43675    }
43676  }
43677
43678  protected void composeExplanationOfBenefitProperties(ExplanationOfBenefit element) throws IOException {
43679    composeDomainResourceProperties(element);
43680      if (element.hasIdentifier()) {
43681        openArray("identifier");
43682        for (Identifier e : element.getIdentifier()) 
43683          composeIdentifier(null, e);
43684        closeArray();
43685      };
43686      if (element.hasStatusElement()) {
43687        composeEnumerationCore("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
43688        composeEnumerationExtras("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
43689      }
43690      if (element.hasType()) {
43691        composeCodeableConcept("type", element.getType());
43692      }
43693      if (element.hasSubType()) {
43694        composeCodeableConcept("subType", element.getSubType());
43695      }
43696      if (element.hasUseElement()) {
43697        composeEnumerationCore("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
43698        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.UseEnumFactory(), false);
43699      }
43700      if (element.hasPatient()) {
43701        composeReference("patient", element.getPatient());
43702      }
43703      if (element.hasBillablePeriod()) {
43704        composePeriod("billablePeriod", element.getBillablePeriod());
43705      }
43706      if (element.hasCreatedElement()) {
43707        composeDateTimeCore("created", element.getCreatedElement(), false);
43708        composeDateTimeExtras("created", element.getCreatedElement(), false);
43709      }
43710      if (element.hasEnterer()) {
43711        composeReference("enterer", element.getEnterer());
43712      }
43713      if (element.hasInsurer()) {
43714        composeReference("insurer", element.getInsurer());
43715      }
43716      if (element.hasProvider()) {
43717        composeReference("provider", element.getProvider());
43718      }
43719      if (element.hasPriority()) {
43720        composeCodeableConcept("priority", element.getPriority());
43721      }
43722      if (element.hasFundsReserveRequested()) {
43723        composeCodeableConcept("fundsReserveRequested", element.getFundsReserveRequested());
43724      }
43725      if (element.hasFundsReserve()) {
43726        composeCodeableConcept("fundsReserve", element.getFundsReserve());
43727      }
43728      if (element.hasRelated()) {
43729        openArray("related");
43730        for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated()) 
43731          composeRelatedClaimComponent(null, e);
43732        closeArray();
43733      };
43734      if (element.hasPrescription()) {
43735        composeReference("prescription", element.getPrescription());
43736      }
43737      if (element.hasOriginalPrescription()) {
43738        composeReference("originalPrescription", element.getOriginalPrescription());
43739      }
43740      if (element.hasPayee()) {
43741        composePayeeComponent("payee", element.getPayee());
43742      }
43743      if (element.hasReferral()) {
43744        composeReference("referral", element.getReferral());
43745      }
43746      if (element.hasFacility()) {
43747        composeReference("facility", element.getFacility());
43748      }
43749      if (element.hasClaim()) {
43750        composeReference("claim", element.getClaim());
43751      }
43752      if (element.hasClaimResponse()) {
43753        composeReference("claimResponse", element.getClaimResponse());
43754      }
43755      if (element.hasOutcomeElement()) {
43756        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
43757        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
43758      }
43759      if (element.hasDispositionElement()) {
43760        composeStringCore("disposition", element.getDispositionElement(), false);
43761        composeStringExtras("disposition", element.getDispositionElement(), false);
43762      }
43763      if (element.hasPreAuthRef()) {
43764        openArray("preAuthRef");
43765        for (StringType e : element.getPreAuthRef()) 
43766          composeStringCore(null, e, true);
43767        closeArray();
43768        if (anyHasExtras(element.getPreAuthRef())) {
43769          openArray("_preAuthRef");
43770          for (StringType e : element.getPreAuthRef()) 
43771            composeStringExtras(null, e, true);
43772          closeArray();
43773        }
43774      };
43775      if (element.hasPreAuthRefPeriod()) {
43776        openArray("preAuthRefPeriod");
43777        for (Period e : element.getPreAuthRefPeriod()) 
43778          composePeriod(null, e);
43779        closeArray();
43780      };
43781      if (element.hasCareTeam()) {
43782        openArray("careTeam");
43783        for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam()) 
43784          composeCareTeamComponent(null, e);
43785        closeArray();
43786      };
43787      if (element.hasSupportingInfo()) {
43788        openArray("supportingInfo");
43789        for (ExplanationOfBenefit.SupportingInformationComponent e : element.getSupportingInfo()) 
43790          composeSupportingInformationComponent(null, e);
43791        closeArray();
43792      };
43793      if (element.hasDiagnosis()) {
43794        openArray("diagnosis");
43795        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
43796          composeDiagnosisComponent(null, e);
43797        closeArray();
43798      };
43799      if (element.hasProcedure()) {
43800        openArray("procedure");
43801        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
43802          composeProcedureComponent(null, e);
43803        closeArray();
43804      };
43805      if (element.hasPrecedenceElement()) {
43806        composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
43807        composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
43808      }
43809      if (element.hasInsurance()) {
43810        openArray("insurance");
43811        for (ExplanationOfBenefit.InsuranceComponent e : element.getInsurance()) 
43812          composeInsuranceComponent(null, e);
43813        closeArray();
43814      };
43815      if (element.hasAccident()) {
43816        composeAccidentComponent("accident", element.getAccident());
43817      }
43818      if (element.hasItem()) {
43819        openArray("item");
43820        for (ExplanationOfBenefit.ItemComponent e : element.getItem()) 
43821          composeItemComponent(null, e);
43822        closeArray();
43823      };
43824      if (element.hasAddItem()) {
43825        openArray("addItem");
43826        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
43827          composeAddedItemComponent(null, e);
43828        closeArray();
43829      };
43830      if (element.hasAdjudication()) {
43831        openArray("adjudication");
43832        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
43833          composeAdjudicationComponent(null, e);
43834        closeArray();
43835      };
43836      if (element.hasTotal()) {
43837        openArray("total");
43838        for (ExplanationOfBenefit.TotalComponent e : element.getTotal()) 
43839          composeTotalComponent(null, e);
43840        closeArray();
43841      };
43842      if (element.hasPayment()) {
43843        composePaymentComponent("payment", element.getPayment());
43844      }
43845      if (element.hasFormCode()) {
43846        composeCodeableConcept("formCode", element.getFormCode());
43847      }
43848      if (element.hasForm()) {
43849        composeAttachment("form", element.getForm());
43850      }
43851      if (element.hasProcessNote()) {
43852        openArray("processNote");
43853        for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote()) 
43854          composeNoteComponent(null, e);
43855        closeArray();
43856      };
43857      if (element.hasBenefitPeriod()) {
43858        composePeriod("benefitPeriod", element.getBenefitPeriod());
43859      }
43860      if (element.hasBenefitBalance()) {
43861        openArray("benefitBalance");
43862        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
43863          composeBenefitBalanceComponent(null, e);
43864        closeArray();
43865      };
43866  }
43867
43868  protected void composeRelatedClaimComponent(String name, ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
43869    if (element != null) {
43870      open(name);
43871      composeRelatedClaimComponentProperties(element);
43872      close();
43873    }
43874  }
43875
43876  protected void composeRelatedClaimComponentProperties(ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
43877    composeBackboneElementProperties(element);
43878      if (element.hasClaim()) {
43879        composeReference("claim", element.getClaim());
43880      }
43881      if (element.hasRelationship()) {
43882        composeCodeableConcept("relationship", element.getRelationship());
43883      }
43884      if (element.hasReference()) {
43885        composeIdentifier("reference", element.getReference());
43886      }
43887  }
43888
43889  protected void composePayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
43890    if (element != null) {
43891      open(name);
43892      composePayeeComponentProperties(element);
43893      close();
43894    }
43895  }
43896
43897  protected void composePayeeComponentProperties(ExplanationOfBenefit.PayeeComponent element) throws IOException {
43898    composeBackboneElementProperties(element);
43899      if (element.hasType()) {
43900        composeCodeableConcept("type", element.getType());
43901      }
43902      if (element.hasParty()) {
43903        composeReference("party", element.getParty());
43904      }
43905  }
43906
43907  protected void composeCareTeamComponent(String name, ExplanationOfBenefit.CareTeamComponent element) throws IOException {
43908    if (element != null) {
43909      open(name);
43910      composeCareTeamComponentProperties(element);
43911      close();
43912    }
43913  }
43914
43915  protected void composeCareTeamComponentProperties(ExplanationOfBenefit.CareTeamComponent element) throws IOException {
43916    composeBackboneElementProperties(element);
43917      if (element.hasSequenceElement()) {
43918        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43919        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43920      }
43921      if (element.hasProvider()) {
43922        composeReference("provider", element.getProvider());
43923      }
43924      if (element.hasResponsibleElement()) {
43925        composeBooleanCore("responsible", element.getResponsibleElement(), false);
43926        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
43927      }
43928      if (element.hasRole()) {
43929        composeCodeableConcept("role", element.getRole());
43930      }
43931      if (element.hasQualification()) {
43932        composeCodeableConcept("qualification", element.getQualification());
43933      }
43934  }
43935
43936  protected void composeSupportingInformationComponent(String name, ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
43937    if (element != null) {
43938      open(name);
43939      composeSupportingInformationComponentProperties(element);
43940      close();
43941    }
43942  }
43943
43944  protected void composeSupportingInformationComponentProperties(ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
43945    composeBackboneElementProperties(element);
43946      if (element.hasSequenceElement()) {
43947        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43948        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43949      }
43950      if (element.hasCategory()) {
43951        composeCodeableConcept("category", element.getCategory());
43952      }
43953      if (element.hasCode()) {
43954        composeCodeableConcept("code", element.getCode());
43955      }
43956      if (element.hasTiming()) {
43957        composeType("timing", element.getTiming());
43958      }
43959      if (element.hasValue()) {
43960        composeType("value", element.getValue());
43961      }
43962      if (element.hasReason()) {
43963        composeCoding("reason", element.getReason());
43964      }
43965  }
43966
43967  protected void composeDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
43968    if (element != null) {
43969      open(name);
43970      composeDiagnosisComponentProperties(element);
43971      close();
43972    }
43973  }
43974
43975  protected void composeDiagnosisComponentProperties(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
43976    composeBackboneElementProperties(element);
43977      if (element.hasSequenceElement()) {
43978        composePositiveIntCore("sequence", element.getSequenceElement(), false);
43979        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
43980      }
43981      if (element.hasDiagnosis()) {
43982        composeType("diagnosis", element.getDiagnosis());
43983      }
43984      if (element.hasType()) {
43985        openArray("type");
43986        for (CodeableConcept e : element.getType()) 
43987          composeCodeableConcept(null, e);
43988        closeArray();
43989      };
43990      if (element.hasOnAdmission()) {
43991        composeCodeableConcept("onAdmission", element.getOnAdmission());
43992      }
43993      if (element.hasPackageCode()) {
43994        composeCodeableConcept("packageCode", element.getPackageCode());
43995      }
43996  }
43997
43998  protected void composeProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
43999    if (element != null) {
44000      open(name);
44001      composeProcedureComponentProperties(element);
44002      close();
44003    }
44004  }
44005
44006  protected void composeProcedureComponentProperties(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
44007    composeBackboneElementProperties(element);
44008      if (element.hasSequenceElement()) {
44009        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44010        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44011      }
44012      if (element.hasType()) {
44013        openArray("type");
44014        for (CodeableConcept e : element.getType()) 
44015          composeCodeableConcept(null, e);
44016        closeArray();
44017      };
44018      if (element.hasDateElement()) {
44019        composeDateTimeCore("date", element.getDateElement(), false);
44020        composeDateTimeExtras("date", element.getDateElement(), false);
44021      }
44022      if (element.hasProcedure()) {
44023        composeType("procedure", element.getProcedure());
44024      }
44025      if (element.hasUdi()) {
44026        openArray("udi");
44027        for (Reference e : element.getUdi()) 
44028          composeReference(null, e);
44029        closeArray();
44030      };
44031  }
44032
44033  protected void composeInsuranceComponent(String name, ExplanationOfBenefit.InsuranceComponent element) throws IOException {
44034    if (element != null) {
44035      open(name);
44036      composeInsuranceComponentProperties(element);
44037      close();
44038    }
44039  }
44040
44041  protected void composeInsuranceComponentProperties(ExplanationOfBenefit.InsuranceComponent element) throws IOException {
44042    composeBackboneElementProperties(element);
44043      if (element.hasFocalElement()) {
44044        composeBooleanCore("focal", element.getFocalElement(), false);
44045        composeBooleanExtras("focal", element.getFocalElement(), false);
44046      }
44047      if (element.hasCoverage()) {
44048        composeReference("coverage", element.getCoverage());
44049      }
44050      if (element.hasPreAuthRef()) {
44051        openArray("preAuthRef");
44052        for (StringType e : element.getPreAuthRef()) 
44053          composeStringCore(null, e, true);
44054        closeArray();
44055        if (anyHasExtras(element.getPreAuthRef())) {
44056          openArray("_preAuthRef");
44057          for (StringType e : element.getPreAuthRef()) 
44058            composeStringExtras(null, e, true);
44059          closeArray();
44060        }
44061      };
44062  }
44063
44064  protected void composeAccidentComponent(String name, ExplanationOfBenefit.AccidentComponent element) throws IOException {
44065    if (element != null) {
44066      open(name);
44067      composeAccidentComponentProperties(element);
44068      close();
44069    }
44070  }
44071
44072  protected void composeAccidentComponentProperties(ExplanationOfBenefit.AccidentComponent element) throws IOException {
44073    composeBackboneElementProperties(element);
44074      if (element.hasDateElement()) {
44075        composeDateCore("date", element.getDateElement(), false);
44076        composeDateExtras("date", element.getDateElement(), false);
44077      }
44078      if (element.hasType()) {
44079        composeCodeableConcept("type", element.getType());
44080      }
44081      if (element.hasLocation()) {
44082        composeType("location", element.getLocation());
44083      }
44084  }
44085
44086  protected void composeItemComponent(String name, ExplanationOfBenefit.ItemComponent element) throws IOException {
44087    if (element != null) {
44088      open(name);
44089      composeItemComponentProperties(element);
44090      close();
44091    }
44092  }
44093
44094  protected void composeItemComponentProperties(ExplanationOfBenefit.ItemComponent element) throws IOException {
44095    composeBackboneElementProperties(element);
44096      if (element.hasSequenceElement()) {
44097        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44098        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44099      }
44100      if (element.hasCareTeamSequence()) {
44101        openArray("careTeamSequence");
44102        for (PositiveIntType e : element.getCareTeamSequence()) 
44103          composePositiveIntCore(null, e, true);
44104        closeArray();
44105        if (anyHasExtras(element.getCareTeamSequence())) {
44106          openArray("_careTeamSequence");
44107          for (PositiveIntType e : element.getCareTeamSequence()) 
44108            composePositiveIntExtras(null, e, true);
44109          closeArray();
44110        }
44111      };
44112      if (element.hasDiagnosisSequence()) {
44113        openArray("diagnosisSequence");
44114        for (PositiveIntType e : element.getDiagnosisSequence()) 
44115          composePositiveIntCore(null, e, true);
44116        closeArray();
44117        if (anyHasExtras(element.getDiagnosisSequence())) {
44118          openArray("_diagnosisSequence");
44119          for (PositiveIntType e : element.getDiagnosisSequence()) 
44120            composePositiveIntExtras(null, e, true);
44121          closeArray();
44122        }
44123      };
44124      if (element.hasProcedureSequence()) {
44125        openArray("procedureSequence");
44126        for (PositiveIntType e : element.getProcedureSequence()) 
44127          composePositiveIntCore(null, e, true);
44128        closeArray();
44129        if (anyHasExtras(element.getProcedureSequence())) {
44130          openArray("_procedureSequence");
44131          for (PositiveIntType e : element.getProcedureSequence()) 
44132            composePositiveIntExtras(null, e, true);
44133          closeArray();
44134        }
44135      };
44136      if (element.hasInformationSequence()) {
44137        openArray("informationSequence");
44138        for (PositiveIntType e : element.getInformationSequence()) 
44139          composePositiveIntCore(null, e, true);
44140        closeArray();
44141        if (anyHasExtras(element.getInformationSequence())) {
44142          openArray("_informationSequence");
44143          for (PositiveIntType e : element.getInformationSequence()) 
44144            composePositiveIntExtras(null, e, true);
44145          closeArray();
44146        }
44147      };
44148      if (element.hasRevenue()) {
44149        composeCodeableConcept("revenue", element.getRevenue());
44150      }
44151      if (element.hasCategory()) {
44152        composeCodeableConcept("category", element.getCategory());
44153      }
44154      if (element.hasProductOrService()) {
44155        composeCodeableConcept("productOrService", element.getProductOrService());
44156      }
44157      if (element.hasModifier()) {
44158        openArray("modifier");
44159        for (CodeableConcept e : element.getModifier()) 
44160          composeCodeableConcept(null, e);
44161        closeArray();
44162      };
44163      if (element.hasProgramCode()) {
44164        openArray("programCode");
44165        for (CodeableConcept e : element.getProgramCode()) 
44166          composeCodeableConcept(null, e);
44167        closeArray();
44168      };
44169      if (element.hasServiced()) {
44170        composeType("serviced", element.getServiced());
44171      }
44172      if (element.hasLocation()) {
44173        composeType("location", element.getLocation());
44174      }
44175      if (element.hasQuantity()) {
44176        composeQuantity("quantity", element.getQuantity());
44177      }
44178      if (element.hasUnitPrice()) {
44179        composeMoney("unitPrice", element.getUnitPrice());
44180      }
44181      if (element.hasFactorElement()) {
44182        composeDecimalCore("factor", element.getFactorElement(), false);
44183        composeDecimalExtras("factor", element.getFactorElement(), false);
44184      }
44185      if (element.hasNet()) {
44186        composeMoney("net", element.getNet());
44187      }
44188      if (element.hasUdi()) {
44189        openArray("udi");
44190        for (Reference e : element.getUdi()) 
44191          composeReference(null, e);
44192        closeArray();
44193      };
44194      if (element.hasBodySite()) {
44195        composeCodeableConcept("bodySite", element.getBodySite());
44196      }
44197      if (element.hasSubSite()) {
44198        openArray("subSite");
44199        for (CodeableConcept e : element.getSubSite()) 
44200          composeCodeableConcept(null, e);
44201        closeArray();
44202      };
44203      if (element.hasEncounter()) {
44204        openArray("encounter");
44205        for (Reference e : element.getEncounter()) 
44206          composeReference(null, e);
44207        closeArray();
44208      };
44209      if (element.hasNoteNumber()) {
44210        openArray("noteNumber");
44211        for (PositiveIntType e : element.getNoteNumber()) 
44212          composePositiveIntCore(null, e, true);
44213        closeArray();
44214        if (anyHasExtras(element.getNoteNumber())) {
44215          openArray("_noteNumber");
44216          for (PositiveIntType e : element.getNoteNumber()) 
44217            composePositiveIntExtras(null, e, true);
44218          closeArray();
44219        }
44220      };
44221      if (element.hasAdjudication()) {
44222        openArray("adjudication");
44223        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
44224          composeAdjudicationComponent(null, e);
44225        closeArray();
44226      };
44227      if (element.hasDetail()) {
44228        openArray("detail");
44229        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
44230          composeDetailComponent(null, e);
44231        closeArray();
44232      };
44233  }
44234
44235  protected void composeAdjudicationComponent(String name, ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
44236    if (element != null) {
44237      open(name);
44238      composeAdjudicationComponentProperties(element);
44239      close();
44240    }
44241  }
44242
44243  protected void composeAdjudicationComponentProperties(ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
44244    composeBackboneElementProperties(element);
44245      if (element.hasCategory()) {
44246        composeCodeableConcept("category", element.getCategory());
44247      }
44248      if (element.hasReason()) {
44249        composeCodeableConcept("reason", element.getReason());
44250      }
44251      if (element.hasAmount()) {
44252        composeMoney("amount", element.getAmount());
44253      }
44254      if (element.hasValueElement()) {
44255        composeDecimalCore("value", element.getValueElement(), false);
44256        composeDecimalExtras("value", element.getValueElement(), false);
44257      }
44258  }
44259
44260  protected void composeDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
44261    if (element != null) {
44262      open(name);
44263      composeDetailComponentProperties(element);
44264      close();
44265    }
44266  }
44267
44268  protected void composeDetailComponentProperties(ExplanationOfBenefit.DetailComponent element) throws IOException {
44269    composeBackboneElementProperties(element);
44270      if (element.hasSequenceElement()) {
44271        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44272        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44273      }
44274      if (element.hasRevenue()) {
44275        composeCodeableConcept("revenue", element.getRevenue());
44276      }
44277      if (element.hasCategory()) {
44278        composeCodeableConcept("category", element.getCategory());
44279      }
44280      if (element.hasProductOrService()) {
44281        composeCodeableConcept("productOrService", element.getProductOrService());
44282      }
44283      if (element.hasModifier()) {
44284        openArray("modifier");
44285        for (CodeableConcept e : element.getModifier()) 
44286          composeCodeableConcept(null, e);
44287        closeArray();
44288      };
44289      if (element.hasProgramCode()) {
44290        openArray("programCode");
44291        for (CodeableConcept e : element.getProgramCode()) 
44292          composeCodeableConcept(null, e);
44293        closeArray();
44294      };
44295      if (element.hasQuantity()) {
44296        composeQuantity("quantity", element.getQuantity());
44297      }
44298      if (element.hasUnitPrice()) {
44299        composeMoney("unitPrice", element.getUnitPrice());
44300      }
44301      if (element.hasFactorElement()) {
44302        composeDecimalCore("factor", element.getFactorElement(), false);
44303        composeDecimalExtras("factor", element.getFactorElement(), false);
44304      }
44305      if (element.hasNet()) {
44306        composeMoney("net", element.getNet());
44307      }
44308      if (element.hasUdi()) {
44309        openArray("udi");
44310        for (Reference e : element.getUdi()) 
44311          composeReference(null, e);
44312        closeArray();
44313      };
44314      if (element.hasNoteNumber()) {
44315        openArray("noteNumber");
44316        for (PositiveIntType e : element.getNoteNumber()) 
44317          composePositiveIntCore(null, e, true);
44318        closeArray();
44319        if (anyHasExtras(element.getNoteNumber())) {
44320          openArray("_noteNumber");
44321          for (PositiveIntType e : element.getNoteNumber()) 
44322            composePositiveIntExtras(null, e, true);
44323          closeArray();
44324        }
44325      };
44326      if (element.hasAdjudication()) {
44327        openArray("adjudication");
44328        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
44329          composeAdjudicationComponent(null, e);
44330        closeArray();
44331      };
44332      if (element.hasSubDetail()) {
44333        openArray("subDetail");
44334        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
44335          composeSubDetailComponent(null, e);
44336        closeArray();
44337      };
44338  }
44339
44340  protected void composeSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
44341    if (element != null) {
44342      open(name);
44343      composeSubDetailComponentProperties(element);
44344      close();
44345    }
44346  }
44347
44348  protected void composeSubDetailComponentProperties(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
44349    composeBackboneElementProperties(element);
44350      if (element.hasSequenceElement()) {
44351        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44352        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44353      }
44354      if (element.hasRevenue()) {
44355        composeCodeableConcept("revenue", element.getRevenue());
44356      }
44357      if (element.hasCategory()) {
44358        composeCodeableConcept("category", element.getCategory());
44359      }
44360      if (element.hasProductOrService()) {
44361        composeCodeableConcept("productOrService", element.getProductOrService());
44362      }
44363      if (element.hasModifier()) {
44364        openArray("modifier");
44365        for (CodeableConcept e : element.getModifier()) 
44366          composeCodeableConcept(null, e);
44367        closeArray();
44368      };
44369      if (element.hasProgramCode()) {
44370        openArray("programCode");
44371        for (CodeableConcept e : element.getProgramCode()) 
44372          composeCodeableConcept(null, e);
44373        closeArray();
44374      };
44375      if (element.hasQuantity()) {
44376        composeQuantity("quantity", element.getQuantity());
44377      }
44378      if (element.hasUnitPrice()) {
44379        composeMoney("unitPrice", element.getUnitPrice());
44380      }
44381      if (element.hasFactorElement()) {
44382        composeDecimalCore("factor", element.getFactorElement(), false);
44383        composeDecimalExtras("factor", element.getFactorElement(), false);
44384      }
44385      if (element.hasNet()) {
44386        composeMoney("net", element.getNet());
44387      }
44388      if (element.hasUdi()) {
44389        openArray("udi");
44390        for (Reference e : element.getUdi()) 
44391          composeReference(null, e);
44392        closeArray();
44393      };
44394      if (element.hasNoteNumber()) {
44395        openArray("noteNumber");
44396        for (PositiveIntType e : element.getNoteNumber()) 
44397          composePositiveIntCore(null, e, true);
44398        closeArray();
44399        if (anyHasExtras(element.getNoteNumber())) {
44400          openArray("_noteNumber");
44401          for (PositiveIntType e : element.getNoteNumber()) 
44402            composePositiveIntExtras(null, e, true);
44403          closeArray();
44404        }
44405      };
44406      if (element.hasAdjudication()) {
44407        openArray("adjudication");
44408        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
44409          composeAdjudicationComponent(null, e);
44410        closeArray();
44411      };
44412  }
44413
44414  protected void composeAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
44415    if (element != null) {
44416      open(name);
44417      composeAddedItemComponentProperties(element);
44418      close();
44419    }
44420  }
44421
44422  protected void composeAddedItemComponentProperties(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
44423    composeBackboneElementProperties(element);
44424      if (element.hasItemSequence()) {
44425        openArray("itemSequence");
44426        for (PositiveIntType e : element.getItemSequence()) 
44427          composePositiveIntCore(null, e, true);
44428        closeArray();
44429        if (anyHasExtras(element.getItemSequence())) {
44430          openArray("_itemSequence");
44431          for (PositiveIntType e : element.getItemSequence()) 
44432            composePositiveIntExtras(null, e, true);
44433          closeArray();
44434        }
44435      };
44436      if (element.hasDetailSequence()) {
44437        openArray("detailSequence");
44438        for (PositiveIntType e : element.getDetailSequence()) 
44439          composePositiveIntCore(null, e, true);
44440        closeArray();
44441        if (anyHasExtras(element.getDetailSequence())) {
44442          openArray("_detailSequence");
44443          for (PositiveIntType e : element.getDetailSequence()) 
44444            composePositiveIntExtras(null, e, true);
44445          closeArray();
44446        }
44447      };
44448      if (element.hasSubDetailSequence()) {
44449        openArray("subDetailSequence");
44450        for (PositiveIntType e : element.getSubDetailSequence()) 
44451          composePositiveIntCore(null, e, true);
44452        closeArray();
44453        if (anyHasExtras(element.getSubDetailSequence())) {
44454          openArray("_subDetailSequence");
44455          for (PositiveIntType e : element.getSubDetailSequence()) 
44456            composePositiveIntExtras(null, e, true);
44457          closeArray();
44458        }
44459      };
44460      if (element.hasProvider()) {
44461        openArray("provider");
44462        for (Reference e : element.getProvider()) 
44463          composeReference(null, e);
44464        closeArray();
44465      };
44466      if (element.hasProductOrService()) {
44467        composeCodeableConcept("productOrService", element.getProductOrService());
44468      }
44469      if (element.hasModifier()) {
44470        openArray("modifier");
44471        for (CodeableConcept e : element.getModifier()) 
44472          composeCodeableConcept(null, e);
44473        closeArray();
44474      };
44475      if (element.hasProgramCode()) {
44476        openArray("programCode");
44477        for (CodeableConcept e : element.getProgramCode()) 
44478          composeCodeableConcept(null, e);
44479        closeArray();
44480      };
44481      if (element.hasServiced()) {
44482        composeType("serviced", element.getServiced());
44483      }
44484      if (element.hasLocation()) {
44485        composeType("location", element.getLocation());
44486      }
44487      if (element.hasQuantity()) {
44488        composeQuantity("quantity", element.getQuantity());
44489      }
44490      if (element.hasUnitPrice()) {
44491        composeMoney("unitPrice", element.getUnitPrice());
44492      }
44493      if (element.hasFactorElement()) {
44494        composeDecimalCore("factor", element.getFactorElement(), false);
44495        composeDecimalExtras("factor", element.getFactorElement(), false);
44496      }
44497      if (element.hasNet()) {
44498        composeMoney("net", element.getNet());
44499      }
44500      if (element.hasBodySite()) {
44501        composeCodeableConcept("bodySite", element.getBodySite());
44502      }
44503      if (element.hasSubSite()) {
44504        openArray("subSite");
44505        for (CodeableConcept e : element.getSubSite()) 
44506          composeCodeableConcept(null, e);
44507        closeArray();
44508      };
44509      if (element.hasNoteNumber()) {
44510        openArray("noteNumber");
44511        for (PositiveIntType e : element.getNoteNumber()) 
44512          composePositiveIntCore(null, e, true);
44513        closeArray();
44514        if (anyHasExtras(element.getNoteNumber())) {
44515          openArray("_noteNumber");
44516          for (PositiveIntType e : element.getNoteNumber()) 
44517            composePositiveIntExtras(null, e, true);
44518          closeArray();
44519        }
44520      };
44521      if (element.hasAdjudication()) {
44522        openArray("adjudication");
44523        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
44524          composeAdjudicationComponent(null, e);
44525        closeArray();
44526      };
44527      if (element.hasDetail()) {
44528        openArray("detail");
44529        for (ExplanationOfBenefit.AddedItemDetailComponent e : element.getDetail()) 
44530          composeAddedItemDetailComponent(null, e);
44531        closeArray();
44532      };
44533  }
44534
44535  protected void composeAddedItemDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
44536    if (element != null) {
44537      open(name);
44538      composeAddedItemDetailComponentProperties(element);
44539      close();
44540    }
44541  }
44542
44543  protected void composeAddedItemDetailComponentProperties(ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
44544    composeBackboneElementProperties(element);
44545      if (element.hasProductOrService()) {
44546        composeCodeableConcept("productOrService", element.getProductOrService());
44547      }
44548      if (element.hasModifier()) {
44549        openArray("modifier");
44550        for (CodeableConcept e : element.getModifier()) 
44551          composeCodeableConcept(null, e);
44552        closeArray();
44553      };
44554      if (element.hasQuantity()) {
44555        composeQuantity("quantity", element.getQuantity());
44556      }
44557      if (element.hasUnitPrice()) {
44558        composeMoney("unitPrice", element.getUnitPrice());
44559      }
44560      if (element.hasFactorElement()) {
44561        composeDecimalCore("factor", element.getFactorElement(), false);
44562        composeDecimalExtras("factor", element.getFactorElement(), false);
44563      }
44564      if (element.hasNet()) {
44565        composeMoney("net", element.getNet());
44566      }
44567      if (element.hasNoteNumber()) {
44568        openArray("noteNumber");
44569        for (PositiveIntType e : element.getNoteNumber()) 
44570          composePositiveIntCore(null, e, true);
44571        closeArray();
44572        if (anyHasExtras(element.getNoteNumber())) {
44573          openArray("_noteNumber");
44574          for (PositiveIntType e : element.getNoteNumber()) 
44575            composePositiveIntExtras(null, e, true);
44576          closeArray();
44577        }
44578      };
44579      if (element.hasAdjudication()) {
44580        openArray("adjudication");
44581        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
44582          composeAdjudicationComponent(null, e);
44583        closeArray();
44584      };
44585      if (element.hasSubDetail()) {
44586        openArray("subDetail");
44587        for (ExplanationOfBenefit.AddedItemDetailSubDetailComponent e : element.getSubDetail()) 
44588          composeAddedItemDetailSubDetailComponent(null, e);
44589        closeArray();
44590      };
44591  }
44592
44593  protected void composeAddedItemDetailSubDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
44594    if (element != null) {
44595      open(name);
44596      composeAddedItemDetailSubDetailComponentProperties(element);
44597      close();
44598    }
44599  }
44600
44601  protected void composeAddedItemDetailSubDetailComponentProperties(ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
44602    composeBackboneElementProperties(element);
44603      if (element.hasProductOrService()) {
44604        composeCodeableConcept("productOrService", element.getProductOrService());
44605      }
44606      if (element.hasModifier()) {
44607        openArray("modifier");
44608        for (CodeableConcept e : element.getModifier()) 
44609          composeCodeableConcept(null, e);
44610        closeArray();
44611      };
44612      if (element.hasQuantity()) {
44613        composeQuantity("quantity", element.getQuantity());
44614      }
44615      if (element.hasUnitPrice()) {
44616        composeMoney("unitPrice", element.getUnitPrice());
44617      }
44618      if (element.hasFactorElement()) {
44619        composeDecimalCore("factor", element.getFactorElement(), false);
44620        composeDecimalExtras("factor", element.getFactorElement(), false);
44621      }
44622      if (element.hasNet()) {
44623        composeMoney("net", element.getNet());
44624      }
44625      if (element.hasNoteNumber()) {
44626        openArray("noteNumber");
44627        for (PositiveIntType e : element.getNoteNumber()) 
44628          composePositiveIntCore(null, e, true);
44629        closeArray();
44630        if (anyHasExtras(element.getNoteNumber())) {
44631          openArray("_noteNumber");
44632          for (PositiveIntType e : element.getNoteNumber()) 
44633            composePositiveIntExtras(null, e, true);
44634          closeArray();
44635        }
44636      };
44637      if (element.hasAdjudication()) {
44638        openArray("adjudication");
44639        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
44640          composeAdjudicationComponent(null, e);
44641        closeArray();
44642      };
44643  }
44644
44645  protected void composeTotalComponent(String name, ExplanationOfBenefit.TotalComponent element) throws IOException {
44646    if (element != null) {
44647      open(name);
44648      composeTotalComponentProperties(element);
44649      close();
44650    }
44651  }
44652
44653  protected void composeTotalComponentProperties(ExplanationOfBenefit.TotalComponent element) throws IOException {
44654    composeBackboneElementProperties(element);
44655      if (element.hasCategory()) {
44656        composeCodeableConcept("category", element.getCategory());
44657      }
44658      if (element.hasAmount()) {
44659        composeMoney("amount", element.getAmount());
44660      }
44661  }
44662
44663  protected void composePaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element) throws IOException {
44664    if (element != null) {
44665      open(name);
44666      composePaymentComponentProperties(element);
44667      close();
44668    }
44669  }
44670
44671  protected void composePaymentComponentProperties(ExplanationOfBenefit.PaymentComponent element) throws IOException {
44672    composeBackboneElementProperties(element);
44673      if (element.hasType()) {
44674        composeCodeableConcept("type", element.getType());
44675      }
44676      if (element.hasAdjustment()) {
44677        composeMoney("adjustment", element.getAdjustment());
44678      }
44679      if (element.hasAdjustmentReason()) {
44680        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
44681      }
44682      if (element.hasDateElement()) {
44683        composeDateCore("date", element.getDateElement(), false);
44684        composeDateExtras("date", element.getDateElement(), false);
44685      }
44686      if (element.hasAmount()) {
44687        composeMoney("amount", element.getAmount());
44688      }
44689      if (element.hasIdentifier()) {
44690        composeIdentifier("identifier", element.getIdentifier());
44691      }
44692  }
44693
44694  protected void composeNoteComponent(String name, ExplanationOfBenefit.NoteComponent element) throws IOException {
44695    if (element != null) {
44696      open(name);
44697      composeNoteComponentProperties(element);
44698      close();
44699    }
44700  }
44701
44702  protected void composeNoteComponentProperties(ExplanationOfBenefit.NoteComponent element) throws IOException {
44703    composeBackboneElementProperties(element);
44704      if (element.hasNumberElement()) {
44705        composePositiveIntCore("number", element.getNumberElement(), false);
44706        composePositiveIntExtras("number", element.getNumberElement(), false);
44707      }
44708      if (element.hasTypeElement()) {
44709        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
44710        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
44711      }
44712      if (element.hasTextElement()) {
44713        composeStringCore("text", element.getTextElement(), false);
44714        composeStringExtras("text", element.getTextElement(), false);
44715      }
44716      if (element.hasLanguage()) {
44717        composeCodeableConcept("language", element.getLanguage());
44718      }
44719  }
44720
44721  protected void composeBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
44722    if (element != null) {
44723      open(name);
44724      composeBenefitBalanceComponentProperties(element);
44725      close();
44726    }
44727  }
44728
44729  protected void composeBenefitBalanceComponentProperties(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
44730    composeBackboneElementProperties(element);
44731      if (element.hasCategory()) {
44732        composeCodeableConcept("category", element.getCategory());
44733      }
44734      if (element.hasExcludedElement()) {
44735        composeBooleanCore("excluded", element.getExcludedElement(), false);
44736        composeBooleanExtras("excluded", element.getExcludedElement(), false);
44737      }
44738      if (element.hasNameElement()) {
44739        composeStringCore("name", element.getNameElement(), false);
44740        composeStringExtras("name", element.getNameElement(), false);
44741      }
44742      if (element.hasDescriptionElement()) {
44743        composeStringCore("description", element.getDescriptionElement(), false);
44744        composeStringExtras("description", element.getDescriptionElement(), false);
44745      }
44746      if (element.hasNetwork()) {
44747        composeCodeableConcept("network", element.getNetwork());
44748      }
44749      if (element.hasUnit()) {
44750        composeCodeableConcept("unit", element.getUnit());
44751      }
44752      if (element.hasTerm()) {
44753        composeCodeableConcept("term", element.getTerm());
44754      }
44755      if (element.hasFinancial()) {
44756        openArray("financial");
44757        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
44758          composeBenefitComponent(null, e);
44759        closeArray();
44760      };
44761  }
44762
44763  protected void composeBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
44764    if (element != null) {
44765      open(name);
44766      composeBenefitComponentProperties(element);
44767      close();
44768    }
44769  }
44770
44771  protected void composeBenefitComponentProperties(ExplanationOfBenefit.BenefitComponent element) throws IOException {
44772    composeBackboneElementProperties(element);
44773      if (element.hasType()) {
44774        composeCodeableConcept("type", element.getType());
44775      }
44776      if (element.hasAllowed()) {
44777        composeType("allowed", element.getAllowed());
44778      }
44779      if (element.hasUsed()) {
44780        composeType("used", element.getUsed());
44781      }
44782  }
44783
44784  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
44785    if (element != null) {
44786      prop("resourceType", name);
44787      composeFamilyMemberHistoryProperties(element);
44788    }
44789  }
44790
44791  protected void composeFamilyMemberHistoryProperties(FamilyMemberHistory element) throws IOException {
44792    composeDomainResourceProperties(element);
44793      if (element.hasIdentifier()) {
44794        openArray("identifier");
44795        for (Identifier e : element.getIdentifier()) 
44796          composeIdentifier(null, e);
44797        closeArray();
44798      };
44799      if (element.hasInstantiatesCanonical()) {
44800        openArray("instantiatesCanonical");
44801        for (CanonicalType e : element.getInstantiatesCanonical()) 
44802          composeCanonicalCore(null, e, true);
44803        closeArray();
44804        if (anyHasExtras(element.getInstantiatesCanonical())) {
44805          openArray("_instantiatesCanonical");
44806          for (CanonicalType e : element.getInstantiatesCanonical()) 
44807            composeCanonicalExtras(null, e, true);
44808          closeArray();
44809        }
44810      };
44811      if (element.hasInstantiatesUri()) {
44812        openArray("instantiatesUri");
44813        for (UriType e : element.getInstantiatesUri()) 
44814          composeUriCore(null, e, true);
44815        closeArray();
44816        if (anyHasExtras(element.getInstantiatesUri())) {
44817          openArray("_instantiatesUri");
44818          for (UriType e : element.getInstantiatesUri()) 
44819            composeUriExtras(null, e, true);
44820          closeArray();
44821        }
44822      };
44823      if (element.hasStatusElement()) {
44824        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
44825        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
44826      }
44827      if (element.hasDataAbsentReason()) {
44828        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
44829      }
44830      if (element.hasPatient()) {
44831        composeReference("patient", element.getPatient());
44832      }
44833      if (element.hasDateElement()) {
44834        composeDateTimeCore("date", element.getDateElement(), false);
44835        composeDateTimeExtras("date", element.getDateElement(), false);
44836      }
44837      if (element.hasNameElement()) {
44838        composeStringCore("name", element.getNameElement(), false);
44839        composeStringExtras("name", element.getNameElement(), false);
44840      }
44841      if (element.hasRelationship()) {
44842        composeCodeableConcept("relationship", element.getRelationship());
44843      }
44844      if (element.hasSex()) {
44845        composeCodeableConcept("sex", element.getSex());
44846      }
44847      if (element.hasBorn()) {
44848        composeType("born", element.getBorn());
44849      }
44850      if (element.hasAge()) {
44851        composeType("age", element.getAge());
44852      }
44853      if (element.hasEstimatedAgeElement()) {
44854        composeBooleanCore("estimatedAge", element.getEstimatedAgeElement(), false);
44855        composeBooleanExtras("estimatedAge", element.getEstimatedAgeElement(), false);
44856      }
44857      if (element.hasDeceased()) {
44858        composeType("deceased", element.getDeceased());
44859      }
44860      if (element.hasReason()) {
44861        openArray("reason");
44862        for (CodeableReference e : element.getReason()) 
44863          composeCodeableReference(null, e);
44864        closeArray();
44865      };
44866      if (element.hasNote()) {
44867        openArray("note");
44868        for (Annotation e : element.getNote()) 
44869          composeAnnotation(null, e);
44870        closeArray();
44871      };
44872      if (element.hasCondition()) {
44873        openArray("condition");
44874        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
44875          composeFamilyMemberHistoryConditionComponent(null, e);
44876        closeArray();
44877      };
44878      if (element.hasProcedure()) {
44879        openArray("procedure");
44880        for (FamilyMemberHistory.FamilyMemberHistoryProcedureComponent e : element.getProcedure()) 
44881          composeFamilyMemberHistoryProcedureComponent(null, e);
44882        closeArray();
44883      };
44884  }
44885
44886  protected void composeFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
44887    if (element != null) {
44888      open(name);
44889      composeFamilyMemberHistoryConditionComponentProperties(element);
44890      close();
44891    }
44892  }
44893
44894  protected void composeFamilyMemberHistoryConditionComponentProperties(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
44895    composeBackboneElementProperties(element);
44896      if (element.hasCode()) {
44897        composeCodeableConcept("code", element.getCode());
44898      }
44899      if (element.hasOutcome()) {
44900        composeCodeableConcept("outcome", element.getOutcome());
44901      }
44902      if (element.hasContributedToDeathElement()) {
44903        composeBooleanCore("contributedToDeath", element.getContributedToDeathElement(), false);
44904        composeBooleanExtras("contributedToDeath", element.getContributedToDeathElement(), false);
44905      }
44906      if (element.hasOnset()) {
44907        composeType("onset", element.getOnset());
44908      }
44909      if (element.hasNote()) {
44910        openArray("note");
44911        for (Annotation e : element.getNote()) 
44912          composeAnnotation(null, e);
44913        closeArray();
44914      };
44915  }
44916
44917  protected void composeFamilyMemberHistoryProcedureComponent(String name, FamilyMemberHistory.FamilyMemberHistoryProcedureComponent element) throws IOException {
44918    if (element != null) {
44919      open(name);
44920      composeFamilyMemberHistoryProcedureComponentProperties(element);
44921      close();
44922    }
44923  }
44924
44925  protected void composeFamilyMemberHistoryProcedureComponentProperties(FamilyMemberHistory.FamilyMemberHistoryProcedureComponent element) throws IOException {
44926    composeBackboneElementProperties(element);
44927      if (element.hasCode()) {
44928        composeCodeableConcept("code", element.getCode());
44929      }
44930      if (element.hasOutcome()) {
44931        composeCodeableConcept("outcome", element.getOutcome());
44932      }
44933      if (element.hasContributedToDeathElement()) {
44934        composeBooleanCore("contributedToDeath", element.getContributedToDeathElement(), false);
44935        composeBooleanExtras("contributedToDeath", element.getContributedToDeathElement(), false);
44936      }
44937      if (element.hasPerformed()) {
44938        composeType("performed", element.getPerformed());
44939      }
44940      if (element.hasNote()) {
44941        openArray("note");
44942        for (Annotation e : element.getNote()) 
44943          composeAnnotation(null, e);
44944        closeArray();
44945      };
44946  }
44947
44948  protected void composeFlag(String name, Flag element) throws IOException {
44949    if (element != null) {
44950      prop("resourceType", name);
44951      composeFlagProperties(element);
44952    }
44953  }
44954
44955  protected void composeFlagProperties(Flag element) throws IOException {
44956    composeDomainResourceProperties(element);
44957      if (element.hasIdentifier()) {
44958        openArray("identifier");
44959        for (Identifier e : element.getIdentifier()) 
44960          composeIdentifier(null, e);
44961        closeArray();
44962      };
44963      if (element.hasStatusElement()) {
44964        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
44965        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
44966      }
44967      if (element.hasCategory()) {
44968        openArray("category");
44969        for (CodeableConcept e : element.getCategory()) 
44970          composeCodeableConcept(null, e);
44971        closeArray();
44972      };
44973      if (element.hasCode()) {
44974        composeCodeableConcept("code", element.getCode());
44975      }
44976      if (element.hasSubject()) {
44977        composeReference("subject", element.getSubject());
44978      }
44979      if (element.hasPeriod()) {
44980        composePeriod("period", element.getPeriod());
44981      }
44982      if (element.hasEncounter()) {
44983        composeReference("encounter", element.getEncounter());
44984      }
44985      if (element.hasAuthor()) {
44986        composeReference("author", element.getAuthor());
44987      }
44988  }
44989
44990  protected void composeGoal(String name, Goal element) throws IOException {
44991    if (element != null) {
44992      prop("resourceType", name);
44993      composeGoalProperties(element);
44994    }
44995  }
44996
44997  protected void composeGoalProperties(Goal element) throws IOException {
44998    composeDomainResourceProperties(element);
44999      if (element.hasIdentifier()) {
45000        openArray("identifier");
45001        for (Identifier e : element.getIdentifier()) 
45002          composeIdentifier(null, e);
45003        closeArray();
45004      };
45005      if (element.hasLifecycleStatusElement()) {
45006        composeEnumerationCore("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
45007        composeEnumerationExtras("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
45008      }
45009      if (element.hasAchievementStatus()) {
45010        composeCodeableConcept("achievementStatus", element.getAchievementStatus());
45011      }
45012      if (element.hasCategory()) {
45013        openArray("category");
45014        for (CodeableConcept e : element.getCategory()) 
45015          composeCodeableConcept(null, e);
45016        closeArray();
45017      };
45018      if (element.hasContinuousElement()) {
45019        composeBooleanCore("continuous", element.getContinuousElement(), false);
45020        composeBooleanExtras("continuous", element.getContinuousElement(), false);
45021      }
45022      if (element.hasPriority()) {
45023        composeCodeableConcept("priority", element.getPriority());
45024      }
45025      if (element.hasDescription()) {
45026        composeCodeableConcept("description", element.getDescription());
45027      }
45028      if (element.hasSubject()) {
45029        composeReference("subject", element.getSubject());
45030      }
45031      if (element.hasStart()) {
45032        composeType("start", element.getStart());
45033      }
45034      if (element.hasTarget()) {
45035        openArray("target");
45036        for (Goal.GoalTargetComponent e : element.getTarget()) 
45037          composeGoalTargetComponent(null, e);
45038        closeArray();
45039      };
45040      if (element.hasStatusDateElement()) {
45041        composeDateCore("statusDate", element.getStatusDateElement(), false);
45042        composeDateExtras("statusDate", element.getStatusDateElement(), false);
45043      }
45044      if (element.hasStatusReasonElement()) {
45045        composeStringCore("statusReason", element.getStatusReasonElement(), false);
45046        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
45047      }
45048      if (element.hasExpressedBy()) {
45049        composeReference("expressedBy", element.getExpressedBy());
45050      }
45051      if (element.hasAddresses()) {
45052        openArray("addresses");
45053        for (Reference e : element.getAddresses()) 
45054          composeReference(null, e);
45055        closeArray();
45056      };
45057      if (element.hasNote()) {
45058        openArray("note");
45059        for (Annotation e : element.getNote()) 
45060          composeAnnotation(null, e);
45061        closeArray();
45062      };
45063      if (element.hasOutcome()) {
45064        openArray("outcome");
45065        for (CodeableReference e : element.getOutcome()) 
45066          composeCodeableReference(null, e);
45067        closeArray();
45068      };
45069  }
45070
45071  protected void composeGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
45072    if (element != null) {
45073      open(name);
45074      composeGoalTargetComponentProperties(element);
45075      close();
45076    }
45077  }
45078
45079  protected void composeGoalTargetComponentProperties(Goal.GoalTargetComponent element) throws IOException {
45080    composeBackboneElementProperties(element);
45081      if (element.hasMeasure()) {
45082        composeCodeableConcept("measure", element.getMeasure());
45083      }
45084      if (element.hasDetail()) {
45085        composeType("detail", element.getDetail());
45086      }
45087      if (element.hasDue()) {
45088        composeType("due", element.getDue());
45089      }
45090  }
45091
45092  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
45093    if (element != null) {
45094      prop("resourceType", name);
45095      composeGraphDefinitionProperties(element);
45096    }
45097  }
45098
45099  protected void composeGraphDefinitionProperties(GraphDefinition element) throws IOException {
45100    composeCanonicalResourceProperties(element);
45101      if (element.hasUrlElement()) {
45102        composeUriCore("url", element.getUrlElement(), false);
45103        composeUriExtras("url", element.getUrlElement(), false);
45104      }
45105      if (element.hasVersionElement()) {
45106        composeStringCore("version", element.getVersionElement(), false);
45107        composeStringExtras("version", element.getVersionElement(), false);
45108      }
45109      if (element.hasNameElement()) {
45110        composeStringCore("name", element.getNameElement(), false);
45111        composeStringExtras("name", element.getNameElement(), false);
45112      }
45113      if (element.hasStatusElement()) {
45114        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45115        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45116      }
45117      if (element.hasExperimentalElement()) {
45118        composeBooleanCore("experimental", element.getExperimentalElement(), false);
45119        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
45120      }
45121      if (element.hasDateElement()) {
45122        composeDateTimeCore("date", element.getDateElement(), false);
45123        composeDateTimeExtras("date", element.getDateElement(), false);
45124      }
45125      if (element.hasPublisherElement()) {
45126        composeStringCore("publisher", element.getPublisherElement(), false);
45127        composeStringExtras("publisher", element.getPublisherElement(), false);
45128      }
45129      if (element.hasContact()) {
45130        openArray("contact");
45131        for (ContactDetail e : element.getContact()) 
45132          composeContactDetail(null, e);
45133        closeArray();
45134      };
45135      if (element.hasDescriptionElement()) {
45136        composeMarkdownCore("description", element.getDescriptionElement(), false);
45137        composeMarkdownExtras("description", element.getDescriptionElement(), false);
45138      }
45139      if (element.hasUseContext()) {
45140        openArray("useContext");
45141        for (UsageContext e : element.getUseContext()) 
45142          composeUsageContext(null, e);
45143        closeArray();
45144      };
45145      if (element.hasJurisdiction()) {
45146        openArray("jurisdiction");
45147        for (CodeableConcept e : element.getJurisdiction()) 
45148          composeCodeableConcept(null, e);
45149        closeArray();
45150      };
45151      if (element.hasPurposeElement()) {
45152        composeMarkdownCore("purpose", element.getPurposeElement(), false);
45153        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
45154      }
45155      if (element.hasStartElement()) {
45156        composeCodeCore("start", element.getStartElement(), false);
45157        composeCodeExtras("start", element.getStartElement(), false);
45158      }
45159      if (element.hasProfileElement()) {
45160        composeCanonicalCore("profile", element.getProfileElement(), false);
45161        composeCanonicalExtras("profile", element.getProfileElement(), false);
45162      }
45163      if (element.hasLink()) {
45164        openArray("link");
45165        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
45166          composeGraphDefinitionLinkComponent(null, e);
45167        closeArray();
45168      };
45169  }
45170
45171  protected void composeGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
45172    if (element != null) {
45173      open(name);
45174      composeGraphDefinitionLinkComponentProperties(element);
45175      close();
45176    }
45177  }
45178
45179  protected void composeGraphDefinitionLinkComponentProperties(GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
45180    composeBackboneElementProperties(element);
45181      if (element.hasPathElement()) {
45182        composeStringCore("path", element.getPathElement(), false);
45183        composeStringExtras("path", element.getPathElement(), false);
45184      }
45185      if (element.hasSliceNameElement()) {
45186        composeStringCore("sliceName", element.getSliceNameElement(), false);
45187        composeStringExtras("sliceName", element.getSliceNameElement(), false);
45188      }
45189      if (element.hasMinElement()) {
45190        composeIntegerCore("min", element.getMinElement(), false);
45191        composeIntegerExtras("min", element.getMinElement(), false);
45192      }
45193      if (element.hasMaxElement()) {
45194        composeStringCore("max", element.getMaxElement(), false);
45195        composeStringExtras("max", element.getMaxElement(), false);
45196      }
45197      if (element.hasDescriptionElement()) {
45198        composeStringCore("description", element.getDescriptionElement(), false);
45199        composeStringExtras("description", element.getDescriptionElement(), false);
45200      }
45201      if (element.hasTarget()) {
45202        openArray("target");
45203        for (GraphDefinition.GraphDefinitionLinkTargetComponent e : element.getTarget()) 
45204          composeGraphDefinitionLinkTargetComponent(null, e);
45205        closeArray();
45206      };
45207  }
45208
45209  protected void composeGraphDefinitionLinkTargetComponent(String name, GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
45210    if (element != null) {
45211      open(name);
45212      composeGraphDefinitionLinkTargetComponentProperties(element);
45213      close();
45214    }
45215  }
45216
45217  protected void composeGraphDefinitionLinkTargetComponentProperties(GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
45218    composeBackboneElementProperties(element);
45219      if (element.hasTypeElement()) {
45220        composeCodeCore("type", element.getTypeElement(), false);
45221        composeCodeExtras("type", element.getTypeElement(), false);
45222      }
45223      if (element.hasParamsElement()) {
45224        composeStringCore("params", element.getParamsElement(), false);
45225        composeStringExtras("params", element.getParamsElement(), false);
45226      }
45227      if (element.hasProfileElement()) {
45228        composeCanonicalCore("profile", element.getProfileElement(), false);
45229        composeCanonicalExtras("profile", element.getProfileElement(), false);
45230      }
45231      if (element.hasCompartment()) {
45232        openArray("compartment");
45233        for (GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent e : element.getCompartment()) 
45234          composeGraphDefinitionLinkTargetCompartmentComponent(null, e);
45235        closeArray();
45236      };
45237      if (element.hasLink()) {
45238        openArray("link");
45239        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
45240          composeGraphDefinitionLinkComponent(null, e);
45241        closeArray();
45242      };
45243  }
45244
45245  protected void composeGraphDefinitionLinkTargetCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
45246    if (element != null) {
45247      open(name);
45248      composeGraphDefinitionLinkTargetCompartmentComponentProperties(element);
45249      close();
45250    }
45251  }
45252
45253  protected void composeGraphDefinitionLinkTargetCompartmentComponentProperties(GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
45254    composeBackboneElementProperties(element);
45255      if (element.hasUseElement()) {
45256        composeEnumerationCore("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
45257        composeEnumerationExtras("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
45258      }
45259      if (element.hasCodeElement()) {
45260        composeEnumerationCore("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
45261        composeEnumerationExtras("code", element.getCodeElement(), new Enumerations.CompartmentTypeEnumFactory(), false);
45262      }
45263      if (element.hasRuleElement()) {
45264        composeEnumerationCore("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
45265        composeEnumerationExtras("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
45266      }
45267      if (element.hasExpressionElement()) {
45268        composeStringCore("expression", element.getExpressionElement(), false);
45269        composeStringExtras("expression", element.getExpressionElement(), false);
45270      }
45271      if (element.hasDescriptionElement()) {
45272        composeStringCore("description", element.getDescriptionElement(), false);
45273        composeStringExtras("description", element.getDescriptionElement(), false);
45274      }
45275  }
45276
45277  protected void composeGroup(String name, Group element) throws IOException {
45278    if (element != null) {
45279      prop("resourceType", name);
45280      composeGroupProperties(element);
45281    }
45282  }
45283
45284  protected void composeGroupProperties(Group element) throws IOException {
45285    composeDomainResourceProperties(element);
45286      if (element.hasIdentifier()) {
45287        openArray("identifier");
45288        for (Identifier e : element.getIdentifier()) 
45289          composeIdentifier(null, e);
45290        closeArray();
45291      };
45292      if (element.hasActiveElement()) {
45293        composeBooleanCore("active", element.getActiveElement(), false);
45294        composeBooleanExtras("active", element.getActiveElement(), false);
45295      }
45296      if (element.hasTypeElement()) {
45297        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
45298        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
45299      }
45300      if (element.hasActualElement()) {
45301        composeBooleanCore("actual", element.getActualElement(), false);
45302        composeBooleanExtras("actual", element.getActualElement(), false);
45303      }
45304      if (element.hasCode()) {
45305        composeCodeableConcept("code", element.getCode());
45306      }
45307      if (element.hasNameElement()) {
45308        composeStringCore("name", element.getNameElement(), false);
45309        composeStringExtras("name", element.getNameElement(), false);
45310      }
45311      if (element.hasQuantityElement()) {
45312        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
45313        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
45314      }
45315      if (element.hasManagingEntity()) {
45316        composeReference("managingEntity", element.getManagingEntity());
45317      }
45318      if (element.hasCharacteristic()) {
45319        openArray("characteristic");
45320        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
45321          composeGroupCharacteristicComponent(null, e);
45322        closeArray();
45323      };
45324      if (element.hasMember()) {
45325        openArray("member");
45326        for (Group.GroupMemberComponent e : element.getMember()) 
45327          composeGroupMemberComponent(null, e);
45328        closeArray();
45329      };
45330  }
45331
45332  protected void composeGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
45333    if (element != null) {
45334      open(name);
45335      composeGroupCharacteristicComponentProperties(element);
45336      close();
45337    }
45338  }
45339
45340  protected void composeGroupCharacteristicComponentProperties(Group.GroupCharacteristicComponent element) throws IOException {
45341    composeBackboneElementProperties(element);
45342      if (element.hasCode()) {
45343        composeCodeableConcept("code", element.getCode());
45344      }
45345      if (element.hasValue()) {
45346        composeType("value", element.getValue());
45347      }
45348      if (element.hasExcludeElement()) {
45349        composeBooleanCore("exclude", element.getExcludeElement(), false);
45350        composeBooleanExtras("exclude", element.getExcludeElement(), false);
45351      }
45352      if (element.hasPeriod()) {
45353        composePeriod("period", element.getPeriod());
45354      }
45355  }
45356
45357  protected void composeGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
45358    if (element != null) {
45359      open(name);
45360      composeGroupMemberComponentProperties(element);
45361      close();
45362    }
45363  }
45364
45365  protected void composeGroupMemberComponentProperties(Group.GroupMemberComponent element) throws IOException {
45366    composeBackboneElementProperties(element);
45367      if (element.hasEntity()) {
45368        composeReference("entity", element.getEntity());
45369      }
45370      if (element.hasPeriod()) {
45371        composePeriod("period", element.getPeriod());
45372      }
45373      if (element.hasInactiveElement()) {
45374        composeBooleanCore("inactive", element.getInactiveElement(), false);
45375        composeBooleanExtras("inactive", element.getInactiveElement(), false);
45376      }
45377  }
45378
45379  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
45380    if (element != null) {
45381      prop("resourceType", name);
45382      composeGuidanceResponseProperties(element);
45383    }
45384  }
45385
45386  protected void composeGuidanceResponseProperties(GuidanceResponse element) throws IOException {
45387    composeDomainResourceProperties(element);
45388      if (element.hasRequestIdentifier()) {
45389        composeIdentifier("requestIdentifier", element.getRequestIdentifier());
45390      }
45391      if (element.hasIdentifier()) {
45392        openArray("identifier");
45393        for (Identifier e : element.getIdentifier()) 
45394          composeIdentifier(null, e);
45395        closeArray();
45396      };
45397      if (element.hasModule()) {
45398        composeType("module", element.getModule());
45399      }
45400      if (element.hasStatusElement()) {
45401        composeEnumerationCore("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
45402        composeEnumerationExtras("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
45403      }
45404      if (element.hasSubject()) {
45405        composeReference("subject", element.getSubject());
45406      }
45407      if (element.hasEncounter()) {
45408        composeReference("encounter", element.getEncounter());
45409      }
45410      if (element.hasOccurrenceDateTimeElement()) {
45411        composeDateTimeCore("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
45412        composeDateTimeExtras("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
45413      }
45414      if (element.hasPerformer()) {
45415        composeReference("performer", element.getPerformer());
45416      }
45417      if (element.hasReason()) {
45418        openArray("reason");
45419        for (CodeableReference e : element.getReason()) 
45420          composeCodeableReference(null, e);
45421        closeArray();
45422      };
45423      if (element.hasNote()) {
45424        openArray("note");
45425        for (Annotation e : element.getNote()) 
45426          composeAnnotation(null, e);
45427        closeArray();
45428      };
45429      if (element.hasEvaluationMessage()) {
45430        openArray("evaluationMessage");
45431        for (Reference e : element.getEvaluationMessage()) 
45432          composeReference(null, e);
45433        closeArray();
45434      };
45435      if (element.hasOutputParameters()) {
45436        composeReference("outputParameters", element.getOutputParameters());
45437      }
45438      if (element.hasResult()) {
45439        composeReference("result", element.getResult());
45440      }
45441      if (element.hasDataRequirement()) {
45442        openArray("dataRequirement");
45443        for (DataRequirement e : element.getDataRequirement()) 
45444          composeDataRequirement(null, e);
45445        closeArray();
45446      };
45447  }
45448
45449  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
45450    if (element != null) {
45451      prop("resourceType", name);
45452      composeHealthcareServiceProperties(element);
45453    }
45454  }
45455
45456  protected void composeHealthcareServiceProperties(HealthcareService element) throws IOException {
45457    composeDomainResourceProperties(element);
45458      if (element.hasIdentifier()) {
45459        openArray("identifier");
45460        for (Identifier e : element.getIdentifier()) 
45461          composeIdentifier(null, e);
45462        closeArray();
45463      };
45464      if (element.hasActiveElement()) {
45465        composeBooleanCore("active", element.getActiveElement(), false);
45466        composeBooleanExtras("active", element.getActiveElement(), false);
45467      }
45468      if (element.hasProvidedBy()) {
45469        composeReference("providedBy", element.getProvidedBy());
45470      }
45471      if (element.hasCategory()) {
45472        openArray("category");
45473        for (CodeableConcept e : element.getCategory()) 
45474          composeCodeableConcept(null, e);
45475        closeArray();
45476      };
45477      if (element.hasType()) {
45478        openArray("type");
45479        for (CodeableConcept e : element.getType()) 
45480          composeCodeableConcept(null, e);
45481        closeArray();
45482      };
45483      if (element.hasSpecialty()) {
45484        openArray("specialty");
45485        for (CodeableConcept e : element.getSpecialty()) 
45486          composeCodeableConcept(null, e);
45487        closeArray();
45488      };
45489      if (element.hasLocation()) {
45490        openArray("location");
45491        for (Reference e : element.getLocation()) 
45492          composeReference(null, e);
45493        closeArray();
45494      };
45495      if (element.hasNameElement()) {
45496        composeStringCore("name", element.getNameElement(), false);
45497        composeStringExtras("name", element.getNameElement(), false);
45498      }
45499      if (element.hasCommentElement()) {
45500        composeStringCore("comment", element.getCommentElement(), false);
45501        composeStringExtras("comment", element.getCommentElement(), false);
45502      }
45503      if (element.hasExtraDetailsElement()) {
45504        composeMarkdownCore("extraDetails", element.getExtraDetailsElement(), false);
45505        composeMarkdownExtras("extraDetails", element.getExtraDetailsElement(), false);
45506      }
45507      if (element.hasPhoto()) {
45508        composeAttachment("photo", element.getPhoto());
45509      }
45510      if (element.hasTelecom()) {
45511        openArray("telecom");
45512        for (ContactPoint e : element.getTelecom()) 
45513          composeContactPoint(null, e);
45514        closeArray();
45515      };
45516      if (element.hasCoverageArea()) {
45517        openArray("coverageArea");
45518        for (Reference e : element.getCoverageArea()) 
45519          composeReference(null, e);
45520        closeArray();
45521      };
45522      if (element.hasServiceProvisionCode()) {
45523        openArray("serviceProvisionCode");
45524        for (CodeableConcept e : element.getServiceProvisionCode()) 
45525          composeCodeableConcept(null, e);
45526        closeArray();
45527      };
45528      if (element.hasEligibility()) {
45529        openArray("eligibility");
45530        for (HealthcareService.HealthcareServiceEligibilityComponent e : element.getEligibility()) 
45531          composeHealthcareServiceEligibilityComponent(null, e);
45532        closeArray();
45533      };
45534      if (element.hasProgram()) {
45535        openArray("program");
45536        for (CodeableConcept e : element.getProgram()) 
45537          composeCodeableConcept(null, e);
45538        closeArray();
45539      };
45540      if (element.hasCharacteristic()) {
45541        openArray("characteristic");
45542        for (CodeableConcept e : element.getCharacteristic()) 
45543          composeCodeableConcept(null, e);
45544        closeArray();
45545      };
45546      if (element.hasCommunication()) {
45547        openArray("communication");
45548        for (CodeableConcept e : element.getCommunication()) 
45549          composeCodeableConcept(null, e);
45550        closeArray();
45551      };
45552      if (element.hasReferralMethod()) {
45553        openArray("referralMethod");
45554        for (CodeableConcept e : element.getReferralMethod()) 
45555          composeCodeableConcept(null, e);
45556        closeArray();
45557      };
45558      if (element.hasAppointmentRequiredElement()) {
45559        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
45560        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
45561      }
45562      if (element.hasAvailableTime()) {
45563        openArray("availableTime");
45564        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
45565          composeHealthcareServiceAvailableTimeComponent(null, e);
45566        closeArray();
45567      };
45568      if (element.hasNotAvailable()) {
45569        openArray("notAvailable");
45570        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
45571          composeHealthcareServiceNotAvailableComponent(null, e);
45572        closeArray();
45573      };
45574      if (element.hasAvailabilityExceptionsElement()) {
45575        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
45576        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
45577      }
45578      if (element.hasEndpoint()) {
45579        openArray("endpoint");
45580        for (Reference e : element.getEndpoint()) 
45581          composeReference(null, e);
45582        closeArray();
45583      };
45584  }
45585
45586  protected void composeHealthcareServiceEligibilityComponent(String name, HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
45587    if (element != null) {
45588      open(name);
45589      composeHealthcareServiceEligibilityComponentProperties(element);
45590      close();
45591    }
45592  }
45593
45594  protected void composeHealthcareServiceEligibilityComponentProperties(HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
45595    composeBackboneElementProperties(element);
45596      if (element.hasCode()) {
45597        composeCodeableConcept("code", element.getCode());
45598      }
45599      if (element.hasCommentElement()) {
45600        composeMarkdownCore("comment", element.getCommentElement(), false);
45601        composeMarkdownExtras("comment", element.getCommentElement(), false);
45602      }
45603  }
45604
45605  protected void composeHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
45606    if (element != null) {
45607      open(name);
45608      composeHealthcareServiceAvailableTimeComponentProperties(element);
45609      close();
45610    }
45611  }
45612
45613  protected void composeHealthcareServiceAvailableTimeComponentProperties(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
45614    composeBackboneElementProperties(element);
45615      if (element.hasDaysOfWeek()) {
45616        openArray("daysOfWeek");
45617        for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
45618          composeEnumerationCore(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
45619        closeArray();
45620        if (anyHasExtras(element.getDaysOfWeek())) {
45621          openArray("_daysOfWeek");
45622          for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
45623            composeEnumerationExtras(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
45624          closeArray();
45625        }
45626      };
45627      if (element.hasAllDayElement()) {
45628        composeBooleanCore("allDay", element.getAllDayElement(), false);
45629        composeBooleanExtras("allDay", element.getAllDayElement(), false);
45630      }
45631      if (element.hasAvailableStartTimeElement()) {
45632        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
45633        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
45634      }
45635      if (element.hasAvailableEndTimeElement()) {
45636        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
45637        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
45638      }
45639  }
45640
45641  protected void composeHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
45642    if (element != null) {
45643      open(name);
45644      composeHealthcareServiceNotAvailableComponentProperties(element);
45645      close();
45646    }
45647  }
45648
45649  protected void composeHealthcareServiceNotAvailableComponentProperties(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
45650    composeBackboneElementProperties(element);
45651      if (element.hasDescriptionElement()) {
45652        composeStringCore("description", element.getDescriptionElement(), false);
45653        composeStringExtras("description", element.getDescriptionElement(), false);
45654      }
45655      if (element.hasDuring()) {
45656        composePeriod("during", element.getDuring());
45657      }
45658  }
45659
45660  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
45661    if (element != null) {
45662      prop("resourceType", name);
45663      composeImagingStudyProperties(element);
45664    }
45665  }
45666
45667  protected void composeImagingStudyProperties(ImagingStudy element) throws IOException {
45668    composeDomainResourceProperties(element);
45669      if (element.hasIdentifier()) {
45670        openArray("identifier");
45671        for (Identifier e : element.getIdentifier()) 
45672          composeIdentifier(null, e);
45673        closeArray();
45674      };
45675      if (element.hasStatusElement()) {
45676        composeEnumerationCore("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
45677        composeEnumerationExtras("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
45678      }
45679      if (element.hasModality()) {
45680        openArray("modality");
45681        for (Coding e : element.getModality()) 
45682          composeCoding(null, e);
45683        closeArray();
45684      };
45685      if (element.hasSubject()) {
45686        composeReference("subject", element.getSubject());
45687      }
45688      if (element.hasEncounter()) {
45689        composeReference("encounter", element.getEncounter());
45690      }
45691      if (element.hasStartedElement()) {
45692        composeDateTimeCore("started", element.getStartedElement(), false);
45693        composeDateTimeExtras("started", element.getStartedElement(), false);
45694      }
45695      if (element.hasBasedOn()) {
45696        openArray("basedOn");
45697        for (Reference e : element.getBasedOn()) 
45698          composeReference(null, e);
45699        closeArray();
45700      };
45701      if (element.hasReferrer()) {
45702        composeReference("referrer", element.getReferrer());
45703      }
45704      if (element.hasInterpreter()) {
45705        openArray("interpreter");
45706        for (Reference e : element.getInterpreter()) 
45707          composeReference(null, e);
45708        closeArray();
45709      };
45710      if (element.hasEndpoint()) {
45711        openArray("endpoint");
45712        for (Reference e : element.getEndpoint()) 
45713          composeReference(null, e);
45714        closeArray();
45715      };
45716      if (element.hasNumberOfSeriesElement()) {
45717        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
45718        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
45719      }
45720      if (element.hasNumberOfInstancesElement()) {
45721        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
45722        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
45723      }
45724      if (element.hasProcedure()) {
45725        openArray("procedure");
45726        for (ImagingStudy.ImagingStudyProcedureComponent e : element.getProcedure()) 
45727          composeImagingStudyProcedureComponent(null, e);
45728        closeArray();
45729      };
45730      if (element.hasLocation()) {
45731        composeReference("location", element.getLocation());
45732      }
45733      if (element.hasReason()) {
45734        openArray("reason");
45735        for (CodeableReference e : element.getReason()) 
45736          composeCodeableReference(null, e);
45737        closeArray();
45738      };
45739      if (element.hasNote()) {
45740        openArray("note");
45741        for (Annotation e : element.getNote()) 
45742          composeAnnotation(null, e);
45743        closeArray();
45744      };
45745      if (element.hasDescriptionElement()) {
45746        composeStringCore("description", element.getDescriptionElement(), false);
45747        composeStringExtras("description", element.getDescriptionElement(), false);
45748      }
45749      if (element.hasSeries()) {
45750        openArray("series");
45751        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
45752          composeImagingStudySeriesComponent(null, e);
45753        closeArray();
45754      };
45755  }
45756
45757  protected void composeImagingStudyProcedureComponent(String name, ImagingStudy.ImagingStudyProcedureComponent element) throws IOException {
45758    if (element != null) {
45759      open(name);
45760      composeImagingStudyProcedureComponentProperties(element);
45761      close();
45762    }
45763  }
45764
45765  protected void composeImagingStudyProcedureComponentProperties(ImagingStudy.ImagingStudyProcedureComponent element) throws IOException {
45766    composeBackboneElementProperties(element);
45767      if (element.hasValue()) {
45768        composeType("value", element.getValue());
45769      }
45770  }
45771
45772  protected void composeImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
45773    if (element != null) {
45774      open(name);
45775      composeImagingStudySeriesComponentProperties(element);
45776      close();
45777    }
45778  }
45779
45780  protected void composeImagingStudySeriesComponentProperties(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
45781    composeBackboneElementProperties(element);
45782      if (element.hasUidElement()) {
45783        composeIdCore("uid", element.getUidElement(), false);
45784        composeIdExtras("uid", element.getUidElement(), false);
45785      }
45786      if (element.hasNumberElement()) {
45787        composeUnsignedIntCore("number", element.getNumberElement(), false);
45788        composeUnsignedIntExtras("number", element.getNumberElement(), false);
45789      }
45790      if (element.hasModality()) {
45791        composeCoding("modality", element.getModality());
45792      }
45793      if (element.hasDescriptionElement()) {
45794        composeStringCore("description", element.getDescriptionElement(), false);
45795        composeStringExtras("description", element.getDescriptionElement(), false);
45796      }
45797      if (element.hasNumberOfInstancesElement()) {
45798        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
45799        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
45800      }
45801      if (element.hasEndpoint()) {
45802        openArray("endpoint");
45803        for (Reference e : element.getEndpoint()) 
45804          composeReference(null, e);
45805        closeArray();
45806      };
45807      if (element.hasBodySite()) {
45808        composeCoding("bodySite", element.getBodySite());
45809      }
45810      if (element.hasLaterality()) {
45811        composeCoding("laterality", element.getLaterality());
45812      }
45813      if (element.hasSpecimen()) {
45814        openArray("specimen");
45815        for (Reference e : element.getSpecimen()) 
45816          composeReference(null, e);
45817        closeArray();
45818      };
45819      if (element.hasStartedElement()) {
45820        composeDateTimeCore("started", element.getStartedElement(), false);
45821        composeDateTimeExtras("started", element.getStartedElement(), false);
45822      }
45823      if (element.hasPerformer()) {
45824        openArray("performer");
45825        for (ImagingStudy.ImagingStudySeriesPerformerComponent e : element.getPerformer()) 
45826          composeImagingStudySeriesPerformerComponent(null, e);
45827        closeArray();
45828      };
45829      if (element.hasInstance()) {
45830        openArray("instance");
45831        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
45832          composeImagingStudySeriesInstanceComponent(null, e);
45833        closeArray();
45834      };
45835  }
45836
45837  protected void composeImagingStudySeriesPerformerComponent(String name, ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
45838    if (element != null) {
45839      open(name);
45840      composeImagingStudySeriesPerformerComponentProperties(element);
45841      close();
45842    }
45843  }
45844
45845  protected void composeImagingStudySeriesPerformerComponentProperties(ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
45846    composeBackboneElementProperties(element);
45847      if (element.hasFunction()) {
45848        composeCodeableConcept("function", element.getFunction());
45849      }
45850      if (element.hasActor()) {
45851        composeReference("actor", element.getActor());
45852      }
45853  }
45854
45855  protected void composeImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
45856    if (element != null) {
45857      open(name);
45858      composeImagingStudySeriesInstanceComponentProperties(element);
45859      close();
45860    }
45861  }
45862
45863  protected void composeImagingStudySeriesInstanceComponentProperties(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
45864    composeBackboneElementProperties(element);
45865      if (element.hasUidElement()) {
45866        composeIdCore("uid", element.getUidElement(), false);
45867        composeIdExtras("uid", element.getUidElement(), false);
45868      }
45869      if (element.hasSopClass()) {
45870        composeCoding("sopClass", element.getSopClass());
45871      }
45872      if (element.hasNumberElement()) {
45873        composeUnsignedIntCore("number", element.getNumberElement(), false);
45874        composeUnsignedIntExtras("number", element.getNumberElement(), false);
45875      }
45876      if (element.hasTitleElement()) {
45877        composeStringCore("title", element.getTitleElement(), false);
45878        composeStringExtras("title", element.getTitleElement(), false);
45879      }
45880  }
45881
45882  protected void composeImmunization(String name, Immunization element) throws IOException {
45883    if (element != null) {
45884      prop("resourceType", name);
45885      composeImmunizationProperties(element);
45886    }
45887  }
45888
45889  protected void composeImmunizationProperties(Immunization element) throws IOException {
45890    composeDomainResourceProperties(element);
45891      if (element.hasIdentifier()) {
45892        openArray("identifier");
45893        for (Identifier e : element.getIdentifier()) 
45894          composeIdentifier(null, e);
45895        closeArray();
45896      };
45897      if (element.hasStatusElement()) {
45898        composeEnumerationCore("status", element.getStatusElement(), new Immunization.ImmunizationStatusCodesEnumFactory(), false);
45899        composeEnumerationExtras("status", element.getStatusElement(), new Immunization.ImmunizationStatusCodesEnumFactory(), false);
45900      }
45901      if (element.hasStatusReason()) {
45902        composeCodeableConcept("statusReason", element.getStatusReason());
45903      }
45904      if (element.hasVaccineCode()) {
45905        composeCodeableConcept("vaccineCode", element.getVaccineCode());
45906      }
45907      if (element.hasPatient()) {
45908        composeReference("patient", element.getPatient());
45909      }
45910      if (element.hasEncounter()) {
45911        composeReference("encounter", element.getEncounter());
45912      }
45913      if (element.hasOccurrence()) {
45914        composeType("occurrence", element.getOccurrence());
45915      }
45916      if (element.hasRecordedElement()) {
45917        composeDateTimeCore("recorded", element.getRecordedElement(), false);
45918        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
45919      }
45920      if (element.hasPrimarySourceElement()) {
45921        composeBooleanCore("primarySource", element.getPrimarySourceElement(), false);
45922        composeBooleanExtras("primarySource", element.getPrimarySourceElement(), false);
45923      }
45924      if (element.hasInformationSource()) {
45925        composeType("informationSource", element.getInformationSource());
45926      }
45927      if (element.hasLocation()) {
45928        composeReference("location", element.getLocation());
45929      }
45930      if (element.hasManufacturer()) {
45931        composeReference("manufacturer", element.getManufacturer());
45932      }
45933      if (element.hasLotNumberElement()) {
45934        composeStringCore("lotNumber", element.getLotNumberElement(), false);
45935        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
45936      }
45937      if (element.hasExpirationDateElement()) {
45938        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
45939        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
45940      }
45941      if (element.hasSite()) {
45942        composeCodeableConcept("site", element.getSite());
45943      }
45944      if (element.hasRoute()) {
45945        composeCodeableConcept("route", element.getRoute());
45946      }
45947      if (element.hasDoseQuantity()) {
45948        composeQuantity("doseQuantity", element.getDoseQuantity());
45949      }
45950      if (element.hasPerformer()) {
45951        openArray("performer");
45952        for (Immunization.ImmunizationPerformerComponent e : element.getPerformer()) 
45953          composeImmunizationPerformerComponent(null, e);
45954        closeArray();
45955      };
45956      if (element.hasNote()) {
45957        openArray("note");
45958        for (Annotation e : element.getNote()) 
45959          composeAnnotation(null, e);
45960        closeArray();
45961      };
45962      if (element.hasReason()) {
45963        openArray("reason");
45964        for (CodeableReference e : element.getReason()) 
45965          composeCodeableReference(null, e);
45966        closeArray();
45967      };
45968      if (element.hasIsSubpotentElement()) {
45969        composeBooleanCore("isSubpotent", element.getIsSubpotentElement(), false);
45970        composeBooleanExtras("isSubpotent", element.getIsSubpotentElement(), false);
45971      }
45972      if (element.hasSubpotentReason()) {
45973        openArray("subpotentReason");
45974        for (CodeableConcept e : element.getSubpotentReason()) 
45975          composeCodeableConcept(null, e);
45976        closeArray();
45977      };
45978      if (element.hasEducation()) {
45979        openArray("education");
45980        for (Immunization.ImmunizationEducationComponent e : element.getEducation()) 
45981          composeImmunizationEducationComponent(null, e);
45982        closeArray();
45983      };
45984      if (element.hasProgramEligibility()) {
45985        openArray("programEligibility");
45986        for (CodeableConcept e : element.getProgramEligibility()) 
45987          composeCodeableConcept(null, e);
45988        closeArray();
45989      };
45990      if (element.hasFundingSource()) {
45991        composeCodeableConcept("fundingSource", element.getFundingSource());
45992      }
45993      if (element.hasReaction()) {
45994        openArray("reaction");
45995        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
45996          composeImmunizationReactionComponent(null, e);
45997        closeArray();
45998      };
45999      if (element.hasProtocolApplied()) {
46000        openArray("protocolApplied");
46001        for (Immunization.ImmunizationProtocolAppliedComponent e : element.getProtocolApplied()) 
46002          composeImmunizationProtocolAppliedComponent(null, e);
46003        closeArray();
46004      };
46005  }
46006
46007  protected void composeImmunizationPerformerComponent(String name, Immunization.ImmunizationPerformerComponent element) throws IOException {
46008    if (element != null) {
46009      open(name);
46010      composeImmunizationPerformerComponentProperties(element);
46011      close();
46012    }
46013  }
46014
46015  protected void composeImmunizationPerformerComponentProperties(Immunization.ImmunizationPerformerComponent element) throws IOException {
46016    composeBackboneElementProperties(element);
46017      if (element.hasFunction()) {
46018        composeCodeableConcept("function", element.getFunction());
46019      }
46020      if (element.hasActor()) {
46021        composeReference("actor", element.getActor());
46022      }
46023  }
46024
46025  protected void composeImmunizationEducationComponent(String name, Immunization.ImmunizationEducationComponent element) throws IOException {
46026    if (element != null) {
46027      open(name);
46028      composeImmunizationEducationComponentProperties(element);
46029      close();
46030    }
46031  }
46032
46033  protected void composeImmunizationEducationComponentProperties(Immunization.ImmunizationEducationComponent element) throws IOException {
46034    composeBackboneElementProperties(element);
46035      if (element.hasDocumentTypeElement()) {
46036        composeStringCore("documentType", element.getDocumentTypeElement(), false);
46037        composeStringExtras("documentType", element.getDocumentTypeElement(), false);
46038      }
46039      if (element.hasReferenceElement()) {
46040        composeUriCore("reference", element.getReferenceElement(), false);
46041        composeUriExtras("reference", element.getReferenceElement(), false);
46042      }
46043      if (element.hasPublicationDateElement()) {
46044        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
46045        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
46046      }
46047      if (element.hasPresentationDateElement()) {
46048        composeDateTimeCore("presentationDate", element.getPresentationDateElement(), false);
46049        composeDateTimeExtras("presentationDate", element.getPresentationDateElement(), false);
46050      }
46051  }
46052
46053  protected void composeImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
46054    if (element != null) {
46055      open(name);
46056      composeImmunizationReactionComponentProperties(element);
46057      close();
46058    }
46059  }
46060
46061  protected void composeImmunizationReactionComponentProperties(Immunization.ImmunizationReactionComponent element) throws IOException {
46062    composeBackboneElementProperties(element);
46063      if (element.hasDateElement()) {
46064        composeDateTimeCore("date", element.getDateElement(), false);
46065        composeDateTimeExtras("date", element.getDateElement(), false);
46066      }
46067      if (element.hasDetail()) {
46068        composeReference("detail", element.getDetail());
46069      }
46070      if (element.hasReportedElement()) {
46071        composeBooleanCore("reported", element.getReportedElement(), false);
46072        composeBooleanExtras("reported", element.getReportedElement(), false);
46073      }
46074  }
46075
46076  protected void composeImmunizationProtocolAppliedComponent(String name, Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
46077    if (element != null) {
46078      open(name);
46079      composeImmunizationProtocolAppliedComponentProperties(element);
46080      close();
46081    }
46082  }
46083
46084  protected void composeImmunizationProtocolAppliedComponentProperties(Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
46085    composeBackboneElementProperties(element);
46086      if (element.hasSeriesElement()) {
46087        composeStringCore("series", element.getSeriesElement(), false);
46088        composeStringExtras("series", element.getSeriesElement(), false);
46089      }
46090      if (element.hasAuthority()) {
46091        composeReference("authority", element.getAuthority());
46092      }
46093      if (element.hasTargetDisease()) {
46094        openArray("targetDisease");
46095        for (CodeableConcept e : element.getTargetDisease()) 
46096          composeCodeableConcept(null, e);
46097        closeArray();
46098      };
46099      if (element.hasDoseNumber()) {
46100        composeType("doseNumber", element.getDoseNumber());
46101      }
46102      if (element.hasSeriesDoses()) {
46103        composeType("seriesDoses", element.getSeriesDoses());
46104      }
46105  }
46106
46107  protected void composeImmunizationEvaluation(String name, ImmunizationEvaluation element) throws IOException {
46108    if (element != null) {
46109      prop("resourceType", name);
46110      composeImmunizationEvaluationProperties(element);
46111    }
46112  }
46113
46114  protected void composeImmunizationEvaluationProperties(ImmunizationEvaluation element) throws IOException {
46115    composeDomainResourceProperties(element);
46116      if (element.hasIdentifier()) {
46117        openArray("identifier");
46118        for (Identifier e : element.getIdentifier()) 
46119          composeIdentifier(null, e);
46120        closeArray();
46121      };
46122      if (element.hasStatusElement()) {
46123        composeEnumerationCore("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusCodesEnumFactory(), false);
46124        composeEnumerationExtras("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusCodesEnumFactory(), false);
46125      }
46126      if (element.hasPatient()) {
46127        composeReference("patient", element.getPatient());
46128      }
46129      if (element.hasDateElement()) {
46130        composeDateTimeCore("date", element.getDateElement(), false);
46131        composeDateTimeExtras("date", element.getDateElement(), false);
46132      }
46133      if (element.hasAuthority()) {
46134        composeReference("authority", element.getAuthority());
46135      }
46136      if (element.hasTargetDisease()) {
46137        composeCodeableConcept("targetDisease", element.getTargetDisease());
46138      }
46139      if (element.hasImmunizationEvent()) {
46140        composeReference("immunizationEvent", element.getImmunizationEvent());
46141      }
46142      if (element.hasDoseStatus()) {
46143        composeCodeableConcept("doseStatus", element.getDoseStatus());
46144      }
46145      if (element.hasDoseStatusReason()) {
46146        openArray("doseStatusReason");
46147        for (CodeableConcept e : element.getDoseStatusReason()) 
46148          composeCodeableConcept(null, e);
46149        closeArray();
46150      };
46151      if (element.hasDescriptionElement()) {
46152        composeStringCore("description", element.getDescriptionElement(), false);
46153        composeStringExtras("description", element.getDescriptionElement(), false);
46154      }
46155      if (element.hasSeriesElement()) {
46156        composeStringCore("series", element.getSeriesElement(), false);
46157        composeStringExtras("series", element.getSeriesElement(), false);
46158      }
46159      if (element.hasDoseNumber()) {
46160        composeType("doseNumber", element.getDoseNumber());
46161      }
46162      if (element.hasSeriesDoses()) {
46163        composeType("seriesDoses", element.getSeriesDoses());
46164      }
46165  }
46166
46167  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
46168    if (element != null) {
46169      prop("resourceType", name);
46170      composeImmunizationRecommendationProperties(element);
46171    }
46172  }
46173
46174  protected void composeImmunizationRecommendationProperties(ImmunizationRecommendation element) throws IOException {
46175    composeDomainResourceProperties(element);
46176      if (element.hasIdentifier()) {
46177        openArray("identifier");
46178        for (Identifier e : element.getIdentifier()) 
46179          composeIdentifier(null, e);
46180        closeArray();
46181      };
46182      if (element.hasPatient()) {
46183        composeReference("patient", element.getPatient());
46184      }
46185      if (element.hasDateElement()) {
46186        composeDateTimeCore("date", element.getDateElement(), false);
46187        composeDateTimeExtras("date", element.getDateElement(), false);
46188      }
46189      if (element.hasAuthority()) {
46190        composeReference("authority", element.getAuthority());
46191      }
46192      if (element.hasRecommendation()) {
46193        openArray("recommendation");
46194        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
46195          composeImmunizationRecommendationRecommendationComponent(null, e);
46196        closeArray();
46197      };
46198  }
46199
46200  protected void composeImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
46201    if (element != null) {
46202      open(name);
46203      composeImmunizationRecommendationRecommendationComponentProperties(element);
46204      close();
46205    }
46206  }
46207
46208  protected void composeImmunizationRecommendationRecommendationComponentProperties(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
46209    composeBackboneElementProperties(element);
46210      if (element.hasVaccineCode()) {
46211        openArray("vaccineCode");
46212        for (CodeableConcept e : element.getVaccineCode()) 
46213          composeCodeableConcept(null, e);
46214        closeArray();
46215      };
46216      if (element.hasTargetDisease()) {
46217        openArray("targetDisease");
46218        for (CodeableConcept e : element.getTargetDisease()) 
46219          composeCodeableConcept(null, e);
46220        closeArray();
46221      };
46222      if (element.hasContraindicatedVaccineCode()) {
46223        openArray("contraindicatedVaccineCode");
46224        for (CodeableConcept e : element.getContraindicatedVaccineCode()) 
46225          composeCodeableConcept(null, e);
46226        closeArray();
46227      };
46228      if (element.hasForecastStatus()) {
46229        composeCodeableConcept("forecastStatus", element.getForecastStatus());
46230      }
46231      if (element.hasForecastReason()) {
46232        openArray("forecastReason");
46233        for (CodeableConcept e : element.getForecastReason()) 
46234          composeCodeableConcept(null, e);
46235        closeArray();
46236      };
46237      if (element.hasDateCriterion()) {
46238        openArray("dateCriterion");
46239        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
46240          composeImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
46241        closeArray();
46242      };
46243      if (element.hasDescriptionElement()) {
46244        composeStringCore("description", element.getDescriptionElement(), false);
46245        composeStringExtras("description", element.getDescriptionElement(), false);
46246      }
46247      if (element.hasSeriesElement()) {
46248        composeStringCore("series", element.getSeriesElement(), false);
46249        composeStringExtras("series", element.getSeriesElement(), false);
46250      }
46251      if (element.hasDoseNumber()) {
46252        composeType("doseNumber", element.getDoseNumber());
46253      }
46254      if (element.hasSeriesDoses()) {
46255        composeType("seriesDoses", element.getSeriesDoses());
46256      }
46257      if (element.hasSupportingImmunization()) {
46258        openArray("supportingImmunization");
46259        for (Reference e : element.getSupportingImmunization()) 
46260          composeReference(null, e);
46261        closeArray();
46262      };
46263      if (element.hasSupportingPatientInformation()) {
46264        openArray("supportingPatientInformation");
46265        for (Reference e : element.getSupportingPatientInformation()) 
46266          composeReference(null, e);
46267        closeArray();
46268      };
46269  }
46270
46271  protected void composeImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
46272    if (element != null) {
46273      open(name);
46274      composeImmunizationRecommendationRecommendationDateCriterionComponentProperties(element);
46275      close();
46276    }
46277  }
46278
46279  protected void composeImmunizationRecommendationRecommendationDateCriterionComponentProperties(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
46280    composeBackboneElementProperties(element);
46281      if (element.hasCode()) {
46282        composeCodeableConcept("code", element.getCode());
46283      }
46284      if (element.hasValueElement()) {
46285        composeDateTimeCore("value", element.getValueElement(), false);
46286        composeDateTimeExtras("value", element.getValueElement(), false);
46287      }
46288  }
46289
46290  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
46291    if (element != null) {
46292      prop("resourceType", name);
46293      composeImplementationGuideProperties(element);
46294    }
46295  }
46296
46297  protected void composeImplementationGuideProperties(ImplementationGuide element) throws IOException {
46298    composeCanonicalResourceProperties(element);
46299      if (element.hasUrlElement()) {
46300        composeUriCore("url", element.getUrlElement(), false);
46301        composeUriExtras("url", element.getUrlElement(), false);
46302      }
46303      if (element.hasVersionElement()) {
46304        composeStringCore("version", element.getVersionElement(), false);
46305        composeStringExtras("version", element.getVersionElement(), false);
46306      }
46307      if (element.hasNameElement()) {
46308        composeStringCore("name", element.getNameElement(), false);
46309        composeStringExtras("name", element.getNameElement(), false);
46310      }
46311      if (element.hasTitleElement()) {
46312        composeStringCore("title", element.getTitleElement(), false);
46313        composeStringExtras("title", element.getTitleElement(), false);
46314      }
46315      if (element.hasStatusElement()) {
46316        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46317        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46318      }
46319      if (element.hasExperimentalElement()) {
46320        composeBooleanCore("experimental", element.getExperimentalElement(), false);
46321        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
46322      }
46323      if (element.hasDateElement()) {
46324        composeDateTimeCore("date", element.getDateElement(), false);
46325        composeDateTimeExtras("date", element.getDateElement(), false);
46326      }
46327      if (element.hasPublisherElement()) {
46328        composeStringCore("publisher", element.getPublisherElement(), false);
46329        composeStringExtras("publisher", element.getPublisherElement(), false);
46330      }
46331      if (element.hasContact()) {
46332        openArray("contact");
46333        for (ContactDetail e : element.getContact()) 
46334          composeContactDetail(null, e);
46335        closeArray();
46336      };
46337      if (element.hasDescriptionElement()) {
46338        composeMarkdownCore("description", element.getDescriptionElement(), false);
46339        composeMarkdownExtras("description", element.getDescriptionElement(), false);
46340      }
46341      if (element.hasUseContext()) {
46342        openArray("useContext");
46343        for (UsageContext e : element.getUseContext()) 
46344          composeUsageContext(null, e);
46345        closeArray();
46346      };
46347      if (element.hasJurisdiction()) {
46348        openArray("jurisdiction");
46349        for (CodeableConcept e : element.getJurisdiction()) 
46350          composeCodeableConcept(null, e);
46351        closeArray();
46352      };
46353      if (element.hasCopyrightElement()) {
46354        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
46355        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
46356      }
46357      if (element.hasPackageIdElement()) {
46358        composeIdCore("packageId", element.getPackageIdElement(), false);
46359        composeIdExtras("packageId", element.getPackageIdElement(), false);
46360      }
46361      if (element.hasLicenseElement()) {
46362        composeEnumerationCore("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
46363        composeEnumerationExtras("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
46364      }
46365      if (element.hasFhirVersion()) {
46366        openArray("fhirVersion");
46367        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
46368          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
46369        closeArray();
46370        if (anyHasExtras(element.getFhirVersion())) {
46371          openArray("_fhirVersion");
46372          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
46373            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
46374          closeArray();
46375        }
46376      };
46377      if (element.hasDependsOn()) {
46378        openArray("dependsOn");
46379        for (ImplementationGuide.ImplementationGuideDependsOnComponent e : element.getDependsOn()) 
46380          composeImplementationGuideDependsOnComponent(null, e);
46381        closeArray();
46382      };
46383      if (element.hasGlobal()) {
46384        openArray("global");
46385        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
46386          composeImplementationGuideGlobalComponent(null, e);
46387        closeArray();
46388      };
46389      if (element.hasDefinition()) {
46390        composeImplementationGuideDefinitionComponent("definition", element.getDefinition());
46391      }
46392      if (element.hasManifest()) {
46393        composeImplementationGuideManifestComponent("manifest", element.getManifest());
46394      }
46395  }
46396
46397  protected void composeImplementationGuideDependsOnComponent(String name, ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
46398    if (element != null) {
46399      open(name);
46400      composeImplementationGuideDependsOnComponentProperties(element);
46401      close();
46402    }
46403  }
46404
46405  protected void composeImplementationGuideDependsOnComponentProperties(ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
46406    composeBackboneElementProperties(element);
46407      if (element.hasUriElement()) {
46408        composeCanonicalCore("uri", element.getUriElement(), false);
46409        composeCanonicalExtras("uri", element.getUriElement(), false);
46410      }
46411      if (element.hasPackageIdElement()) {
46412        composeIdCore("packageId", element.getPackageIdElement(), false);
46413        composeIdExtras("packageId", element.getPackageIdElement(), false);
46414      }
46415      if (element.hasVersionElement()) {
46416        composeStringCore("version", element.getVersionElement(), false);
46417        composeStringExtras("version", element.getVersionElement(), false);
46418      }
46419  }
46420
46421  protected void composeImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
46422    if (element != null) {
46423      open(name);
46424      composeImplementationGuideGlobalComponentProperties(element);
46425      close();
46426    }
46427  }
46428
46429  protected void composeImplementationGuideGlobalComponentProperties(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
46430    composeBackboneElementProperties(element);
46431      if (element.hasTypeElement()) {
46432        composeCodeCore("type", element.getTypeElement(), false);
46433        composeCodeExtras("type", element.getTypeElement(), false);
46434      }
46435      if (element.hasProfileElement()) {
46436        composeCanonicalCore("profile", element.getProfileElement(), false);
46437        composeCanonicalExtras("profile", element.getProfileElement(), false);
46438      }
46439  }
46440
46441  protected void composeImplementationGuideDefinitionComponent(String name, ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
46442    if (element != null) {
46443      open(name);
46444      composeImplementationGuideDefinitionComponentProperties(element);
46445      close();
46446    }
46447  }
46448
46449  protected void composeImplementationGuideDefinitionComponentProperties(ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
46450    composeBackboneElementProperties(element);
46451      if (element.hasGrouping()) {
46452        openArray("grouping");
46453        for (ImplementationGuide.ImplementationGuideDefinitionGroupingComponent e : element.getGrouping()) 
46454          composeImplementationGuideDefinitionGroupingComponent(null, e);
46455        closeArray();
46456      };
46457      if (element.hasResource()) {
46458        openArray("resource");
46459        for (ImplementationGuide.ImplementationGuideDefinitionResourceComponent e : element.getResource()) 
46460          composeImplementationGuideDefinitionResourceComponent(null, e);
46461        closeArray();
46462      };
46463      if (element.hasPage()) {
46464        composeImplementationGuideDefinitionPageComponent("page", element.getPage());
46465      }
46466      if (element.hasParameter()) {
46467        openArray("parameter");
46468        for (ImplementationGuide.ImplementationGuideDefinitionParameterComponent e : element.getParameter()) 
46469          composeImplementationGuideDefinitionParameterComponent(null, e);
46470        closeArray();
46471      };
46472      if (element.hasTemplate()) {
46473        openArray("template");
46474        for (ImplementationGuide.ImplementationGuideDefinitionTemplateComponent e : element.getTemplate()) 
46475          composeImplementationGuideDefinitionTemplateComponent(null, e);
46476        closeArray();
46477      };
46478  }
46479
46480  protected void composeImplementationGuideDefinitionGroupingComponent(String name, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
46481    if (element != null) {
46482      open(name);
46483      composeImplementationGuideDefinitionGroupingComponentProperties(element);
46484      close();
46485    }
46486  }
46487
46488  protected void composeImplementationGuideDefinitionGroupingComponentProperties(ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
46489    composeBackboneElementProperties(element);
46490      if (element.hasNameElement()) {
46491        composeStringCore("name", element.getNameElement(), false);
46492        composeStringExtras("name", element.getNameElement(), false);
46493      }
46494      if (element.hasDescriptionElement()) {
46495        composeStringCore("description", element.getDescriptionElement(), false);
46496        composeStringExtras("description", element.getDescriptionElement(), false);
46497      }
46498  }
46499
46500  protected void composeImplementationGuideDefinitionResourceComponent(String name, ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
46501    if (element != null) {
46502      open(name);
46503      composeImplementationGuideDefinitionResourceComponentProperties(element);
46504      close();
46505    }
46506  }
46507
46508  protected void composeImplementationGuideDefinitionResourceComponentProperties(ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
46509    composeBackboneElementProperties(element);
46510      if (element.hasReference()) {
46511        composeReference("reference", element.getReference());
46512      }
46513      if (element.hasFhirVersion()) {
46514        openArray("fhirVersion");
46515        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
46516          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
46517        closeArray();
46518        if (anyHasExtras(element.getFhirVersion())) {
46519          openArray("_fhirVersion");
46520          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
46521            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
46522          closeArray();
46523        }
46524      };
46525      if (element.hasNameElement()) {
46526        composeStringCore("name", element.getNameElement(), false);
46527        composeStringExtras("name", element.getNameElement(), false);
46528      }
46529      if (element.hasDescriptionElement()) {
46530        composeStringCore("description", element.getDescriptionElement(), false);
46531        composeStringExtras("description", element.getDescriptionElement(), false);
46532      }
46533      if (element.hasExample()) {
46534        composeType("example", element.getExample());
46535      }
46536      if (element.hasGroupingIdElement()) {
46537        composeIdCore("groupingId", element.getGroupingIdElement(), false);
46538        composeIdExtras("groupingId", element.getGroupingIdElement(), false);
46539      }
46540  }
46541
46542  protected void composeImplementationGuideDefinitionPageComponent(String name, ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
46543    if (element != null) {
46544      open(name);
46545      composeImplementationGuideDefinitionPageComponentProperties(element);
46546      close();
46547    }
46548  }
46549
46550  protected void composeImplementationGuideDefinitionPageComponentProperties(ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
46551    composeBackboneElementProperties(element);
46552      if (element.hasName()) {
46553        composeType("name", element.getName());
46554      }
46555      if (element.hasTitleElement()) {
46556        composeStringCore("title", element.getTitleElement(), false);
46557        composeStringExtras("title", element.getTitleElement(), false);
46558      }
46559      if (element.hasGenerationElement()) {
46560        composeEnumerationCore("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
46561        composeEnumerationExtras("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
46562      }
46563      if (element.hasPage()) {
46564        openArray("page");
46565        for (ImplementationGuide.ImplementationGuideDefinitionPageComponent e : element.getPage()) 
46566          composeImplementationGuideDefinitionPageComponent(null, e);
46567        closeArray();
46568      };
46569  }
46570
46571  protected void composeImplementationGuideDefinitionParameterComponent(String name, ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
46572    if (element != null) {
46573      open(name);
46574      composeImplementationGuideDefinitionParameterComponentProperties(element);
46575      close();
46576    }
46577  }
46578
46579  protected void composeImplementationGuideDefinitionParameterComponentProperties(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
46580    composeBackboneElementProperties(element);
46581      if (element.hasCodeElement()) {
46582        composeStringCore("code", element.getCodeElement(), false);
46583        composeStringExtras("code", element.getCodeElement(), false);
46584      }
46585      if (element.hasValueElement()) {
46586        composeStringCore("value", element.getValueElement(), false);
46587        composeStringExtras("value", element.getValueElement(), false);
46588      }
46589  }
46590
46591  protected void composeImplementationGuideDefinitionTemplateComponent(String name, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
46592    if (element != null) {
46593      open(name);
46594      composeImplementationGuideDefinitionTemplateComponentProperties(element);
46595      close();
46596    }
46597  }
46598
46599  protected void composeImplementationGuideDefinitionTemplateComponentProperties(ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
46600    composeBackboneElementProperties(element);
46601      if (element.hasCodeElement()) {
46602        composeCodeCore("code", element.getCodeElement(), false);
46603        composeCodeExtras("code", element.getCodeElement(), false);
46604      }
46605      if (element.hasSourceElement()) {
46606        composeStringCore("source", element.getSourceElement(), false);
46607        composeStringExtras("source", element.getSourceElement(), false);
46608      }
46609      if (element.hasScopeElement()) {
46610        composeStringCore("scope", element.getScopeElement(), false);
46611        composeStringExtras("scope", element.getScopeElement(), false);
46612      }
46613  }
46614
46615  protected void composeImplementationGuideManifestComponent(String name, ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
46616    if (element != null) {
46617      open(name);
46618      composeImplementationGuideManifestComponentProperties(element);
46619      close();
46620    }
46621  }
46622
46623  protected void composeImplementationGuideManifestComponentProperties(ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
46624    composeBackboneElementProperties(element);
46625      if (element.hasRenderingElement()) {
46626        composeUrlCore("rendering", element.getRenderingElement(), false);
46627        composeUrlExtras("rendering", element.getRenderingElement(), false);
46628      }
46629      if (element.hasResource()) {
46630        openArray("resource");
46631        for (ImplementationGuide.ManifestResourceComponent e : element.getResource()) 
46632          composeManifestResourceComponent(null, e);
46633        closeArray();
46634      };
46635      if (element.hasPage()) {
46636        openArray("page");
46637        for (ImplementationGuide.ManifestPageComponent e : element.getPage()) 
46638          composeManifestPageComponent(null, e);
46639        closeArray();
46640      };
46641      if (element.hasImage()) {
46642        openArray("image");
46643        for (StringType e : element.getImage()) 
46644          composeStringCore(null, e, true);
46645        closeArray();
46646        if (anyHasExtras(element.getImage())) {
46647          openArray("_image");
46648          for (StringType e : element.getImage()) 
46649            composeStringExtras(null, e, true);
46650          closeArray();
46651        }
46652      };
46653      if (element.hasOther()) {
46654        openArray("other");
46655        for (StringType e : element.getOther()) 
46656          composeStringCore(null, e, true);
46657        closeArray();
46658        if (anyHasExtras(element.getOther())) {
46659          openArray("_other");
46660          for (StringType e : element.getOther()) 
46661            composeStringExtras(null, e, true);
46662          closeArray();
46663        }
46664      };
46665  }
46666
46667  protected void composeManifestResourceComponent(String name, ImplementationGuide.ManifestResourceComponent element) throws IOException {
46668    if (element != null) {
46669      open(name);
46670      composeManifestResourceComponentProperties(element);
46671      close();
46672    }
46673  }
46674
46675  protected void composeManifestResourceComponentProperties(ImplementationGuide.ManifestResourceComponent element) throws IOException {
46676    composeBackboneElementProperties(element);
46677      if (element.hasReference()) {
46678        composeReference("reference", element.getReference());
46679      }
46680      if (element.hasExample()) {
46681        composeType("example", element.getExample());
46682      }
46683      if (element.hasRelativePathElement()) {
46684        composeUrlCore("relativePath", element.getRelativePathElement(), false);
46685        composeUrlExtras("relativePath", element.getRelativePathElement(), false);
46686      }
46687  }
46688
46689  protected void composeManifestPageComponent(String name, ImplementationGuide.ManifestPageComponent element) throws IOException {
46690    if (element != null) {
46691      open(name);
46692      composeManifestPageComponentProperties(element);
46693      close();
46694    }
46695  }
46696
46697  protected void composeManifestPageComponentProperties(ImplementationGuide.ManifestPageComponent element) throws IOException {
46698    composeBackboneElementProperties(element);
46699      if (element.hasNameElement()) {
46700        composeStringCore("name", element.getNameElement(), false);
46701        composeStringExtras("name", element.getNameElement(), false);
46702      }
46703      if (element.hasTitleElement()) {
46704        composeStringCore("title", element.getTitleElement(), false);
46705        composeStringExtras("title", element.getTitleElement(), false);
46706      }
46707      if (element.hasAnchor()) {
46708        openArray("anchor");
46709        for (StringType e : element.getAnchor()) 
46710          composeStringCore(null, e, true);
46711        closeArray();
46712        if (anyHasExtras(element.getAnchor())) {
46713          openArray("_anchor");
46714          for (StringType e : element.getAnchor()) 
46715            composeStringExtras(null, e, true);
46716          closeArray();
46717        }
46718      };
46719  }
46720
46721  protected void composeIngredient(String name, Ingredient element) throws IOException {
46722    if (element != null) {
46723      prop("resourceType", name);
46724      composeIngredientProperties(element);
46725    }
46726  }
46727
46728  protected void composeIngredientProperties(Ingredient element) throws IOException {
46729    composeDomainResourceProperties(element);
46730      if (element.hasIdentifier()) {
46731        composeIdentifier("identifier", element.getIdentifier());
46732      }
46733      if (element.hasRole()) {
46734        composeCodeableConcept("role", element.getRole());
46735      }
46736      if (element.hasAllergenicIndicatorElement()) {
46737        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
46738        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
46739      }
46740      if (element.hasManufacturer()) {
46741        openArray("manufacturer");
46742        for (Reference e : element.getManufacturer()) 
46743          composeReference(null, e);
46744        closeArray();
46745      };
46746      if (element.hasSpecifiedSubstance()) {
46747        openArray("specifiedSubstance");
46748        for (Ingredient.IngredientSpecifiedSubstanceComponent e : element.getSpecifiedSubstance()) 
46749          composeIngredientSpecifiedSubstanceComponent(null, e);
46750        closeArray();
46751      };
46752      if (element.hasSubstance()) {
46753        composeIngredientSubstanceComponent("substance", element.getSubstance());
46754      }
46755  }
46756
46757  protected void composeIngredientSpecifiedSubstanceComponent(String name, Ingredient.IngredientSpecifiedSubstanceComponent element) throws IOException {
46758    if (element != null) {
46759      open(name);
46760      composeIngredientSpecifiedSubstanceComponentProperties(element);
46761      close();
46762    }
46763  }
46764
46765  protected void composeIngredientSpecifiedSubstanceComponentProperties(Ingredient.IngredientSpecifiedSubstanceComponent element) throws IOException {
46766    composeBackboneElementProperties(element);
46767      if (element.hasCode()) {
46768        composeType("code", element.getCode());
46769      }
46770      if (element.hasGroup()) {
46771        composeCodeableConcept("group", element.getGroup());
46772      }
46773      if (element.hasConfidentiality()) {
46774        composeCodeableConcept("confidentiality", element.getConfidentiality());
46775      }
46776      if (element.hasStrength()) {
46777        openArray("strength");
46778        for (Ingredient.IngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
46779          composeIngredientSpecifiedSubstanceStrengthComponent(null, e);
46780        closeArray();
46781      };
46782  }
46783
46784  protected void composeIngredientSpecifiedSubstanceStrengthComponent(String name, Ingredient.IngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
46785    if (element != null) {
46786      open(name);
46787      composeIngredientSpecifiedSubstanceStrengthComponentProperties(element);
46788      close();
46789    }
46790  }
46791
46792  protected void composeIngredientSpecifiedSubstanceStrengthComponentProperties(Ingredient.IngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
46793    composeBackboneElementProperties(element);
46794      if (element.hasPresentation()) {
46795        composeRatio("presentation", element.getPresentation());
46796      }
46797      if (element.hasPresentationHighLimit()) {
46798        composeRatio("presentationHighLimit", element.getPresentationHighLimit());
46799      }
46800      if (element.hasConcentration()) {
46801        composeRatio("concentration", element.getConcentration());
46802      }
46803      if (element.hasConcentrationHighLimit()) {
46804        composeRatio("concentrationHighLimit", element.getConcentrationHighLimit());
46805      }
46806      if (element.hasMeasurementPointElement()) {
46807        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
46808        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
46809      }
46810      if (element.hasCountry()) {
46811        openArray("country");
46812        for (CodeableConcept e : element.getCountry()) 
46813          composeCodeableConcept(null, e);
46814        closeArray();
46815      };
46816      if (element.hasReferenceStrength()) {
46817        openArray("referenceStrength");
46818        for (Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent e : element.getReferenceStrength()) 
46819          composeIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(null, e);
46820        closeArray();
46821      };
46822  }
46823
46824  protected void composeIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(String name, Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
46825    if (element != null) {
46826      open(name);
46827      composeIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(element);
46828      close();
46829    }
46830  }
46831
46832  protected void composeIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
46833    composeBackboneElementProperties(element);
46834      if (element.hasSubstance()) {
46835        composeType("substance", element.getSubstance());
46836      }
46837      if (element.hasStrength()) {
46838        composeRatio("strength", element.getStrength());
46839      }
46840      if (element.hasStrengthHighLimit()) {
46841        composeRatio("strengthHighLimit", element.getStrengthHighLimit());
46842      }
46843      if (element.hasMeasurementPointElement()) {
46844        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
46845        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
46846      }
46847      if (element.hasCountry()) {
46848        openArray("country");
46849        for (CodeableConcept e : element.getCountry()) 
46850          composeCodeableConcept(null, e);
46851        closeArray();
46852      };
46853  }
46854
46855  protected void composeIngredientSubstanceComponent(String name, Ingredient.IngredientSubstanceComponent element) throws IOException {
46856    if (element != null) {
46857      open(name);
46858      composeIngredientSubstanceComponentProperties(element);
46859      close();
46860    }
46861  }
46862
46863  protected void composeIngredientSubstanceComponentProperties(Ingredient.IngredientSubstanceComponent element) throws IOException {
46864    composeBackboneElementProperties(element);
46865      if (element.hasCode()) {
46866        composeType("code", element.getCode());
46867      }
46868      if (element.hasStrength()) {
46869        openArray("strength");
46870        for (Ingredient.IngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
46871          composeIngredientSpecifiedSubstanceStrengthComponent(null, e);
46872        closeArray();
46873      };
46874  }
46875
46876  protected void composeInsurancePlan(String name, InsurancePlan element) throws IOException {
46877    if (element != null) {
46878      prop("resourceType", name);
46879      composeInsurancePlanProperties(element);
46880    }
46881  }
46882
46883  protected void composeInsurancePlanProperties(InsurancePlan element) throws IOException {
46884    composeDomainResourceProperties(element);
46885      if (element.hasIdentifier()) {
46886        openArray("identifier");
46887        for (Identifier e : element.getIdentifier()) 
46888          composeIdentifier(null, e);
46889        closeArray();
46890      };
46891      if (element.hasStatusElement()) {
46892        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46893        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46894      }
46895      if (element.hasType()) {
46896        openArray("type");
46897        for (CodeableConcept e : element.getType()) 
46898          composeCodeableConcept(null, e);
46899        closeArray();
46900      };
46901      if (element.hasNameElement()) {
46902        composeStringCore("name", element.getNameElement(), false);
46903        composeStringExtras("name", element.getNameElement(), false);
46904      }
46905      if (element.hasAlias()) {
46906        openArray("alias");
46907        for (StringType e : element.getAlias()) 
46908          composeStringCore(null, e, true);
46909        closeArray();
46910        if (anyHasExtras(element.getAlias())) {
46911          openArray("_alias");
46912          for (StringType e : element.getAlias()) 
46913            composeStringExtras(null, e, true);
46914          closeArray();
46915        }
46916      };
46917      if (element.hasPeriod()) {
46918        composePeriod("period", element.getPeriod());
46919      }
46920      if (element.hasOwnedBy()) {
46921        composeReference("ownedBy", element.getOwnedBy());
46922      }
46923      if (element.hasAdministeredBy()) {
46924        composeReference("administeredBy", element.getAdministeredBy());
46925      }
46926      if (element.hasCoverageArea()) {
46927        openArray("coverageArea");
46928        for (Reference e : element.getCoverageArea()) 
46929          composeReference(null, e);
46930        closeArray();
46931      };
46932      if (element.hasContact()) {
46933        openArray("contact");
46934        for (InsurancePlan.InsurancePlanContactComponent e : element.getContact()) 
46935          composeInsurancePlanContactComponent(null, e);
46936        closeArray();
46937      };
46938      if (element.hasEndpoint()) {
46939        openArray("endpoint");
46940        for (Reference e : element.getEndpoint()) 
46941          composeReference(null, e);
46942        closeArray();
46943      };
46944      if (element.hasNetwork()) {
46945        openArray("network");
46946        for (Reference e : element.getNetwork()) 
46947          composeReference(null, e);
46948        closeArray();
46949      };
46950      if (element.hasCoverage()) {
46951        openArray("coverage");
46952        for (InsurancePlan.InsurancePlanCoverageComponent e : element.getCoverage()) 
46953          composeInsurancePlanCoverageComponent(null, e);
46954        closeArray();
46955      };
46956      if (element.hasPlan()) {
46957        openArray("plan");
46958        for (InsurancePlan.InsurancePlanPlanComponent e : element.getPlan()) 
46959          composeInsurancePlanPlanComponent(null, e);
46960        closeArray();
46961      };
46962  }
46963
46964  protected void composeInsurancePlanContactComponent(String name, InsurancePlan.InsurancePlanContactComponent element) throws IOException {
46965    if (element != null) {
46966      open(name);
46967      composeInsurancePlanContactComponentProperties(element);
46968      close();
46969    }
46970  }
46971
46972  protected void composeInsurancePlanContactComponentProperties(InsurancePlan.InsurancePlanContactComponent element) throws IOException {
46973    composeBackboneElementProperties(element);
46974      if (element.hasPurpose()) {
46975        composeCodeableConcept("purpose", element.getPurpose());
46976      }
46977      if (element.hasName()) {
46978        composeHumanName("name", element.getName());
46979      }
46980      if (element.hasTelecom()) {
46981        openArray("telecom");
46982        for (ContactPoint e : element.getTelecom()) 
46983          composeContactPoint(null, e);
46984        closeArray();
46985      };
46986      if (element.hasAddress()) {
46987        composeAddress("address", element.getAddress());
46988      }
46989  }
46990
46991  protected void composeInsurancePlanCoverageComponent(String name, InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
46992    if (element != null) {
46993      open(name);
46994      composeInsurancePlanCoverageComponentProperties(element);
46995      close();
46996    }
46997  }
46998
46999  protected void composeInsurancePlanCoverageComponentProperties(InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
47000    composeBackboneElementProperties(element);
47001      if (element.hasType()) {
47002        composeCodeableConcept("type", element.getType());
47003      }
47004      if (element.hasNetwork()) {
47005        openArray("network");
47006        for (Reference e : element.getNetwork()) 
47007          composeReference(null, e);
47008        closeArray();
47009      };
47010      if (element.hasBenefit()) {
47011        openArray("benefit");
47012        for (InsurancePlan.CoverageBenefitComponent e : element.getBenefit()) 
47013          composeCoverageBenefitComponent(null, e);
47014        closeArray();
47015      };
47016  }
47017
47018  protected void composeCoverageBenefitComponent(String name, InsurancePlan.CoverageBenefitComponent element) throws IOException {
47019    if (element != null) {
47020      open(name);
47021      composeCoverageBenefitComponentProperties(element);
47022      close();
47023    }
47024  }
47025
47026  protected void composeCoverageBenefitComponentProperties(InsurancePlan.CoverageBenefitComponent element) throws IOException {
47027    composeBackboneElementProperties(element);
47028      if (element.hasType()) {
47029        composeCodeableConcept("type", element.getType());
47030      }
47031      if (element.hasRequirementElement()) {
47032        composeStringCore("requirement", element.getRequirementElement(), false);
47033        composeStringExtras("requirement", element.getRequirementElement(), false);
47034      }
47035      if (element.hasLimit()) {
47036        openArray("limit");
47037        for (InsurancePlan.CoverageBenefitLimitComponent e : element.getLimit()) 
47038          composeCoverageBenefitLimitComponent(null, e);
47039        closeArray();
47040      };
47041  }
47042
47043  protected void composeCoverageBenefitLimitComponent(String name, InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
47044    if (element != null) {
47045      open(name);
47046      composeCoverageBenefitLimitComponentProperties(element);
47047      close();
47048    }
47049  }
47050
47051  protected void composeCoverageBenefitLimitComponentProperties(InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
47052    composeBackboneElementProperties(element);
47053      if (element.hasValue()) {
47054        composeQuantity("value", element.getValue());
47055      }
47056      if (element.hasCode()) {
47057        composeCodeableConcept("code", element.getCode());
47058      }
47059  }
47060
47061  protected void composeInsurancePlanPlanComponent(String name, InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
47062    if (element != null) {
47063      open(name);
47064      composeInsurancePlanPlanComponentProperties(element);
47065      close();
47066    }
47067  }
47068
47069  protected void composeInsurancePlanPlanComponentProperties(InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
47070    composeBackboneElementProperties(element);
47071      if (element.hasIdentifier()) {
47072        openArray("identifier");
47073        for (Identifier e : element.getIdentifier()) 
47074          composeIdentifier(null, e);
47075        closeArray();
47076      };
47077      if (element.hasType()) {
47078        composeCodeableConcept("type", element.getType());
47079      }
47080      if (element.hasCoverageArea()) {
47081        openArray("coverageArea");
47082        for (Reference e : element.getCoverageArea()) 
47083          composeReference(null, e);
47084        closeArray();
47085      };
47086      if (element.hasNetwork()) {
47087        openArray("network");
47088        for (Reference e : element.getNetwork()) 
47089          composeReference(null, e);
47090        closeArray();
47091      };
47092      if (element.hasGeneralCost()) {
47093        openArray("generalCost");
47094        for (InsurancePlan.InsurancePlanPlanGeneralCostComponent e : element.getGeneralCost()) 
47095          composeInsurancePlanPlanGeneralCostComponent(null, e);
47096        closeArray();
47097      };
47098      if (element.hasSpecificCost()) {
47099        openArray("specificCost");
47100        for (InsurancePlan.InsurancePlanPlanSpecificCostComponent e : element.getSpecificCost()) 
47101          composeInsurancePlanPlanSpecificCostComponent(null, e);
47102        closeArray();
47103      };
47104  }
47105
47106  protected void composeInsurancePlanPlanGeneralCostComponent(String name, InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
47107    if (element != null) {
47108      open(name);
47109      composeInsurancePlanPlanGeneralCostComponentProperties(element);
47110      close();
47111    }
47112  }
47113
47114  protected void composeInsurancePlanPlanGeneralCostComponentProperties(InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
47115    composeBackboneElementProperties(element);
47116      if (element.hasType()) {
47117        composeCodeableConcept("type", element.getType());
47118      }
47119      if (element.hasGroupSizeElement()) {
47120        composePositiveIntCore("groupSize", element.getGroupSizeElement(), false);
47121        composePositiveIntExtras("groupSize", element.getGroupSizeElement(), false);
47122      }
47123      if (element.hasCost()) {
47124        composeMoney("cost", element.getCost());
47125      }
47126      if (element.hasCommentElement()) {
47127        composeStringCore("comment", element.getCommentElement(), false);
47128        composeStringExtras("comment", element.getCommentElement(), false);
47129      }
47130  }
47131
47132  protected void composeInsurancePlanPlanSpecificCostComponent(String name, InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
47133    if (element != null) {
47134      open(name);
47135      composeInsurancePlanPlanSpecificCostComponentProperties(element);
47136      close();
47137    }
47138  }
47139
47140  protected void composeInsurancePlanPlanSpecificCostComponentProperties(InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
47141    composeBackboneElementProperties(element);
47142      if (element.hasCategory()) {
47143        composeCodeableConcept("category", element.getCategory());
47144      }
47145      if (element.hasBenefit()) {
47146        openArray("benefit");
47147        for (InsurancePlan.PlanBenefitComponent e : element.getBenefit()) 
47148          composePlanBenefitComponent(null, e);
47149        closeArray();
47150      };
47151  }
47152
47153  protected void composePlanBenefitComponent(String name, InsurancePlan.PlanBenefitComponent element) throws IOException {
47154    if (element != null) {
47155      open(name);
47156      composePlanBenefitComponentProperties(element);
47157      close();
47158    }
47159  }
47160
47161  protected void composePlanBenefitComponentProperties(InsurancePlan.PlanBenefitComponent element) throws IOException {
47162    composeBackboneElementProperties(element);
47163      if (element.hasType()) {
47164        composeCodeableConcept("type", element.getType());
47165      }
47166      if (element.hasCost()) {
47167        openArray("cost");
47168        for (InsurancePlan.PlanBenefitCostComponent e : element.getCost()) 
47169          composePlanBenefitCostComponent(null, e);
47170        closeArray();
47171      };
47172  }
47173
47174  protected void composePlanBenefitCostComponent(String name, InsurancePlan.PlanBenefitCostComponent element) throws IOException {
47175    if (element != null) {
47176      open(name);
47177      composePlanBenefitCostComponentProperties(element);
47178      close();
47179    }
47180  }
47181
47182  protected void composePlanBenefitCostComponentProperties(InsurancePlan.PlanBenefitCostComponent element) throws IOException {
47183    composeBackboneElementProperties(element);
47184      if (element.hasType()) {
47185        composeCodeableConcept("type", element.getType());
47186      }
47187      if (element.hasApplicability()) {
47188        composeCodeableConcept("applicability", element.getApplicability());
47189      }
47190      if (element.hasQualifiers()) {
47191        openArray("qualifiers");
47192        for (CodeableConcept e : element.getQualifiers()) 
47193          composeCodeableConcept(null, e);
47194        closeArray();
47195      };
47196      if (element.hasValue()) {
47197        composeQuantity("value", element.getValue());
47198      }
47199  }
47200
47201  protected void composeInvoice(String name, Invoice element) throws IOException {
47202    if (element != null) {
47203      prop("resourceType", name);
47204      composeInvoiceProperties(element);
47205    }
47206  }
47207
47208  protected void composeInvoiceProperties(Invoice element) throws IOException {
47209    composeDomainResourceProperties(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 Invoice.InvoiceStatusEnumFactory(), false);
47218        composeEnumerationExtras("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
47219      }
47220      if (element.hasCancelledReasonElement()) {
47221        composeStringCore("cancelledReason", element.getCancelledReasonElement(), false);
47222        composeStringExtras("cancelledReason", element.getCancelledReasonElement(), false);
47223      }
47224      if (element.hasType()) {
47225        composeCodeableConcept("type", element.getType());
47226      }
47227      if (element.hasSubject()) {
47228        composeReference("subject", element.getSubject());
47229      }
47230      if (element.hasRecipient()) {
47231        composeReference("recipient", element.getRecipient());
47232      }
47233      if (element.hasDateElement()) {
47234        composeDateTimeCore("date", element.getDateElement(), false);
47235        composeDateTimeExtras("date", element.getDateElement(), false);
47236      }
47237      if (element.hasParticipant()) {
47238        openArray("participant");
47239        for (Invoice.InvoiceParticipantComponent e : element.getParticipant()) 
47240          composeInvoiceParticipantComponent(null, e);
47241        closeArray();
47242      };
47243      if (element.hasIssuer()) {
47244        composeReference("issuer", element.getIssuer());
47245      }
47246      if (element.hasAccount()) {
47247        composeReference("account", element.getAccount());
47248      }
47249      if (element.hasLineItem()) {
47250        openArray("lineItem");
47251        for (Invoice.InvoiceLineItemComponent e : element.getLineItem()) 
47252          composeInvoiceLineItemComponent(null, e);
47253        closeArray();
47254      };
47255      if (element.hasTotalPriceComponent()) {
47256        openArray("totalPriceComponent");
47257        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getTotalPriceComponent()) 
47258          composeInvoiceLineItemPriceComponentComponent(null, e);
47259        closeArray();
47260      };
47261      if (element.hasTotalNet()) {
47262        composeMoney("totalNet", element.getTotalNet());
47263      }
47264      if (element.hasTotalGross()) {
47265        composeMoney("totalGross", element.getTotalGross());
47266      }
47267      if (element.hasPaymentTermsElement()) {
47268        composeMarkdownCore("paymentTerms", element.getPaymentTermsElement(), false);
47269        composeMarkdownExtras("paymentTerms", element.getPaymentTermsElement(), false);
47270      }
47271      if (element.hasNote()) {
47272        openArray("note");
47273        for (Annotation e : element.getNote()) 
47274          composeAnnotation(null, e);
47275        closeArray();
47276      };
47277  }
47278
47279  protected void composeInvoiceParticipantComponent(String name, Invoice.InvoiceParticipantComponent element) throws IOException {
47280    if (element != null) {
47281      open(name);
47282      composeInvoiceParticipantComponentProperties(element);
47283      close();
47284    }
47285  }
47286
47287  protected void composeInvoiceParticipantComponentProperties(Invoice.InvoiceParticipantComponent element) throws IOException {
47288    composeBackboneElementProperties(element);
47289      if (element.hasRole()) {
47290        composeCodeableConcept("role", element.getRole());
47291      }
47292      if (element.hasActor()) {
47293        composeReference("actor", element.getActor());
47294      }
47295  }
47296
47297  protected void composeInvoiceLineItemComponent(String name, Invoice.InvoiceLineItemComponent element) throws IOException {
47298    if (element != null) {
47299      open(name);
47300      composeInvoiceLineItemComponentProperties(element);
47301      close();
47302    }
47303  }
47304
47305  protected void composeInvoiceLineItemComponentProperties(Invoice.InvoiceLineItemComponent element) throws IOException {
47306    composeBackboneElementProperties(element);
47307      if (element.hasSequenceElement()) {
47308        composePositiveIntCore("sequence", element.getSequenceElement(), false);
47309        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
47310      }
47311      if (element.hasChargeItem()) {
47312        composeType("chargeItem", element.getChargeItem());
47313      }
47314      if (element.hasPriceComponent()) {
47315        openArray("priceComponent");
47316        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getPriceComponent()) 
47317          composeInvoiceLineItemPriceComponentComponent(null, e);
47318        closeArray();
47319      };
47320  }
47321
47322  protected void composeInvoiceLineItemPriceComponentComponent(String name, Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
47323    if (element != null) {
47324      open(name);
47325      composeInvoiceLineItemPriceComponentComponentProperties(element);
47326      close();
47327    }
47328  }
47329
47330  protected void composeInvoiceLineItemPriceComponentComponentProperties(Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
47331    composeBackboneElementProperties(element);
47332      if (element.hasTypeElement()) {
47333        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.InvoicePriceComponentTypeEnumFactory(), false);
47334        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.InvoicePriceComponentTypeEnumFactory(), false);
47335      }
47336      if (element.hasCode()) {
47337        composeCodeableConcept("code", element.getCode());
47338      }
47339      if (element.hasFactorElement()) {
47340        composeDecimalCore("factor", element.getFactorElement(), false);
47341        composeDecimalExtras("factor", element.getFactorElement(), false);
47342      }
47343      if (element.hasAmount()) {
47344        composeMoney("amount", element.getAmount());
47345      }
47346  }
47347
47348  protected void composeLibrary(String name, Library element) throws IOException {
47349    if (element != null) {
47350      prop("resourceType", name);
47351      composeLibraryProperties(element);
47352    }
47353  }
47354
47355  protected void composeLibraryProperties(Library element) throws IOException {
47356    composeMetadataResourceProperties(element);
47357      if (element.hasUrlElement()) {
47358        composeUriCore("url", element.getUrlElement(), false);
47359        composeUriExtras("url", element.getUrlElement(), false);
47360      }
47361      if (element.hasIdentifier()) {
47362        openArray("identifier");
47363        for (Identifier e : element.getIdentifier()) 
47364          composeIdentifier(null, e);
47365        closeArray();
47366      };
47367      if (element.hasVersionElement()) {
47368        composeStringCore("version", element.getVersionElement(), false);
47369        composeStringExtras("version", element.getVersionElement(), false);
47370      }
47371      if (element.hasNameElement()) {
47372        composeStringCore("name", element.getNameElement(), false);
47373        composeStringExtras("name", element.getNameElement(), false);
47374      }
47375      if (element.hasTitleElement()) {
47376        composeStringCore("title", element.getTitleElement(), false);
47377        composeStringExtras("title", element.getTitleElement(), false);
47378      }
47379      if (element.hasSubtitleElement()) {
47380        composeStringCore("subtitle", element.getSubtitleElement(), false);
47381        composeStringExtras("subtitle", element.getSubtitleElement(), false);
47382      }
47383      if (element.hasStatusElement()) {
47384        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47385        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47386      }
47387      if (element.hasExperimentalElement()) {
47388        composeBooleanCore("experimental", element.getExperimentalElement(), false);
47389        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
47390      }
47391      if (element.hasType()) {
47392        composeCodeableConcept("type", element.getType());
47393      }
47394      if (element.hasSubject()) {
47395        composeType("subject", element.getSubject());
47396      }
47397      if (element.hasDateElement()) {
47398        composeDateTimeCore("date", element.getDateElement(), false);
47399        composeDateTimeExtras("date", element.getDateElement(), false);
47400      }
47401      if (element.hasPublisherElement()) {
47402        composeStringCore("publisher", element.getPublisherElement(), false);
47403        composeStringExtras("publisher", element.getPublisherElement(), false);
47404      }
47405      if (element.hasContact()) {
47406        openArray("contact");
47407        for (ContactDetail e : element.getContact()) 
47408          composeContactDetail(null, e);
47409        closeArray();
47410      };
47411      if (element.hasDescriptionElement()) {
47412        composeMarkdownCore("description", element.getDescriptionElement(), false);
47413        composeMarkdownExtras("description", element.getDescriptionElement(), false);
47414      }
47415      if (element.hasUseContext()) {
47416        openArray("useContext");
47417        for (UsageContext e : element.getUseContext()) 
47418          composeUsageContext(null, e);
47419        closeArray();
47420      };
47421      if (element.hasJurisdiction()) {
47422        openArray("jurisdiction");
47423        for (CodeableConcept e : element.getJurisdiction()) 
47424          composeCodeableConcept(null, e);
47425        closeArray();
47426      };
47427      if (element.hasPurposeElement()) {
47428        composeMarkdownCore("purpose", element.getPurposeElement(), false);
47429        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
47430      }
47431      if (element.hasUsageElement()) {
47432        composeStringCore("usage", element.getUsageElement(), false);
47433        composeStringExtras("usage", element.getUsageElement(), false);
47434      }
47435      if (element.hasCopyrightElement()) {
47436        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
47437        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
47438      }
47439      if (element.hasApprovalDateElement()) {
47440        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
47441        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
47442      }
47443      if (element.hasLastReviewDateElement()) {
47444        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
47445        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
47446      }
47447      if (element.hasEffectivePeriod()) {
47448        composePeriod("effectivePeriod", element.getEffectivePeriod());
47449      }
47450      if (element.hasTopic()) {
47451        openArray("topic");
47452        for (CodeableConcept e : element.getTopic()) 
47453          composeCodeableConcept(null, e);
47454        closeArray();
47455      };
47456      if (element.hasAuthor()) {
47457        openArray("author");
47458        for (ContactDetail e : element.getAuthor()) 
47459          composeContactDetail(null, e);
47460        closeArray();
47461      };
47462      if (element.hasEditor()) {
47463        openArray("editor");
47464        for (ContactDetail e : element.getEditor()) 
47465          composeContactDetail(null, e);
47466        closeArray();
47467      };
47468      if (element.hasReviewer()) {
47469        openArray("reviewer");
47470        for (ContactDetail e : element.getReviewer()) 
47471          composeContactDetail(null, e);
47472        closeArray();
47473      };
47474      if (element.hasEndorser()) {
47475        openArray("endorser");
47476        for (ContactDetail e : element.getEndorser()) 
47477          composeContactDetail(null, e);
47478        closeArray();
47479      };
47480      if (element.hasRelatedArtifact()) {
47481        openArray("relatedArtifact");
47482        for (RelatedArtifact e : element.getRelatedArtifact()) 
47483          composeRelatedArtifact(null, e);
47484        closeArray();
47485      };
47486      if (element.hasParameter()) {
47487        openArray("parameter");
47488        for (ParameterDefinition e : element.getParameter()) 
47489          composeParameterDefinition(null, e);
47490        closeArray();
47491      };
47492      if (element.hasDataRequirement()) {
47493        openArray("dataRequirement");
47494        for (DataRequirement e : element.getDataRequirement()) 
47495          composeDataRequirement(null, e);
47496        closeArray();
47497      };
47498      if (element.hasContent()) {
47499        openArray("content");
47500        for (Attachment e : element.getContent()) 
47501          composeAttachment(null, e);
47502        closeArray();
47503      };
47504  }
47505
47506  protected void composeLinkage(String name, Linkage element) throws IOException {
47507    if (element != null) {
47508      prop("resourceType", name);
47509      composeLinkageProperties(element);
47510    }
47511  }
47512
47513  protected void composeLinkageProperties(Linkage element) throws IOException {
47514    composeDomainResourceProperties(element);
47515      if (element.hasActiveElement()) {
47516        composeBooleanCore("active", element.getActiveElement(), false);
47517        composeBooleanExtras("active", element.getActiveElement(), false);
47518      }
47519      if (element.hasAuthor()) {
47520        composeReference("author", element.getAuthor());
47521      }
47522      if (element.hasItem()) {
47523        openArray("item");
47524        for (Linkage.LinkageItemComponent e : element.getItem()) 
47525          composeLinkageItemComponent(null, e);
47526        closeArray();
47527      };
47528  }
47529
47530  protected void composeLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
47531    if (element != null) {
47532      open(name);
47533      composeLinkageItemComponentProperties(element);
47534      close();
47535    }
47536  }
47537
47538  protected void composeLinkageItemComponentProperties(Linkage.LinkageItemComponent element) throws IOException {
47539    composeBackboneElementProperties(element);
47540      if (element.hasTypeElement()) {
47541        composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
47542        composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
47543      }
47544      if (element.hasResource()) {
47545        composeReference("resource", element.getResource());
47546      }
47547  }
47548
47549  protected void composeListResource(String name, ListResource element) throws IOException {
47550    if (element != null) {
47551      prop("resourceType", name);
47552      composeListResourceProperties(element);
47553    }
47554  }
47555
47556  protected void composeListResourceProperties(ListResource element) throws IOException {
47557    composeDomainResourceProperties(element);
47558      if (element.hasIdentifier()) {
47559        openArray("identifier");
47560        for (Identifier e : element.getIdentifier()) 
47561          composeIdentifier(null, e);
47562        closeArray();
47563      };
47564      if (element.hasStatusElement()) {
47565        composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
47566        composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
47567      }
47568      if (element.hasModeElement()) {
47569        composeEnumerationCore("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
47570        composeEnumerationExtras("mode", element.getModeElement(), new Enumerations.ListModeEnumFactory(), false);
47571      }
47572      if (element.hasTitleElement()) {
47573        composeStringCore("title", element.getTitleElement(), false);
47574        composeStringExtras("title", element.getTitleElement(), false);
47575      }
47576      if (element.hasCode()) {
47577        composeCodeableConcept("code", element.getCode());
47578      }
47579      if (element.hasSubject()) {
47580        composeReference("subject", element.getSubject());
47581      }
47582      if (element.hasEncounter()) {
47583        composeReference("encounter", element.getEncounter());
47584      }
47585      if (element.hasDateElement()) {
47586        composeDateTimeCore("date", element.getDateElement(), false);
47587        composeDateTimeExtras("date", element.getDateElement(), false);
47588      }
47589      if (element.hasSource()) {
47590        composeReference("source", element.getSource());
47591      }
47592      if (element.hasOrderedBy()) {
47593        composeCodeableConcept("orderedBy", element.getOrderedBy());
47594      }
47595      if (element.hasNote()) {
47596        openArray("note");
47597        for (Annotation e : element.getNote()) 
47598          composeAnnotation(null, e);
47599        closeArray();
47600      };
47601      if (element.hasEntry()) {
47602        openArray("entry");
47603        for (ListResource.ListResourceEntryComponent e : element.getEntry()) 
47604          composeListResourceEntryComponent(null, e);
47605        closeArray();
47606      };
47607      if (element.hasEmptyReason()) {
47608        composeCodeableConcept("emptyReason", element.getEmptyReason());
47609      }
47610  }
47611
47612  protected void composeListResourceEntryComponent(String name, ListResource.ListResourceEntryComponent element) throws IOException {
47613    if (element != null) {
47614      open(name);
47615      composeListResourceEntryComponentProperties(element);
47616      close();
47617    }
47618  }
47619
47620  protected void composeListResourceEntryComponentProperties(ListResource.ListResourceEntryComponent element) throws IOException {
47621    composeBackboneElementProperties(element);
47622      if (element.hasFlag()) {
47623        composeCodeableConcept("flag", element.getFlag());
47624      }
47625      if (element.hasDeletedElement()) {
47626        composeBooleanCore("deleted", element.getDeletedElement(), false);
47627        composeBooleanExtras("deleted", element.getDeletedElement(), false);
47628      }
47629      if (element.hasDateElement()) {
47630        composeDateTimeCore("date", element.getDateElement(), false);
47631        composeDateTimeExtras("date", element.getDateElement(), false);
47632      }
47633      if (element.hasItem()) {
47634        composeReference("item", element.getItem());
47635      }
47636  }
47637
47638  protected void composeLocation(String name, Location element) throws IOException {
47639    if (element != null) {
47640      prop("resourceType", name);
47641      composeLocationProperties(element);
47642    }
47643  }
47644
47645  protected void composeLocationProperties(Location element) throws IOException {
47646    composeDomainResourceProperties(element);
47647      if (element.hasIdentifier()) {
47648        openArray("identifier");
47649        for (Identifier e : element.getIdentifier()) 
47650          composeIdentifier(null, e);
47651        closeArray();
47652      };
47653      if (element.hasStatusElement()) {
47654        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
47655        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
47656      }
47657      if (element.hasOperationalStatus()) {
47658        composeCoding("operationalStatus", element.getOperationalStatus());
47659      }
47660      if (element.hasNameElement()) {
47661        composeStringCore("name", element.getNameElement(), false);
47662        composeStringExtras("name", element.getNameElement(), false);
47663      }
47664      if (element.hasAlias()) {
47665        openArray("alias");
47666        for (StringType e : element.getAlias()) 
47667          composeStringCore(null, e, true);
47668        closeArray();
47669        if (anyHasExtras(element.getAlias())) {
47670          openArray("_alias");
47671          for (StringType e : element.getAlias()) 
47672            composeStringExtras(null, e, true);
47673          closeArray();
47674        }
47675      };
47676      if (element.hasDescriptionElement()) {
47677        composeStringCore("description", element.getDescriptionElement(), false);
47678        composeStringExtras("description", element.getDescriptionElement(), false);
47679      }
47680      if (element.hasModeElement()) {
47681        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
47682        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
47683      }
47684      if (element.hasType()) {
47685        openArray("type");
47686        for (CodeableConcept e : element.getType()) 
47687          composeCodeableConcept(null, e);
47688        closeArray();
47689      };
47690      if (element.hasTelecom()) {
47691        openArray("telecom");
47692        for (ContactPoint e : element.getTelecom()) 
47693          composeContactPoint(null, e);
47694        closeArray();
47695      };
47696      if (element.hasAddress()) {
47697        composeAddress("address", element.getAddress());
47698      }
47699      if (element.hasPhysicalType()) {
47700        composeCodeableConcept("physicalType", element.getPhysicalType());
47701      }
47702      if (element.hasPosition()) {
47703        composeLocationPositionComponent("position", element.getPosition());
47704      }
47705      if (element.hasManagingOrganization()) {
47706        composeReference("managingOrganization", element.getManagingOrganization());
47707      }
47708      if (element.hasPartOf()) {
47709        composeReference("partOf", element.getPartOf());
47710      }
47711      if (element.hasHoursOfOperation()) {
47712        openArray("hoursOfOperation");
47713        for (Location.LocationHoursOfOperationComponent e : element.getHoursOfOperation()) 
47714          composeLocationHoursOfOperationComponent(null, e);
47715        closeArray();
47716      };
47717      if (element.hasAvailabilityExceptionsElement()) {
47718        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
47719        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
47720      }
47721      if (element.hasEndpoint()) {
47722        openArray("endpoint");
47723        for (Reference e : element.getEndpoint()) 
47724          composeReference(null, e);
47725        closeArray();
47726      };
47727  }
47728
47729  protected void composeLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
47730    if (element != null) {
47731      open(name);
47732      composeLocationPositionComponentProperties(element);
47733      close();
47734    }
47735  }
47736
47737  protected void composeLocationPositionComponentProperties(Location.LocationPositionComponent element) throws IOException {
47738    composeBackboneElementProperties(element);
47739      if (element.hasLongitudeElement()) {
47740        composeDecimalCore("longitude", element.getLongitudeElement(), false);
47741        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
47742      }
47743      if (element.hasLatitudeElement()) {
47744        composeDecimalCore("latitude", element.getLatitudeElement(), false);
47745        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
47746      }
47747      if (element.hasAltitudeElement()) {
47748        composeDecimalCore("altitude", element.getAltitudeElement(), false);
47749        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
47750      }
47751  }
47752
47753  protected void composeLocationHoursOfOperationComponent(String name, Location.LocationHoursOfOperationComponent element) throws IOException {
47754    if (element != null) {
47755      open(name);
47756      composeLocationHoursOfOperationComponentProperties(element);
47757      close();
47758    }
47759  }
47760
47761  protected void composeLocationHoursOfOperationComponentProperties(Location.LocationHoursOfOperationComponent element) throws IOException {
47762    composeBackboneElementProperties(element);
47763      if (element.hasDaysOfWeek()) {
47764        openArray("daysOfWeek");
47765        for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
47766          composeEnumerationCore(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
47767        closeArray();
47768        if (anyHasExtras(element.getDaysOfWeek())) {
47769          openArray("_daysOfWeek");
47770          for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
47771            composeEnumerationExtras(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
47772          closeArray();
47773        }
47774      };
47775      if (element.hasAllDayElement()) {
47776        composeBooleanCore("allDay", element.getAllDayElement(), false);
47777        composeBooleanExtras("allDay", element.getAllDayElement(), false);
47778      }
47779      if (element.hasOpeningTimeElement()) {
47780        composeTimeCore("openingTime", element.getOpeningTimeElement(), false);
47781        composeTimeExtras("openingTime", element.getOpeningTimeElement(), false);
47782      }
47783      if (element.hasClosingTimeElement()) {
47784        composeTimeCore("closingTime", element.getClosingTimeElement(), false);
47785        composeTimeExtras("closingTime", element.getClosingTimeElement(), false);
47786      }
47787  }
47788
47789  protected void composeManufacturedItemDefinition(String name, ManufacturedItemDefinition element) throws IOException {
47790    if (element != null) {
47791      prop("resourceType", name);
47792      composeManufacturedItemDefinitionProperties(element);
47793    }
47794  }
47795
47796  protected void composeManufacturedItemDefinitionProperties(ManufacturedItemDefinition element) throws IOException {
47797    composeDomainResourceProperties(element);
47798      if (element.hasIdentifier()) {
47799        openArray("identifier");
47800        for (Identifier e : element.getIdentifier()) 
47801          composeIdentifier(null, e);
47802        closeArray();
47803      };
47804      if (element.hasManufacturedDoseForm()) {
47805        composeCodeableConcept("manufacturedDoseForm", element.getManufacturedDoseForm());
47806      }
47807      if (element.hasUnitOfPresentation()) {
47808        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
47809      }
47810      if (element.hasManufacturer()) {
47811        openArray("manufacturer");
47812        for (Reference e : element.getManufacturer()) 
47813          composeReference(null, e);
47814        closeArray();
47815      };
47816      if (element.hasIngredient()) {
47817        openArray("ingredient");
47818        for (Reference e : element.getIngredient()) 
47819          composeReference(null, e);
47820        closeArray();
47821      };
47822      if (element.hasCharacteristic()) {
47823        openArray("characteristic");
47824        for (ManufacturedItemDefinition.ManufacturedItemDefinitionCharacteristicComponent e : element.getCharacteristic()) 
47825          composeManufacturedItemDefinitionCharacteristicComponent(null, e);
47826        closeArray();
47827      };
47828  }
47829
47830  protected void composeManufacturedItemDefinitionCharacteristicComponent(String name, ManufacturedItemDefinition.ManufacturedItemDefinitionCharacteristicComponent element) throws IOException {
47831    if (element != null) {
47832      open(name);
47833      composeManufacturedItemDefinitionCharacteristicComponentProperties(element);
47834      close();
47835    }
47836  }
47837
47838  protected void composeManufacturedItemDefinitionCharacteristicComponentProperties(ManufacturedItemDefinition.ManufacturedItemDefinitionCharacteristicComponent element) throws IOException {
47839    composeBackboneElementProperties(element);
47840      if (element.hasCode()) {
47841        composeCodeableConcept("code", element.getCode());
47842      }
47843      if (element.hasValue()) {
47844        composeType("value", element.getValue());
47845      }
47846  }
47847
47848  protected void composeMeasure(String name, Measure element) throws IOException {
47849    if (element != null) {
47850      prop("resourceType", name);
47851      composeMeasureProperties(element);
47852    }
47853  }
47854
47855  protected void composeMeasureProperties(Measure element) throws IOException {
47856    composeMetadataResourceProperties(element);
47857      if (element.hasUrlElement()) {
47858        composeUriCore("url", element.getUrlElement(), false);
47859        composeUriExtras("url", element.getUrlElement(), false);
47860      }
47861      if (element.hasIdentifier()) {
47862        openArray("identifier");
47863        for (Identifier e : element.getIdentifier()) 
47864          composeIdentifier(null, e);
47865        closeArray();
47866      };
47867      if (element.hasVersionElement()) {
47868        composeStringCore("version", element.getVersionElement(), false);
47869        composeStringExtras("version", element.getVersionElement(), false);
47870      }
47871      if (element.hasNameElement()) {
47872        composeStringCore("name", element.getNameElement(), false);
47873        composeStringExtras("name", element.getNameElement(), false);
47874      }
47875      if (element.hasTitleElement()) {
47876        composeStringCore("title", element.getTitleElement(), false);
47877        composeStringExtras("title", element.getTitleElement(), false);
47878      }
47879      if (element.hasSubtitleElement()) {
47880        composeStringCore("subtitle", element.getSubtitleElement(), false);
47881        composeStringExtras("subtitle", element.getSubtitleElement(), false);
47882      }
47883      if (element.hasStatusElement()) {
47884        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47885        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47886      }
47887      if (element.hasExperimentalElement()) {
47888        composeBooleanCore("experimental", element.getExperimentalElement(), false);
47889        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
47890      }
47891      if (element.hasSubject()) {
47892        composeType("subject", element.getSubject());
47893      }
47894      if (element.hasDateElement()) {
47895        composeDateTimeCore("date", element.getDateElement(), false);
47896        composeDateTimeExtras("date", element.getDateElement(), false);
47897      }
47898      if (element.hasPublisherElement()) {
47899        composeStringCore("publisher", element.getPublisherElement(), false);
47900        composeStringExtras("publisher", element.getPublisherElement(), false);
47901      }
47902      if (element.hasContact()) {
47903        openArray("contact");
47904        for (ContactDetail e : element.getContact()) 
47905          composeContactDetail(null, e);
47906        closeArray();
47907      };
47908      if (element.hasDescriptionElement()) {
47909        composeMarkdownCore("description", element.getDescriptionElement(), false);
47910        composeMarkdownExtras("description", element.getDescriptionElement(), false);
47911      }
47912      if (element.hasUseContext()) {
47913        openArray("useContext");
47914        for (UsageContext e : element.getUseContext()) 
47915          composeUsageContext(null, e);
47916        closeArray();
47917      };
47918      if (element.hasJurisdiction()) {
47919        openArray("jurisdiction");
47920        for (CodeableConcept e : element.getJurisdiction()) 
47921          composeCodeableConcept(null, e);
47922        closeArray();
47923      };
47924      if (element.hasPurposeElement()) {
47925        composeMarkdownCore("purpose", element.getPurposeElement(), false);
47926        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
47927      }
47928      if (element.hasUsageElement()) {
47929        composeStringCore("usage", element.getUsageElement(), false);
47930        composeStringExtras("usage", element.getUsageElement(), false);
47931      }
47932      if (element.hasCopyrightElement()) {
47933        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
47934        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
47935      }
47936      if (element.hasApprovalDateElement()) {
47937        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
47938        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
47939      }
47940      if (element.hasLastReviewDateElement()) {
47941        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
47942        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
47943      }
47944      if (element.hasEffectivePeriod()) {
47945        composePeriod("effectivePeriod", element.getEffectivePeriod());
47946      }
47947      if (element.hasTopic()) {
47948        openArray("topic");
47949        for (CodeableConcept e : element.getTopic()) 
47950          composeCodeableConcept(null, e);
47951        closeArray();
47952      };
47953      if (element.hasAuthor()) {
47954        openArray("author");
47955        for (ContactDetail e : element.getAuthor()) 
47956          composeContactDetail(null, e);
47957        closeArray();
47958      };
47959      if (element.hasEditor()) {
47960        openArray("editor");
47961        for (ContactDetail e : element.getEditor()) 
47962          composeContactDetail(null, e);
47963        closeArray();
47964      };
47965      if (element.hasReviewer()) {
47966        openArray("reviewer");
47967        for (ContactDetail e : element.getReviewer()) 
47968          composeContactDetail(null, e);
47969        closeArray();
47970      };
47971      if (element.hasEndorser()) {
47972        openArray("endorser");
47973        for (ContactDetail e : element.getEndorser()) 
47974          composeContactDetail(null, e);
47975        closeArray();
47976      };
47977      if (element.hasRelatedArtifact()) {
47978        openArray("relatedArtifact");
47979        for (RelatedArtifact e : element.getRelatedArtifact()) 
47980          composeRelatedArtifact(null, e);
47981        closeArray();
47982      };
47983      if (element.hasLibrary()) {
47984        openArray("library");
47985        for (CanonicalType e : element.getLibrary()) 
47986          composeCanonicalCore(null, e, true);
47987        closeArray();
47988        if (anyHasExtras(element.getLibrary())) {
47989          openArray("_library");
47990          for (CanonicalType e : element.getLibrary()) 
47991            composeCanonicalExtras(null, e, true);
47992          closeArray();
47993        }
47994      };
47995      if (element.hasDisclaimerElement()) {
47996        composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
47997        composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
47998      }
47999      if (element.hasScoring()) {
48000        composeCodeableConcept("scoring", element.getScoring());
48001      }
48002      if (element.hasCompositeScoring()) {
48003        composeCodeableConcept("compositeScoring", element.getCompositeScoring());
48004      }
48005      if (element.hasType()) {
48006        openArray("type");
48007        for (CodeableConcept e : element.getType()) 
48008          composeCodeableConcept(null, e);
48009        closeArray();
48010      };
48011      if (element.hasRiskAdjustmentElement()) {
48012        composeStringCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
48013        composeStringExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
48014      }
48015      if (element.hasRateAggregationElement()) {
48016        composeStringCore("rateAggregation", element.getRateAggregationElement(), false);
48017        composeStringExtras("rateAggregation", element.getRateAggregationElement(), false);
48018      }
48019      if (element.hasRationaleElement()) {
48020        composeMarkdownCore("rationale", element.getRationaleElement(), false);
48021        composeMarkdownExtras("rationale", element.getRationaleElement(), false);
48022      }
48023      if (element.hasClinicalRecommendationStatementElement()) {
48024        composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
48025        composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
48026      }
48027      if (element.hasImprovementNotation()) {
48028        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
48029      }
48030      if (element.hasDefinition()) {
48031        openArray("definition");
48032        for (MarkdownType e : element.getDefinition()) 
48033          composeMarkdownCore(null, e, true);
48034        closeArray();
48035        if (anyHasExtras(element.getDefinition())) {
48036          openArray("_definition");
48037          for (MarkdownType e : element.getDefinition()) 
48038            composeMarkdownExtras(null, e, true);
48039          closeArray();
48040        }
48041      };
48042      if (element.hasGuidanceElement()) {
48043        composeMarkdownCore("guidance", element.getGuidanceElement(), false);
48044        composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
48045      }
48046      if (element.hasGroup()) {
48047        openArray("group");
48048        for (Measure.MeasureGroupComponent e : element.getGroup()) 
48049          composeMeasureGroupComponent(null, e);
48050        closeArray();
48051      };
48052      if (element.hasSupplementalData()) {
48053        openArray("supplementalData");
48054        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
48055          composeMeasureSupplementalDataComponent(null, e);
48056        closeArray();
48057      };
48058  }
48059
48060  protected void composeMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
48061    if (element != null) {
48062      open(name);
48063      composeMeasureGroupComponentProperties(element);
48064      close();
48065    }
48066  }
48067
48068  protected void composeMeasureGroupComponentProperties(Measure.MeasureGroupComponent element) throws IOException {
48069    composeBackboneElementProperties(element);
48070      if (element.hasCode()) {
48071        composeCodeableConcept("code", element.getCode());
48072      }
48073      if (element.hasDescriptionElement()) {
48074        composeStringCore("description", element.getDescriptionElement(), false);
48075        composeStringExtras("description", element.getDescriptionElement(), false);
48076      }
48077      if (element.hasPopulation()) {
48078        openArray("population");
48079        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
48080          composeMeasureGroupPopulationComponent(null, e);
48081        closeArray();
48082      };
48083      if (element.hasStratifier()) {
48084        openArray("stratifier");
48085        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
48086          composeMeasureGroupStratifierComponent(null, e);
48087        closeArray();
48088      };
48089  }
48090
48091  protected void composeMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
48092    if (element != null) {
48093      open(name);
48094      composeMeasureGroupPopulationComponentProperties(element);
48095      close();
48096    }
48097  }
48098
48099  protected void composeMeasureGroupPopulationComponentProperties(Measure.MeasureGroupPopulationComponent element) throws IOException {
48100    composeBackboneElementProperties(element);
48101      if (element.hasCode()) {
48102        composeCodeableConcept("code", element.getCode());
48103      }
48104      if (element.hasDescriptionElement()) {
48105        composeStringCore("description", element.getDescriptionElement(), false);
48106        composeStringExtras("description", element.getDescriptionElement(), false);
48107      }
48108      if (element.hasCriteria()) {
48109        composeExpression("criteria", element.getCriteria());
48110      }
48111  }
48112
48113  protected void composeMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
48114    if (element != null) {
48115      open(name);
48116      composeMeasureGroupStratifierComponentProperties(element);
48117      close();
48118    }
48119  }
48120
48121  protected void composeMeasureGroupStratifierComponentProperties(Measure.MeasureGroupStratifierComponent element) throws IOException {
48122    composeBackboneElementProperties(element);
48123      if (element.hasCode()) {
48124        composeCodeableConcept("code", element.getCode());
48125      }
48126      if (element.hasDescriptionElement()) {
48127        composeStringCore("description", element.getDescriptionElement(), false);
48128        composeStringExtras("description", element.getDescriptionElement(), false);
48129      }
48130      if (element.hasCriteria()) {
48131        composeExpression("criteria", element.getCriteria());
48132      }
48133      if (element.hasComponent()) {
48134        openArray("component");
48135        for (Measure.MeasureGroupStratifierComponentComponent e : element.getComponent()) 
48136          composeMeasureGroupStratifierComponentComponent(null, e);
48137        closeArray();
48138      };
48139  }
48140
48141  protected void composeMeasureGroupStratifierComponentComponent(String name, Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
48142    if (element != null) {
48143      open(name);
48144      composeMeasureGroupStratifierComponentComponentProperties(element);
48145      close();
48146    }
48147  }
48148
48149  protected void composeMeasureGroupStratifierComponentComponentProperties(Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
48150    composeBackboneElementProperties(element);
48151      if (element.hasCode()) {
48152        composeCodeableConcept("code", element.getCode());
48153      }
48154      if (element.hasDescriptionElement()) {
48155        composeStringCore("description", element.getDescriptionElement(), false);
48156        composeStringExtras("description", element.getDescriptionElement(), false);
48157      }
48158      if (element.hasCriteria()) {
48159        composeExpression("criteria", element.getCriteria());
48160      }
48161  }
48162
48163  protected void composeMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
48164    if (element != null) {
48165      open(name);
48166      composeMeasureSupplementalDataComponentProperties(element);
48167      close();
48168    }
48169  }
48170
48171  protected void composeMeasureSupplementalDataComponentProperties(Measure.MeasureSupplementalDataComponent element) throws IOException {
48172    composeBackboneElementProperties(element);
48173      if (element.hasCode()) {
48174        composeCodeableConcept("code", element.getCode());
48175      }
48176      if (element.hasUsage()) {
48177        openArray("usage");
48178        for (CodeableConcept e : element.getUsage()) 
48179          composeCodeableConcept(null, e);
48180        closeArray();
48181      };
48182      if (element.hasDescriptionElement()) {
48183        composeStringCore("description", element.getDescriptionElement(), false);
48184        composeStringExtras("description", element.getDescriptionElement(), false);
48185      }
48186      if (element.hasCriteria()) {
48187        composeExpression("criteria", element.getCriteria());
48188      }
48189  }
48190
48191  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
48192    if (element != null) {
48193      prop("resourceType", name);
48194      composeMeasureReportProperties(element);
48195    }
48196  }
48197
48198  protected void composeMeasureReportProperties(MeasureReport element) throws IOException {
48199    composeDomainResourceProperties(element);
48200      if (element.hasIdentifier()) {
48201        openArray("identifier");
48202        for (Identifier e : element.getIdentifier()) 
48203          composeIdentifier(null, e);
48204        closeArray();
48205      };
48206      if (element.hasStatusElement()) {
48207        composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
48208        composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
48209      }
48210      if (element.hasTypeElement()) {
48211        composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
48212        composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
48213      }
48214      if (element.hasMeasureElement()) {
48215        composeCanonicalCore("measure", element.getMeasureElement(), false);
48216        composeCanonicalExtras("measure", element.getMeasureElement(), false);
48217      }
48218      if (element.hasSubject()) {
48219        composeReference("subject", element.getSubject());
48220      }
48221      if (element.hasDateElement()) {
48222        composeDateTimeCore("date", element.getDateElement(), false);
48223        composeDateTimeExtras("date", element.getDateElement(), false);
48224      }
48225      if (element.hasReporter()) {
48226        composeReference("reporter", element.getReporter());
48227      }
48228      if (element.hasPeriod()) {
48229        composePeriod("period", element.getPeriod());
48230      }
48231      if (element.hasImprovementNotation()) {
48232        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
48233      }
48234      if (element.hasGroup()) {
48235        openArray("group");
48236        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
48237          composeMeasureReportGroupComponent(null, e);
48238        closeArray();
48239      };
48240      if (element.hasEvaluatedResource()) {
48241        openArray("evaluatedResource");
48242        for (Reference e : element.getEvaluatedResource()) 
48243          composeReference(null, e);
48244        closeArray();
48245      };
48246  }
48247
48248  protected void composeMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
48249    if (element != null) {
48250      open(name);
48251      composeMeasureReportGroupComponentProperties(element);
48252      close();
48253    }
48254  }
48255
48256  protected void composeMeasureReportGroupComponentProperties(MeasureReport.MeasureReportGroupComponent element) throws IOException {
48257    composeBackboneElementProperties(element);
48258      if (element.hasCode()) {
48259        composeCodeableConcept("code", element.getCode());
48260      }
48261      if (element.hasPopulation()) {
48262        openArray("population");
48263        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
48264          composeMeasureReportGroupPopulationComponent(null, e);
48265        closeArray();
48266      };
48267      if (element.hasMeasureScore()) {
48268        composeQuantity("measureScore", element.getMeasureScore());
48269      }
48270      if (element.hasStratifier()) {
48271        openArray("stratifier");
48272        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
48273          composeMeasureReportGroupStratifierComponent(null, e);
48274        closeArray();
48275      };
48276  }
48277
48278  protected void composeMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
48279    if (element != null) {
48280      open(name);
48281      composeMeasureReportGroupPopulationComponentProperties(element);
48282      close();
48283    }
48284  }
48285
48286  protected void composeMeasureReportGroupPopulationComponentProperties(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
48287    composeBackboneElementProperties(element);
48288      if (element.hasCode()) {
48289        composeCodeableConcept("code", element.getCode());
48290      }
48291      if (element.hasCountElement()) {
48292        composeIntegerCore("count", element.getCountElement(), false);
48293        composeIntegerExtras("count", element.getCountElement(), false);
48294      }
48295      if (element.hasSubjectResults()) {
48296        composeReference("subjectResults", element.getSubjectResults());
48297      }
48298  }
48299
48300  protected void composeMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
48301    if (element != null) {
48302      open(name);
48303      composeMeasureReportGroupStratifierComponentProperties(element);
48304      close();
48305    }
48306  }
48307
48308  protected void composeMeasureReportGroupStratifierComponentProperties(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
48309    composeBackboneElementProperties(element);
48310      if (element.hasCode()) {
48311        openArray("code");
48312        for (CodeableConcept e : element.getCode()) 
48313          composeCodeableConcept(null, e);
48314        closeArray();
48315      };
48316      if (element.hasStratum()) {
48317        openArray("stratum");
48318        for (MeasureReport.StratifierGroupComponent e : element.getStratum()) 
48319          composeStratifierGroupComponent(null, e);
48320        closeArray();
48321      };
48322  }
48323
48324  protected void composeStratifierGroupComponent(String name, MeasureReport.StratifierGroupComponent element) throws IOException {
48325    if (element != null) {
48326      open(name);
48327      composeStratifierGroupComponentProperties(element);
48328      close();
48329    }
48330  }
48331
48332  protected void composeStratifierGroupComponentProperties(MeasureReport.StratifierGroupComponent element) throws IOException {
48333    composeBackboneElementProperties(element);
48334      if (element.hasValue()) {
48335        composeCodeableConcept("value", element.getValue());
48336      }
48337      if (element.hasComponent()) {
48338        openArray("component");
48339        for (MeasureReport.StratifierGroupComponentComponent e : element.getComponent()) 
48340          composeStratifierGroupComponentComponent(null, e);
48341        closeArray();
48342      };
48343      if (element.hasPopulation()) {
48344        openArray("population");
48345        for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation()) 
48346          composeStratifierGroupPopulationComponent(null, e);
48347        closeArray();
48348      };
48349      if (element.hasMeasureScore()) {
48350        composeQuantity("measureScore", element.getMeasureScore());
48351      }
48352  }
48353
48354  protected void composeStratifierGroupComponentComponent(String name, MeasureReport.StratifierGroupComponentComponent element) throws IOException {
48355    if (element != null) {
48356      open(name);
48357      composeStratifierGroupComponentComponentProperties(element);
48358      close();
48359    }
48360  }
48361
48362  protected void composeStratifierGroupComponentComponentProperties(MeasureReport.StratifierGroupComponentComponent element) throws IOException {
48363    composeBackboneElementProperties(element);
48364      if (element.hasCode()) {
48365        composeCodeableConcept("code", element.getCode());
48366      }
48367      if (element.hasValue()) {
48368        composeCodeableConcept("value", element.getValue());
48369      }
48370  }
48371
48372  protected void composeStratifierGroupPopulationComponent(String name, MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
48373    if (element != null) {
48374      open(name);
48375      composeStratifierGroupPopulationComponentProperties(element);
48376      close();
48377    }
48378  }
48379
48380  protected void composeStratifierGroupPopulationComponentProperties(MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
48381    composeBackboneElementProperties(element);
48382      if (element.hasCode()) {
48383        composeCodeableConcept("code", element.getCode());
48384      }
48385      if (element.hasCountElement()) {
48386        composeIntegerCore("count", element.getCountElement(), false);
48387        composeIntegerExtras("count", element.getCountElement(), false);
48388      }
48389      if (element.hasSubjectResults()) {
48390        composeReference("subjectResults", element.getSubjectResults());
48391      }
48392  }
48393
48394  protected void composeMedication(String name, Medication element) throws IOException {
48395    if (element != null) {
48396      prop("resourceType", name);
48397      composeMedicationProperties(element);
48398    }
48399  }
48400
48401  protected void composeMedicationProperties(Medication element) throws IOException {
48402    composeDomainResourceProperties(element);
48403      if (element.hasIdentifier()) {
48404        openArray("identifier");
48405        for (Identifier e : element.getIdentifier()) 
48406          composeIdentifier(null, e);
48407        closeArray();
48408      };
48409      if (element.hasCode()) {
48410        composeCodeableConcept("code", element.getCode());
48411      }
48412      if (element.hasStatusElement()) {
48413        composeEnumerationCore("status", element.getStatusElement(), new Medication.MedicationStatusCodesEnumFactory(), false);
48414        composeEnumerationExtras("status", element.getStatusElement(), new Medication.MedicationStatusCodesEnumFactory(), false);
48415      }
48416      if (element.hasManufacturer()) {
48417        composeReference("manufacturer", element.getManufacturer());
48418      }
48419      if (element.hasDoseForm()) {
48420        composeCodeableConcept("doseForm", element.getDoseForm());
48421      }
48422      if (element.hasAmount()) {
48423        composeRatio("amount", element.getAmount());
48424      }
48425      if (element.hasIngredient()) {
48426        openArray("ingredient");
48427        for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
48428          composeMedicationIngredientComponent(null, e);
48429        closeArray();
48430      };
48431      if (element.hasBatch()) {
48432        composeMedicationBatchComponent("batch", element.getBatch());
48433      }
48434  }
48435
48436  protected void composeMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
48437    if (element != null) {
48438      open(name);
48439      composeMedicationIngredientComponentProperties(element);
48440      close();
48441    }
48442  }
48443
48444  protected void composeMedicationIngredientComponentProperties(Medication.MedicationIngredientComponent element) throws IOException {
48445    composeBackboneElementProperties(element);
48446      if (element.hasItem()) {
48447        composeType("item", element.getItem());
48448      }
48449      if (element.hasIsActiveElement()) {
48450        composeBooleanCore("isActive", element.getIsActiveElement(), false);
48451        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
48452      }
48453      if (element.hasStrength()) {
48454        composeType("strength", element.getStrength());
48455      }
48456  }
48457
48458  protected void composeMedicationBatchComponent(String name, Medication.MedicationBatchComponent element) throws IOException {
48459    if (element != null) {
48460      open(name);
48461      composeMedicationBatchComponentProperties(element);
48462      close();
48463    }
48464  }
48465
48466  protected void composeMedicationBatchComponentProperties(Medication.MedicationBatchComponent element) throws IOException {
48467    composeBackboneElementProperties(element);
48468      if (element.hasLotNumberElement()) {
48469        composeStringCore("lotNumber", element.getLotNumberElement(), false);
48470        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
48471      }
48472      if (element.hasExpirationDateElement()) {
48473        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
48474        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
48475      }
48476  }
48477
48478  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
48479    if (element != null) {
48480      prop("resourceType", name);
48481      composeMedicationAdministrationProperties(element);
48482    }
48483  }
48484
48485  protected void composeMedicationAdministrationProperties(MedicationAdministration element) throws IOException {
48486    composeDomainResourceProperties(element);
48487      if (element.hasIdentifier()) {
48488        openArray("identifier");
48489        for (Identifier e : element.getIdentifier()) 
48490          composeIdentifier(null, e);
48491        closeArray();
48492      };
48493      if (element.hasInstantiatesCanonical()) {
48494        openArray("instantiatesCanonical");
48495        for (CanonicalType e : element.getInstantiatesCanonical()) 
48496          composeCanonicalCore(null, e, true);
48497        closeArray();
48498        if (anyHasExtras(element.getInstantiatesCanonical())) {
48499          openArray("_instantiatesCanonical");
48500          for (CanonicalType e : element.getInstantiatesCanonical()) 
48501            composeCanonicalExtras(null, e, true);
48502          closeArray();
48503        }
48504      };
48505      if (element.hasInstantiatesUri()) {
48506        openArray("instantiatesUri");
48507        for (UriType e : element.getInstantiatesUri()) 
48508          composeUriCore(null, e, true);
48509        closeArray();
48510        if (anyHasExtras(element.getInstantiatesUri())) {
48511          openArray("_instantiatesUri");
48512          for (UriType e : element.getInstantiatesUri()) 
48513            composeUriExtras(null, e, true);
48514          closeArray();
48515        }
48516      };
48517      if (element.hasBasedOn()) {
48518        openArray("basedOn");
48519        for (Reference e : element.getBasedOn()) 
48520          composeReference(null, e);
48521        closeArray();
48522      };
48523      if (element.hasPartOf()) {
48524        openArray("partOf");
48525        for (Reference e : element.getPartOf()) 
48526          composeReference(null, e);
48527        closeArray();
48528      };
48529      if (element.hasStatusElement()) {
48530        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusCodesEnumFactory(), false);
48531        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusCodesEnumFactory(), false);
48532      }
48533      if (element.hasStatusReason()) {
48534        openArray("statusReason");
48535        for (CodeableConcept e : element.getStatusReason()) 
48536          composeCodeableConcept(null, e);
48537        closeArray();
48538      };
48539      if (element.hasCategory()) {
48540        openArray("category");
48541        for (CodeableConcept e : element.getCategory()) 
48542          composeCodeableConcept(null, e);
48543        closeArray();
48544      };
48545      if (element.hasMedication()) {
48546        composeType("medication", element.getMedication());
48547      }
48548      if (element.hasSubject()) {
48549        composeReference("subject", element.getSubject());
48550      }
48551      if (element.hasEncounter()) {
48552        composeReference("encounter", element.getEncounter());
48553      }
48554      if (element.hasSupportingInformation()) {
48555        openArray("supportingInformation");
48556        for (Reference e : element.getSupportingInformation()) 
48557          composeReference(null, e);
48558        closeArray();
48559      };
48560      if (element.hasOccurence()) {
48561        composeType("occurence", element.getOccurence());
48562      }
48563      if (element.hasRecordedElement()) {
48564        composeDateTimeCore("recorded", element.getRecordedElement(), false);
48565        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
48566      }
48567      if (element.hasPerformer()) {
48568        openArray("performer");
48569        for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
48570          composeMedicationAdministrationPerformerComponent(null, e);
48571        closeArray();
48572      };
48573      if (element.hasReason()) {
48574        openArray("reason");
48575        for (CodeableReference e : element.getReason()) 
48576          composeCodeableReference(null, e);
48577        closeArray();
48578      };
48579      if (element.hasRequest()) {
48580        composeReference("request", element.getRequest());
48581      }
48582      if (element.hasDevice()) {
48583        openArray("device");
48584        for (Reference e : element.getDevice()) 
48585          composeReference(null, e);
48586        closeArray();
48587      };
48588      if (element.hasNote()) {
48589        openArray("note");
48590        for (Annotation e : element.getNote()) 
48591          composeAnnotation(null, e);
48592        closeArray();
48593      };
48594      if (element.hasDosage()) {
48595        composeMedicationAdministrationDosageComponent("dosage", element.getDosage());
48596      }
48597      if (element.hasEventHistory()) {
48598        openArray("eventHistory");
48599        for (Reference e : element.getEventHistory()) 
48600          composeReference(null, e);
48601        closeArray();
48602      };
48603  }
48604
48605  protected void composeMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
48606    if (element != null) {
48607      open(name);
48608      composeMedicationAdministrationPerformerComponentProperties(element);
48609      close();
48610    }
48611  }
48612
48613  protected void composeMedicationAdministrationPerformerComponentProperties(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
48614    composeBackboneElementProperties(element);
48615      if (element.hasFunction()) {
48616        composeCodeableConcept("function", element.getFunction());
48617      }
48618      if (element.hasActor()) {
48619        composeReference("actor", element.getActor());
48620      }
48621  }
48622
48623  protected void composeMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
48624    if (element != null) {
48625      open(name);
48626      composeMedicationAdministrationDosageComponentProperties(element);
48627      close();
48628    }
48629  }
48630
48631  protected void composeMedicationAdministrationDosageComponentProperties(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
48632    composeBackboneElementProperties(element);
48633      if (element.hasTextElement()) {
48634        composeStringCore("text", element.getTextElement(), false);
48635        composeStringExtras("text", element.getTextElement(), false);
48636      }
48637      if (element.hasSite()) {
48638        composeCodeableConcept("site", element.getSite());
48639      }
48640      if (element.hasRoute()) {
48641        composeCodeableConcept("route", element.getRoute());
48642      }
48643      if (element.hasMethod()) {
48644        composeCodeableConcept("method", element.getMethod());
48645      }
48646      if (element.hasDose()) {
48647        composeQuantity("dose", element.getDose());
48648      }
48649      if (element.hasRate()) {
48650        composeType("rate", element.getRate());
48651      }
48652  }
48653
48654  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
48655    if (element != null) {
48656      prop("resourceType", name);
48657      composeMedicationDispenseProperties(element);
48658    }
48659  }
48660
48661  protected void composeMedicationDispenseProperties(MedicationDispense element) throws IOException {
48662    composeDomainResourceProperties(element);
48663      if (element.hasIdentifier()) {
48664        openArray("identifier");
48665        for (Identifier e : element.getIdentifier()) 
48666          composeIdentifier(null, e);
48667        closeArray();
48668      };
48669      if (element.hasBasedOn()) {
48670        openArray("basedOn");
48671        for (Reference e : element.getBasedOn()) 
48672          composeReference(null, e);
48673        closeArray();
48674      };
48675      if (element.hasPartOf()) {
48676        openArray("partOf");
48677        for (Reference e : element.getPartOf()) 
48678          composeReference(null, e);
48679        closeArray();
48680      };
48681      if (element.hasStatusElement()) {
48682        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusCodesEnumFactory(), false);
48683        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusCodesEnumFactory(), false);
48684      }
48685      if (element.hasStatusReason()) {
48686        composeType("statusReason", element.getStatusReason());
48687      }
48688      if (element.hasCategory()) {
48689        openArray("category");
48690        for (CodeableConcept e : element.getCategory()) 
48691          composeCodeableConcept(null, e);
48692        closeArray();
48693      };
48694      if (element.hasMedication()) {
48695        composeType("medication", element.getMedication());
48696      }
48697      if (element.hasSubject()) {
48698        composeReference("subject", element.getSubject());
48699      }
48700      if (element.hasEncounter()) {
48701        composeReference("encounter", element.getEncounter());
48702      }
48703      if (element.hasSupportingInformation()) {
48704        openArray("supportingInformation");
48705        for (Reference e : element.getSupportingInformation()) 
48706          composeReference(null, e);
48707        closeArray();
48708      };
48709      if (element.hasPerformer()) {
48710        openArray("performer");
48711        for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
48712          composeMedicationDispensePerformerComponent(null, e);
48713        closeArray();
48714      };
48715      if (element.hasLocation()) {
48716        composeReference("location", element.getLocation());
48717      }
48718      if (element.hasAuthorizingPrescription()) {
48719        openArray("authorizingPrescription");
48720        for (Reference e : element.getAuthorizingPrescription()) 
48721          composeReference(null, e);
48722        closeArray();
48723      };
48724      if (element.hasType()) {
48725        composeCodeableConcept("type", element.getType());
48726      }
48727      if (element.hasQuantity()) {
48728        composeQuantity("quantity", element.getQuantity());
48729      }
48730      if (element.hasDaysSupply()) {
48731        composeQuantity("daysSupply", element.getDaysSupply());
48732      }
48733      if (element.hasWhenPreparedElement()) {
48734        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
48735        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
48736      }
48737      if (element.hasWhenHandedOverElement()) {
48738        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
48739        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
48740      }
48741      if (element.hasDestination()) {
48742        composeReference("destination", element.getDestination());
48743      }
48744      if (element.hasReceiver()) {
48745        openArray("receiver");
48746        for (Reference e : element.getReceiver()) 
48747          composeReference(null, e);
48748        closeArray();
48749      };
48750      if (element.hasNote()) {
48751        openArray("note");
48752        for (Annotation e : element.getNote()) 
48753          composeAnnotation(null, e);
48754        closeArray();
48755      };
48756      if (element.hasRenderedDosageInstructionElement()) {
48757        composeStringCore("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
48758        composeStringExtras("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
48759      }
48760      if (element.hasDosageInstruction()) {
48761        openArray("dosageInstruction");
48762        for (Dosage e : element.getDosageInstruction()) 
48763          composeDosage(null, e);
48764        closeArray();
48765      };
48766      if (element.hasSubstitution()) {
48767        composeMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
48768      }
48769      if (element.hasDetectedIssue()) {
48770        openArray("detectedIssue");
48771        for (Reference e : element.getDetectedIssue()) 
48772          composeReference(null, e);
48773        closeArray();
48774      };
48775      if (element.hasEventHistory()) {
48776        openArray("eventHistory");
48777        for (Reference e : element.getEventHistory()) 
48778          composeReference(null, e);
48779        closeArray();
48780      };
48781  }
48782
48783  protected void composeMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
48784    if (element != null) {
48785      open(name);
48786      composeMedicationDispensePerformerComponentProperties(element);
48787      close();
48788    }
48789  }
48790
48791  protected void composeMedicationDispensePerformerComponentProperties(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
48792    composeBackboneElementProperties(element);
48793      if (element.hasFunction()) {
48794        composeCodeableConcept("function", element.getFunction());
48795      }
48796      if (element.hasActor()) {
48797        composeReference("actor", element.getActor());
48798      }
48799  }
48800
48801  protected void composeMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
48802    if (element != null) {
48803      open(name);
48804      composeMedicationDispenseSubstitutionComponentProperties(element);
48805      close();
48806    }
48807  }
48808
48809  protected void composeMedicationDispenseSubstitutionComponentProperties(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
48810    composeBackboneElementProperties(element);
48811      if (element.hasWasSubstitutedElement()) {
48812        composeBooleanCore("wasSubstituted", element.getWasSubstitutedElement(), false);
48813        composeBooleanExtras("wasSubstituted", element.getWasSubstitutedElement(), false);
48814      }
48815      if (element.hasType()) {
48816        composeCodeableConcept("type", element.getType());
48817      }
48818      if (element.hasReason()) {
48819        openArray("reason");
48820        for (CodeableConcept e : element.getReason()) 
48821          composeCodeableConcept(null, e);
48822        closeArray();
48823      };
48824      if (element.hasResponsibleParty()) {
48825        composeReference("responsibleParty", element.getResponsibleParty());
48826      }
48827  }
48828
48829  protected void composeMedicationKnowledge(String name, MedicationKnowledge element) throws IOException {
48830    if (element != null) {
48831      prop("resourceType", name);
48832      composeMedicationKnowledgeProperties(element);
48833    }
48834  }
48835
48836  protected void composeMedicationKnowledgeProperties(MedicationKnowledge element) throws IOException {
48837    composeDomainResourceProperties(element);
48838      if (element.hasIdentifier()) {
48839        openArray("identifier");
48840        for (Identifier e : element.getIdentifier()) 
48841          composeIdentifier(null, e);
48842        closeArray();
48843      };
48844      if (element.hasCode()) {
48845        composeCodeableConcept("code", element.getCode());
48846      }
48847      if (element.hasStatusElement()) {
48848        composeEnumerationCore("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusCodesEnumFactory(), false);
48849        composeEnumerationExtras("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusCodesEnumFactory(), false);
48850      }
48851      if (element.hasManufacturer()) {
48852        composeReference("manufacturer", element.getManufacturer());
48853      }
48854      if (element.hasDoseForm()) {
48855        composeCodeableConcept("doseForm", element.getDoseForm());
48856      }
48857      if (element.hasAmount()) {
48858        composeQuantity("amount", element.getAmount());
48859      }
48860      if (element.hasSynonym()) {
48861        openArray("synonym");
48862        for (StringType e : element.getSynonym()) 
48863          composeStringCore(null, e, true);
48864        closeArray();
48865        if (anyHasExtras(element.getSynonym())) {
48866          openArray("_synonym");
48867          for (StringType e : element.getSynonym()) 
48868            composeStringExtras(null, e, true);
48869          closeArray();
48870        }
48871      };
48872      if (element.hasRelatedMedicationKnowledge()) {
48873        openArray("relatedMedicationKnowledge");
48874        for (MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent e : element.getRelatedMedicationKnowledge()) 
48875          composeMedicationKnowledgeRelatedMedicationKnowledgeComponent(null, e);
48876        closeArray();
48877      };
48878      if (element.hasAssociatedMedication()) {
48879        openArray("associatedMedication");
48880        for (Reference e : element.getAssociatedMedication()) 
48881          composeReference(null, e);
48882        closeArray();
48883      };
48884      if (element.hasProductType()) {
48885        openArray("productType");
48886        for (CodeableConcept e : element.getProductType()) 
48887          composeCodeableConcept(null, e);
48888        closeArray();
48889      };
48890      if (element.hasMonograph()) {
48891        openArray("monograph");
48892        for (MedicationKnowledge.MedicationKnowledgeMonographComponent e : element.getMonograph()) 
48893          composeMedicationKnowledgeMonographComponent(null, e);
48894        closeArray();
48895      };
48896      if (element.hasIngredient()) {
48897        openArray("ingredient");
48898        for (MedicationKnowledge.MedicationKnowledgeIngredientComponent e : element.getIngredient()) 
48899          composeMedicationKnowledgeIngredientComponent(null, e);
48900        closeArray();
48901      };
48902      if (element.hasDevice()) {
48903        openArray("device");
48904        for (Reference e : element.getDevice()) 
48905          composeReference(null, e);
48906        closeArray();
48907      };
48908      if (element.hasPreparationInstructionElement()) {
48909        composeMarkdownCore("preparationInstruction", element.getPreparationInstructionElement(), false);
48910        composeMarkdownExtras("preparationInstruction", element.getPreparationInstructionElement(), false);
48911      }
48912      if (element.hasIntendedRoute()) {
48913        openArray("intendedRoute");
48914        for (CodeableConcept e : element.getIntendedRoute()) 
48915          composeCodeableConcept(null, e);
48916        closeArray();
48917      };
48918      if (element.hasCost()) {
48919        openArray("cost");
48920        for (MedicationKnowledge.MedicationKnowledgeCostComponent e : element.getCost()) 
48921          composeMedicationKnowledgeCostComponent(null, e);
48922        closeArray();
48923      };
48924      if (element.hasMonitoringProgram()) {
48925        openArray("monitoringProgram");
48926        for (MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent e : element.getMonitoringProgram()) 
48927          composeMedicationKnowledgeMonitoringProgramComponent(null, e);
48928        closeArray();
48929      };
48930      if (element.hasAdministrationGuideline()) {
48931        openArray("administrationGuideline");
48932        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent e : element.getAdministrationGuideline()) 
48933          composeMedicationKnowledgeAdministrationGuidelineComponent(null, e);
48934        closeArray();
48935      };
48936      if (element.hasMedicineClassification()) {
48937        openArray("medicineClassification");
48938        for (MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent e : element.getMedicineClassification()) 
48939          composeMedicationKnowledgeMedicineClassificationComponent(null, e);
48940        closeArray();
48941      };
48942      if (element.hasPackaging()) {
48943        composeMedicationKnowledgePackagingComponent("packaging", element.getPackaging());
48944      }
48945      if (element.hasDrugCharacteristic()) {
48946        openArray("drugCharacteristic");
48947        for (MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent e : element.getDrugCharacteristic()) 
48948          composeMedicationKnowledgeDrugCharacteristicComponent(null, e);
48949        closeArray();
48950      };
48951      if (element.hasClinicalUseIssue()) {
48952        openArray("clinicalUseIssue");
48953        for (Reference e : element.getClinicalUseIssue()) 
48954          composeReference(null, e);
48955        closeArray();
48956      };
48957      if (element.hasRegulatory()) {
48958        openArray("regulatory");
48959        for (MedicationKnowledge.MedicationKnowledgeRegulatoryComponent e : element.getRegulatory()) 
48960          composeMedicationKnowledgeRegulatoryComponent(null, e);
48961        closeArray();
48962      };
48963      if (element.hasKineticCharacteristic()) {
48964        openArray("kineticCharacteristic");
48965        for (MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent e : element.getKineticCharacteristic()) 
48966          composeMedicationKnowledgeKineticCharacteristicComponent(null, e);
48967        closeArray();
48968      };
48969  }
48970
48971  protected void composeMedicationKnowledgeRelatedMedicationKnowledgeComponent(String name, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
48972    if (element != null) {
48973      open(name);
48974      composeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(element);
48975      close();
48976    }
48977  }
48978
48979  protected void composeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
48980    composeBackboneElementProperties(element);
48981      if (element.hasType()) {
48982        composeCodeableConcept("type", element.getType());
48983      }
48984      if (element.hasReference()) {
48985        openArray("reference");
48986        for (Reference e : element.getReference()) 
48987          composeReference(null, e);
48988        closeArray();
48989      };
48990  }
48991
48992  protected void composeMedicationKnowledgeMonographComponent(String name, MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
48993    if (element != null) {
48994      open(name);
48995      composeMedicationKnowledgeMonographComponentProperties(element);
48996      close();
48997    }
48998  }
48999
49000  protected void composeMedicationKnowledgeMonographComponentProperties(MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
49001    composeBackboneElementProperties(element);
49002      if (element.hasType()) {
49003        composeCodeableConcept("type", element.getType());
49004      }
49005      if (element.hasSource()) {
49006        composeReference("source", element.getSource());
49007      }
49008  }
49009
49010  protected void composeMedicationKnowledgeIngredientComponent(String name, MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
49011    if (element != null) {
49012      open(name);
49013      composeMedicationKnowledgeIngredientComponentProperties(element);
49014      close();
49015    }
49016  }
49017
49018  protected void composeMedicationKnowledgeIngredientComponentProperties(MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
49019    composeBackboneElementProperties(element);
49020      if (element.hasItem()) {
49021        composeType("item", element.getItem());
49022      }
49023      if (element.hasIsActiveElement()) {
49024        composeBooleanCore("isActive", element.getIsActiveElement(), false);
49025        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
49026      }
49027      if (element.hasStrength()) {
49028        composeType("strength", element.getStrength());
49029      }
49030  }
49031
49032  protected void composeMedicationKnowledgeCostComponent(String name, MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
49033    if (element != null) {
49034      open(name);
49035      composeMedicationKnowledgeCostComponentProperties(element);
49036      close();
49037    }
49038  }
49039
49040  protected void composeMedicationKnowledgeCostComponentProperties(MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
49041    composeBackboneElementProperties(element);
49042      if (element.hasType()) {
49043        composeCodeableConcept("type", element.getType());
49044      }
49045      if (element.hasSourceElement()) {
49046        composeStringCore("source", element.getSourceElement(), false);
49047        composeStringExtras("source", element.getSourceElement(), false);
49048      }
49049      if (element.hasCost()) {
49050        composeMoney("cost", element.getCost());
49051      }
49052  }
49053
49054  protected void composeMedicationKnowledgeMonitoringProgramComponent(String name, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
49055    if (element != null) {
49056      open(name);
49057      composeMedicationKnowledgeMonitoringProgramComponentProperties(element);
49058      close();
49059    }
49060  }
49061
49062  protected void composeMedicationKnowledgeMonitoringProgramComponentProperties(MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
49063    composeBackboneElementProperties(element);
49064      if (element.hasType()) {
49065        composeCodeableConcept("type", element.getType());
49066      }
49067      if (element.hasNameElement()) {
49068        composeStringCore("name", element.getNameElement(), false);
49069        composeStringExtras("name", element.getNameElement(), false);
49070      }
49071  }
49072
49073  protected void composeMedicationKnowledgeAdministrationGuidelineComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent element) throws IOException {
49074    if (element != null) {
49075      open(name);
49076      composeMedicationKnowledgeAdministrationGuidelineComponentProperties(element);
49077      close();
49078    }
49079  }
49080
49081  protected void composeMedicationKnowledgeAdministrationGuidelineComponentProperties(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent element) throws IOException {
49082    composeBackboneElementProperties(element);
49083      if (element.hasDosage()) {
49084        openArray("dosage");
49085        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent e : element.getDosage()) 
49086          composeMedicationKnowledgeAdministrationGuidelineDosageComponent(null, e);
49087        closeArray();
49088      };
49089      if (element.hasIndication()) {
49090        composeType("indication", element.getIndication());
49091      }
49092      if (element.hasPatientCharacteristic()) {
49093        openArray("patientCharacteristic");
49094        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent e : element.getPatientCharacteristic()) 
49095          composeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent(null, e);
49096        closeArray();
49097      };
49098  }
49099
49100  protected void composeMedicationKnowledgeAdministrationGuidelineDosageComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent element) throws IOException {
49101    if (element != null) {
49102      open(name);
49103      composeMedicationKnowledgeAdministrationGuidelineDosageComponentProperties(element);
49104      close();
49105    }
49106  }
49107
49108  protected void composeMedicationKnowledgeAdministrationGuidelineDosageComponentProperties(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent element) throws IOException {
49109    composeBackboneElementProperties(element);
49110      if (element.hasType()) {
49111        composeCodeableConcept("type", element.getType());
49112      }
49113      if (element.hasDosage()) {
49114        openArray("dosage");
49115        for (Dosage e : element.getDosage()) 
49116          composeDosage(null, e);
49117        closeArray();
49118      };
49119  }
49120
49121  protected void composeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent element) throws IOException {
49122    if (element != null) {
49123      open(name);
49124      composeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponentProperties(element);
49125      close();
49126    }
49127  }
49128
49129  protected void composeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponentProperties(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent element) throws IOException {
49130    composeBackboneElementProperties(element);
49131      if (element.hasCharacteristic()) {
49132        composeType("characteristic", element.getCharacteristic());
49133      }
49134      if (element.hasValue()) {
49135        openArray("value");
49136        for (StringType e : element.getValue()) 
49137          composeStringCore(null, e, true);
49138        closeArray();
49139        if (anyHasExtras(element.getValue())) {
49140          openArray("_value");
49141          for (StringType e : element.getValue()) 
49142            composeStringExtras(null, e, true);
49143          closeArray();
49144        }
49145      };
49146  }
49147
49148  protected void composeMedicationKnowledgeMedicineClassificationComponent(String name, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
49149    if (element != null) {
49150      open(name);
49151      composeMedicationKnowledgeMedicineClassificationComponentProperties(element);
49152      close();
49153    }
49154  }
49155
49156  protected void composeMedicationKnowledgeMedicineClassificationComponentProperties(MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
49157    composeBackboneElementProperties(element);
49158      if (element.hasType()) {
49159        composeCodeableConcept("type", element.getType());
49160      }
49161      if (element.hasClassification()) {
49162        openArray("classification");
49163        for (CodeableConcept e : element.getClassification()) 
49164          composeCodeableConcept(null, e);
49165        closeArray();
49166      };
49167  }
49168
49169  protected void composeMedicationKnowledgePackagingComponent(String name, MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
49170    if (element != null) {
49171      open(name);
49172      composeMedicationKnowledgePackagingComponentProperties(element);
49173      close();
49174    }
49175  }
49176
49177  protected void composeMedicationKnowledgePackagingComponentProperties(MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
49178    composeBackboneElementProperties(element);
49179      if (element.hasType()) {
49180        composeCodeableConcept("type", element.getType());
49181      }
49182      if (element.hasQuantity()) {
49183        composeQuantity("quantity", element.getQuantity());
49184      }
49185      if (element.hasDevice()) {
49186        composeReference("device", element.getDevice());
49187      }
49188      if (element.hasMaterial()) {
49189        composeCodeableConcept("material", element.getMaterial());
49190      }
49191      if (element.hasPackaging()) {
49192        openArray("packaging");
49193        for (MedicationKnowledge.MedicationKnowledgePackagingComponent e : element.getPackaging()) 
49194          composeMedicationKnowledgePackagingComponent(null, e);
49195        closeArray();
49196      };
49197  }
49198
49199  protected void composeMedicationKnowledgeDrugCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
49200    if (element != null) {
49201      open(name);
49202      composeMedicationKnowledgeDrugCharacteristicComponentProperties(element);
49203      close();
49204    }
49205  }
49206
49207  protected void composeMedicationKnowledgeDrugCharacteristicComponentProperties(MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
49208    composeBackboneElementProperties(element);
49209      if (element.hasType()) {
49210        composeCodeableConcept("type", element.getType());
49211      }
49212      if (element.hasValue()) {
49213        composeType("value", element.getValue());
49214      }
49215  }
49216
49217  protected void composeMedicationKnowledgeRegulatoryComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
49218    if (element != null) {
49219      open(name);
49220      composeMedicationKnowledgeRegulatoryComponentProperties(element);
49221      close();
49222    }
49223  }
49224
49225  protected void composeMedicationKnowledgeRegulatoryComponentProperties(MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
49226    composeBackboneElementProperties(element);
49227      if (element.hasRegulatoryAuthority()) {
49228        composeReference("regulatoryAuthority", element.getRegulatoryAuthority());
49229      }
49230      if (element.hasSubstitution()) {
49231        openArray("substitution");
49232        for (MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent e : element.getSubstitution()) 
49233          composeMedicationKnowledgeRegulatorySubstitutionComponent(null, e);
49234        closeArray();
49235      };
49236      if (element.hasSchedule()) {
49237        openArray("schedule");
49238        for (CodeableConcept e : element.getSchedule()) 
49239          composeCodeableConcept(null, e);
49240        closeArray();
49241      };
49242      if (element.hasMaxDispense()) {
49243        composeMedicationKnowledgeRegulatoryMaxDispenseComponent("maxDispense", element.getMaxDispense());
49244      }
49245  }
49246
49247  protected void composeMedicationKnowledgeRegulatorySubstitutionComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
49248    if (element != null) {
49249      open(name);
49250      composeMedicationKnowledgeRegulatorySubstitutionComponentProperties(element);
49251      close();
49252    }
49253  }
49254
49255  protected void composeMedicationKnowledgeRegulatorySubstitutionComponentProperties(MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
49256    composeBackboneElementProperties(element);
49257      if (element.hasType()) {
49258        composeCodeableConcept("type", element.getType());
49259      }
49260      if (element.hasAllowedElement()) {
49261        composeBooleanCore("allowed", element.getAllowedElement(), false);
49262        composeBooleanExtras("allowed", element.getAllowedElement(), false);
49263      }
49264  }
49265
49266  protected void composeMedicationKnowledgeRegulatoryMaxDispenseComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
49267    if (element != null) {
49268      open(name);
49269      composeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(element);
49270      close();
49271    }
49272  }
49273
49274  protected void composeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
49275    composeBackboneElementProperties(element);
49276      if (element.hasQuantity()) {
49277        composeQuantity("quantity", element.getQuantity());
49278      }
49279      if (element.hasPeriod()) {
49280        composeDuration("period", element.getPeriod());
49281      }
49282  }
49283
49284  protected void composeMedicationKnowledgeKineticCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent element) throws IOException {
49285    if (element != null) {
49286      open(name);
49287      composeMedicationKnowledgeKineticCharacteristicComponentProperties(element);
49288      close();
49289    }
49290  }
49291
49292  protected void composeMedicationKnowledgeKineticCharacteristicComponentProperties(MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent element) throws IOException {
49293    composeBackboneElementProperties(element);
49294      if (element.hasType()) {
49295        composeCodeableConcept("type", element.getType());
49296      }
49297      if (element.hasValue()) {
49298        composeType("value", element.getValue());
49299      }
49300  }
49301
49302  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
49303    if (element != null) {
49304      prop("resourceType", name);
49305      composeMedicationRequestProperties(element);
49306    }
49307  }
49308
49309  protected void composeMedicationRequestProperties(MedicationRequest element) throws IOException {
49310    composeDomainResourceProperties(element);
49311      if (element.hasIdentifier()) {
49312        openArray("identifier");
49313        for (Identifier e : element.getIdentifier()) 
49314          composeIdentifier(null, e);
49315        closeArray();
49316      };
49317      if (element.hasStatusElement()) {
49318        composeEnumerationCore("status", element.getStatusElement(), new MedicationRequest.MedicationrequestStatusEnumFactory(), false);
49319        composeEnumerationExtras("status", element.getStatusElement(), new MedicationRequest.MedicationrequestStatusEnumFactory(), false);
49320      }
49321      if (element.hasStatusReason()) {
49322        composeCodeableConcept("statusReason", element.getStatusReason());
49323      }
49324      if (element.hasIntentElement()) {
49325        composeEnumerationCore("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
49326        composeEnumerationExtras("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
49327      }
49328      if (element.hasCategory()) {
49329        openArray("category");
49330        for (CodeableConcept e : element.getCategory()) 
49331          composeCodeableConcept(null, e);
49332        closeArray();
49333      };
49334      if (element.hasPriorityElement()) {
49335        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
49336        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
49337      }
49338      if (element.hasDoNotPerformElement()) {
49339        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
49340        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
49341      }
49342      if (element.hasReportedElement()) {
49343        composeBooleanCore("reported", element.getReportedElement(), false);
49344        composeBooleanExtras("reported", element.getReportedElement(), false);
49345      }
49346      if (element.hasInformationSource()) {
49347        composeReference("informationSource", element.getInformationSource());
49348      }
49349      if (element.hasMedication()) {
49350        composeType("medication", element.getMedication());
49351      }
49352      if (element.hasSubject()) {
49353        composeReference("subject", element.getSubject());
49354      }
49355      if (element.hasEncounter()) {
49356        composeReference("encounter", element.getEncounter());
49357      }
49358      if (element.hasSupportingInformation()) {
49359        openArray("supportingInformation");
49360        for (Reference e : element.getSupportingInformation()) 
49361          composeReference(null, e);
49362        closeArray();
49363      };
49364      if (element.hasAuthoredOnElement()) {
49365        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
49366        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
49367      }
49368      if (element.hasRequester()) {
49369        composeReference("requester", element.getRequester());
49370      }
49371      if (element.hasPerformer()) {
49372        composeReference("performer", element.getPerformer());
49373      }
49374      if (element.hasPerformerType()) {
49375        composeCodeableConcept("performerType", element.getPerformerType());
49376      }
49377      if (element.hasRecorder()) {
49378        composeReference("recorder", element.getRecorder());
49379      }
49380      if (element.hasReason()) {
49381        openArray("reason");
49382        for (CodeableReference e : element.getReason()) 
49383          composeCodeableReference(null, e);
49384        closeArray();
49385      };
49386      if (element.hasInstantiatesCanonical()) {
49387        openArray("instantiatesCanonical");
49388        for (CanonicalType e : element.getInstantiatesCanonical()) 
49389          composeCanonicalCore(null, e, true);
49390        closeArray();
49391        if (anyHasExtras(element.getInstantiatesCanonical())) {
49392          openArray("_instantiatesCanonical");
49393          for (CanonicalType e : element.getInstantiatesCanonical()) 
49394            composeCanonicalExtras(null, e, true);
49395          closeArray();
49396        }
49397      };
49398      if (element.hasInstantiatesUri()) {
49399        openArray("instantiatesUri");
49400        for (UriType e : element.getInstantiatesUri()) 
49401          composeUriCore(null, e, true);
49402        closeArray();
49403        if (anyHasExtras(element.getInstantiatesUri())) {
49404          openArray("_instantiatesUri");
49405          for (UriType e : element.getInstantiatesUri()) 
49406            composeUriExtras(null, e, true);
49407          closeArray();
49408        }
49409      };
49410      if (element.hasBasedOn()) {
49411        openArray("basedOn");
49412        for (Reference e : element.getBasedOn()) 
49413          composeReference(null, e);
49414        closeArray();
49415      };
49416      if (element.hasGroupIdentifier()) {
49417        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
49418      }
49419      if (element.hasCourseOfTherapyType()) {
49420        composeCodeableConcept("courseOfTherapyType", element.getCourseOfTherapyType());
49421      }
49422      if (element.hasInsurance()) {
49423        openArray("insurance");
49424        for (Reference e : element.getInsurance()) 
49425          composeReference(null, e);
49426        closeArray();
49427      };
49428      if (element.hasNote()) {
49429        openArray("note");
49430        for (Annotation e : element.getNote()) 
49431          composeAnnotation(null, e);
49432        closeArray();
49433      };
49434      if (element.hasRenderedDosageInstructionElement()) {
49435        composeStringCore("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
49436        composeStringExtras("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
49437      }
49438      if (element.hasDosageInstruction()) {
49439        openArray("dosageInstruction");
49440        for (Dosage e : element.getDosageInstruction()) 
49441          composeDosage(null, e);
49442        closeArray();
49443      };
49444      if (element.hasDispenseRequest()) {
49445        composeMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
49446      }
49447      if (element.hasSubstitution()) {
49448        composeMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
49449      }
49450      if (element.hasPriorPrescription()) {
49451        composeReference("priorPrescription", element.getPriorPrescription());
49452      }
49453      if (element.hasDetectedIssue()) {
49454        openArray("detectedIssue");
49455        for (Reference e : element.getDetectedIssue()) 
49456          composeReference(null, e);
49457        closeArray();
49458      };
49459      if (element.hasEventHistory()) {
49460        openArray("eventHistory");
49461        for (Reference e : element.getEventHistory()) 
49462          composeReference(null, e);
49463        closeArray();
49464      };
49465  }
49466
49467  protected void composeMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
49468    if (element != null) {
49469      open(name);
49470      composeMedicationRequestDispenseRequestComponentProperties(element);
49471      close();
49472    }
49473  }
49474
49475  protected void composeMedicationRequestDispenseRequestComponentProperties(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
49476    composeBackboneElementProperties(element);
49477      if (element.hasInitialFill()) {
49478        composeMedicationRequestDispenseRequestInitialFillComponent("initialFill", element.getInitialFill());
49479      }
49480      if (element.hasDispenseInterval()) {
49481        composeDuration("dispenseInterval", element.getDispenseInterval());
49482      }
49483      if (element.hasValidityPeriod()) {
49484        composePeriod("validityPeriod", element.getValidityPeriod());
49485      }
49486      if (element.hasNumberOfRepeatsAllowedElement()) {
49487        composeUnsignedIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
49488        composeUnsignedIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
49489      }
49490      if (element.hasQuantity()) {
49491        composeQuantity("quantity", element.getQuantity());
49492      }
49493      if (element.hasExpectedSupplyDuration()) {
49494        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
49495      }
49496      if (element.hasDispenser()) {
49497        composeReference("dispenser", element.getDispenser());
49498      }
49499  }
49500
49501  protected void composeMedicationRequestDispenseRequestInitialFillComponent(String name, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
49502    if (element != null) {
49503      open(name);
49504      composeMedicationRequestDispenseRequestInitialFillComponentProperties(element);
49505      close();
49506    }
49507  }
49508
49509  protected void composeMedicationRequestDispenseRequestInitialFillComponentProperties(MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
49510    composeBackboneElementProperties(element);
49511      if (element.hasQuantity()) {
49512        composeQuantity("quantity", element.getQuantity());
49513      }
49514      if (element.hasDuration()) {
49515        composeDuration("duration", element.getDuration());
49516      }
49517  }
49518
49519  protected void composeMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
49520    if (element != null) {
49521      open(name);
49522      composeMedicationRequestSubstitutionComponentProperties(element);
49523      close();
49524    }
49525  }
49526
49527  protected void composeMedicationRequestSubstitutionComponentProperties(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
49528    composeBackboneElementProperties(element);
49529      if (element.hasAllowed()) {
49530        composeType("allowed", element.getAllowed());
49531      }
49532      if (element.hasReason()) {
49533        composeCodeableConcept("reason", element.getReason());
49534      }
49535  }
49536
49537  protected void composeMedicationUsage(String name, MedicationUsage element) throws IOException {
49538    if (element != null) {
49539      prop("resourceType", name);
49540      composeMedicationUsageProperties(element);
49541    }
49542  }
49543
49544  protected void composeMedicationUsageProperties(MedicationUsage element) throws IOException {
49545    composeDomainResourceProperties(element);
49546      if (element.hasIdentifier()) {
49547        openArray("identifier");
49548        for (Identifier e : element.getIdentifier()) 
49549          composeIdentifier(null, e);
49550        closeArray();
49551      };
49552      if (element.hasBasedOn()) {
49553        openArray("basedOn");
49554        for (Reference e : element.getBasedOn()) 
49555          composeReference(null, e);
49556        closeArray();
49557      };
49558      if (element.hasPartOf()) {
49559        openArray("partOf");
49560        for (Reference e : element.getPartOf()) 
49561          composeReference(null, e);
49562        closeArray();
49563      };
49564      if (element.hasStatusElement()) {
49565        composeEnumerationCore("status", element.getStatusElement(), new MedicationUsage.MedicationUsageStatusCodesEnumFactory(), false);
49566        composeEnumerationExtras("status", element.getStatusElement(), new MedicationUsage.MedicationUsageStatusCodesEnumFactory(), false);
49567      }
49568      if (element.hasStatusReason()) {
49569        openArray("statusReason");
49570        for (CodeableConcept e : element.getStatusReason()) 
49571          composeCodeableConcept(null, e);
49572        closeArray();
49573      };
49574      if (element.hasCategory()) {
49575        openArray("category");
49576        for (CodeableConcept e : element.getCategory()) 
49577          composeCodeableConcept(null, e);
49578        closeArray();
49579      };
49580      if (element.hasMedication()) {
49581        composeType("medication", element.getMedication());
49582      }
49583      if (element.hasSubject()) {
49584        composeReference("subject", element.getSubject());
49585      }
49586      if (element.hasEncounter()) {
49587        composeReference("encounter", element.getEncounter());
49588      }
49589      if (element.hasEffective()) {
49590        composeType("effective", element.getEffective());
49591      }
49592      if (element.hasDateAssertedElement()) {
49593        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
49594        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
49595      }
49596      if (element.hasInformationSource()) {
49597        composeReference("informationSource", element.getInformationSource());
49598      }
49599      if (element.hasDerivedFrom()) {
49600        openArray("derivedFrom");
49601        for (Reference e : element.getDerivedFrom()) 
49602          composeReference(null, e);
49603        closeArray();
49604      };
49605      if (element.hasReason()) {
49606        openArray("reason");
49607        for (CodeableReference e : element.getReason()) 
49608          composeCodeableReference(null, e);
49609        closeArray();
49610      };
49611      if (element.hasNote()) {
49612        openArray("note");
49613        for (Annotation e : element.getNote()) 
49614          composeAnnotation(null, e);
49615        closeArray();
49616      };
49617      if (element.hasRenderedDosageInstructionElement()) {
49618        composeStringCore("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
49619        composeStringExtras("renderedDosageInstruction", element.getRenderedDosageInstructionElement(), false);
49620      }
49621      if (element.hasDosage()) {
49622        openArray("dosage");
49623        for (Dosage e : element.getDosage()) 
49624          composeDosage(null, e);
49625        closeArray();
49626      };
49627      if (element.hasTakenAsOrderedElement()) {
49628        composeBooleanCore("takenAsOrdered", element.getTakenAsOrderedElement(), false);
49629        composeBooleanExtras("takenAsOrdered", element.getTakenAsOrderedElement(), false);
49630      }
49631  }
49632
49633  protected void composeMedicinalProductDefinition(String name, MedicinalProductDefinition element) throws IOException {
49634    if (element != null) {
49635      prop("resourceType", name);
49636      composeMedicinalProductDefinitionProperties(element);
49637    }
49638  }
49639
49640  protected void composeMedicinalProductDefinitionProperties(MedicinalProductDefinition element) throws IOException {
49641    composeDomainResourceProperties(element);
49642      if (element.hasIdentifier()) {
49643        openArray("identifier");
49644        for (Identifier e : element.getIdentifier()) 
49645          composeIdentifier(null, e);
49646        closeArray();
49647      };
49648      if (element.hasType()) {
49649        composeCodeableConcept("type", element.getType());
49650      }
49651      if (element.hasDomain()) {
49652        composeCoding("domain", element.getDomain());
49653      }
49654      if (element.hasVersionElement()) {
49655        composeStringCore("version", element.getVersionElement(), false);
49656        composeStringExtras("version", element.getVersionElement(), false);
49657      }
49658      if (element.hasStatus()) {
49659        composeCoding("status", element.getStatus());
49660      }
49661      if (element.hasDescriptionElement()) {
49662        composeMarkdownCore("description", element.getDescriptionElement(), false);
49663        composeMarkdownExtras("description", element.getDescriptionElement(), false);
49664      }
49665      if (element.hasCombinedPharmaceuticalDoseForm()) {
49666        composeCodeableConcept("combinedPharmaceuticalDoseForm", element.getCombinedPharmaceuticalDoseForm());
49667      }
49668      if (element.hasIndicationElement()) {
49669        composeMarkdownCore("indication", element.getIndicationElement(), false);
49670        composeMarkdownExtras("indication", element.getIndicationElement(), false);
49671      }
49672      if (element.hasLegalStatusOfSupply()) {
49673        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
49674      }
49675      if (element.hasAdditionalMonitoringIndicator()) {
49676        composeCodeableConcept("additionalMonitoringIndicator", element.getAdditionalMonitoringIndicator());
49677      }
49678      if (element.hasSpecialMeasures()) {
49679        openArray("specialMeasures");
49680        for (CodeableConcept e : element.getSpecialMeasures()) 
49681          composeCodeableConcept(null, e);
49682        closeArray();
49683      };
49684      if (element.hasPaediatricUseIndicator()) {
49685        composeCodeableConcept("paediatricUseIndicator", element.getPaediatricUseIndicator());
49686      }
49687      if (element.hasProductClassification()) {
49688        openArray("productClassification");
49689        for (CodeableConcept e : element.getProductClassification()) 
49690          composeCodeableConcept(null, e);
49691        closeArray();
49692      };
49693      if (element.hasMarketingStatus()) {
49694        openArray("marketingStatus");
49695        for (MarketingStatus e : element.getMarketingStatus()) 
49696          composeMarketingStatus(null, e);
49697        closeArray();
49698      };
49699      if (element.hasPharmaceuticalProduct()) {
49700        openArray("pharmaceuticalProduct");
49701        for (Reference e : element.getPharmaceuticalProduct()) 
49702          composeReference(null, e);
49703        closeArray();
49704      };
49705      if (element.hasPackagedMedicinalProduct()) {
49706        openArray("packagedMedicinalProduct");
49707        for (Reference e : element.getPackagedMedicinalProduct()) 
49708          composeReference(null, e);
49709        closeArray();
49710      };
49711      if (element.hasIngredient()) {
49712        openArray("ingredient");
49713        for (Reference e : element.getIngredient()) 
49714          composeReference(null, e);
49715        closeArray();
49716      };
49717      if (element.hasAttachedDocument()) {
49718        openArray("attachedDocument");
49719        for (Reference e : element.getAttachedDocument()) 
49720          composeReference(null, e);
49721        closeArray();
49722      };
49723      if (element.hasMasterFile()) {
49724        openArray("masterFile");
49725        for (Reference e : element.getMasterFile()) 
49726          composeReference(null, e);
49727        closeArray();
49728      };
49729      if (element.hasContact()) {
49730        openArray("contact");
49731        for (MedicinalProductDefinition.MedicinalProductDefinitionContactComponent e : element.getContact()) 
49732          composeMedicinalProductDefinitionContactComponent(null, e);
49733        closeArray();
49734      };
49735      if (element.hasClinicalTrial()) {
49736        openArray("clinicalTrial");
49737        for (Reference e : element.getClinicalTrial()) 
49738          composeReference(null, e);
49739        closeArray();
49740      };
49741      if (element.hasName()) {
49742        openArray("name");
49743        for (MedicinalProductDefinition.MedicinalProductDefinitionNameComponent e : element.getName()) 
49744          composeMedicinalProductDefinitionNameComponent(null, e);
49745        closeArray();
49746      };
49747      if (element.hasCrossReference()) {
49748        openArray("crossReference");
49749        for (MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent e : element.getCrossReference()) 
49750          composeMedicinalProductDefinitionCrossReferenceComponent(null, e);
49751        closeArray();
49752      };
49753      if (element.hasManufacturingBusinessOperation()) {
49754        openArray("manufacturingBusinessOperation");
49755        for (MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent e : element.getManufacturingBusinessOperation()) 
49756          composeMedicinalProductDefinitionManufacturingBusinessOperationComponent(null, e);
49757        closeArray();
49758      };
49759  }
49760
49761  protected void composeMedicinalProductDefinitionContactComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionContactComponent element) throws IOException {
49762    if (element != null) {
49763      open(name);
49764      composeMedicinalProductDefinitionContactComponentProperties(element);
49765      close();
49766    }
49767  }
49768
49769  protected void composeMedicinalProductDefinitionContactComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionContactComponent element) throws IOException {
49770    composeBackboneElementProperties(element);
49771      if (element.hasType()) {
49772        composeCodeableConcept("type", element.getType());
49773      }
49774      if (element.hasContact()) {
49775        composeReference("contact", element.getContact());
49776      }
49777  }
49778
49779  protected void composeMedicinalProductDefinitionNameComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameComponent element) throws IOException {
49780    if (element != null) {
49781      open(name);
49782      composeMedicinalProductDefinitionNameComponentProperties(element);
49783      close();
49784    }
49785  }
49786
49787  protected void composeMedicinalProductDefinitionNameComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionNameComponent element) throws IOException {
49788    composeBackboneElementProperties(element);
49789      if (element.hasProductNameElement()) {
49790        composeStringCore("productName", element.getProductNameElement(), false);
49791        composeStringExtras("productName", element.getProductNameElement(), false);
49792      }
49793      if (element.hasType()) {
49794        composeCoding("type", element.getType());
49795      }
49796      if (element.hasNamePart()) {
49797        openArray("namePart");
49798        for (MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent e : element.getNamePart()) 
49799          composeMedicinalProductDefinitionNameNamePartComponent(null, e);
49800        closeArray();
49801      };
49802      if (element.hasCountryLanguage()) {
49803        openArray("countryLanguage");
49804        for (MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent e : element.getCountryLanguage()) 
49805          composeMedicinalProductDefinitionNameCountryLanguageComponent(null, e);
49806        closeArray();
49807      };
49808  }
49809
49810  protected void composeMedicinalProductDefinitionNameNamePartComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent element) throws IOException {
49811    if (element != null) {
49812      open(name);
49813      composeMedicinalProductDefinitionNameNamePartComponentProperties(element);
49814      close();
49815    }
49816  }
49817
49818  protected void composeMedicinalProductDefinitionNameNamePartComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent element) throws IOException {
49819    composeBackboneElementProperties(element);
49820      if (element.hasPartElement()) {
49821        composeStringCore("part", element.getPartElement(), false);
49822        composeStringExtras("part", element.getPartElement(), false);
49823      }
49824      if (element.hasType()) {
49825        composeCoding("type", element.getType());
49826      }
49827  }
49828
49829  protected void composeMedicinalProductDefinitionNameCountryLanguageComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent element) throws IOException {
49830    if (element != null) {
49831      open(name);
49832      composeMedicinalProductDefinitionNameCountryLanguageComponentProperties(element);
49833      close();
49834    }
49835  }
49836
49837  protected void composeMedicinalProductDefinitionNameCountryLanguageComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent element) throws IOException {
49838    composeBackboneElementProperties(element);
49839      if (element.hasCountry()) {
49840        composeCodeableConcept("country", element.getCountry());
49841      }
49842      if (element.hasJurisdiction()) {
49843        composeCodeableConcept("jurisdiction", element.getJurisdiction());
49844      }
49845      if (element.hasLanguage()) {
49846        composeCodeableConcept("language", element.getLanguage());
49847      }
49848  }
49849
49850  protected void composeMedicinalProductDefinitionCrossReferenceComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent element) throws IOException {
49851    if (element != null) {
49852      open(name);
49853      composeMedicinalProductDefinitionCrossReferenceComponentProperties(element);
49854      close();
49855    }
49856  }
49857
49858  protected void composeMedicinalProductDefinitionCrossReferenceComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent element) throws IOException {
49859    composeBackboneElementProperties(element);
49860      if (element.hasProduct()) {
49861        composeType("product", element.getProduct());
49862      }
49863      if (element.hasType()) {
49864        composeCoding("type", element.getType());
49865      }
49866  }
49867
49868  protected void composeMedicinalProductDefinitionManufacturingBusinessOperationComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent element) throws IOException {
49869    if (element != null) {
49870      open(name);
49871      composeMedicinalProductDefinitionManufacturingBusinessOperationComponentProperties(element);
49872      close();
49873    }
49874  }
49875
49876  protected void composeMedicinalProductDefinitionManufacturingBusinessOperationComponentProperties(MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent element) throws IOException {
49877    composeBackboneElementProperties(element);
49878      if (element.hasType()) {
49879        composeType("type", element.getType());
49880      }
49881      if (element.hasEffectiveDate()) {
49882        composePeriod("effectiveDate", element.getEffectiveDate());
49883      }
49884      if (element.hasManufacturer()) {
49885        openArray("manufacturer");
49886        for (Reference e : element.getManufacturer()) 
49887          composeReference(null, e);
49888        closeArray();
49889      };
49890      if (element.hasAuthorization()) {
49891        composeReference("authorization", element.getAuthorization());
49892      }
49893      if (element.hasConfidentialityIndicator()) {
49894        composeCodeableConcept("confidentialityIndicator", element.getConfidentialityIndicator());
49895      }
49896  }
49897
49898  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
49899    if (element != null) {
49900      prop("resourceType", name);
49901      composeMessageDefinitionProperties(element);
49902    }
49903  }
49904
49905  protected void composeMessageDefinitionProperties(MessageDefinition element) throws IOException {
49906    composeCanonicalResourceProperties(element);
49907      if (element.hasUrlElement()) {
49908        composeUriCore("url", element.getUrlElement(), false);
49909        composeUriExtras("url", element.getUrlElement(), false);
49910      }
49911      if (element.hasIdentifier()) {
49912        openArray("identifier");
49913        for (Identifier e : element.getIdentifier()) 
49914          composeIdentifier(null, e);
49915        closeArray();
49916      };
49917      if (element.hasVersionElement()) {
49918        composeStringCore("version", element.getVersionElement(), false);
49919        composeStringExtras("version", element.getVersionElement(), false);
49920      }
49921      if (element.hasNameElement()) {
49922        composeStringCore("name", element.getNameElement(), false);
49923        composeStringExtras("name", element.getNameElement(), false);
49924      }
49925      if (element.hasTitleElement()) {
49926        composeStringCore("title", element.getTitleElement(), false);
49927        composeStringExtras("title", element.getTitleElement(), false);
49928      }
49929      if (element.hasReplaces()) {
49930        openArray("replaces");
49931        for (CanonicalType e : element.getReplaces()) 
49932          composeCanonicalCore(null, e, true);
49933        closeArray();
49934        if (anyHasExtras(element.getReplaces())) {
49935          openArray("_replaces");
49936          for (CanonicalType e : element.getReplaces()) 
49937            composeCanonicalExtras(null, e, true);
49938          closeArray();
49939        }
49940      };
49941      if (element.hasStatusElement()) {
49942        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49943        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49944      }
49945      if (element.hasExperimentalElement()) {
49946        composeBooleanCore("experimental", element.getExperimentalElement(), false);
49947        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
49948      }
49949      if (element.hasDateElement()) {
49950        composeDateTimeCore("date", element.getDateElement(), false);
49951        composeDateTimeExtras("date", element.getDateElement(), false);
49952      }
49953      if (element.hasPublisherElement()) {
49954        composeStringCore("publisher", element.getPublisherElement(), false);
49955        composeStringExtras("publisher", element.getPublisherElement(), false);
49956      }
49957      if (element.hasContact()) {
49958        openArray("contact");
49959        for (ContactDetail e : element.getContact()) 
49960          composeContactDetail(null, e);
49961        closeArray();
49962      };
49963      if (element.hasDescriptionElement()) {
49964        composeMarkdownCore("description", element.getDescriptionElement(), false);
49965        composeMarkdownExtras("description", element.getDescriptionElement(), false);
49966      }
49967      if (element.hasUseContext()) {
49968        openArray("useContext");
49969        for (UsageContext e : element.getUseContext()) 
49970          composeUsageContext(null, e);
49971        closeArray();
49972      };
49973      if (element.hasJurisdiction()) {
49974        openArray("jurisdiction");
49975        for (CodeableConcept e : element.getJurisdiction()) 
49976          composeCodeableConcept(null, e);
49977        closeArray();
49978      };
49979      if (element.hasPurposeElement()) {
49980        composeMarkdownCore("purpose", element.getPurposeElement(), false);
49981        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
49982      }
49983      if (element.hasCopyrightElement()) {
49984        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
49985        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
49986      }
49987      if (element.hasBaseElement()) {
49988        composeCanonicalCore("base", element.getBaseElement(), false);
49989        composeCanonicalExtras("base", element.getBaseElement(), false);
49990      }
49991      if (element.hasParent()) {
49992        openArray("parent");
49993        for (CanonicalType e : element.getParent()) 
49994          composeCanonicalCore(null, e, true);
49995        closeArray();
49996        if (anyHasExtras(element.getParent())) {
49997          openArray("_parent");
49998          for (CanonicalType e : element.getParent()) 
49999            composeCanonicalExtras(null, e, true);
50000          closeArray();
50001        }
50002      };
50003      if (element.hasEvent()) {
50004        composeType("event", element.getEvent());
50005      }
50006      if (element.hasCategoryElement()) {
50007        composeEnumerationCore("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
50008        composeEnumerationExtras("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
50009      }
50010      if (element.hasFocus()) {
50011        openArray("focus");
50012        for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus()) 
50013          composeMessageDefinitionFocusComponent(null, e);
50014        closeArray();
50015      };
50016      if (element.hasResponseRequiredElement()) {
50017        composeEnumerationCore("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
50018        composeEnumerationExtras("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
50019      }
50020      if (element.hasAllowedResponse()) {
50021        openArray("allowedResponse");
50022        for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
50023          composeMessageDefinitionAllowedResponseComponent(null, e);
50024        closeArray();
50025      };
50026      if (element.hasGraph()) {
50027        openArray("graph");
50028        for (CanonicalType e : element.getGraph()) 
50029          composeCanonicalCore(null, e, true);
50030        closeArray();
50031        if (anyHasExtras(element.getGraph())) {
50032          openArray("_graph");
50033          for (CanonicalType e : element.getGraph()) 
50034            composeCanonicalExtras(null, e, true);
50035          closeArray();
50036        }
50037      };
50038  }
50039
50040  protected void composeMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
50041    if (element != null) {
50042      open(name);
50043      composeMessageDefinitionFocusComponentProperties(element);
50044      close();
50045    }
50046  }
50047
50048  protected void composeMessageDefinitionFocusComponentProperties(MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
50049    composeBackboneElementProperties(element);
50050      if (element.hasCodeElement()) {
50051        composeCodeCore("code", element.getCodeElement(), false);
50052        composeCodeExtras("code", element.getCodeElement(), false);
50053      }
50054      if (element.hasProfileElement()) {
50055        composeCanonicalCore("profile", element.getProfileElement(), false);
50056        composeCanonicalExtras("profile", element.getProfileElement(), false);
50057      }
50058      if (element.hasMinElement()) {
50059        composeUnsignedIntCore("min", element.getMinElement(), false);
50060        composeUnsignedIntExtras("min", element.getMinElement(), false);
50061      }
50062      if (element.hasMaxElement()) {
50063        composeStringCore("max", element.getMaxElement(), false);
50064        composeStringExtras("max", element.getMaxElement(), false);
50065      }
50066  }
50067
50068  protected void composeMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
50069    if (element != null) {
50070      open(name);
50071      composeMessageDefinitionAllowedResponseComponentProperties(element);
50072      close();
50073    }
50074  }
50075
50076  protected void composeMessageDefinitionAllowedResponseComponentProperties(MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
50077    composeBackboneElementProperties(element);
50078      if (element.hasMessageElement()) {
50079        composeCanonicalCore("message", element.getMessageElement(), false);
50080        composeCanonicalExtras("message", element.getMessageElement(), false);
50081      }
50082      if (element.hasSituationElement()) {
50083        composeMarkdownCore("situation", element.getSituationElement(), false);
50084        composeMarkdownExtras("situation", element.getSituationElement(), false);
50085      }
50086  }
50087
50088  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
50089    if (element != null) {
50090      prop("resourceType", name);
50091      composeMessageHeaderProperties(element);
50092    }
50093  }
50094
50095  protected void composeMessageHeaderProperties(MessageHeader element) throws IOException {
50096    composeDomainResourceProperties(element);
50097      if (element.hasEvent()) {
50098        composeType("event", element.getEvent());
50099      }
50100      if (element.hasDestination()) {
50101        openArray("destination");
50102        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
50103          composeMessageDestinationComponent(null, e);
50104        closeArray();
50105      };
50106      if (element.hasSender()) {
50107        composeReference("sender", element.getSender());
50108      }
50109      if (element.hasEnterer()) {
50110        composeReference("enterer", element.getEnterer());
50111      }
50112      if (element.hasAuthor()) {
50113        composeReference("author", element.getAuthor());
50114      }
50115      if (element.hasSource()) {
50116        composeMessageSourceComponent("source", element.getSource());
50117      }
50118      if (element.hasResponsible()) {
50119        composeReference("responsible", element.getResponsible());
50120      }
50121      if (element.hasReason()) {
50122        composeCodeableConcept("reason", element.getReason());
50123      }
50124      if (element.hasResponse()) {
50125        composeMessageHeaderResponseComponent("response", element.getResponse());
50126      }
50127      if (element.hasFocus()) {
50128        openArray("focus");
50129        for (Reference e : element.getFocus()) 
50130          composeReference(null, e);
50131        closeArray();
50132      };
50133      if (element.hasDefinitionElement()) {
50134        composeCanonicalCore("definition", element.getDefinitionElement(), false);
50135        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
50136      }
50137  }
50138
50139  protected void composeMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
50140    if (element != null) {
50141      open(name);
50142      composeMessageDestinationComponentProperties(element);
50143      close();
50144    }
50145  }
50146
50147  protected void composeMessageDestinationComponentProperties(MessageHeader.MessageDestinationComponent element) throws IOException {
50148    composeBackboneElementProperties(element);
50149      if (element.hasNameElement()) {
50150        composeStringCore("name", element.getNameElement(), false);
50151        composeStringExtras("name", element.getNameElement(), false);
50152      }
50153      if (element.hasTarget()) {
50154        composeReference("target", element.getTarget());
50155      }
50156      if (element.hasEndpointElement()) {
50157        composeUrlCore("endpoint", element.getEndpointElement(), false);
50158        composeUrlExtras("endpoint", element.getEndpointElement(), false);
50159      }
50160      if (element.hasReceiver()) {
50161        composeReference("receiver", element.getReceiver());
50162      }
50163  }
50164
50165  protected void composeMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
50166    if (element != null) {
50167      open(name);
50168      composeMessageSourceComponentProperties(element);
50169      close();
50170    }
50171  }
50172
50173  protected void composeMessageSourceComponentProperties(MessageHeader.MessageSourceComponent element) throws IOException {
50174    composeBackboneElementProperties(element);
50175      if (element.hasNameElement()) {
50176        composeStringCore("name", element.getNameElement(), false);
50177        composeStringExtras("name", element.getNameElement(), false);
50178      }
50179      if (element.hasSoftwareElement()) {
50180        composeStringCore("software", element.getSoftwareElement(), false);
50181        composeStringExtras("software", element.getSoftwareElement(), false);
50182      }
50183      if (element.hasVersionElement()) {
50184        composeStringCore("version", element.getVersionElement(), false);
50185        composeStringExtras("version", element.getVersionElement(), false);
50186      }
50187      if (element.hasContact()) {
50188        composeContactPoint("contact", element.getContact());
50189      }
50190      if (element.hasEndpointElement()) {
50191        composeUrlCore("endpoint", element.getEndpointElement(), false);
50192        composeUrlExtras("endpoint", element.getEndpointElement(), false);
50193      }
50194  }
50195
50196  protected void composeMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
50197    if (element != null) {
50198      open(name);
50199      composeMessageHeaderResponseComponentProperties(element);
50200      close();
50201    }
50202  }
50203
50204  protected void composeMessageHeaderResponseComponentProperties(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
50205    composeBackboneElementProperties(element);
50206      if (element.hasIdentifierElement()) {
50207        composeIdCore("identifier", element.getIdentifierElement(), false);
50208        composeIdExtras("identifier", element.getIdentifierElement(), false);
50209      }
50210      if (element.hasCodeElement()) {
50211        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
50212        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
50213      }
50214      if (element.hasDetails()) {
50215        composeReference("details", element.getDetails());
50216      }
50217  }
50218
50219  protected void composeMolecularSequence(String name, MolecularSequence element) throws IOException {
50220    if (element != null) {
50221      prop("resourceType", name);
50222      composeMolecularSequenceProperties(element);
50223    }
50224  }
50225
50226  protected void composeMolecularSequenceProperties(MolecularSequence element) throws IOException {
50227    composeDomainResourceProperties(element);
50228      if (element.hasIdentifier()) {
50229        openArray("identifier");
50230        for (Identifier e : element.getIdentifier()) 
50231          composeIdentifier(null, e);
50232        closeArray();
50233      };
50234      if (element.hasTypeElement()) {
50235        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
50236        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
50237      }
50238      if (element.hasCoordinateSystemElement()) {
50239        composeIntegerCore("coordinateSystem", element.getCoordinateSystemElement(), false);
50240        composeIntegerExtras("coordinateSystem", element.getCoordinateSystemElement(), false);
50241      }
50242      if (element.hasPatient()) {
50243        composeReference("patient", element.getPatient());
50244      }
50245      if (element.hasSpecimen()) {
50246        composeReference("specimen", element.getSpecimen());
50247      }
50248      if (element.hasDevice()) {
50249        composeReference("device", element.getDevice());
50250      }
50251      if (element.hasPerformer()) {
50252        composeReference("performer", element.getPerformer());
50253      }
50254      if (element.hasQuantity()) {
50255        composeQuantity("quantity", element.getQuantity());
50256      }
50257      if (element.hasReferenceSeq()) {
50258        composeMolecularSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
50259      }
50260      if (element.hasVariant()) {
50261        openArray("variant");
50262        for (MolecularSequence.MolecularSequenceVariantComponent e : element.getVariant()) 
50263          composeMolecularSequenceVariantComponent(null, e);
50264        closeArray();
50265      };
50266      if (element.hasObservedSeqElement()) {
50267        composeStringCore("observedSeq", element.getObservedSeqElement(), false);
50268        composeStringExtras("observedSeq", element.getObservedSeqElement(), false);
50269      }
50270      if (element.hasQuality()) {
50271        openArray("quality");
50272        for (MolecularSequence.MolecularSequenceQualityComponent e : element.getQuality()) 
50273          composeMolecularSequenceQualityComponent(null, e);
50274        closeArray();
50275      };
50276      if (element.hasReadCoverageElement()) {
50277        composeIntegerCore("readCoverage", element.getReadCoverageElement(), false);
50278        composeIntegerExtras("readCoverage", element.getReadCoverageElement(), false);
50279      }
50280      if (element.hasRepository()) {
50281        openArray("repository");
50282        for (MolecularSequence.MolecularSequenceRepositoryComponent e : element.getRepository()) 
50283          composeMolecularSequenceRepositoryComponent(null, e);
50284        closeArray();
50285      };
50286      if (element.hasPointer()) {
50287        openArray("pointer");
50288        for (Reference e : element.getPointer()) 
50289          composeReference(null, e);
50290        closeArray();
50291      };
50292      if (element.hasStructureVariant()) {
50293        openArray("structureVariant");
50294        for (MolecularSequence.MolecularSequenceStructureVariantComponent e : element.getStructureVariant()) 
50295          composeMolecularSequenceStructureVariantComponent(null, e);
50296        closeArray();
50297      };
50298  }
50299
50300  protected void composeMolecularSequenceReferenceSeqComponent(String name, MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
50301    if (element != null) {
50302      open(name);
50303      composeMolecularSequenceReferenceSeqComponentProperties(element);
50304      close();
50305    }
50306  }
50307
50308  protected void composeMolecularSequenceReferenceSeqComponentProperties(MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
50309    composeBackboneElementProperties(element);
50310      if (element.hasChromosome()) {
50311        composeCodeableConcept("chromosome", element.getChromosome());
50312      }
50313      if (element.hasGenomeBuildElement()) {
50314        composeStringCore("genomeBuild", element.getGenomeBuildElement(), false);
50315        composeStringExtras("genomeBuild", element.getGenomeBuildElement(), false);
50316      }
50317      if (element.hasOrientationElement()) {
50318        composeEnumerationCore("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
50319        composeEnumerationExtras("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
50320      }
50321      if (element.hasReferenceSeqId()) {
50322        composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
50323      }
50324      if (element.hasReferenceSeqPointer()) {
50325        composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
50326      }
50327      if (element.hasReferenceSeqStringElement()) {
50328        composeStringCore("referenceSeqString", element.getReferenceSeqStringElement(), false);
50329        composeStringExtras("referenceSeqString", element.getReferenceSeqStringElement(), false);
50330      }
50331      if (element.hasStrandElement()) {
50332        composeEnumerationCore("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
50333        composeEnumerationExtras("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
50334      }
50335      if (element.hasWindowStartElement()) {
50336        composeIntegerCore("windowStart", element.getWindowStartElement(), false);
50337        composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
50338      }
50339      if (element.hasWindowEndElement()) {
50340        composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
50341        composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
50342      }
50343  }
50344
50345  protected void composeMolecularSequenceVariantComponent(String name, MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
50346    if (element != null) {
50347      open(name);
50348      composeMolecularSequenceVariantComponentProperties(element);
50349      close();
50350    }
50351  }
50352
50353  protected void composeMolecularSequenceVariantComponentProperties(MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
50354    composeBackboneElementProperties(element);
50355      if (element.hasStartElement()) {
50356        composeIntegerCore("start", element.getStartElement(), false);
50357        composeIntegerExtras("start", element.getStartElement(), false);
50358      }
50359      if (element.hasEndElement()) {
50360        composeIntegerCore("end", element.getEndElement(), false);
50361        composeIntegerExtras("end", element.getEndElement(), false);
50362      }
50363      if (element.hasObservedAlleleElement()) {
50364        composeStringCore("observedAllele", element.getObservedAlleleElement(), false);
50365        composeStringExtras("observedAllele", element.getObservedAlleleElement(), false);
50366      }
50367      if (element.hasReferenceAlleleElement()) {
50368        composeStringCore("referenceAllele", element.getReferenceAlleleElement(), false);
50369        composeStringExtras("referenceAllele", element.getReferenceAlleleElement(), false);
50370      }
50371      if (element.hasCigarElement()) {
50372        composeStringCore("cigar", element.getCigarElement(), false);
50373        composeStringExtras("cigar", element.getCigarElement(), false);
50374      }
50375      if (element.hasVariantPointer()) {
50376        composeReference("variantPointer", element.getVariantPointer());
50377      }
50378  }
50379
50380  protected void composeMolecularSequenceQualityComponent(String name, MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
50381    if (element != null) {
50382      open(name);
50383      composeMolecularSequenceQualityComponentProperties(element);
50384      close();
50385    }
50386  }
50387
50388  protected void composeMolecularSequenceQualityComponentProperties(MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
50389    composeBackboneElementProperties(element);
50390      if (element.hasTypeElement()) {
50391        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
50392        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
50393      }
50394      if (element.hasStandardSequence()) {
50395        composeCodeableConcept("standardSequence", element.getStandardSequence());
50396      }
50397      if (element.hasStartElement()) {
50398        composeIntegerCore("start", element.getStartElement(), false);
50399        composeIntegerExtras("start", element.getStartElement(), false);
50400      }
50401      if (element.hasEndElement()) {
50402        composeIntegerCore("end", element.getEndElement(), false);
50403        composeIntegerExtras("end", element.getEndElement(), false);
50404      }
50405      if (element.hasScore()) {
50406        composeQuantity("score", element.getScore());
50407      }
50408      if (element.hasMethod()) {
50409        composeCodeableConcept("method", element.getMethod());
50410      }
50411      if (element.hasTruthTPElement()) {
50412        composeDecimalCore("truthTP", element.getTruthTPElement(), false);
50413        composeDecimalExtras("truthTP", element.getTruthTPElement(), false);
50414      }
50415      if (element.hasQueryTPElement()) {
50416        composeDecimalCore("queryTP", element.getQueryTPElement(), false);
50417        composeDecimalExtras("queryTP", element.getQueryTPElement(), false);
50418      }
50419      if (element.hasTruthFNElement()) {
50420        composeDecimalCore("truthFN", element.getTruthFNElement(), false);
50421        composeDecimalExtras("truthFN", element.getTruthFNElement(), false);
50422      }
50423      if (element.hasQueryFPElement()) {
50424        composeDecimalCore("queryFP", element.getQueryFPElement(), false);
50425        composeDecimalExtras("queryFP", element.getQueryFPElement(), false);
50426      }
50427      if (element.hasGtFPElement()) {
50428        composeDecimalCore("gtFP", element.getGtFPElement(), false);
50429        composeDecimalExtras("gtFP", element.getGtFPElement(), false);
50430      }
50431      if (element.hasPrecisionElement()) {
50432        composeDecimalCore("precision", element.getPrecisionElement(), false);
50433        composeDecimalExtras("precision", element.getPrecisionElement(), false);
50434      }
50435      if (element.hasRecallElement()) {
50436        composeDecimalCore("recall", element.getRecallElement(), false);
50437        composeDecimalExtras("recall", element.getRecallElement(), false);
50438      }
50439      if (element.hasFScoreElement()) {
50440        composeDecimalCore("fScore", element.getFScoreElement(), false);
50441        composeDecimalExtras("fScore", element.getFScoreElement(), false);
50442      }
50443      if (element.hasRoc()) {
50444        composeMolecularSequenceQualityRocComponent("roc", element.getRoc());
50445      }
50446  }
50447
50448  protected void composeMolecularSequenceQualityRocComponent(String name, MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
50449    if (element != null) {
50450      open(name);
50451      composeMolecularSequenceQualityRocComponentProperties(element);
50452      close();
50453    }
50454  }
50455
50456  protected void composeMolecularSequenceQualityRocComponentProperties(MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
50457    composeBackboneElementProperties(element);
50458      if (element.hasScore()) {
50459        openArray("score");
50460        for (IntegerType e : element.getScore()) 
50461          composeIntegerCore(null, e, true);
50462        closeArray();
50463        if (anyHasExtras(element.getScore())) {
50464          openArray("_score");
50465          for (IntegerType e : element.getScore()) 
50466            composeIntegerExtras(null, e, true);
50467          closeArray();
50468        }
50469      };
50470      if (element.hasNumTP()) {
50471        openArray("numTP");
50472        for (IntegerType e : element.getNumTP()) 
50473          composeIntegerCore(null, e, true);
50474        closeArray();
50475        if (anyHasExtras(element.getNumTP())) {
50476          openArray("_numTP");
50477          for (IntegerType e : element.getNumTP()) 
50478            composeIntegerExtras(null, e, true);
50479          closeArray();
50480        }
50481      };
50482      if (element.hasNumFP()) {
50483        openArray("numFP");
50484        for (IntegerType e : element.getNumFP()) 
50485          composeIntegerCore(null, e, true);
50486        closeArray();
50487        if (anyHasExtras(element.getNumFP())) {
50488          openArray("_numFP");
50489          for (IntegerType e : element.getNumFP()) 
50490            composeIntegerExtras(null, e, true);
50491          closeArray();
50492        }
50493      };
50494      if (element.hasNumFN()) {
50495        openArray("numFN");
50496        for (IntegerType e : element.getNumFN()) 
50497          composeIntegerCore(null, e, true);
50498        closeArray();
50499        if (anyHasExtras(element.getNumFN())) {
50500          openArray("_numFN");
50501          for (IntegerType e : element.getNumFN()) 
50502            composeIntegerExtras(null, e, true);
50503          closeArray();
50504        }
50505      };
50506      if (element.hasPrecision()) {
50507        openArray("precision");
50508        for (DecimalType e : element.getPrecision()) 
50509          composeDecimalCore(null, e, true);
50510        closeArray();
50511        if (anyHasExtras(element.getPrecision())) {
50512          openArray("_precision");
50513          for (DecimalType e : element.getPrecision()) 
50514            composeDecimalExtras(null, e, true);
50515          closeArray();
50516        }
50517      };
50518      if (element.hasSensitivity()) {
50519        openArray("sensitivity");
50520        for (DecimalType e : element.getSensitivity()) 
50521          composeDecimalCore(null, e, true);
50522        closeArray();
50523        if (anyHasExtras(element.getSensitivity())) {
50524          openArray("_sensitivity");
50525          for (DecimalType e : element.getSensitivity()) 
50526            composeDecimalExtras(null, e, true);
50527          closeArray();
50528        }
50529      };
50530      if (element.hasFMeasure()) {
50531        openArray("fMeasure");
50532        for (DecimalType e : element.getFMeasure()) 
50533          composeDecimalCore(null, e, true);
50534        closeArray();
50535        if (anyHasExtras(element.getFMeasure())) {
50536          openArray("_fMeasure");
50537          for (DecimalType e : element.getFMeasure()) 
50538            composeDecimalExtras(null, e, true);
50539          closeArray();
50540        }
50541      };
50542  }
50543
50544  protected void composeMolecularSequenceRepositoryComponent(String name, MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
50545    if (element != null) {
50546      open(name);
50547      composeMolecularSequenceRepositoryComponentProperties(element);
50548      close();
50549    }
50550  }
50551
50552  protected void composeMolecularSequenceRepositoryComponentProperties(MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
50553    composeBackboneElementProperties(element);
50554      if (element.hasTypeElement()) {
50555        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(), false);
50556        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(), false);
50557      }
50558      if (element.hasUrlElement()) {
50559        composeUriCore("url", element.getUrlElement(), false);
50560        composeUriExtras("url", element.getUrlElement(), false);
50561      }
50562      if (element.hasNameElement()) {
50563        composeStringCore("name", element.getNameElement(), false);
50564        composeStringExtras("name", element.getNameElement(), false);
50565      }
50566      if (element.hasDatasetIdElement()) {
50567        composeStringCore("datasetId", element.getDatasetIdElement(), false);
50568        composeStringExtras("datasetId", element.getDatasetIdElement(), false);
50569      }
50570      if (element.hasVariantsetIdElement()) {
50571        composeStringCore("variantsetId", element.getVariantsetIdElement(), false);
50572        composeStringExtras("variantsetId", element.getVariantsetIdElement(), false);
50573      }
50574      if (element.hasReadsetIdElement()) {
50575        composeStringCore("readsetId", element.getReadsetIdElement(), false);
50576        composeStringExtras("readsetId", element.getReadsetIdElement(), false);
50577      }
50578  }
50579
50580  protected void composeMolecularSequenceStructureVariantComponent(String name, MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
50581    if (element != null) {
50582      open(name);
50583      composeMolecularSequenceStructureVariantComponentProperties(element);
50584      close();
50585    }
50586  }
50587
50588  protected void composeMolecularSequenceStructureVariantComponentProperties(MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
50589    composeBackboneElementProperties(element);
50590      if (element.hasVariantType()) {
50591        composeCodeableConcept("variantType", element.getVariantType());
50592      }
50593      if (element.hasExactElement()) {
50594        composeBooleanCore("exact", element.getExactElement(), false);
50595        composeBooleanExtras("exact", element.getExactElement(), false);
50596      }
50597      if (element.hasLengthElement()) {
50598        composeIntegerCore("length", element.getLengthElement(), false);
50599        composeIntegerExtras("length", element.getLengthElement(), false);
50600      }
50601      if (element.hasOuter()) {
50602        composeMolecularSequenceStructureVariantOuterComponent("outer", element.getOuter());
50603      }
50604      if (element.hasInner()) {
50605        composeMolecularSequenceStructureVariantInnerComponent("inner", element.getInner());
50606      }
50607  }
50608
50609  protected void composeMolecularSequenceStructureVariantOuterComponent(String name, MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
50610    if (element != null) {
50611      open(name);
50612      composeMolecularSequenceStructureVariantOuterComponentProperties(element);
50613      close();
50614    }
50615  }
50616
50617  protected void composeMolecularSequenceStructureVariantOuterComponentProperties(MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
50618    composeBackboneElementProperties(element);
50619      if (element.hasStartElement()) {
50620        composeIntegerCore("start", element.getStartElement(), false);
50621        composeIntegerExtras("start", element.getStartElement(), false);
50622      }
50623      if (element.hasEndElement()) {
50624        composeIntegerCore("end", element.getEndElement(), false);
50625        composeIntegerExtras("end", element.getEndElement(), false);
50626      }
50627  }
50628
50629  protected void composeMolecularSequenceStructureVariantInnerComponent(String name, MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
50630    if (element != null) {
50631      open(name);
50632      composeMolecularSequenceStructureVariantInnerComponentProperties(element);
50633      close();
50634    }
50635  }
50636
50637  protected void composeMolecularSequenceStructureVariantInnerComponentProperties(MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
50638    composeBackboneElementProperties(element);
50639      if (element.hasStartElement()) {
50640        composeIntegerCore("start", element.getStartElement(), false);
50641        composeIntegerExtras("start", element.getStartElement(), false);
50642      }
50643      if (element.hasEndElement()) {
50644        composeIntegerCore("end", element.getEndElement(), false);
50645        composeIntegerExtras("end", element.getEndElement(), false);
50646      }
50647  }
50648
50649  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
50650    if (element != null) {
50651      prop("resourceType", name);
50652      composeNamingSystemProperties(element);
50653    }
50654  }
50655
50656  protected void composeNamingSystemProperties(NamingSystem element) throws IOException {
50657    composeCanonicalResourceProperties(element);
50658      if (element.hasUrlElement()) {
50659        composeUriCore("url", element.getUrlElement(), false);
50660        composeUriExtras("url", element.getUrlElement(), false);
50661      }
50662      if (element.hasVersionElement()) {
50663        composeStringCore("version", element.getVersionElement(), false);
50664        composeStringExtras("version", element.getVersionElement(), false);
50665      }
50666      if (element.hasNameElement()) {
50667        composeStringCore("name", element.getNameElement(), false);
50668        composeStringExtras("name", element.getNameElement(), false);
50669      }
50670      if (element.hasStatusElement()) {
50671        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50672        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50673      }
50674      if (element.hasKindElement()) {
50675        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
50676        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
50677      }
50678      if (element.hasDateElement()) {
50679        composeDateTimeCore("date", element.getDateElement(), false);
50680        composeDateTimeExtras("date", element.getDateElement(), false);
50681      }
50682      if (element.hasPublisherElement()) {
50683        composeStringCore("publisher", element.getPublisherElement(), false);
50684        composeStringExtras("publisher", element.getPublisherElement(), false);
50685      }
50686      if (element.hasContact()) {
50687        openArray("contact");
50688        for (ContactDetail e : element.getContact()) 
50689          composeContactDetail(null, e);
50690        closeArray();
50691      };
50692      if (element.hasResponsibleElement()) {
50693        composeStringCore("responsible", element.getResponsibleElement(), false);
50694        composeStringExtras("responsible", element.getResponsibleElement(), false);
50695      }
50696      if (element.hasType()) {
50697        composeCodeableConcept("type", element.getType());
50698      }
50699      if (element.hasDescriptionElement()) {
50700        composeMarkdownCore("description", element.getDescriptionElement(), false);
50701        composeMarkdownExtras("description", element.getDescriptionElement(), false);
50702      }
50703      if (element.hasUseContext()) {
50704        openArray("useContext");
50705        for (UsageContext e : element.getUseContext()) 
50706          composeUsageContext(null, e);
50707        closeArray();
50708      };
50709      if (element.hasJurisdiction()) {
50710        openArray("jurisdiction");
50711        for (CodeableConcept e : element.getJurisdiction()) 
50712          composeCodeableConcept(null, e);
50713        closeArray();
50714      };
50715      if (element.hasUsageElement()) {
50716        composeStringCore("usage", element.getUsageElement(), false);
50717        composeStringExtras("usage", element.getUsageElement(), false);
50718      }
50719      if (element.hasUniqueId()) {
50720        openArray("uniqueId");
50721        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
50722          composeNamingSystemUniqueIdComponent(null, e);
50723        closeArray();
50724      };
50725  }
50726
50727  protected void composeNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
50728    if (element != null) {
50729      open(name);
50730      composeNamingSystemUniqueIdComponentProperties(element);
50731      close();
50732    }
50733  }
50734
50735  protected void composeNamingSystemUniqueIdComponentProperties(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
50736    composeBackboneElementProperties(element);
50737      if (element.hasTypeElement()) {
50738        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
50739        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
50740      }
50741      if (element.hasValueElement()) {
50742        composeStringCore("value", element.getValueElement(), false);
50743        composeStringExtras("value", element.getValueElement(), false);
50744      }
50745      if (element.hasPreferredElement()) {
50746        composeBooleanCore("preferred", element.getPreferredElement(), false);
50747        composeBooleanExtras("preferred", element.getPreferredElement(), false);
50748      }
50749      if (element.hasCommentElement()) {
50750        composeStringCore("comment", element.getCommentElement(), false);
50751        composeStringExtras("comment", element.getCommentElement(), false);
50752      }
50753      if (element.hasPeriod()) {
50754        composePeriod("period", element.getPeriod());
50755      }
50756  }
50757
50758  protected void composeNutritionIntake(String name, NutritionIntake element) throws IOException {
50759    if (element != null) {
50760      prop("resourceType", name);
50761      composeNutritionIntakeProperties(element);
50762    }
50763  }
50764
50765  protected void composeNutritionIntakeProperties(NutritionIntake element) throws IOException {
50766    composeDomainResourceProperties(element);
50767      if (element.hasIdentifier()) {
50768        openArray("identifier");
50769        for (Identifier e : element.getIdentifier()) 
50770          composeIdentifier(null, e);
50771        closeArray();
50772      };
50773      if (element.hasBasedOn()) {
50774        openArray("basedOn");
50775        for (Reference e : element.getBasedOn()) 
50776          composeReference(null, e);
50777        closeArray();
50778      };
50779      if (element.hasPartOf()) {
50780        openArray("partOf");
50781        for (Reference e : element.getPartOf()) 
50782          composeReference(null, e);
50783        closeArray();
50784      };
50785      if (element.hasStatusElement()) {
50786        composeEnumerationCore("status", element.getStatusElement(), new NutritionIntake.NutritionIntakeStatusCodesEnumFactory(), false);
50787        composeEnumerationExtras("status", element.getStatusElement(), new NutritionIntake.NutritionIntakeStatusCodesEnumFactory(), false);
50788      }
50789      if (element.hasStatusReason()) {
50790        openArray("statusReason");
50791        for (CodeableConcept e : element.getStatusReason()) 
50792          composeCodeableConcept(null, e);
50793        closeArray();
50794      };
50795      if (element.hasCategory()) {
50796        openArray("category");
50797        for (CodeableConcept e : element.getCategory()) 
50798          composeCodeableConcept(null, e);
50799        closeArray();
50800      };
50801      if (element.hasConsumedItem()) {
50802        openArray("consumedItem");
50803        for (NutritionIntake.NutritionIntakeConsumedItemComponent e : element.getConsumedItem()) 
50804          composeNutritionIntakeConsumedItemComponent(null, e);
50805        closeArray();
50806      };
50807      if (element.hasIngredientLabel()) {
50808        openArray("ingredientLabel");
50809        for (NutritionIntake.NutritionIntakeIngredientLabelComponent e : element.getIngredientLabel()) 
50810          composeNutritionIntakeIngredientLabelComponent(null, e);
50811        closeArray();
50812      };
50813      if (element.hasSubject()) {
50814        composeReference("subject", element.getSubject());
50815      }
50816      if (element.hasEncounter()) {
50817        composeReference("encounter", element.getEncounter());
50818      }
50819      if (element.hasEffective()) {
50820        composeType("effective", element.getEffective());
50821      }
50822      if (element.hasDateAssertedElement()) {
50823        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
50824        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
50825      }
50826      if (element.hasInformationSource()) {
50827        composeReference("informationSource", element.getInformationSource());
50828      }
50829      if (element.hasDerivedFrom()) {
50830        openArray("derivedFrom");
50831        for (Reference e : element.getDerivedFrom()) 
50832          composeReference(null, e);
50833        closeArray();
50834      };
50835      if (element.hasReasonCode()) {
50836        openArray("reasonCode");
50837        for (CodeableReference e : element.getReasonCode()) 
50838          composeCodeableReference(null, e);
50839        closeArray();
50840      };
50841      if (element.hasNote()) {
50842        openArray("note");
50843        for (Annotation e : element.getNote()) 
50844          composeAnnotation(null, e);
50845        closeArray();
50846      };
50847  }
50848
50849  protected void composeNutritionIntakeConsumedItemComponent(String name, NutritionIntake.NutritionIntakeConsumedItemComponent element) throws IOException {
50850    if (element != null) {
50851      open(name);
50852      composeNutritionIntakeConsumedItemComponentProperties(element);
50853      close();
50854    }
50855  }
50856
50857  protected void composeNutritionIntakeConsumedItemComponentProperties(NutritionIntake.NutritionIntakeConsumedItemComponent element) throws IOException {
50858    composeBackboneElementProperties(element);
50859      if (element.hasType()) {
50860        composeCodeableConcept("type", element.getType());
50861      }
50862      if (element.hasNutritionProduct()) {
50863        composeCodeableConcept("nutritionProduct", element.getNutritionProduct());
50864      }
50865      if (element.hasSchedule()) {
50866        composeTiming("schedule", element.getSchedule());
50867      }
50868      if (element.hasAmount()) {
50869        composeQuantity("amount", element.getAmount());
50870      }
50871      if (element.hasRate()) {
50872        composeQuantity("rate", element.getRate());
50873      }
50874      if (element.hasNotConsumedElement()) {
50875        composeBooleanCore("notConsumed", element.getNotConsumedElement(), false);
50876        composeBooleanExtras("notConsumed", element.getNotConsumedElement(), false);
50877      }
50878      if (element.hasNotConsumedReason()) {
50879        composeCodeableConcept("notConsumedReason", element.getNotConsumedReason());
50880      }
50881  }
50882
50883  protected void composeNutritionIntakeIngredientLabelComponent(String name, NutritionIntake.NutritionIntakeIngredientLabelComponent element) throws IOException {
50884    if (element != null) {
50885      open(name);
50886      composeNutritionIntakeIngredientLabelComponentProperties(element);
50887      close();
50888    }
50889  }
50890
50891  protected void composeNutritionIntakeIngredientLabelComponentProperties(NutritionIntake.NutritionIntakeIngredientLabelComponent element) throws IOException {
50892    composeBackboneElementProperties(element);
50893      if (element.hasNutrient()) {
50894        composeCodeableConcept("nutrient", element.getNutrient());
50895      }
50896      if (element.hasAmount()) {
50897        composeQuantity("amount", element.getAmount());
50898      }
50899  }
50900
50901  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
50902    if (element != null) {
50903      prop("resourceType", name);
50904      composeNutritionOrderProperties(element);
50905    }
50906  }
50907
50908  protected void composeNutritionOrderProperties(NutritionOrder element) throws IOException {
50909    composeDomainResourceProperties(element);
50910      if (element.hasIdentifier()) {
50911        openArray("identifier");
50912        for (Identifier e : element.getIdentifier()) 
50913          composeIdentifier(null, e);
50914        closeArray();
50915      };
50916      if (element.hasInstantiatesCanonical()) {
50917        openArray("instantiatesCanonical");
50918        for (CanonicalType e : element.getInstantiatesCanonical()) 
50919          composeCanonicalCore(null, e, true);
50920        closeArray();
50921        if (anyHasExtras(element.getInstantiatesCanonical())) {
50922          openArray("_instantiatesCanonical");
50923          for (CanonicalType e : element.getInstantiatesCanonical()) 
50924            composeCanonicalExtras(null, e, true);
50925          closeArray();
50926        }
50927      };
50928      if (element.hasInstantiatesUri()) {
50929        openArray("instantiatesUri");
50930        for (UriType e : element.getInstantiatesUri()) 
50931          composeUriCore(null, e, true);
50932        closeArray();
50933        if (anyHasExtras(element.getInstantiatesUri())) {
50934          openArray("_instantiatesUri");
50935          for (UriType e : element.getInstantiatesUri()) 
50936            composeUriExtras(null, e, true);
50937          closeArray();
50938        }
50939      };
50940      if (element.hasInstantiates()) {
50941        openArray("instantiates");
50942        for (UriType e : element.getInstantiates()) 
50943          composeUriCore(null, e, true);
50944        closeArray();
50945        if (anyHasExtras(element.getInstantiates())) {
50946          openArray("_instantiates");
50947          for (UriType e : element.getInstantiates()) 
50948            composeUriExtras(null, e, true);
50949          closeArray();
50950        }
50951      };
50952      if (element.hasStatusElement()) {
50953        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
50954        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
50955      }
50956      if (element.hasIntentElement()) {
50957        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
50958        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
50959      }
50960      if (element.hasPatient()) {
50961        composeReference("patient", element.getPatient());
50962      }
50963      if (element.hasEncounter()) {
50964        composeReference("encounter", element.getEncounter());
50965      }
50966      if (element.hasDateTimeElement()) {
50967        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
50968        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
50969      }
50970      if (element.hasOrderer()) {
50971        composeReference("orderer", element.getOrderer());
50972      }
50973      if (element.hasAllergyIntolerance()) {
50974        openArray("allergyIntolerance");
50975        for (Reference e : element.getAllergyIntolerance()) 
50976          composeReference(null, e);
50977        closeArray();
50978      };
50979      if (element.hasFoodPreferenceModifier()) {
50980        openArray("foodPreferenceModifier");
50981        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
50982          composeCodeableConcept(null, e);
50983        closeArray();
50984      };
50985      if (element.hasExcludeFoodModifier()) {
50986        openArray("excludeFoodModifier");
50987        for (CodeableConcept e : element.getExcludeFoodModifier()) 
50988          composeCodeableConcept(null, e);
50989        closeArray();
50990      };
50991      if (element.hasOralDiet()) {
50992        composeNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
50993      }
50994      if (element.hasSupplement()) {
50995        openArray("supplement");
50996        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
50997          composeNutritionOrderSupplementComponent(null, e);
50998        closeArray();
50999      };
51000      if (element.hasEnteralFormula()) {
51001        composeNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
51002      }
51003      if (element.hasNote()) {
51004        openArray("note");
51005        for (Annotation e : element.getNote()) 
51006          composeAnnotation(null, e);
51007        closeArray();
51008      };
51009  }
51010
51011  protected void composeNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
51012    if (element != null) {
51013      open(name);
51014      composeNutritionOrderOralDietComponentProperties(element);
51015      close();
51016    }
51017  }
51018
51019  protected void composeNutritionOrderOralDietComponentProperties(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
51020    composeBackboneElementProperties(element);
51021      if (element.hasType()) {
51022        openArray("type");
51023        for (CodeableConcept e : element.getType()) 
51024          composeCodeableConcept(null, e);
51025        closeArray();
51026      };
51027      if (element.hasSchedule()) {
51028        openArray("schedule");
51029        for (Timing e : element.getSchedule()) 
51030          composeTiming(null, e);
51031        closeArray();
51032      };
51033      if (element.hasNutrient()) {
51034        openArray("nutrient");
51035        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
51036          composeNutritionOrderOralDietNutrientComponent(null, e);
51037        closeArray();
51038      };
51039      if (element.hasTexture()) {
51040        openArray("texture");
51041        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
51042          composeNutritionOrderOralDietTextureComponent(null, e);
51043        closeArray();
51044      };
51045      if (element.hasFluidConsistencyType()) {
51046        openArray("fluidConsistencyType");
51047        for (CodeableConcept e : element.getFluidConsistencyType()) 
51048          composeCodeableConcept(null, e);
51049        closeArray();
51050      };
51051      if (element.hasInstructionElement()) {
51052        composeStringCore("instruction", element.getInstructionElement(), false);
51053        composeStringExtras("instruction", element.getInstructionElement(), false);
51054      }
51055  }
51056
51057  protected void composeNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
51058    if (element != null) {
51059      open(name);
51060      composeNutritionOrderOralDietNutrientComponentProperties(element);
51061      close();
51062    }
51063  }
51064
51065  protected void composeNutritionOrderOralDietNutrientComponentProperties(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
51066    composeBackboneElementProperties(element);
51067      if (element.hasModifier()) {
51068        composeCodeableConcept("modifier", element.getModifier());
51069      }
51070      if (element.hasAmount()) {
51071        composeQuantity("amount", element.getAmount());
51072      }
51073  }
51074
51075  protected void composeNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
51076    if (element != null) {
51077      open(name);
51078      composeNutritionOrderOralDietTextureComponentProperties(element);
51079      close();
51080    }
51081  }
51082
51083  protected void composeNutritionOrderOralDietTextureComponentProperties(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
51084    composeBackboneElementProperties(element);
51085      if (element.hasModifier()) {
51086        composeCodeableConcept("modifier", element.getModifier());
51087      }
51088      if (element.hasFoodType()) {
51089        composeCodeableConcept("foodType", element.getFoodType());
51090      }
51091  }
51092
51093  protected void composeNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
51094    if (element != null) {
51095      open(name);
51096      composeNutritionOrderSupplementComponentProperties(element);
51097      close();
51098    }
51099  }
51100
51101  protected void composeNutritionOrderSupplementComponentProperties(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
51102    composeBackboneElementProperties(element);
51103      if (element.hasType()) {
51104        composeCodeableConcept("type", element.getType());
51105      }
51106      if (element.hasProductNameElement()) {
51107        composeStringCore("productName", element.getProductNameElement(), false);
51108        composeStringExtras("productName", element.getProductNameElement(), false);
51109      }
51110      if (element.hasSchedule()) {
51111        openArray("schedule");
51112        for (Timing e : element.getSchedule()) 
51113          composeTiming(null, e);
51114        closeArray();
51115      };
51116      if (element.hasQuantity()) {
51117        composeQuantity("quantity", element.getQuantity());
51118      }
51119      if (element.hasInstructionElement()) {
51120        composeStringCore("instruction", element.getInstructionElement(), false);
51121        composeStringExtras("instruction", element.getInstructionElement(), false);
51122      }
51123  }
51124
51125  protected void composeNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
51126    if (element != null) {
51127      open(name);
51128      composeNutritionOrderEnteralFormulaComponentProperties(element);
51129      close();
51130    }
51131  }
51132
51133  protected void composeNutritionOrderEnteralFormulaComponentProperties(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
51134    composeBackboneElementProperties(element);
51135      if (element.hasBaseFormulaType()) {
51136        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
51137      }
51138      if (element.hasBaseFormulaProductNameElement()) {
51139        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
51140        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
51141      }
51142      if (element.hasAdditiveType()) {
51143        composeCodeableConcept("additiveType", element.getAdditiveType());
51144      }
51145      if (element.hasAdditiveProductNameElement()) {
51146        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
51147        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
51148      }
51149      if (element.hasCaloricDensity()) {
51150        composeQuantity("caloricDensity", element.getCaloricDensity());
51151      }
51152      if (element.hasRouteofAdministration()) {
51153        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
51154      }
51155      if (element.hasAdministration()) {
51156        openArray("administration");
51157        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
51158          composeNutritionOrderEnteralFormulaAdministrationComponent(null, e);
51159        closeArray();
51160      };
51161      if (element.hasMaxVolumeToDeliver()) {
51162        composeQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
51163      }
51164      if (element.hasAdministrationInstructionElement()) {
51165        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
51166        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
51167      }
51168  }
51169
51170  protected void composeNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
51171    if (element != null) {
51172      open(name);
51173      composeNutritionOrderEnteralFormulaAdministrationComponentProperties(element);
51174      close();
51175    }
51176  }
51177
51178  protected void composeNutritionOrderEnteralFormulaAdministrationComponentProperties(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
51179    composeBackboneElementProperties(element);
51180      if (element.hasSchedule()) {
51181        composeTiming("schedule", element.getSchedule());
51182      }
51183      if (element.hasQuantity()) {
51184        composeQuantity("quantity", element.getQuantity());
51185      }
51186      if (element.hasRate()) {
51187        composeType("rate", element.getRate());
51188      }
51189  }
51190
51191  protected void composeObservation(String name, Observation element) throws IOException {
51192    if (element != null) {
51193      prop("resourceType", name);
51194      composeObservationProperties(element);
51195    }
51196  }
51197
51198  protected void composeObservationProperties(Observation element) throws IOException {
51199    composeDomainResourceProperties(element);
51200      if (element.hasIdentifier()) {
51201        openArray("identifier");
51202        for (Identifier e : element.getIdentifier()) 
51203          composeIdentifier(null, e);
51204        closeArray();
51205      };
51206      if (element.hasBasedOn()) {
51207        openArray("basedOn");
51208        for (Reference e : element.getBasedOn()) 
51209          composeReference(null, e);
51210        closeArray();
51211      };
51212      if (element.hasPartOf()) {
51213        openArray("partOf");
51214        for (Reference e : element.getPartOf()) 
51215          composeReference(null, e);
51216        closeArray();
51217      };
51218      if (element.hasStatusElement()) {
51219        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
51220        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
51221      }
51222      if (element.hasCategory()) {
51223        openArray("category");
51224        for (CodeableConcept e : element.getCategory()) 
51225          composeCodeableConcept(null, e);
51226        closeArray();
51227      };
51228      if (element.hasCode()) {
51229        composeCodeableConcept("code", element.getCode());
51230      }
51231      if (element.hasSubject()) {
51232        composeReference("subject", element.getSubject());
51233      }
51234      if (element.hasFocus()) {
51235        openArray("focus");
51236        for (Reference e : element.getFocus()) 
51237          composeReference(null, e);
51238        closeArray();
51239      };
51240      if (element.hasEncounter()) {
51241        composeReference("encounter", element.getEncounter());
51242      }
51243      if (element.hasEffective()) {
51244        composeType("effective", element.getEffective());
51245      }
51246      if (element.hasIssuedElement()) {
51247        composeInstantCore("issued", element.getIssuedElement(), false);
51248        composeInstantExtras("issued", element.getIssuedElement(), false);
51249      }
51250      if (element.hasPerformer()) {
51251        openArray("performer");
51252        for (Reference e : element.getPerformer()) 
51253          composeReference(null, e);
51254        closeArray();
51255      };
51256      if (element.hasValue()) {
51257        composeType("value", element.getValue());
51258      }
51259      if (element.hasDataAbsentReason()) {
51260        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
51261      }
51262      if (element.hasInterpretation()) {
51263        openArray("interpretation");
51264        for (CodeableConcept e : element.getInterpretation()) 
51265          composeCodeableConcept(null, e);
51266        closeArray();
51267      };
51268      if (element.hasNote()) {
51269        openArray("note");
51270        for (Annotation e : element.getNote()) 
51271          composeAnnotation(null, e);
51272        closeArray();
51273      };
51274      if (element.hasBodySite()) {
51275        composeCodeableConcept("bodySite", element.getBodySite());
51276      }
51277      if (element.hasMethod()) {
51278        composeCodeableConcept("method", element.getMethod());
51279      }
51280      if (element.hasSpecimen()) {
51281        composeReference("specimen", element.getSpecimen());
51282      }
51283      if (element.hasDevice()) {
51284        composeReference("device", element.getDevice());
51285      }
51286      if (element.hasReferenceRange()) {
51287        openArray("referenceRange");
51288        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
51289          composeObservationReferenceRangeComponent(null, e);
51290        closeArray();
51291      };
51292      if (element.hasHasMember()) {
51293        openArray("hasMember");
51294        for (Reference e : element.getHasMember()) 
51295          composeReference(null, e);
51296        closeArray();
51297      };
51298      if (element.hasDerivedFrom()) {
51299        openArray("derivedFrom");
51300        for (Reference e : element.getDerivedFrom()) 
51301          composeReference(null, e);
51302        closeArray();
51303      };
51304      if (element.hasComponent()) {
51305        openArray("component");
51306        for (Observation.ObservationComponentComponent e : element.getComponent()) 
51307          composeObservationComponentComponent(null, e);
51308        closeArray();
51309      };
51310  }
51311
51312  protected void composeObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
51313    if (element != null) {
51314      open(name);
51315      composeObservationReferenceRangeComponentProperties(element);
51316      close();
51317    }
51318  }
51319
51320  protected void composeObservationReferenceRangeComponentProperties(Observation.ObservationReferenceRangeComponent element) throws IOException {
51321    composeBackboneElementProperties(element);
51322      if (element.hasLow()) {
51323        composeQuantity("low", element.getLow());
51324      }
51325      if (element.hasHigh()) {
51326        composeQuantity("high", element.getHigh());
51327      }
51328      if (element.hasType()) {
51329        composeCodeableConcept("type", element.getType());
51330      }
51331      if (element.hasAppliesTo()) {
51332        openArray("appliesTo");
51333        for (CodeableConcept e : element.getAppliesTo()) 
51334          composeCodeableConcept(null, e);
51335        closeArray();
51336      };
51337      if (element.hasAge()) {
51338        composeRange("age", element.getAge());
51339      }
51340      if (element.hasTextElement()) {
51341        composeStringCore("text", element.getTextElement(), false);
51342        composeStringExtras("text", element.getTextElement(), false);
51343      }
51344  }
51345
51346  protected void composeObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
51347    if (element != null) {
51348      open(name);
51349      composeObservationComponentComponentProperties(element);
51350      close();
51351    }
51352  }
51353
51354  protected void composeObservationComponentComponentProperties(Observation.ObservationComponentComponent element) throws IOException {
51355    composeBackboneElementProperties(element);
51356      if (element.hasCode()) {
51357        composeCodeableConcept("code", element.getCode());
51358      }
51359      if (element.hasValue()) {
51360        composeType("value", element.getValue());
51361      }
51362      if (element.hasDataAbsentReason()) {
51363        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
51364      }
51365      if (element.hasInterpretation()) {
51366        openArray("interpretation");
51367        for (CodeableConcept e : element.getInterpretation()) 
51368          composeCodeableConcept(null, e);
51369        closeArray();
51370      };
51371      if (element.hasReferenceRange()) {
51372        openArray("referenceRange");
51373        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
51374          composeObservationReferenceRangeComponent(null, e);
51375        closeArray();
51376      };
51377  }
51378
51379  protected void composeObservationDefinition(String name, ObservationDefinition element) throws IOException {
51380    if (element != null) {
51381      prop("resourceType", name);
51382      composeObservationDefinitionProperties(element);
51383    }
51384  }
51385
51386  protected void composeObservationDefinitionProperties(ObservationDefinition element) throws IOException {
51387    composeDomainResourceProperties(element);
51388      if (element.hasUrlElement()) {
51389        composeUriCore("url", element.getUrlElement(), false);
51390        composeUriExtras("url", element.getUrlElement(), false);
51391      }
51392      if (element.hasIdentifier()) {
51393        composeIdentifier("identifier", element.getIdentifier());
51394      }
51395      if (element.hasVersionElement()) {
51396        composeStringCore("version", element.getVersionElement(), false);
51397        composeStringExtras("version", element.getVersionElement(), false);
51398      }
51399      if (element.hasTitleElement()) {
51400        composeStringCore("title", element.getTitleElement(), false);
51401        composeStringExtras("title", element.getTitleElement(), false);
51402      }
51403      if (element.hasDerivedFromCanonical()) {
51404        openArray("derivedFromCanonical");
51405        for (CanonicalType e : element.getDerivedFromCanonical()) 
51406          composeCanonicalCore(null, e, true);
51407        closeArray();
51408        if (anyHasExtras(element.getDerivedFromCanonical())) {
51409          openArray("_derivedFromCanonical");
51410          for (CanonicalType e : element.getDerivedFromCanonical()) 
51411            composeCanonicalExtras(null, e, true);
51412          closeArray();
51413        }
51414      };
51415      if (element.hasDerivedFromUri()) {
51416        openArray("derivedFromUri");
51417        for (UriType e : element.getDerivedFromUri()) 
51418          composeUriCore(null, e, true);
51419        closeArray();
51420        if (anyHasExtras(element.getDerivedFromUri())) {
51421          openArray("_derivedFromUri");
51422          for (UriType e : element.getDerivedFromUri()) 
51423            composeUriExtras(null, e, true);
51424          closeArray();
51425        }
51426      };
51427      if (element.hasStatusElement()) {
51428        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51429        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51430      }
51431      if (element.hasExperimentalElement()) {
51432        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51433        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51434      }
51435      if (element.hasSubject()) {
51436        composeType("subject", element.getSubject());
51437      }
51438      if (element.hasDateElement()) {
51439        composeDateTimeCore("date", element.getDateElement(), false);
51440        composeDateTimeExtras("date", element.getDateElement(), false);
51441      }
51442      if (element.hasPublisher()) {
51443        composeReference("publisher", element.getPublisher());
51444      }
51445      if (element.hasContact()) {
51446        openArray("contact");
51447        for (ContactDetail e : element.getContact()) 
51448          composeContactDetail(null, e);
51449        closeArray();
51450      };
51451      if (element.hasDescriptionElement()) {
51452        composeMarkdownCore("description", element.getDescriptionElement(), false);
51453        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51454      }
51455      if (element.hasUseContext()) {
51456        openArray("useContext");
51457        for (UsageContext e : element.getUseContext()) 
51458          composeUsageContext(null, e);
51459        closeArray();
51460      };
51461      if (element.hasJurisdiction()) {
51462        openArray("jurisdiction");
51463        for (CodeableConcept e : element.getJurisdiction()) 
51464          composeCodeableConcept(null, e);
51465        closeArray();
51466      };
51467      if (element.hasPurposeElement()) {
51468        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51469        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51470      }
51471      if (element.hasCopyrightElement()) {
51472        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51473        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51474      }
51475      if (element.hasApprovalDateElement()) {
51476        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
51477        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
51478      }
51479      if (element.hasLastReviewDateElement()) {
51480        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
51481        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
51482      }
51483      if (element.hasEffectivePeriod()) {
51484        composePeriod("effectivePeriod", element.getEffectivePeriod());
51485      }
51486      if (element.hasPerformerType()) {
51487        composeCodeableConcept("performerType", element.getPerformerType());
51488      }
51489      if (element.hasCategory()) {
51490        openArray("category");
51491        for (CodeableConcept e : element.getCategory()) 
51492          composeCodeableConcept(null, e);
51493        closeArray();
51494      };
51495      if (element.hasCode()) {
51496        composeCodeableConcept("code", element.getCode());
51497      }
51498      if (element.hasPermittedDataType()) {
51499        openArray("permittedDataType");
51500        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
51501          composeEnumerationCore(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
51502        closeArray();
51503        if (anyHasExtras(element.getPermittedDataType())) {
51504          openArray("_permittedDataType");
51505          for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
51506            composeEnumerationExtras(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
51507          closeArray();
51508        }
51509      };
51510      if (element.hasMultipleResultsAllowedElement()) {
51511        composeBooleanCore("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
51512        composeBooleanExtras("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
51513      }
51514      if (element.hasBodySite()) {
51515        composeCodeableConcept("bodySite", element.getBodySite());
51516      }
51517      if (element.hasMethod()) {
51518        composeCodeableConcept("method", element.getMethod());
51519      }
51520      if (element.hasSpecimen()) {
51521        composeReference("specimen", element.getSpecimen());
51522      }
51523      if (element.hasDevice()) {
51524        composeReference("device", element.getDevice());
51525      }
51526      if (element.hasPreferredReportNameElement()) {
51527        composeStringCore("preferredReportName", element.getPreferredReportNameElement(), false);
51528        composeStringExtras("preferredReportName", element.getPreferredReportNameElement(), false);
51529      }
51530      if (element.hasQuantitativeDetails()) {
51531        composeObservationDefinitionQuantitativeDetailsComponent("quantitativeDetails", element.getQuantitativeDetails());
51532      }
51533      if (element.hasQualifiedInterval()) {
51534        openArray("qualifiedInterval");
51535        for (ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent e : element.getQualifiedInterval()) 
51536          composeObservationDefinitionQualifiedIntervalComponent(null, e);
51537        closeArray();
51538      };
51539      if (element.hasValidCodedValueSet()) {
51540        composeReference("validCodedValueSet", element.getValidCodedValueSet());
51541      }
51542      if (element.hasNormalCodedValueSet()) {
51543        composeReference("normalCodedValueSet", element.getNormalCodedValueSet());
51544      }
51545      if (element.hasAbnormalCodedValueSet()) {
51546        composeReference("abnormalCodedValueSet", element.getAbnormalCodedValueSet());
51547      }
51548      if (element.hasCriticalCodedValueSet()) {
51549        composeReference("criticalCodedValueSet", element.getCriticalCodedValueSet());
51550      }
51551      if (element.hasHasMember()) {
51552        openArray("hasMember");
51553        for (Reference e : element.getHasMember()) 
51554          composeReference(null, e);
51555        closeArray();
51556      };
51557      if (element.hasComponent()) {
51558        openArray("component");
51559        for (ObservationDefinition.ObservationDefinitionComponentComponent e : element.getComponent()) 
51560          composeObservationDefinitionComponentComponent(null, e);
51561        closeArray();
51562      };
51563  }
51564
51565  protected void composeObservationDefinitionQuantitativeDetailsComponent(String name, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
51566    if (element != null) {
51567      open(name);
51568      composeObservationDefinitionQuantitativeDetailsComponentProperties(element);
51569      close();
51570    }
51571  }
51572
51573  protected void composeObservationDefinitionQuantitativeDetailsComponentProperties(ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
51574    composeBackboneElementProperties(element);
51575      if (element.hasCustomaryUnit()) {
51576        composeCodeableConcept("customaryUnit", element.getCustomaryUnit());
51577      }
51578      if (element.hasUnit()) {
51579        composeCodeableConcept("unit", element.getUnit());
51580      }
51581      if (element.hasConversionFactorElement()) {
51582        composeDecimalCore("conversionFactor", element.getConversionFactorElement(), false);
51583        composeDecimalExtras("conversionFactor", element.getConversionFactorElement(), false);
51584      }
51585      if (element.hasDecimalPrecisionElement()) {
51586        composeIntegerCore("decimalPrecision", element.getDecimalPrecisionElement(), false);
51587        composeIntegerExtras("decimalPrecision", element.getDecimalPrecisionElement(), false);
51588      }
51589  }
51590
51591  protected void composeObservationDefinitionQualifiedIntervalComponent(String name, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
51592    if (element != null) {
51593      open(name);
51594      composeObservationDefinitionQualifiedIntervalComponentProperties(element);
51595      close();
51596    }
51597  }
51598
51599  protected void composeObservationDefinitionQualifiedIntervalComponentProperties(ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
51600    composeBackboneElementProperties(element);
51601      if (element.hasCategoryElement()) {
51602        composeEnumerationCore("category", element.getCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
51603        composeEnumerationExtras("category", element.getCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
51604      }
51605      if (element.hasRange()) {
51606        composeRange("range", element.getRange());
51607      }
51608      if (element.hasContext()) {
51609        composeCodeableConcept("context", element.getContext());
51610      }
51611      if (element.hasAppliesTo()) {
51612        openArray("appliesTo");
51613        for (CodeableConcept e : element.getAppliesTo()) 
51614          composeCodeableConcept(null, e);
51615        closeArray();
51616      };
51617      if (element.hasGenderElement()) {
51618        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51619        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51620      }
51621      if (element.hasAge()) {
51622        composeRange("age", element.getAge());
51623      }
51624      if (element.hasGestationalAge()) {
51625        composeRange("gestationalAge", element.getGestationalAge());
51626      }
51627      if (element.hasConditionElement()) {
51628        composeStringCore("condition", element.getConditionElement(), false);
51629        composeStringExtras("condition", element.getConditionElement(), false);
51630      }
51631  }
51632
51633  protected void composeObservationDefinitionComponentComponent(String name, ObservationDefinition.ObservationDefinitionComponentComponent element) throws IOException {
51634    if (element != null) {
51635      open(name);
51636      composeObservationDefinitionComponentComponentProperties(element);
51637      close();
51638    }
51639  }
51640
51641  protected void composeObservationDefinitionComponentComponentProperties(ObservationDefinition.ObservationDefinitionComponentComponent element) throws IOException {
51642    composeBackboneElementProperties(element);
51643      if (element.hasCode()) {
51644        composeCodeableConcept("code", element.getCode());
51645      }
51646      if (element.hasPermittedDataType()) {
51647        openArray("permittedDataType");
51648        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
51649          composeEnumerationCore(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
51650        closeArray();
51651        if (anyHasExtras(element.getPermittedDataType())) {
51652          openArray("_permittedDataType");
51653          for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
51654            composeEnumerationExtras(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
51655          closeArray();
51656        }
51657      };
51658      if (element.hasQuantitativeDetails()) {
51659        composeObservationDefinitionQuantitativeDetailsComponent("quantitativeDetails", element.getQuantitativeDetails());
51660      }
51661      if (element.hasQualifiedInterval()) {
51662        openArray("qualifiedInterval");
51663        for (ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent e : element.getQualifiedInterval()) 
51664          composeObservationDefinitionQualifiedIntervalComponent(null, e);
51665        closeArray();
51666      };
51667  }
51668
51669  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
51670    if (element != null) {
51671      prop("resourceType", name);
51672      composeOperationDefinitionProperties(element);
51673    }
51674  }
51675
51676  protected void composeOperationDefinitionProperties(OperationDefinition element) throws IOException {
51677    composeCanonicalResourceProperties(element);
51678      if (element.hasUrlElement()) {
51679        composeUriCore("url", element.getUrlElement(), false);
51680        composeUriExtras("url", element.getUrlElement(), false);
51681      }
51682      if (element.hasVersionElement()) {
51683        composeStringCore("version", element.getVersionElement(), false);
51684        composeStringExtras("version", element.getVersionElement(), false);
51685      }
51686      if (element.hasNameElement()) {
51687        composeStringCore("name", element.getNameElement(), false);
51688        composeStringExtras("name", element.getNameElement(), false);
51689      }
51690      if (element.hasTitleElement()) {
51691        composeStringCore("title", element.getTitleElement(), false);
51692        composeStringExtras("title", element.getTitleElement(), false);
51693      }
51694      if (element.hasStatusElement()) {
51695        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51696        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51697      }
51698      if (element.hasKindElement()) {
51699        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
51700        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
51701      }
51702      if (element.hasExperimentalElement()) {
51703        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51704        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51705      }
51706      if (element.hasDateElement()) {
51707        composeDateTimeCore("date", element.getDateElement(), false);
51708        composeDateTimeExtras("date", element.getDateElement(), false);
51709      }
51710      if (element.hasPublisherElement()) {
51711        composeStringCore("publisher", element.getPublisherElement(), false);
51712        composeStringExtras("publisher", element.getPublisherElement(), false);
51713      }
51714      if (element.hasContact()) {
51715        openArray("contact");
51716        for (ContactDetail e : element.getContact()) 
51717          composeContactDetail(null, e);
51718        closeArray();
51719      };
51720      if (element.hasDescriptionElement()) {
51721        composeMarkdownCore("description", element.getDescriptionElement(), false);
51722        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51723      }
51724      if (element.hasUseContext()) {
51725        openArray("useContext");
51726        for (UsageContext e : element.getUseContext()) 
51727          composeUsageContext(null, e);
51728        closeArray();
51729      };
51730      if (element.hasJurisdiction()) {
51731        openArray("jurisdiction");
51732        for (CodeableConcept e : element.getJurisdiction()) 
51733          composeCodeableConcept(null, e);
51734        closeArray();
51735      };
51736      if (element.hasPurposeElement()) {
51737        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51738        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51739      }
51740      if (element.hasAffectsStateElement()) {
51741        composeBooleanCore("affectsState", element.getAffectsStateElement(), false);
51742        composeBooleanExtras("affectsState", element.getAffectsStateElement(), false);
51743      }
51744      if (element.hasCodeElement()) {
51745        composeCodeCore("code", element.getCodeElement(), false);
51746        composeCodeExtras("code", element.getCodeElement(), false);
51747      }
51748      if (element.hasCommentElement()) {
51749        composeMarkdownCore("comment", element.getCommentElement(), false);
51750        composeMarkdownExtras("comment", element.getCommentElement(), false);
51751      }
51752      if (element.hasBaseElement()) {
51753        composeCanonicalCore("base", element.getBaseElement(), false);
51754        composeCanonicalExtras("base", element.getBaseElement(), false);
51755      }
51756      if (element.hasResource()) {
51757        openArray("resource");
51758        for (CodeType e : element.getResource()) 
51759          composeCodeCore(null, e, true);
51760        closeArray();
51761        if (anyHasExtras(element.getResource())) {
51762          openArray("_resource");
51763          for (CodeType e : element.getResource()) 
51764            composeCodeExtras(null, e, true);
51765          closeArray();
51766        }
51767      };
51768      if (element.hasSystemElement()) {
51769        composeBooleanCore("system", element.getSystemElement(), false);
51770        composeBooleanExtras("system", element.getSystemElement(), false);
51771      }
51772      if (element.hasTypeElement()) {
51773        composeBooleanCore("type", element.getTypeElement(), false);
51774        composeBooleanExtras("type", element.getTypeElement(), false);
51775      }
51776      if (element.hasInstanceElement()) {
51777        composeBooleanCore("instance", element.getInstanceElement(), false);
51778        composeBooleanExtras("instance", element.getInstanceElement(), false);
51779      }
51780      if (element.hasInputProfileElement()) {
51781        composeCanonicalCore("inputProfile", element.getInputProfileElement(), false);
51782        composeCanonicalExtras("inputProfile", element.getInputProfileElement(), false);
51783      }
51784      if (element.hasOutputProfileElement()) {
51785        composeCanonicalCore("outputProfile", element.getOutputProfileElement(), false);
51786        composeCanonicalExtras("outputProfile", element.getOutputProfileElement(), false);
51787      }
51788      if (element.hasParameter()) {
51789        openArray("parameter");
51790        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
51791          composeOperationDefinitionParameterComponent(null, e);
51792        closeArray();
51793      };
51794      if (element.hasOverload()) {
51795        openArray("overload");
51796        for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
51797          composeOperationDefinitionOverloadComponent(null, e);
51798        closeArray();
51799      };
51800  }
51801
51802  protected void composeOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
51803    if (element != null) {
51804      open(name);
51805      composeOperationDefinitionParameterComponentProperties(element);
51806      close();
51807    }
51808  }
51809
51810  protected void composeOperationDefinitionParameterComponentProperties(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
51811    composeBackboneElementProperties(element);
51812      if (element.hasNameElement()) {
51813        composeCodeCore("name", element.getNameElement(), false);
51814        composeCodeExtras("name", element.getNameElement(), false);
51815      }
51816      if (element.hasUseElement()) {
51817        composeEnumerationCore("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
51818        composeEnumerationExtras("use", element.getUseElement(), new Enumerations.OperationParameterUseEnumFactory(), false);
51819      }
51820      if (element.hasMinElement()) {
51821        composeIntegerCore("min", element.getMinElement(), false);
51822        composeIntegerExtras("min", element.getMinElement(), false);
51823      }
51824      if (element.hasMaxElement()) {
51825        composeStringCore("max", element.getMaxElement(), false);
51826        composeStringExtras("max", element.getMaxElement(), false);
51827      }
51828      if (element.hasDocumentationElement()) {
51829        composeStringCore("documentation", element.getDocumentationElement(), false);
51830        composeStringExtras("documentation", element.getDocumentationElement(), false);
51831      }
51832      if (element.hasTypeElement()) {
51833        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.FHIRAllTypesEnumFactory(), false);
51834        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.FHIRAllTypesEnumFactory(), false);
51835      }
51836      if (element.hasTargetProfile()) {
51837        openArray("targetProfile");
51838        for (CanonicalType e : element.getTargetProfile()) 
51839          composeCanonicalCore(null, e, true);
51840        closeArray();
51841        if (anyHasExtras(element.getTargetProfile())) {
51842          openArray("_targetProfile");
51843          for (CanonicalType e : element.getTargetProfile()) 
51844            composeCanonicalExtras(null, e, true);
51845          closeArray();
51846        }
51847      };
51848      if (element.hasSearchTypeElement()) {
51849        composeEnumerationCore("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
51850        composeEnumerationExtras("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
51851      }
51852      if (element.hasBinding()) {
51853        composeOperationDefinitionParameterBindingComponent("binding", element.getBinding());
51854      }
51855      if (element.hasReferencedFrom()) {
51856        openArray("referencedFrom");
51857        for (OperationDefinition.OperationDefinitionParameterReferencedFromComponent e : element.getReferencedFrom()) 
51858          composeOperationDefinitionParameterReferencedFromComponent(null, e);
51859        closeArray();
51860      };
51861      if (element.hasPart()) {
51862        openArray("part");
51863        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
51864          composeOperationDefinitionParameterComponent(null, e);
51865        closeArray();
51866      };
51867  }
51868
51869  protected void composeOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
51870    if (element != null) {
51871      open(name);
51872      composeOperationDefinitionParameterBindingComponentProperties(element);
51873      close();
51874    }
51875  }
51876
51877  protected void composeOperationDefinitionParameterBindingComponentProperties(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
51878    composeBackboneElementProperties(element);
51879      if (element.hasStrengthElement()) {
51880        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
51881        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
51882      }
51883      if (element.hasValueSetElement()) {
51884        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
51885        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
51886      }
51887  }
51888
51889  protected void composeOperationDefinitionParameterReferencedFromComponent(String name, OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
51890    if (element != null) {
51891      open(name);
51892      composeOperationDefinitionParameterReferencedFromComponentProperties(element);
51893      close();
51894    }
51895  }
51896
51897  protected void composeOperationDefinitionParameterReferencedFromComponentProperties(OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
51898    composeBackboneElementProperties(element);
51899      if (element.hasSourceElement()) {
51900        composeStringCore("source", element.getSourceElement(), false);
51901        composeStringExtras("source", element.getSourceElement(), false);
51902      }
51903      if (element.hasSourceIdElement()) {
51904        composeStringCore("sourceId", element.getSourceIdElement(), false);
51905        composeStringExtras("sourceId", element.getSourceIdElement(), false);
51906      }
51907  }
51908
51909  protected void composeOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
51910    if (element != null) {
51911      open(name);
51912      composeOperationDefinitionOverloadComponentProperties(element);
51913      close();
51914    }
51915  }
51916
51917  protected void composeOperationDefinitionOverloadComponentProperties(OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
51918    composeBackboneElementProperties(element);
51919      if (element.hasParameterName()) {
51920        openArray("parameterName");
51921        for (StringType e : element.getParameterName()) 
51922          composeStringCore(null, e, true);
51923        closeArray();
51924        if (anyHasExtras(element.getParameterName())) {
51925          openArray("_parameterName");
51926          for (StringType e : element.getParameterName()) 
51927            composeStringExtras(null, e, true);
51928          closeArray();
51929        }
51930      };
51931      if (element.hasCommentElement()) {
51932        composeStringCore("comment", element.getCommentElement(), false);
51933        composeStringExtras("comment", element.getCommentElement(), false);
51934      }
51935  }
51936
51937  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
51938    if (element != null) {
51939      prop("resourceType", name);
51940      composeOperationOutcomeProperties(element);
51941    }
51942  }
51943
51944  protected void composeOperationOutcomeProperties(OperationOutcome element) throws IOException {
51945    composeDomainResourceProperties(element);
51946      if (element.hasIssue()) {
51947        openArray("issue");
51948        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
51949          composeOperationOutcomeIssueComponent(null, e);
51950        closeArray();
51951      };
51952  }
51953
51954  protected void composeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
51955    if (element != null) {
51956      open(name);
51957      composeOperationOutcomeIssueComponentProperties(element);
51958      close();
51959    }
51960  }
51961
51962  protected void composeOperationOutcomeIssueComponentProperties(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
51963    composeBackboneElementProperties(element);
51964      if (element.hasSeverityElement()) {
51965        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
51966        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
51967      }
51968      if (element.hasCodeElement()) {
51969        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
51970        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
51971      }
51972      if (element.hasDetails()) {
51973        composeCodeableConcept("details", element.getDetails());
51974      }
51975      if (element.hasDiagnosticsElement()) {
51976        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
51977        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
51978      }
51979      if (element.hasLocation()) {
51980        openArray("location");
51981        for (StringType e : element.getLocation()) 
51982          composeStringCore(null, e, true);
51983        closeArray();
51984        if (anyHasExtras(element.getLocation())) {
51985          openArray("_location");
51986          for (StringType e : element.getLocation()) 
51987            composeStringExtras(null, e, true);
51988          closeArray();
51989        }
51990      };
51991      if (element.hasExpression()) {
51992        openArray("expression");
51993        for (StringType e : element.getExpression()) 
51994          composeStringCore(null, e, true);
51995        closeArray();
51996        if (anyHasExtras(element.getExpression())) {
51997          openArray("_expression");
51998          for (StringType e : element.getExpression()) 
51999            composeStringExtras(null, e, true);
52000          closeArray();
52001        }
52002      };
52003  }
52004
52005  protected void composeOrganization(String name, Organization element) throws IOException {
52006    if (element != null) {
52007      prop("resourceType", name);
52008      composeOrganizationProperties(element);
52009    }
52010  }
52011
52012  protected void composeOrganizationProperties(Organization element) throws IOException {
52013    composeDomainResourceProperties(element);
52014      if (element.hasIdentifier()) {
52015        openArray("identifier");
52016        for (Identifier e : element.getIdentifier()) 
52017          composeIdentifier(null, e);
52018        closeArray();
52019      };
52020      if (element.hasActiveElement()) {
52021        composeBooleanCore("active", element.getActiveElement(), false);
52022        composeBooleanExtras("active", element.getActiveElement(), false);
52023      }
52024      if (element.hasType()) {
52025        openArray("type");
52026        for (CodeableConcept e : element.getType()) 
52027          composeCodeableConcept(null, e);
52028        closeArray();
52029      };
52030      if (element.hasNameElement()) {
52031        composeStringCore("name", element.getNameElement(), false);
52032        composeStringExtras("name", element.getNameElement(), false);
52033      }
52034      if (element.hasAlias()) {
52035        openArray("alias");
52036        for (StringType e : element.getAlias()) 
52037          composeStringCore(null, e, true);
52038        closeArray();
52039        if (anyHasExtras(element.getAlias())) {
52040          openArray("_alias");
52041          for (StringType e : element.getAlias()) 
52042            composeStringExtras(null, e, true);
52043          closeArray();
52044        }
52045      };
52046      if (element.hasTelecom()) {
52047        openArray("telecom");
52048        for (ContactPoint e : element.getTelecom()) 
52049          composeContactPoint(null, e);
52050        closeArray();
52051      };
52052      if (element.hasAddress()) {
52053        openArray("address");
52054        for (Address e : element.getAddress()) 
52055          composeAddress(null, e);
52056        closeArray();
52057      };
52058      if (element.hasPartOf()) {
52059        composeReference("partOf", element.getPartOf());
52060      }
52061      if (element.hasContact()) {
52062        openArray("contact");
52063        for (Organization.OrganizationContactComponent e : element.getContact()) 
52064          composeOrganizationContactComponent(null, e);
52065        closeArray();
52066      };
52067      if (element.hasEndpoint()) {
52068        openArray("endpoint");
52069        for (Reference e : element.getEndpoint()) 
52070          composeReference(null, e);
52071        closeArray();
52072      };
52073  }
52074
52075  protected void composeOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
52076    if (element != null) {
52077      open(name);
52078      composeOrganizationContactComponentProperties(element);
52079      close();
52080    }
52081  }
52082
52083  protected void composeOrganizationContactComponentProperties(Organization.OrganizationContactComponent element) throws IOException {
52084    composeBackboneElementProperties(element);
52085      if (element.hasPurpose()) {
52086        composeCodeableConcept("purpose", element.getPurpose());
52087      }
52088      if (element.hasName()) {
52089        composeHumanName("name", element.getName());
52090      }
52091      if (element.hasTelecom()) {
52092        openArray("telecom");
52093        for (ContactPoint e : element.getTelecom()) 
52094          composeContactPoint(null, e);
52095        closeArray();
52096      };
52097      if (element.hasAddress()) {
52098        composeAddress("address", element.getAddress());
52099      }
52100  }
52101
52102  protected void composeOrganizationAffiliation(String name, OrganizationAffiliation element) throws IOException {
52103    if (element != null) {
52104      prop("resourceType", name);
52105      composeOrganizationAffiliationProperties(element);
52106    }
52107  }
52108
52109  protected void composeOrganizationAffiliationProperties(OrganizationAffiliation element) throws IOException {
52110    composeDomainResourceProperties(element);
52111      if (element.hasIdentifier()) {
52112        openArray("identifier");
52113        for (Identifier e : element.getIdentifier()) 
52114          composeIdentifier(null, e);
52115        closeArray();
52116      };
52117      if (element.hasActiveElement()) {
52118        composeBooleanCore("active", element.getActiveElement(), false);
52119        composeBooleanExtras("active", element.getActiveElement(), false);
52120      }
52121      if (element.hasPeriod()) {
52122        composePeriod("period", element.getPeriod());
52123      }
52124      if (element.hasOrganization()) {
52125        composeReference("organization", element.getOrganization());
52126      }
52127      if (element.hasParticipatingOrganization()) {
52128        composeReference("participatingOrganization", element.getParticipatingOrganization());
52129      }
52130      if (element.hasNetwork()) {
52131        openArray("network");
52132        for (Reference e : element.getNetwork()) 
52133          composeReference(null, e);
52134        closeArray();
52135      };
52136      if (element.hasCode()) {
52137        openArray("code");
52138        for (CodeableConcept e : element.getCode()) 
52139          composeCodeableConcept(null, e);
52140        closeArray();
52141      };
52142      if (element.hasSpecialty()) {
52143        openArray("specialty");
52144        for (CodeableConcept e : element.getSpecialty()) 
52145          composeCodeableConcept(null, e);
52146        closeArray();
52147      };
52148      if (element.hasLocation()) {
52149        openArray("location");
52150        for (Reference e : element.getLocation()) 
52151          composeReference(null, e);
52152        closeArray();
52153      };
52154      if (element.hasHealthcareService()) {
52155        openArray("healthcareService");
52156        for (Reference e : element.getHealthcareService()) 
52157          composeReference(null, e);
52158        closeArray();
52159      };
52160      if (element.hasTelecom()) {
52161        openArray("telecom");
52162        for (ContactPoint e : element.getTelecom()) 
52163          composeContactPoint(null, e);
52164        closeArray();
52165      };
52166      if (element.hasEndpoint()) {
52167        openArray("endpoint");
52168        for (Reference e : element.getEndpoint()) 
52169          composeReference(null, e);
52170        closeArray();
52171      };
52172  }
52173
52174  protected void composePackagedProductDefinition(String name, PackagedProductDefinition element) throws IOException {
52175    if (element != null) {
52176      prop("resourceType", name);
52177      composePackagedProductDefinitionProperties(element);
52178    }
52179  }
52180
52181  protected void composePackagedProductDefinitionProperties(PackagedProductDefinition element) throws IOException {
52182    composeDomainResourceProperties(element);
52183      if (element.hasIdentifier()) {
52184        openArray("identifier");
52185        for (Identifier e : element.getIdentifier()) 
52186          composeIdentifier(null, e);
52187        closeArray();
52188      };
52189      if (element.hasSubject()) {
52190        openArray("subject");
52191        for (Reference e : element.getSubject()) 
52192          composeReference(null, e);
52193        closeArray();
52194      };
52195      if (element.hasDescriptionElement()) {
52196        composeStringCore("description", element.getDescriptionElement(), false);
52197        composeStringExtras("description", element.getDescriptionElement(), false);
52198      }
52199      if (element.hasLegalStatusOfSupply()) {
52200        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
52201      }
52202      if (element.hasMarketingStatus()) {
52203        openArray("marketingStatus");
52204        for (MarketingStatus e : element.getMarketingStatus()) 
52205          composeMarketingStatus(null, e);
52206        closeArray();
52207      };
52208      if (element.hasCopackagedIndicatorElement()) {
52209        composeBooleanCore("copackagedIndicator", element.getCopackagedIndicatorElement(), false);
52210        composeBooleanExtras("copackagedIndicator", element.getCopackagedIndicatorElement(), false);
52211      }
52212      if (element.hasMarketingAuthorization()) {
52213        composeReference("marketingAuthorization", element.getMarketingAuthorization());
52214      }
52215      if (element.hasManufacturer()) {
52216        openArray("manufacturer");
52217        for (Reference e : element.getManufacturer()) 
52218          composeReference(null, e);
52219        closeArray();
52220      };
52221      if (element.hasBatchIdentifier()) {
52222        openArray("batchIdentifier");
52223        for (PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent e : element.getBatchIdentifier()) 
52224          composePackagedProductDefinitionBatchIdentifierComponent(null, e);
52225        closeArray();
52226      };
52227      if (element.hasPackage()) {
52228        openArray("package");
52229        for (PackagedProductDefinition.PackagedProductDefinitionPackageComponent e : element.getPackage()) 
52230          composePackagedProductDefinitionPackageComponent(null, e);
52231        closeArray();
52232      };
52233  }
52234
52235  protected void composePackagedProductDefinitionBatchIdentifierComponent(String name, PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent element) throws IOException {
52236    if (element != null) {
52237      open(name);
52238      composePackagedProductDefinitionBatchIdentifierComponentProperties(element);
52239      close();
52240    }
52241  }
52242
52243  protected void composePackagedProductDefinitionBatchIdentifierComponentProperties(PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent element) throws IOException {
52244    composeBackboneElementProperties(element);
52245      if (element.hasOuterPackaging()) {
52246        composeIdentifier("outerPackaging", element.getOuterPackaging());
52247      }
52248      if (element.hasImmediatePackaging()) {
52249        composeIdentifier("immediatePackaging", element.getImmediatePackaging());
52250      }
52251  }
52252
52253  protected void composePackagedProductDefinitionPackageComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackageComponent element) throws IOException {
52254    if (element != null) {
52255      open(name);
52256      composePackagedProductDefinitionPackageComponentProperties(element);
52257      close();
52258    }
52259  }
52260
52261  protected void composePackagedProductDefinitionPackageComponentProperties(PackagedProductDefinition.PackagedProductDefinitionPackageComponent element) throws IOException {
52262    composeBackboneElementProperties(element);
52263      if (element.hasIdentifier()) {
52264        openArray("identifier");
52265        for (Identifier e : element.getIdentifier()) 
52266          composeIdentifier(null, e);
52267        closeArray();
52268      };
52269      if (element.hasType()) {
52270        composeCodeableConcept("type", element.getType());
52271      }
52272      if (element.hasQuantity()) {
52273        composeQuantity("quantity", element.getQuantity());
52274      }
52275      if (element.hasMaterial()) {
52276        openArray("material");
52277        for (CodeableConcept e : element.getMaterial()) 
52278          composeCodeableConcept(null, e);
52279        closeArray();
52280      };
52281      if (element.hasAlternateMaterial()) {
52282        openArray("alternateMaterial");
52283        for (CodeableConcept e : element.getAlternateMaterial()) 
52284          composeCodeableConcept(null, e);
52285        closeArray();
52286      };
52287      if (element.hasShelfLifeStorage()) {
52288        openArray("shelfLifeStorage");
52289        for (ProductShelfLife e : element.getShelfLifeStorage()) 
52290          composeProductShelfLife(null, e);
52291        closeArray();
52292      };
52293      if (element.hasManufacturer()) {
52294        openArray("manufacturer");
52295        for (Reference e : element.getManufacturer()) 
52296          composeReference(null, e);
52297        closeArray();
52298      };
52299      if (element.hasCharacteristic()) {
52300        openArray("characteristic");
52301        for (PackagedProductDefinition.PackagedProductDefinitionPackageCharacteristicComponent e : element.getCharacteristic()) 
52302          composePackagedProductDefinitionPackageCharacteristicComponent(null, e);
52303        closeArray();
52304      };
52305      if (element.hasContainedItem()) {
52306        openArray("containedItem");
52307        for (PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent e : element.getContainedItem()) 
52308          composePackagedProductDefinitionPackageContainedItemComponent(null, e);
52309        closeArray();
52310      };
52311      if (element.hasPackage()) {
52312        openArray("package");
52313        for (PackagedProductDefinition.PackagedProductDefinitionPackageComponent e : element.getPackage()) 
52314          composePackagedProductDefinitionPackageComponent(null, e);
52315        closeArray();
52316      };
52317  }
52318
52319  protected void composePackagedProductDefinitionPackageCharacteristicComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackageCharacteristicComponent element) throws IOException {
52320    if (element != null) {
52321      open(name);
52322      composePackagedProductDefinitionPackageCharacteristicComponentProperties(element);
52323      close();
52324    }
52325  }
52326
52327  protected void composePackagedProductDefinitionPackageCharacteristicComponentProperties(PackagedProductDefinition.PackagedProductDefinitionPackageCharacteristicComponent element) throws IOException {
52328    composeBackboneElementProperties(element);
52329      if (element.hasCode()) {
52330        composeCodeableConcept("code", element.getCode());
52331      }
52332      if (element.hasValue()) {
52333        composeType("value", element.getValue());
52334      }
52335  }
52336
52337  protected void composePackagedProductDefinitionPackageContainedItemComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent element) throws IOException {
52338    if (element != null) {
52339      open(name);
52340      composePackagedProductDefinitionPackageContainedItemComponentProperties(element);
52341      close();
52342    }
52343  }
52344
52345  protected void composePackagedProductDefinitionPackageContainedItemComponentProperties(PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent element) throws IOException {
52346    composeBackboneElementProperties(element);
52347      if (element.hasItem()) {
52348        openArray("item");
52349        for (Reference e : element.getItem()) 
52350          composeReference(null, e);
52351        closeArray();
52352      };
52353      if (element.hasAmount()) {
52354        composeType("amount", element.getAmount());
52355      }
52356  }
52357
52358  protected void composeParameters(String name, Parameters element) throws IOException {
52359    if (element != null) {
52360      prop("resourceType", name);
52361      composeParametersProperties(element);
52362    }
52363  }
52364
52365  protected void composeParametersProperties(Parameters element) throws IOException {
52366    composeResourceProperties(element);
52367      if (element.hasParameter()) {
52368        openArray("parameter");
52369        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
52370          composeParametersParameterComponent(null, e);
52371        closeArray();
52372      };
52373  }
52374
52375  protected void composeParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
52376    if (element != null) {
52377      open(name);
52378      composeParametersParameterComponentProperties(element);
52379      close();
52380    }
52381  }
52382
52383  protected void composeParametersParameterComponentProperties(Parameters.ParametersParameterComponent element) throws IOException {
52384    composeBackboneElementProperties(element);
52385      if (element.hasNameElement()) {
52386        composeStringCore("name", element.getNameElement(), false);
52387        composeStringExtras("name", element.getNameElement(), false);
52388      }
52389      if (element.hasValue()) {
52390        composeType("value", element.getValue());
52391      }
52392        if (element.hasResource()) {
52393          open("resource");
52394          composeResource(element.getResource());
52395          close();
52396        }
52397      if (element.hasPart()) {
52398        openArray("part");
52399        for (Parameters.ParametersParameterComponent e : element.getPart()) 
52400          composeParametersParameterComponent(null, e);
52401        closeArray();
52402      };
52403  }
52404
52405  protected void composePatient(String name, Patient element) throws IOException {
52406    if (element != null) {
52407      prop("resourceType", name);
52408      composePatientProperties(element);
52409    }
52410  }
52411
52412  protected void composePatientProperties(Patient element) throws IOException {
52413    composeDomainResourceProperties(element);
52414      if (element.hasIdentifier()) {
52415        openArray("identifier");
52416        for (Identifier e : element.getIdentifier()) 
52417          composeIdentifier(null, e);
52418        closeArray();
52419      };
52420      if (element.hasActiveElement()) {
52421        composeBooleanCore("active", element.getActiveElement(), false);
52422        composeBooleanExtras("active", element.getActiveElement(), false);
52423      }
52424      if (element.hasName()) {
52425        openArray("name");
52426        for (HumanName e : element.getName()) 
52427          composeHumanName(null, e);
52428        closeArray();
52429      };
52430      if (element.hasTelecom()) {
52431        openArray("telecom");
52432        for (ContactPoint e : element.getTelecom()) 
52433          composeContactPoint(null, e);
52434        closeArray();
52435      };
52436      if (element.hasGenderElement()) {
52437        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
52438        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
52439      }
52440      if (element.hasBirthDateElement()) {
52441        composeDateCore("birthDate", element.getBirthDateElement(), false);
52442        composeDateExtras("birthDate", element.getBirthDateElement(), false);
52443      }
52444      if (element.hasDeceased()) {
52445        composeType("deceased", element.getDeceased());
52446      }
52447      if (element.hasAddress()) {
52448        openArray("address");
52449        for (Address e : element.getAddress()) 
52450          composeAddress(null, e);
52451        closeArray();
52452      };
52453      if (element.hasMaritalStatus()) {
52454        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
52455      }
52456      if (element.hasMultipleBirth()) {
52457        composeType("multipleBirth", element.getMultipleBirth());
52458      }
52459      if (element.hasPhoto()) {
52460        openArray("photo");
52461        for (Attachment e : element.getPhoto()) 
52462          composeAttachment(null, e);
52463        closeArray();
52464      };
52465      if (element.hasContact()) {
52466        openArray("contact");
52467        for (Patient.ContactComponent e : element.getContact()) 
52468          composeContactComponent(null, e);
52469        closeArray();
52470      };
52471      if (element.hasCommunication()) {
52472        openArray("communication");
52473        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
52474          composePatientCommunicationComponent(null, e);
52475        closeArray();
52476      };
52477      if (element.hasGeneralPractitioner()) {
52478        openArray("generalPractitioner");
52479        for (Reference e : element.getGeneralPractitioner()) 
52480          composeReference(null, e);
52481        closeArray();
52482      };
52483      if (element.hasManagingOrganization()) {
52484        composeReference("managingOrganization", element.getManagingOrganization());
52485      }
52486      if (element.hasLink()) {
52487        openArray("link");
52488        for (Patient.PatientLinkComponent e : element.getLink()) 
52489          composePatientLinkComponent(null, e);
52490        closeArray();
52491      };
52492  }
52493
52494  protected void composeContactComponent(String name, Patient.ContactComponent element) throws IOException {
52495    if (element != null) {
52496      open(name);
52497      composeContactComponentProperties(element);
52498      close();
52499    }
52500  }
52501
52502  protected void composeContactComponentProperties(Patient.ContactComponent element) throws IOException {
52503    composeBackboneElementProperties(element);
52504      if (element.hasRelationship()) {
52505        openArray("relationship");
52506        for (CodeableConcept e : element.getRelationship()) 
52507          composeCodeableConcept(null, e);
52508        closeArray();
52509      };
52510      if (element.hasName()) {
52511        composeHumanName("name", element.getName());
52512      }
52513      if (element.hasTelecom()) {
52514        openArray("telecom");
52515        for (ContactPoint e : element.getTelecom()) 
52516          composeContactPoint(null, e);
52517        closeArray();
52518      };
52519      if (element.hasAddress()) {
52520        composeAddress("address", element.getAddress());
52521      }
52522      if (element.hasGenderElement()) {
52523        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
52524        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
52525      }
52526      if (element.hasOrganization()) {
52527        composeReference("organization", element.getOrganization());
52528      }
52529      if (element.hasPeriod()) {
52530        composePeriod("period", element.getPeriod());
52531      }
52532  }
52533
52534  protected void composePatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
52535    if (element != null) {
52536      open(name);
52537      composePatientCommunicationComponentProperties(element);
52538      close();
52539    }
52540  }
52541
52542  protected void composePatientCommunicationComponentProperties(Patient.PatientCommunicationComponent element) throws IOException {
52543    composeBackboneElementProperties(element);
52544      if (element.hasLanguage()) {
52545        composeCodeableConcept("language", element.getLanguage());
52546      }
52547      if (element.hasPreferredElement()) {
52548        composeBooleanCore("preferred", element.getPreferredElement(), false);
52549        composeBooleanExtras("preferred", element.getPreferredElement(), false);
52550      }
52551  }
52552
52553  protected void composePatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
52554    if (element != null) {
52555      open(name);
52556      composePatientLinkComponentProperties(element);
52557      close();
52558    }
52559  }
52560
52561  protected void composePatientLinkComponentProperties(Patient.PatientLinkComponent element) throws IOException {
52562    composeBackboneElementProperties(element);
52563      if (element.hasOther()) {
52564        composeReference("other", element.getOther());
52565      }
52566      if (element.hasTypeElement()) {
52567        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
52568        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
52569      }
52570  }
52571
52572  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
52573    if (element != null) {
52574      prop("resourceType", name);
52575      composePaymentNoticeProperties(element);
52576    }
52577  }
52578
52579  protected void composePaymentNoticeProperties(PaymentNotice element) throws IOException {
52580    composeDomainResourceProperties(element);
52581      if (element.hasIdentifier()) {
52582        openArray("identifier");
52583        for (Identifier e : element.getIdentifier()) 
52584          composeIdentifier(null, e);
52585        closeArray();
52586      };
52587      if (element.hasStatusElement()) {
52588        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
52589        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
52590      }
52591      if (element.hasRequest()) {
52592        composeReference("request", element.getRequest());
52593      }
52594      if (element.hasResponse()) {
52595        composeReference("response", element.getResponse());
52596      }
52597      if (element.hasCreatedElement()) {
52598        composeDateTimeCore("created", element.getCreatedElement(), false);
52599        composeDateTimeExtras("created", element.getCreatedElement(), false);
52600      }
52601      if (element.hasProvider()) {
52602        composeReference("provider", element.getProvider());
52603      }
52604      if (element.hasPayment()) {
52605        composeReference("payment", element.getPayment());
52606      }
52607      if (element.hasPaymentDateElement()) {
52608        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
52609        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
52610      }
52611      if (element.hasPayee()) {
52612        composeReference("payee", element.getPayee());
52613      }
52614      if (element.hasRecipient()) {
52615        composeReference("recipient", element.getRecipient());
52616      }
52617      if (element.hasAmount()) {
52618        composeMoney("amount", element.getAmount());
52619      }
52620      if (element.hasPaymentStatus()) {
52621        composeCodeableConcept("paymentStatus", element.getPaymentStatus());
52622      }
52623  }
52624
52625  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
52626    if (element != null) {
52627      prop("resourceType", name);
52628      composePaymentReconciliationProperties(element);
52629    }
52630  }
52631
52632  protected void composePaymentReconciliationProperties(PaymentReconciliation element) throws IOException {
52633    composeDomainResourceProperties(element);
52634      if (element.hasIdentifier()) {
52635        openArray("identifier");
52636        for (Identifier e : element.getIdentifier()) 
52637          composeIdentifier(null, e);
52638        closeArray();
52639      };
52640      if (element.hasStatusElement()) {
52641        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
52642        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
52643      }
52644      if (element.hasPeriod()) {
52645        composePeriod("period", element.getPeriod());
52646      }
52647      if (element.hasCreatedElement()) {
52648        composeDateTimeCore("created", element.getCreatedElement(), false);
52649        composeDateTimeExtras("created", element.getCreatedElement(), false);
52650      }
52651      if (element.hasPaymentIssuer()) {
52652        composeReference("paymentIssuer", element.getPaymentIssuer());
52653      }
52654      if (element.hasRequest()) {
52655        composeReference("request", element.getRequest());
52656      }
52657      if (element.hasRequestor()) {
52658        composeReference("requestor", element.getRequestor());
52659      }
52660      if (element.hasOutcomeElement()) {
52661        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
52662        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory(), false);
52663      }
52664      if (element.hasDispositionElement()) {
52665        composeStringCore("disposition", element.getDispositionElement(), false);
52666        composeStringExtras("disposition", element.getDispositionElement(), false);
52667      }
52668      if (element.hasPaymentDateElement()) {
52669        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
52670        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
52671      }
52672      if (element.hasPaymentAmount()) {
52673        composeMoney("paymentAmount", element.getPaymentAmount());
52674      }
52675      if (element.hasPaymentIdentifier()) {
52676        composeIdentifier("paymentIdentifier", element.getPaymentIdentifier());
52677      }
52678      if (element.hasDetail()) {
52679        openArray("detail");
52680        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
52681          composeDetailsComponent(null, e);
52682        closeArray();
52683      };
52684      if (element.hasFormCode()) {
52685        composeCodeableConcept("formCode", element.getFormCode());
52686      }
52687      if (element.hasProcessNote()) {
52688        openArray("processNote");
52689        for (PaymentReconciliation.NotesComponent e : element.getProcessNote()) 
52690          composeNotesComponent(null, e);
52691        closeArray();
52692      };
52693  }
52694
52695  protected void composeDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
52696    if (element != null) {
52697      open(name);
52698      composeDetailsComponentProperties(element);
52699      close();
52700    }
52701  }
52702
52703  protected void composeDetailsComponentProperties(PaymentReconciliation.DetailsComponent element) throws IOException {
52704    composeBackboneElementProperties(element);
52705      if (element.hasIdentifier()) {
52706        composeIdentifier("identifier", element.getIdentifier());
52707      }
52708      if (element.hasPredecessor()) {
52709        composeIdentifier("predecessor", element.getPredecessor());
52710      }
52711      if (element.hasType()) {
52712        composeCodeableConcept("type", element.getType());
52713      }
52714      if (element.hasRequest()) {
52715        composeReference("request", element.getRequest());
52716      }
52717      if (element.hasSubmitter()) {
52718        composeReference("submitter", element.getSubmitter());
52719      }
52720      if (element.hasResponse()) {
52721        composeReference("response", element.getResponse());
52722      }
52723      if (element.hasDateElement()) {
52724        composeDateCore("date", element.getDateElement(), false);
52725        composeDateExtras("date", element.getDateElement(), false);
52726      }
52727      if (element.hasResponsible()) {
52728        composeReference("responsible", element.getResponsible());
52729      }
52730      if (element.hasPayee()) {
52731        composeReference("payee", element.getPayee());
52732      }
52733      if (element.hasAmount()) {
52734        composeMoney("amount", element.getAmount());
52735      }
52736  }
52737
52738  protected void composeNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
52739    if (element != null) {
52740      open(name);
52741      composeNotesComponentProperties(element);
52742      close();
52743    }
52744  }
52745
52746  protected void composeNotesComponentProperties(PaymentReconciliation.NotesComponent element) throws IOException {
52747    composeBackboneElementProperties(element);
52748      if (element.hasTypeElement()) {
52749        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
52750        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
52751      }
52752      if (element.hasTextElement()) {
52753        composeStringCore("text", element.getTextElement(), false);
52754        composeStringExtras("text", element.getTextElement(), false);
52755      }
52756  }
52757
52758  protected void composePerson(String name, Person element) throws IOException {
52759    if (element != null) {
52760      prop("resourceType", name);
52761      composePersonProperties(element);
52762    }
52763  }
52764
52765  protected void composePersonProperties(Person element) throws IOException {
52766    composeDomainResourceProperties(element);
52767      if (element.hasIdentifier()) {
52768        openArray("identifier");
52769        for (Identifier e : element.getIdentifier()) 
52770          composeIdentifier(null, e);
52771        closeArray();
52772      };
52773      if (element.hasName()) {
52774        openArray("name");
52775        for (HumanName e : element.getName()) 
52776          composeHumanName(null, e);
52777        closeArray();
52778      };
52779      if (element.hasTelecom()) {
52780        openArray("telecom");
52781        for (ContactPoint e : element.getTelecom()) 
52782          composeContactPoint(null, e);
52783        closeArray();
52784      };
52785      if (element.hasGenderElement()) {
52786        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
52787        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
52788      }
52789      if (element.hasBirthDateElement()) {
52790        composeDateCore("birthDate", element.getBirthDateElement(), false);
52791        composeDateExtras("birthDate", element.getBirthDateElement(), false);
52792      }
52793      if (element.hasAddress()) {
52794        openArray("address");
52795        for (Address e : element.getAddress()) 
52796          composeAddress(null, e);
52797        closeArray();
52798      };
52799      if (element.hasPhoto()) {
52800        composeAttachment("photo", element.getPhoto());
52801      }
52802      if (element.hasManagingOrganization()) {
52803        composeReference("managingOrganization", element.getManagingOrganization());
52804      }
52805      if (element.hasActiveElement()) {
52806        composeBooleanCore("active", element.getActiveElement(), false);
52807        composeBooleanExtras("active", element.getActiveElement(), false);
52808      }
52809      if (element.hasLink()) {
52810        openArray("link");
52811        for (Person.PersonLinkComponent e : element.getLink()) 
52812          composePersonLinkComponent(null, e);
52813        closeArray();
52814      };
52815  }
52816
52817  protected void composePersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
52818    if (element != null) {
52819      open(name);
52820      composePersonLinkComponentProperties(element);
52821      close();
52822    }
52823  }
52824
52825  protected void composePersonLinkComponentProperties(Person.PersonLinkComponent element) throws IOException {
52826    composeBackboneElementProperties(element);
52827      if (element.hasTarget()) {
52828        composeReference("target", element.getTarget());
52829      }
52830      if (element.hasAssuranceElement()) {
52831        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
52832        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
52833      }
52834  }
52835
52836  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
52837    if (element != null) {
52838      prop("resourceType", name);
52839      composePlanDefinitionProperties(element);
52840    }
52841  }
52842
52843  protected void composePlanDefinitionProperties(PlanDefinition element) throws IOException {
52844    composeMetadataResourceProperties(element);
52845      if (element.hasUrlElement()) {
52846        composeUriCore("url", element.getUrlElement(), false);
52847        composeUriExtras("url", element.getUrlElement(), false);
52848      }
52849      if (element.hasIdentifier()) {
52850        openArray("identifier");
52851        for (Identifier e : element.getIdentifier()) 
52852          composeIdentifier(null, e);
52853        closeArray();
52854      };
52855      if (element.hasVersionElement()) {
52856        composeStringCore("version", element.getVersionElement(), false);
52857        composeStringExtras("version", element.getVersionElement(), false);
52858      }
52859      if (element.hasNameElement()) {
52860        composeStringCore("name", element.getNameElement(), false);
52861        composeStringExtras("name", element.getNameElement(), false);
52862      }
52863      if (element.hasTitleElement()) {
52864        composeStringCore("title", element.getTitleElement(), false);
52865        composeStringExtras("title", element.getTitleElement(), false);
52866      }
52867      if (element.hasSubtitleElement()) {
52868        composeStringCore("subtitle", element.getSubtitleElement(), false);
52869        composeStringExtras("subtitle", element.getSubtitleElement(), false);
52870      }
52871      if (element.hasType()) {
52872        composeCodeableConcept("type", element.getType());
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.hasSubject()) {
52883        composeType("subject", element.getSubject());
52884      }
52885      if (element.hasDateElement()) {
52886        composeDateTimeCore("date", element.getDateElement(), false);
52887        composeDateTimeExtras("date", element.getDateElement(), false);
52888      }
52889      if (element.hasPublisherElement()) {
52890        composeStringCore("publisher", element.getPublisherElement(), false);
52891        composeStringExtras("publisher", element.getPublisherElement(), false);
52892      }
52893      if (element.hasContact()) {
52894        openArray("contact");
52895        for (ContactDetail e : element.getContact()) 
52896          composeContactDetail(null, e);
52897        closeArray();
52898      };
52899      if (element.hasDescriptionElement()) {
52900        composeMarkdownCore("description", element.getDescriptionElement(), false);
52901        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52902      }
52903      if (element.hasUseContext()) {
52904        openArray("useContext");
52905        for (UsageContext e : element.getUseContext()) 
52906          composeUsageContext(null, e);
52907        closeArray();
52908      };
52909      if (element.hasJurisdiction()) {
52910        openArray("jurisdiction");
52911        for (CodeableConcept e : element.getJurisdiction()) 
52912          composeCodeableConcept(null, e);
52913        closeArray();
52914      };
52915      if (element.hasPurposeElement()) {
52916        composeMarkdownCore("purpose", element.getPurposeElement(), false);
52917        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
52918      }
52919      if (element.hasUsageElement()) {
52920        composeStringCore("usage", element.getUsageElement(), false);
52921        composeStringExtras("usage", element.getUsageElement(), false);
52922      }
52923      if (element.hasCopyrightElement()) {
52924        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
52925        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
52926      }
52927      if (element.hasApprovalDateElement()) {
52928        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
52929        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
52930      }
52931      if (element.hasLastReviewDateElement()) {
52932        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
52933        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
52934      }
52935      if (element.hasEffectivePeriod()) {
52936        composePeriod("effectivePeriod", element.getEffectivePeriod());
52937      }
52938      if (element.hasTopic()) {
52939        openArray("topic");
52940        for (CodeableConcept e : element.getTopic()) 
52941          composeCodeableConcept(null, e);
52942        closeArray();
52943      };
52944      if (element.hasAuthor()) {
52945        openArray("author");
52946        for (ContactDetail e : element.getAuthor()) 
52947          composeContactDetail(null, e);
52948        closeArray();
52949      };
52950      if (element.hasEditor()) {
52951        openArray("editor");
52952        for (ContactDetail e : element.getEditor()) 
52953          composeContactDetail(null, e);
52954        closeArray();
52955      };
52956      if (element.hasReviewer()) {
52957        openArray("reviewer");
52958        for (ContactDetail e : element.getReviewer()) 
52959          composeContactDetail(null, e);
52960        closeArray();
52961      };
52962      if (element.hasEndorser()) {
52963        openArray("endorser");
52964        for (ContactDetail e : element.getEndorser()) 
52965          composeContactDetail(null, e);
52966        closeArray();
52967      };
52968      if (element.hasRelatedArtifact()) {
52969        openArray("relatedArtifact");
52970        for (RelatedArtifact e : element.getRelatedArtifact()) 
52971          composeRelatedArtifact(null, e);
52972        closeArray();
52973      };
52974      if (element.hasLibrary()) {
52975        openArray("library");
52976        for (CanonicalType e : element.getLibrary()) 
52977          composeCanonicalCore(null, e, true);
52978        closeArray();
52979        if (anyHasExtras(element.getLibrary())) {
52980          openArray("_library");
52981          for (CanonicalType e : element.getLibrary()) 
52982            composeCanonicalExtras(null, e, true);
52983          closeArray();
52984        }
52985      };
52986      if (element.hasGoal()) {
52987        openArray("goal");
52988        for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal()) 
52989          composePlanDefinitionGoalComponent(null, e);
52990        closeArray();
52991      };
52992      if (element.hasAction()) {
52993        openArray("action");
52994        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
52995          composePlanDefinitionActionComponent(null, e);
52996        closeArray();
52997      };
52998  }
52999
53000  protected void composePlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
53001    if (element != null) {
53002      open(name);
53003      composePlanDefinitionGoalComponentProperties(element);
53004      close();
53005    }
53006  }
53007
53008  protected void composePlanDefinitionGoalComponentProperties(PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
53009    composeBackboneElementProperties(element);
53010      if (element.hasCategory()) {
53011        composeCodeableConcept("category", element.getCategory());
53012      }
53013      if (element.hasDescription()) {
53014        composeCodeableConcept("description", element.getDescription());
53015      }
53016      if (element.hasPriority()) {
53017        composeCodeableConcept("priority", element.getPriority());
53018      }
53019      if (element.hasStart()) {
53020        composeCodeableConcept("start", element.getStart());
53021      }
53022      if (element.hasAddresses()) {
53023        openArray("addresses");
53024        for (CodeableConcept e : element.getAddresses()) 
53025          composeCodeableConcept(null, e);
53026        closeArray();
53027      };
53028      if (element.hasDocumentation()) {
53029        openArray("documentation");
53030        for (RelatedArtifact e : element.getDocumentation()) 
53031          composeRelatedArtifact(null, e);
53032        closeArray();
53033      };
53034      if (element.hasTarget()) {
53035        openArray("target");
53036        for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget()) 
53037          composePlanDefinitionGoalTargetComponent(null, e);
53038        closeArray();
53039      };
53040  }
53041
53042  protected void composePlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
53043    if (element != null) {
53044      open(name);
53045      composePlanDefinitionGoalTargetComponentProperties(element);
53046      close();
53047    }
53048  }
53049
53050  protected void composePlanDefinitionGoalTargetComponentProperties(PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
53051    composeBackboneElementProperties(element);
53052      if (element.hasMeasure()) {
53053        composeCodeableConcept("measure", element.getMeasure());
53054      }
53055      if (element.hasDetail()) {
53056        composeType("detail", element.getDetail());
53057      }
53058      if (element.hasDue()) {
53059        composeDuration("due", element.getDue());
53060      }
53061  }
53062
53063  protected void composePlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
53064    if (element != null) {
53065      open(name);
53066      composePlanDefinitionActionComponentProperties(element);
53067      close();
53068    }
53069  }
53070
53071  protected void composePlanDefinitionActionComponentProperties(PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
53072    composeBackboneElementProperties(element);
53073      if (element.hasPrefixElement()) {
53074        composeStringCore("prefix", element.getPrefixElement(), false);
53075        composeStringExtras("prefix", element.getPrefixElement(), false);
53076      }
53077      if (element.hasTitleElement()) {
53078        composeStringCore("title", element.getTitleElement(), false);
53079        composeStringExtras("title", element.getTitleElement(), false);
53080      }
53081      if (element.hasDescriptionElement()) {
53082        composeStringCore("description", element.getDescriptionElement(), false);
53083        composeStringExtras("description", element.getDescriptionElement(), false);
53084      }
53085      if (element.hasTextEquivalentElement()) {
53086        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
53087        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
53088      }
53089      if (element.hasPriorityElement()) {
53090        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
53091        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
53092      }
53093      if (element.hasCode()) {
53094        openArray("code");
53095        for (CodeableConcept e : element.getCode()) 
53096          composeCodeableConcept(null, e);
53097        closeArray();
53098      };
53099      if (element.hasReason()) {
53100        openArray("reason");
53101        for (CodeableConcept e : element.getReason()) 
53102          composeCodeableConcept(null, e);
53103        closeArray();
53104      };
53105      if (element.hasDocumentation()) {
53106        openArray("documentation");
53107        for (RelatedArtifact e : element.getDocumentation()) 
53108          composeRelatedArtifact(null, e);
53109        closeArray();
53110      };
53111      if (element.hasGoalId()) {
53112        openArray("goalId");
53113        for (IdType e : element.getGoalId()) 
53114          composeIdCore(null, e, true);
53115        closeArray();
53116        if (anyHasExtras(element.getGoalId())) {
53117          openArray("_goalId");
53118          for (IdType e : element.getGoalId()) 
53119            composeIdExtras(null, e, true);
53120          closeArray();
53121        }
53122      };
53123      if (element.hasSubject()) {
53124        composeType("subject", element.getSubject());
53125      }
53126      if (element.hasTrigger()) {
53127        openArray("trigger");
53128        for (TriggerDefinition e : element.getTrigger()) 
53129          composeTriggerDefinition(null, e);
53130        closeArray();
53131      };
53132      if (element.hasCondition()) {
53133        openArray("condition");
53134        for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition()) 
53135          composePlanDefinitionActionConditionComponent(null, e);
53136        closeArray();
53137      };
53138      if (element.hasInput()) {
53139        openArray("input");
53140        for (DataRequirement e : element.getInput()) 
53141          composeDataRequirement(null, e);
53142        closeArray();
53143      };
53144      if (element.hasOutput()) {
53145        openArray("output");
53146        for (DataRequirement e : element.getOutput()) 
53147          composeDataRequirement(null, e);
53148        closeArray();
53149      };
53150      if (element.hasRelatedAction()) {
53151        openArray("relatedAction");
53152        for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction()) 
53153          composePlanDefinitionActionRelatedActionComponent(null, e);
53154        closeArray();
53155      };
53156      if (element.hasTiming()) {
53157        composeType("timing", element.getTiming());
53158      }
53159      if (element.hasParticipant()) {
53160        openArray("participant");
53161        for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
53162          composePlanDefinitionActionParticipantComponent(null, e);
53163        closeArray();
53164      };
53165      if (element.hasType()) {
53166        composeCodeableConcept("type", element.getType());
53167      }
53168      if (element.hasGroupingBehaviorElement()) {
53169        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
53170        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
53171      }
53172      if (element.hasSelectionBehaviorElement()) {
53173        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
53174        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
53175      }
53176      if (element.hasRequiredBehaviorElement()) {
53177        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
53178        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
53179      }
53180      if (element.hasPrecheckBehaviorElement()) {
53181        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
53182        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
53183      }
53184      if (element.hasCardinalityBehaviorElement()) {
53185        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
53186        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
53187      }
53188      if (element.hasDefinition()) {
53189        composeType("definition", element.getDefinition());
53190      }
53191      if (element.hasTransformElement()) {
53192        composeCanonicalCore("transform", element.getTransformElement(), false);
53193        composeCanonicalExtras("transform", element.getTransformElement(), false);
53194      }
53195      if (element.hasDynamicValue()) {
53196        openArray("dynamicValue");
53197        for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
53198          composePlanDefinitionActionDynamicValueComponent(null, e);
53199        closeArray();
53200      };
53201      if (element.hasAction()) {
53202        openArray("action");
53203        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
53204          composePlanDefinitionActionComponent(null, e);
53205        closeArray();
53206      };
53207  }
53208
53209  protected void composePlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
53210    if (element != null) {
53211      open(name);
53212      composePlanDefinitionActionConditionComponentProperties(element);
53213      close();
53214    }
53215  }
53216
53217  protected void composePlanDefinitionActionConditionComponentProperties(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
53218    composeBackboneElementProperties(element);
53219      if (element.hasKindElement()) {
53220        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
53221        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
53222      }
53223      if (element.hasExpression()) {
53224        composeExpression("expression", element.getExpression());
53225      }
53226  }
53227
53228  protected void composePlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
53229    if (element != null) {
53230      open(name);
53231      composePlanDefinitionActionRelatedActionComponentProperties(element);
53232      close();
53233    }
53234  }
53235
53236  protected void composePlanDefinitionActionRelatedActionComponentProperties(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
53237    composeBackboneElementProperties(element);
53238      if (element.hasActionIdElement()) {
53239        composeIdCore("actionId", element.getActionIdElement(), false);
53240        composeIdExtras("actionId", element.getActionIdElement(), false);
53241      }
53242      if (element.hasRelationshipElement()) {
53243        composeEnumerationCore("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
53244        composeEnumerationExtras("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
53245      }
53246      if (element.hasOffset()) {
53247        composeType("offset", element.getOffset());
53248      }
53249  }
53250
53251  protected void composePlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
53252    if (element != null) {
53253      open(name);
53254      composePlanDefinitionActionParticipantComponentProperties(element);
53255      close();
53256    }
53257  }
53258
53259  protected void composePlanDefinitionActionParticipantComponentProperties(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
53260    composeBackboneElementProperties(element);
53261      if (element.hasTypeElement()) {
53262        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
53263        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory(), false);
53264      }
53265      if (element.hasRole()) {
53266        composeCodeableConcept("role", element.getRole());
53267      }
53268  }
53269
53270  protected void composePlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
53271    if (element != null) {
53272      open(name);
53273      composePlanDefinitionActionDynamicValueComponentProperties(element);
53274      close();
53275    }
53276  }
53277
53278  protected void composePlanDefinitionActionDynamicValueComponentProperties(PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
53279    composeBackboneElementProperties(element);
53280      if (element.hasPathElement()) {
53281        composeStringCore("path", element.getPathElement(), false);
53282        composeStringExtras("path", element.getPathElement(), false);
53283      }
53284      if (element.hasExpression()) {
53285        composeExpression("expression", element.getExpression());
53286      }
53287  }
53288
53289  protected void composePractitioner(String name, Practitioner element) throws IOException {
53290    if (element != null) {
53291      prop("resourceType", name);
53292      composePractitionerProperties(element);
53293    }
53294  }
53295
53296  protected void composePractitionerProperties(Practitioner element) throws IOException {
53297    composeDomainResourceProperties(element);
53298      if (element.hasIdentifier()) {
53299        openArray("identifier");
53300        for (Identifier e : element.getIdentifier()) 
53301          composeIdentifier(null, e);
53302        closeArray();
53303      };
53304      if (element.hasActiveElement()) {
53305        composeBooleanCore("active", element.getActiveElement(), false);
53306        composeBooleanExtras("active", element.getActiveElement(), false);
53307      }
53308      if (element.hasName()) {
53309        openArray("name");
53310        for (HumanName e : element.getName()) 
53311          composeHumanName(null, e);
53312        closeArray();
53313      };
53314      if (element.hasTelecom()) {
53315        openArray("telecom");
53316        for (ContactPoint e : element.getTelecom()) 
53317          composeContactPoint(null, e);
53318        closeArray();
53319      };
53320      if (element.hasAddress()) {
53321        openArray("address");
53322        for (Address e : element.getAddress()) 
53323          composeAddress(null, e);
53324        closeArray();
53325      };
53326      if (element.hasGenderElement()) {
53327        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
53328        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
53329      }
53330      if (element.hasBirthDateElement()) {
53331        composeDateCore("birthDate", element.getBirthDateElement(), false);
53332        composeDateExtras("birthDate", element.getBirthDateElement(), false);
53333      }
53334      if (element.hasPhoto()) {
53335        openArray("photo");
53336        for (Attachment e : element.getPhoto()) 
53337          composeAttachment(null, e);
53338        closeArray();
53339      };
53340      if (element.hasQualification()) {
53341        openArray("qualification");
53342        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
53343          composePractitionerQualificationComponent(null, e);
53344        closeArray();
53345      };
53346      if (element.hasCommunication()) {
53347        openArray("communication");
53348        for (CodeableConcept e : element.getCommunication()) 
53349          composeCodeableConcept(null, e);
53350        closeArray();
53351      };
53352  }
53353
53354  protected void composePractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
53355    if (element != null) {
53356      open(name);
53357      composePractitionerQualificationComponentProperties(element);
53358      close();
53359    }
53360  }
53361
53362  protected void composePractitionerQualificationComponentProperties(Practitioner.PractitionerQualificationComponent element) throws IOException {
53363    composeBackboneElementProperties(element);
53364      if (element.hasIdentifier()) {
53365        openArray("identifier");
53366        for (Identifier e : element.getIdentifier()) 
53367          composeIdentifier(null, e);
53368        closeArray();
53369      };
53370      if (element.hasCode()) {
53371        composeCodeableConcept("code", element.getCode());
53372      }
53373      if (element.hasPeriod()) {
53374        composePeriod("period", element.getPeriod());
53375      }
53376      if (element.hasIssuer()) {
53377        composeReference("issuer", element.getIssuer());
53378      }
53379  }
53380
53381  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
53382    if (element != null) {
53383      prop("resourceType", name);
53384      composePractitionerRoleProperties(element);
53385    }
53386  }
53387
53388  protected void composePractitionerRoleProperties(PractitionerRole element) throws IOException {
53389    composeDomainResourceProperties(element);
53390      if (element.hasIdentifier()) {
53391        openArray("identifier");
53392        for (Identifier e : element.getIdentifier()) 
53393          composeIdentifier(null, e);
53394        closeArray();
53395      };
53396      if (element.hasActiveElement()) {
53397        composeBooleanCore("active", element.getActiveElement(), false);
53398        composeBooleanExtras("active", element.getActiveElement(), false);
53399      }
53400      if (element.hasPeriod()) {
53401        composePeriod("period", element.getPeriod());
53402      }
53403      if (element.hasPractitioner()) {
53404        composeReference("practitioner", element.getPractitioner());
53405      }
53406      if (element.hasOrganization()) {
53407        composeReference("organization", element.getOrganization());
53408      }
53409      if (element.hasCode()) {
53410        openArray("code");
53411        for (CodeableConcept e : element.getCode()) 
53412          composeCodeableConcept(null, e);
53413        closeArray();
53414      };
53415      if (element.hasSpecialty()) {
53416        openArray("specialty");
53417        for (CodeableConcept e : element.getSpecialty()) 
53418          composeCodeableConcept(null, e);
53419        closeArray();
53420      };
53421      if (element.hasLocation()) {
53422        openArray("location");
53423        for (Reference e : element.getLocation()) 
53424          composeReference(null, e);
53425        closeArray();
53426      };
53427      if (element.hasHealthcareService()) {
53428        openArray("healthcareService");
53429        for (Reference e : element.getHealthcareService()) 
53430          composeReference(null, e);
53431        closeArray();
53432      };
53433      if (element.hasTelecom()) {
53434        openArray("telecom");
53435        for (ContactPoint e : element.getTelecom()) 
53436          composeContactPoint(null, e);
53437        closeArray();
53438      };
53439      if (element.hasAvailableTime()) {
53440        openArray("availableTime");
53441        for (PractitionerRole.PractitionerRoleAvailableTimeComponent e : element.getAvailableTime()) 
53442          composePractitionerRoleAvailableTimeComponent(null, e);
53443        closeArray();
53444      };
53445      if (element.hasNotAvailable()) {
53446        openArray("notAvailable");
53447        for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable()) 
53448          composePractitionerRoleNotAvailableComponent(null, e);
53449        closeArray();
53450      };
53451      if (element.hasAvailabilityExceptionsElement()) {
53452        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
53453        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
53454      }
53455      if (element.hasEndpoint()) {
53456        openArray("endpoint");
53457        for (Reference e : element.getEndpoint()) 
53458          composeReference(null, e);
53459        closeArray();
53460      };
53461  }
53462
53463  protected void composePractitionerRoleAvailableTimeComponent(String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
53464    if (element != null) {
53465      open(name);
53466      composePractitionerRoleAvailableTimeComponentProperties(element);
53467      close();
53468    }
53469  }
53470
53471  protected void composePractitionerRoleAvailableTimeComponentProperties(PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
53472    composeBackboneElementProperties(element);
53473      if (element.hasDaysOfWeek()) {
53474        openArray("daysOfWeek");
53475        for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
53476          composeEnumerationCore(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
53477        closeArray();
53478        if (anyHasExtras(element.getDaysOfWeek())) {
53479          openArray("_daysOfWeek");
53480          for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
53481            composeEnumerationExtras(null, e, new Enumerations.DaysOfWeekEnumFactory(), true);
53482          closeArray();
53483        }
53484      };
53485      if (element.hasAllDayElement()) {
53486        composeBooleanCore("allDay", element.getAllDayElement(), false);
53487        composeBooleanExtras("allDay", element.getAllDayElement(), false);
53488      }
53489      if (element.hasAvailableStartTimeElement()) {
53490        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
53491        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
53492      }
53493      if (element.hasAvailableEndTimeElement()) {
53494        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
53495        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
53496      }
53497  }
53498
53499  protected void composePractitionerRoleNotAvailableComponent(String name, PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
53500    if (element != null) {
53501      open(name);
53502      composePractitionerRoleNotAvailableComponentProperties(element);
53503      close();
53504    }
53505  }
53506
53507  protected void composePractitionerRoleNotAvailableComponentProperties(PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
53508    composeBackboneElementProperties(element);
53509      if (element.hasDescriptionElement()) {
53510        composeStringCore("description", element.getDescriptionElement(), false);
53511        composeStringExtras("description", element.getDescriptionElement(), false);
53512      }
53513      if (element.hasDuring()) {
53514        composePeriod("during", element.getDuring());
53515      }
53516  }
53517
53518  protected void composeProcedure(String name, Procedure element) throws IOException {
53519    if (element != null) {
53520      prop("resourceType", name);
53521      composeProcedureProperties(element);
53522    }
53523  }
53524
53525  protected void composeProcedureProperties(Procedure element) throws IOException {
53526    composeDomainResourceProperties(element);
53527      if (element.hasIdentifier()) {
53528        openArray("identifier");
53529        for (Identifier e : element.getIdentifier()) 
53530          composeIdentifier(null, e);
53531        closeArray();
53532      };
53533      if (element.hasInstantiatesCanonical()) {
53534        openArray("instantiatesCanonical");
53535        for (CanonicalType e : element.getInstantiatesCanonical()) 
53536          composeCanonicalCore(null, e, true);
53537        closeArray();
53538        if (anyHasExtras(element.getInstantiatesCanonical())) {
53539          openArray("_instantiatesCanonical");
53540          for (CanonicalType e : element.getInstantiatesCanonical()) 
53541            composeCanonicalExtras(null, e, true);
53542          closeArray();
53543        }
53544      };
53545      if (element.hasInstantiatesUri()) {
53546        openArray("instantiatesUri");
53547        for (UriType e : element.getInstantiatesUri()) 
53548          composeUriCore(null, e, true);
53549        closeArray();
53550        if (anyHasExtras(element.getInstantiatesUri())) {
53551          openArray("_instantiatesUri");
53552          for (UriType e : element.getInstantiatesUri()) 
53553            composeUriExtras(null, e, true);
53554          closeArray();
53555        }
53556      };
53557      if (element.hasBasedOn()) {
53558        openArray("basedOn");
53559        for (Reference e : element.getBasedOn()) 
53560          composeReference(null, e);
53561        closeArray();
53562      };
53563      if (element.hasPartOf()) {
53564        openArray("partOf");
53565        for (Reference e : element.getPartOf()) 
53566          composeReference(null, e);
53567        closeArray();
53568      };
53569      if (element.hasStatusElement()) {
53570        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
53571        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.EventStatusEnumFactory(), false);
53572      }
53573      if (element.hasStatusReason()) {
53574        composeCodeableConcept("statusReason", element.getStatusReason());
53575      }
53576      if (element.hasCategory()) {
53577        openArray("category");
53578        for (CodeableConcept e : element.getCategory()) 
53579          composeCodeableConcept(null, e);
53580        closeArray();
53581      };
53582      if (element.hasCode()) {
53583        composeCodeableConcept("code", element.getCode());
53584      }
53585      if (element.hasSubject()) {
53586        composeReference("subject", element.getSubject());
53587      }
53588      if (element.hasEncounter()) {
53589        composeReference("encounter", element.getEncounter());
53590      }
53591      if (element.hasOccurrence()) {
53592        composeType("occurrence", element.getOccurrence());
53593      }
53594      if (element.hasRecordedElement()) {
53595        composeDateTimeCore("recorded", element.getRecordedElement(), false);
53596        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
53597      }
53598      if (element.hasRecorder()) {
53599        composeReference("recorder", element.getRecorder());
53600      }
53601      if (element.hasReported()) {
53602        composeType("reported", element.getReported());
53603      }
53604      if (element.hasPerformer()) {
53605        openArray("performer");
53606        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
53607          composeProcedurePerformerComponent(null, e);
53608        closeArray();
53609      };
53610      if (element.hasLocation()) {
53611        composeReference("location", element.getLocation());
53612      }
53613      if (element.hasReason()) {
53614        openArray("reason");
53615        for (CodeableReference e : element.getReason()) 
53616          composeCodeableReference(null, e);
53617        closeArray();
53618      };
53619      if (element.hasBodySite()) {
53620        openArray("bodySite");
53621        for (CodeableConcept e : element.getBodySite()) 
53622          composeCodeableConcept(null, e);
53623        closeArray();
53624      };
53625      if (element.hasOutcome()) {
53626        composeCodeableConcept("outcome", element.getOutcome());
53627      }
53628      if (element.hasReport()) {
53629        openArray("report");
53630        for (Reference e : element.getReport()) 
53631          composeReference(null, e);
53632        closeArray();
53633      };
53634      if (element.hasComplication()) {
53635        openArray("complication");
53636        for (CodeableConcept e : element.getComplication()) 
53637          composeCodeableConcept(null, e);
53638        closeArray();
53639      };
53640      if (element.hasComplicationDetail()) {
53641        openArray("complicationDetail");
53642        for (Reference e : element.getComplicationDetail()) 
53643          composeReference(null, e);
53644        closeArray();
53645      };
53646      if (element.hasFollowUp()) {
53647        openArray("followUp");
53648        for (CodeableConcept e : element.getFollowUp()) 
53649          composeCodeableConcept(null, e);
53650        closeArray();
53651      };
53652      if (element.hasNote()) {
53653        openArray("note");
53654        for (Annotation e : element.getNote()) 
53655          composeAnnotation(null, e);
53656        closeArray();
53657      };
53658      if (element.hasFocalDevice()) {
53659        openArray("focalDevice");
53660        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
53661          composeProcedureFocalDeviceComponent(null, e);
53662        closeArray();
53663      };
53664      if (element.hasUsed()) {
53665        openArray("used");
53666        for (CodeableReference e : element.getUsed()) 
53667          composeCodeableReference(null, e);
53668        closeArray();
53669      };
53670  }
53671
53672  protected void composeProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
53673    if (element != null) {
53674      open(name);
53675      composeProcedurePerformerComponentProperties(element);
53676      close();
53677    }
53678  }
53679
53680  protected void composeProcedurePerformerComponentProperties(Procedure.ProcedurePerformerComponent element) throws IOException {
53681    composeBackboneElementProperties(element);
53682      if (element.hasFunction()) {
53683        composeCodeableConcept("function", element.getFunction());
53684      }
53685      if (element.hasActor()) {
53686        composeReference("actor", element.getActor());
53687      }
53688      if (element.hasOnBehalfOf()) {
53689        composeReference("onBehalfOf", element.getOnBehalfOf());
53690      }
53691  }
53692
53693  protected void composeProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
53694    if (element != null) {
53695      open(name);
53696      composeProcedureFocalDeviceComponentProperties(element);
53697      close();
53698    }
53699  }
53700
53701  protected void composeProcedureFocalDeviceComponentProperties(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
53702    composeBackboneElementProperties(element);
53703      if (element.hasAction()) {
53704        composeCodeableConcept("action", element.getAction());
53705      }
53706      if (element.hasManipulated()) {
53707        composeReference("manipulated", element.getManipulated());
53708      }
53709  }
53710
53711  protected void composeProvenance(String name, Provenance element) throws IOException {
53712    if (element != null) {
53713      prop("resourceType", name);
53714      composeProvenanceProperties(element);
53715    }
53716  }
53717
53718  protected void composeProvenanceProperties(Provenance element) throws IOException {
53719    composeDomainResourceProperties(element);
53720      if (element.hasTarget()) {
53721        openArray("target");
53722        for (Reference e : element.getTarget()) 
53723          composeReference(null, e);
53724        closeArray();
53725      };
53726      if (element.hasOccurred()) {
53727        composeType("occurred", element.getOccurred());
53728      }
53729      if (element.hasRecordedElement()) {
53730        composeInstantCore("recorded", element.getRecordedElement(), false);
53731        composeInstantExtras("recorded", element.getRecordedElement(), false);
53732      }
53733      if (element.hasPolicy()) {
53734        openArray("policy");
53735        for (UriType e : element.getPolicy()) 
53736          composeUriCore(null, e, true);
53737        closeArray();
53738        if (anyHasExtras(element.getPolicy())) {
53739          openArray("_policy");
53740          for (UriType e : element.getPolicy()) 
53741            composeUriExtras(null, e, true);
53742          closeArray();
53743        }
53744      };
53745      if (element.hasLocation()) {
53746        composeReference("location", element.getLocation());
53747      }
53748      if (element.hasReason()) {
53749        openArray("reason");
53750        for (CodeableConcept e : element.getReason()) 
53751          composeCodeableConcept(null, e);
53752        closeArray();
53753      };
53754      if (element.hasActivity()) {
53755        composeCodeableConcept("activity", element.getActivity());
53756      }
53757      if (element.hasAgent()) {
53758        openArray("agent");
53759        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
53760          composeProvenanceAgentComponent(null, e);
53761        closeArray();
53762      };
53763      if (element.hasEntity()) {
53764        openArray("entity");
53765        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
53766          composeProvenanceEntityComponent(null, e);
53767        closeArray();
53768      };
53769      if (element.hasSignature()) {
53770        openArray("signature");
53771        for (Signature e : element.getSignature()) 
53772          composeSignature(null, e);
53773        closeArray();
53774      };
53775  }
53776
53777  protected void composeProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
53778    if (element != null) {
53779      open(name);
53780      composeProvenanceAgentComponentProperties(element);
53781      close();
53782    }
53783  }
53784
53785  protected void composeProvenanceAgentComponentProperties(Provenance.ProvenanceAgentComponent element) throws IOException {
53786    composeBackboneElementProperties(element);
53787      if (element.hasType()) {
53788        composeCodeableConcept("type", element.getType());
53789      }
53790      if (element.hasRole()) {
53791        openArray("role");
53792        for (CodeableConcept e : element.getRole()) 
53793          composeCodeableConcept(null, e);
53794        closeArray();
53795      };
53796      if (element.hasWho()) {
53797        composeReference("who", element.getWho());
53798      }
53799      if (element.hasOnBehalfOf()) {
53800        composeReference("onBehalfOf", element.getOnBehalfOf());
53801      }
53802  }
53803
53804  protected void composeProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
53805    if (element != null) {
53806      open(name);
53807      composeProvenanceEntityComponentProperties(element);
53808      close();
53809    }
53810  }
53811
53812  protected void composeProvenanceEntityComponentProperties(Provenance.ProvenanceEntityComponent element) throws IOException {
53813    composeBackboneElementProperties(element);
53814      if (element.hasRoleElement()) {
53815        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
53816        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
53817      }
53818      if (element.hasWhat()) {
53819        composeReference("what", element.getWhat());
53820      }
53821      if (element.hasAgent()) {
53822        openArray("agent");
53823        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
53824          composeProvenanceAgentComponent(null, e);
53825        closeArray();
53826      };
53827  }
53828
53829  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
53830    if (element != null) {
53831      prop("resourceType", name);
53832      composeQuestionnaireProperties(element);
53833    }
53834  }
53835
53836  protected void composeQuestionnaireProperties(Questionnaire element) throws IOException {
53837    composeMetadataResourceProperties(element);
53838      if (element.hasUrlElement()) {
53839        composeUriCore("url", element.getUrlElement(), false);
53840        composeUriExtras("url", element.getUrlElement(), false);
53841      }
53842      if (element.hasIdentifier()) {
53843        openArray("identifier");
53844        for (Identifier e : element.getIdentifier()) 
53845          composeIdentifier(null, e);
53846        closeArray();
53847      };
53848      if (element.hasVersionElement()) {
53849        composeStringCore("version", element.getVersionElement(), false);
53850        composeStringExtras("version", element.getVersionElement(), false);
53851      }
53852      if (element.hasNameElement()) {
53853        composeStringCore("name", element.getNameElement(), false);
53854        composeStringExtras("name", element.getNameElement(), false);
53855      }
53856      if (element.hasTitleElement()) {
53857        composeStringCore("title", element.getTitleElement(), false);
53858        composeStringExtras("title", element.getTitleElement(), false);
53859      }
53860      if (element.hasDerivedFrom()) {
53861        openArray("derivedFrom");
53862        for (CanonicalType e : element.getDerivedFrom()) 
53863          composeCanonicalCore(null, e, true);
53864        closeArray();
53865        if (anyHasExtras(element.getDerivedFrom())) {
53866          openArray("_derivedFrom");
53867          for (CanonicalType e : element.getDerivedFrom()) 
53868            composeCanonicalExtras(null, e, true);
53869          closeArray();
53870        }
53871      };
53872      if (element.hasStatusElement()) {
53873        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53874        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53875      }
53876      if (element.hasExperimentalElement()) {
53877        composeBooleanCore("experimental", element.getExperimentalElement(), false);
53878        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
53879      }
53880      if (element.hasSubjectType()) {
53881        openArray("subjectType");
53882        for (CodeType e : element.getSubjectType()) 
53883          composeCodeCore(null, e, true);
53884        closeArray();
53885        if (anyHasExtras(element.getSubjectType())) {
53886          openArray("_subjectType");
53887          for (CodeType e : element.getSubjectType()) 
53888            composeCodeExtras(null, e, true);
53889          closeArray();
53890        }
53891      };
53892      if (element.hasDateElement()) {
53893        composeDateTimeCore("date", element.getDateElement(), false);
53894        composeDateTimeExtras("date", element.getDateElement(), false);
53895      }
53896      if (element.hasPublisherElement()) {
53897        composeStringCore("publisher", element.getPublisherElement(), false);
53898        composeStringExtras("publisher", element.getPublisherElement(), false);
53899      }
53900      if (element.hasContact()) {
53901        openArray("contact");
53902        for (ContactDetail e : element.getContact()) 
53903          composeContactDetail(null, e);
53904        closeArray();
53905      };
53906      if (element.hasDescriptionElement()) {
53907        composeMarkdownCore("description", element.getDescriptionElement(), false);
53908        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53909      }
53910      if (element.hasUseContext()) {
53911        openArray("useContext");
53912        for (UsageContext e : element.getUseContext()) 
53913          composeUsageContext(null, e);
53914        closeArray();
53915      };
53916      if (element.hasJurisdiction()) {
53917        openArray("jurisdiction");
53918        for (CodeableConcept e : element.getJurisdiction()) 
53919          composeCodeableConcept(null, e);
53920        closeArray();
53921      };
53922      if (element.hasPurposeElement()) {
53923        composeMarkdownCore("purpose", element.getPurposeElement(), false);
53924        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
53925      }
53926      if (element.hasCopyrightElement()) {
53927        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
53928        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
53929      }
53930      if (element.hasApprovalDateElement()) {
53931        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
53932        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
53933      }
53934      if (element.hasLastReviewDateElement()) {
53935        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
53936        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
53937      }
53938      if (element.hasEffectivePeriod()) {
53939        composePeriod("effectivePeriod", element.getEffectivePeriod());
53940      }
53941      if (element.hasCode()) {
53942        openArray("code");
53943        for (Coding e : element.getCode()) 
53944          composeCoding(null, e);
53945        closeArray();
53946      };
53947      if (element.hasItem()) {
53948        openArray("item");
53949        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
53950          composeQuestionnaireItemComponent(null, e);
53951        closeArray();
53952      };
53953  }
53954
53955  protected void composeQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
53956    if (element != null) {
53957      open(name);
53958      composeQuestionnaireItemComponentProperties(element);
53959      close();
53960    }
53961  }
53962
53963  protected void composeQuestionnaireItemComponentProperties(Questionnaire.QuestionnaireItemComponent element) throws IOException {
53964    composeBackboneElementProperties(element);
53965      if (element.hasLinkIdElement()) {
53966        composeStringCore("linkId", element.getLinkIdElement(), false);
53967        composeStringExtras("linkId", element.getLinkIdElement(), false);
53968      }
53969      if (element.hasDefinitionElement()) {
53970        composeUriCore("definition", element.getDefinitionElement(), false);
53971        composeUriExtras("definition", element.getDefinitionElement(), false);
53972      }
53973      if (element.hasCode()) {
53974        openArray("code");
53975        for (Coding e : element.getCode()) 
53976          composeCoding(null, e);
53977        closeArray();
53978      };
53979      if (element.hasPrefixElement()) {
53980        composeStringCore("prefix", element.getPrefixElement(), false);
53981        composeStringExtras("prefix", element.getPrefixElement(), false);
53982      }
53983      if (element.hasTextElement()) {
53984        composeStringCore("text", element.getTextElement(), false);
53985        composeStringExtras("text", element.getTextElement(), false);
53986      }
53987      if (element.hasTypeElement()) {
53988        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
53989        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
53990      }
53991      if (element.hasEnableWhen()) {
53992        openArray("enableWhen");
53993        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
53994          composeQuestionnaireItemEnableWhenComponent(null, e);
53995        closeArray();
53996      };
53997      if (element.hasEnableBehaviorElement()) {
53998        composeEnumerationCore("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
53999        composeEnumerationExtras("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
54000      }
54001      if (element.hasRequiredElement()) {
54002        composeBooleanCore("required", element.getRequiredElement(), false);
54003        composeBooleanExtras("required", element.getRequiredElement(), false);
54004      }
54005      if (element.hasRepeatsElement()) {
54006        composeBooleanCore("repeats", element.getRepeatsElement(), false);
54007        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
54008      }
54009      if (element.hasReadOnlyElement()) {
54010        composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
54011        composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
54012      }
54013      if (element.hasMaxLengthElement()) {
54014        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
54015        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
54016      }
54017      if (element.hasAnswerValueSetElement()) {
54018        composeCanonicalCore("answerValueSet", element.getAnswerValueSetElement(), false);
54019        composeCanonicalExtras("answerValueSet", element.getAnswerValueSetElement(), false);
54020      }
54021      if (element.hasAnswerOption()) {
54022        openArray("answerOption");
54023        for (Questionnaire.QuestionnaireItemAnswerOptionComponent e : element.getAnswerOption()) 
54024          composeQuestionnaireItemAnswerOptionComponent(null, e);
54025        closeArray();
54026      };
54027      if (element.hasInitial()) {
54028        openArray("initial");
54029        for (Questionnaire.QuestionnaireItemInitialComponent e : element.getInitial()) 
54030          composeQuestionnaireItemInitialComponent(null, e);
54031        closeArray();
54032      };
54033      if (element.hasItem()) {
54034        openArray("item");
54035        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
54036          composeQuestionnaireItemComponent(null, e);
54037        closeArray();
54038      };
54039  }
54040
54041  protected void composeQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
54042    if (element != null) {
54043      open(name);
54044      composeQuestionnaireItemEnableWhenComponentProperties(element);
54045      close();
54046    }
54047  }
54048
54049  protected void composeQuestionnaireItemEnableWhenComponentProperties(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
54050    composeBackboneElementProperties(element);
54051      if (element.hasQuestionElement()) {
54052        composeStringCore("question", element.getQuestionElement(), false);
54053        composeStringExtras("question", element.getQuestionElement(), false);
54054      }
54055      if (element.hasOperatorElement()) {
54056        composeEnumerationCore("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
54057        composeEnumerationExtras("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
54058      }
54059      if (element.hasAnswer()) {
54060        composeType("answer", element.getAnswer());
54061      }
54062  }
54063
54064  protected void composeQuestionnaireItemAnswerOptionComponent(String name, Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
54065    if (element != null) {
54066      open(name);
54067      composeQuestionnaireItemAnswerOptionComponentProperties(element);
54068      close();
54069    }
54070  }
54071
54072  protected void composeQuestionnaireItemAnswerOptionComponentProperties(Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
54073    composeBackboneElementProperties(element);
54074      if (element.hasValue()) {
54075        composeType("value", element.getValue());
54076      }
54077      if (element.hasInitialSelectedElement()) {
54078        composeBooleanCore("initialSelected", element.getInitialSelectedElement(), false);
54079        composeBooleanExtras("initialSelected", element.getInitialSelectedElement(), false);
54080      }
54081  }
54082
54083  protected void composeQuestionnaireItemInitialComponent(String name, Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
54084    if (element != null) {
54085      open(name);
54086      composeQuestionnaireItemInitialComponentProperties(element);
54087      close();
54088    }
54089  }
54090
54091  protected void composeQuestionnaireItemInitialComponentProperties(Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
54092    composeBackboneElementProperties(element);
54093      if (element.hasValue()) {
54094        composeType("value", element.getValue());
54095      }
54096  }
54097
54098  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
54099    if (element != null) {
54100      prop("resourceType", name);
54101      composeQuestionnaireResponseProperties(element);
54102    }
54103  }
54104
54105  protected void composeQuestionnaireResponseProperties(QuestionnaireResponse element) throws IOException {
54106    composeDomainResourceProperties(element);
54107      if (element.hasIdentifier()) {
54108        composeIdentifier("identifier", element.getIdentifier());
54109      }
54110      if (element.hasBasedOn()) {
54111        openArray("basedOn");
54112        for (Reference e : element.getBasedOn()) 
54113          composeReference(null, e);
54114        closeArray();
54115      };
54116      if (element.hasPartOf()) {
54117        openArray("partOf");
54118        for (Reference e : element.getPartOf()) 
54119          composeReference(null, e);
54120        closeArray();
54121      };
54122      if (element.hasQuestionnaireElement()) {
54123        composeCanonicalCore("questionnaire", element.getQuestionnaireElement(), false);
54124        composeCanonicalExtras("questionnaire", element.getQuestionnaireElement(), false);
54125      }
54126      if (element.hasStatusElement()) {
54127        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
54128        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
54129      }
54130      if (element.hasSubject()) {
54131        composeReference("subject", element.getSubject());
54132      }
54133      if (element.hasEncounter()) {
54134        composeReference("encounter", element.getEncounter());
54135      }
54136      if (element.hasAuthoredElement()) {
54137        composeDateTimeCore("authored", element.getAuthoredElement(), false);
54138        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
54139      }
54140      if (element.hasAuthor()) {
54141        composeReference("author", element.getAuthor());
54142      }
54143      if (element.hasSource()) {
54144        composeReference("source", element.getSource());
54145      }
54146      if (element.hasItem()) {
54147        openArray("item");
54148        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
54149          composeQuestionnaireResponseItemComponent(null, e);
54150        closeArray();
54151      };
54152  }
54153
54154  protected void composeQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
54155    if (element != null) {
54156      open(name);
54157      composeQuestionnaireResponseItemComponentProperties(element);
54158      close();
54159    }
54160  }
54161
54162  protected void composeQuestionnaireResponseItemComponentProperties(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
54163    composeBackboneElementProperties(element);
54164      if (element.hasLinkIdElement()) {
54165        composeStringCore("linkId", element.getLinkIdElement(), false);
54166        composeStringExtras("linkId", element.getLinkIdElement(), false);
54167      }
54168      if (element.hasDefinitionElement()) {
54169        composeUriCore("definition", element.getDefinitionElement(), false);
54170        composeUriExtras("definition", element.getDefinitionElement(), false);
54171      }
54172      if (element.hasTextElement()) {
54173        composeStringCore("text", element.getTextElement(), false);
54174        composeStringExtras("text", element.getTextElement(), false);
54175      }
54176      if (element.hasAnswer()) {
54177        openArray("answer");
54178        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
54179          composeQuestionnaireResponseItemAnswerComponent(null, e);
54180        closeArray();
54181      };
54182      if (element.hasItem()) {
54183        openArray("item");
54184        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
54185          composeQuestionnaireResponseItemComponent(null, e);
54186        closeArray();
54187      };
54188  }
54189
54190  protected void composeQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
54191    if (element != null) {
54192      open(name);
54193      composeQuestionnaireResponseItemAnswerComponentProperties(element);
54194      close();
54195    }
54196  }
54197
54198  protected void composeQuestionnaireResponseItemAnswerComponentProperties(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
54199    composeBackboneElementProperties(element);
54200      if (element.hasValue()) {
54201        composeType("value", element.getValue());
54202      }
54203      if (element.hasItem()) {
54204        openArray("item");
54205        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
54206          composeQuestionnaireResponseItemComponent(null, e);
54207        closeArray();
54208      };
54209  }
54210
54211  protected void composeRegulatedAuthorization(String name, RegulatedAuthorization element) throws IOException {
54212    if (element != null) {
54213      prop("resourceType", name);
54214      composeRegulatedAuthorizationProperties(element);
54215    }
54216  }
54217
54218  protected void composeRegulatedAuthorizationProperties(RegulatedAuthorization element) throws IOException {
54219    composeDomainResourceProperties(element);
54220      if (element.hasIdentifier()) {
54221        openArray("identifier");
54222        for (Identifier e : element.getIdentifier()) 
54223          composeIdentifier(null, e);
54224        closeArray();
54225      };
54226      if (element.hasSubject()) {
54227        composeReference("subject", element.getSubject());
54228      }
54229      if (element.hasType()) {
54230        composeCodeableConcept("type", element.getType());
54231      }
54232      if (element.hasDescriptionElement()) {
54233        composeMarkdownCore("description", element.getDescriptionElement(), false);
54234        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54235      }
54236      if (element.hasRegion()) {
54237        openArray("region");
54238        for (CodeableConcept e : element.getRegion()) 
54239          composeCodeableConcept(null, e);
54240        closeArray();
54241      };
54242      if (element.hasStatus()) {
54243        composeCodeableConcept("status", element.getStatus());
54244      }
54245      if (element.hasStatusDateElement()) {
54246        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
54247        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
54248      }
54249      if (element.hasValidityPeriod()) {
54250        composePeriod("validityPeriod", element.getValidityPeriod());
54251      }
54252      if (element.hasBasis()) {
54253        openArray("basis");
54254        for (CodeableConcept e : element.getBasis()) 
54255          composeCodeableConcept(null, e);
54256        closeArray();
54257      };
54258      if (element.hasRelatedDate()) {
54259        openArray("relatedDate");
54260        for (RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent e : element.getRelatedDate()) 
54261          composeRegulatedAuthorizationRelatedDateComponent(null, e);
54262        closeArray();
54263      };
54264      if (element.hasJurisdictionalAuthorization()) {
54265        openArray("jurisdictionalAuthorization");
54266        for (Reference e : element.getJurisdictionalAuthorization()) 
54267          composeReference(null, e);
54268        closeArray();
54269      };
54270      if (element.hasHolder()) {
54271        composeReference("holder", element.getHolder());
54272      }
54273      if (element.hasRegulator()) {
54274        composeReference("regulator", element.getRegulator());
54275      }
54276      if (element.hasCase()) {
54277        composeRegulatedAuthorizationCaseComponent("case", element.getCase());
54278      }
54279  }
54280
54281  protected void composeRegulatedAuthorizationRelatedDateComponent(String name, RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent element) throws IOException {
54282    if (element != null) {
54283      open(name);
54284      composeRegulatedAuthorizationRelatedDateComponentProperties(element);
54285      close();
54286    }
54287  }
54288
54289  protected void composeRegulatedAuthorizationRelatedDateComponentProperties(RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent element) throws IOException {
54290    composeBackboneElementProperties(element);
54291      if (element.hasDate()) {
54292        composeType("date", element.getDate());
54293      }
54294      if (element.hasType()) {
54295        composeCodeableConcept("type", element.getType());
54296      }
54297  }
54298
54299  protected void composeRegulatedAuthorizationCaseComponent(String name, RegulatedAuthorization.RegulatedAuthorizationCaseComponent element) throws IOException {
54300    if (element != null) {
54301      open(name);
54302      composeRegulatedAuthorizationCaseComponentProperties(element);
54303      close();
54304    }
54305  }
54306
54307  protected void composeRegulatedAuthorizationCaseComponentProperties(RegulatedAuthorization.RegulatedAuthorizationCaseComponent element) throws IOException {
54308    composeBackboneElementProperties(element);
54309      if (element.hasIdentifier()) {
54310        composeIdentifier("identifier", element.getIdentifier());
54311      }
54312      if (element.hasType()) {
54313        composeCodeableConcept("type", element.getType());
54314      }
54315      if (element.hasStatus()) {
54316        composeCodeableConcept("status", element.getStatus());
54317      }
54318      if (element.hasDate()) {
54319        composeType("date", element.getDate());
54320      }
54321      if (element.hasApplication()) {
54322        openArray("application");
54323        for (RegulatedAuthorization.RegulatedAuthorizationCaseComponent e : element.getApplication()) 
54324          composeRegulatedAuthorizationCaseComponent(null, e);
54325        closeArray();
54326      };
54327  }
54328
54329  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
54330    if (element != null) {
54331      prop("resourceType", name);
54332      composeRelatedPersonProperties(element);
54333    }
54334  }
54335
54336  protected void composeRelatedPersonProperties(RelatedPerson element) throws IOException {
54337    composeDomainResourceProperties(element);
54338      if (element.hasIdentifier()) {
54339        openArray("identifier");
54340        for (Identifier e : element.getIdentifier()) 
54341          composeIdentifier(null, e);
54342        closeArray();
54343      };
54344      if (element.hasActiveElement()) {
54345        composeBooleanCore("active", element.getActiveElement(), false);
54346        composeBooleanExtras("active", element.getActiveElement(), false);
54347      }
54348      if (element.hasPatient()) {
54349        composeReference("patient", element.getPatient());
54350      }
54351      if (element.hasRelationship()) {
54352        openArray("relationship");
54353        for (CodeableConcept e : element.getRelationship()) 
54354          composeCodeableConcept(null, e);
54355        closeArray();
54356      };
54357      if (element.hasName()) {
54358        openArray("name");
54359        for (HumanName e : element.getName()) 
54360          composeHumanName(null, e);
54361        closeArray();
54362      };
54363      if (element.hasTelecom()) {
54364        openArray("telecom");
54365        for (ContactPoint e : element.getTelecom()) 
54366          composeContactPoint(null, e);
54367        closeArray();
54368      };
54369      if (element.hasGenderElement()) {
54370        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
54371        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
54372      }
54373      if (element.hasBirthDateElement()) {
54374        composeDateCore("birthDate", element.getBirthDateElement(), false);
54375        composeDateExtras("birthDate", element.getBirthDateElement(), false);
54376      }
54377      if (element.hasAddress()) {
54378        openArray("address");
54379        for (Address e : element.getAddress()) 
54380          composeAddress(null, e);
54381        closeArray();
54382      };
54383      if (element.hasPhoto()) {
54384        openArray("photo");
54385        for (Attachment e : element.getPhoto()) 
54386          composeAttachment(null, e);
54387        closeArray();
54388      };
54389      if (element.hasPeriod()) {
54390        composePeriod("period", element.getPeriod());
54391      }
54392      if (element.hasCommunication()) {
54393        openArray("communication");
54394        for (RelatedPerson.RelatedPersonCommunicationComponent e : element.getCommunication()) 
54395          composeRelatedPersonCommunicationComponent(null, e);
54396        closeArray();
54397      };
54398  }
54399
54400  protected void composeRelatedPersonCommunicationComponent(String name, RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
54401    if (element != null) {
54402      open(name);
54403      composeRelatedPersonCommunicationComponentProperties(element);
54404      close();
54405    }
54406  }
54407
54408  protected void composeRelatedPersonCommunicationComponentProperties(RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
54409    composeBackboneElementProperties(element);
54410      if (element.hasLanguage()) {
54411        composeCodeableConcept("language", element.getLanguage());
54412      }
54413      if (element.hasPreferredElement()) {
54414        composeBooleanCore("preferred", element.getPreferredElement(), false);
54415        composeBooleanExtras("preferred", element.getPreferredElement(), false);
54416      }
54417  }
54418
54419  protected void composeRequestGroup(String name, RequestGroup element) throws IOException {
54420    if (element != null) {
54421      prop("resourceType", name);
54422      composeRequestGroupProperties(element);
54423    }
54424  }
54425
54426  protected void composeRequestGroupProperties(RequestGroup element) throws IOException {
54427    composeDomainResourceProperties(element);
54428      if (element.hasIdentifier()) {
54429        openArray("identifier");
54430        for (Identifier e : element.getIdentifier()) 
54431          composeIdentifier(null, e);
54432        closeArray();
54433      };
54434      if (element.hasInstantiatesCanonical()) {
54435        openArray("instantiatesCanonical");
54436        for (CanonicalType e : element.getInstantiatesCanonical()) 
54437          composeCanonicalCore(null, e, true);
54438        closeArray();
54439        if (anyHasExtras(element.getInstantiatesCanonical())) {
54440          openArray("_instantiatesCanonical");
54441          for (CanonicalType e : element.getInstantiatesCanonical()) 
54442            composeCanonicalExtras(null, e, true);
54443          closeArray();
54444        }
54445      };
54446      if (element.hasInstantiatesUri()) {
54447        openArray("instantiatesUri");
54448        for (UriType e : element.getInstantiatesUri()) 
54449          composeUriCore(null, e, true);
54450        closeArray();
54451        if (anyHasExtras(element.getInstantiatesUri())) {
54452          openArray("_instantiatesUri");
54453          for (UriType e : element.getInstantiatesUri()) 
54454            composeUriExtras(null, e, true);
54455          closeArray();
54456        }
54457      };
54458      if (element.hasBasedOn()) {
54459        openArray("basedOn");
54460        for (Reference e : element.getBasedOn()) 
54461          composeReference(null, e);
54462        closeArray();
54463      };
54464      if (element.hasReplaces()) {
54465        openArray("replaces");
54466        for (Reference e : element.getReplaces()) 
54467          composeReference(null, e);
54468        closeArray();
54469      };
54470      if (element.hasGroupIdentifier()) {
54471        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
54472      }
54473      if (element.hasStatusElement()) {
54474        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
54475        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
54476      }
54477      if (element.hasIntentElement()) {
54478        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
54479        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
54480      }
54481      if (element.hasPriorityElement()) {
54482        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
54483        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
54484      }
54485      if (element.hasCode()) {
54486        composeCodeableConcept("code", element.getCode());
54487      }
54488      if (element.hasSubject()) {
54489        composeReference("subject", element.getSubject());
54490      }
54491      if (element.hasEncounter()) {
54492        composeReference("encounter", element.getEncounter());
54493      }
54494      if (element.hasAuthoredOnElement()) {
54495        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
54496        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
54497      }
54498      if (element.hasAuthor()) {
54499        composeReference("author", element.getAuthor());
54500      }
54501      if (element.hasReason()) {
54502        openArray("reason");
54503        for (CodeableReference e : element.getReason()) 
54504          composeCodeableReference(null, e);
54505        closeArray();
54506      };
54507      if (element.hasNote()) {
54508        openArray("note");
54509        for (Annotation e : element.getNote()) 
54510          composeAnnotation(null, e);
54511        closeArray();
54512      };
54513      if (element.hasAction()) {
54514        openArray("action");
54515        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
54516          composeRequestGroupActionComponent(null, e);
54517        closeArray();
54518      };
54519  }
54520
54521  protected void composeRequestGroupActionComponent(String name, RequestGroup.RequestGroupActionComponent element) throws IOException {
54522    if (element != null) {
54523      open(name);
54524      composeRequestGroupActionComponentProperties(element);
54525      close();
54526    }
54527  }
54528
54529  protected void composeRequestGroupActionComponentProperties(RequestGroup.RequestGroupActionComponent element) throws IOException {
54530    composeBackboneElementProperties(element);
54531      if (element.hasPrefixElement()) {
54532        composeStringCore("prefix", element.getPrefixElement(), false);
54533        composeStringExtras("prefix", element.getPrefixElement(), false);
54534      }
54535      if (element.hasTitleElement()) {
54536        composeStringCore("title", element.getTitleElement(), false);
54537        composeStringExtras("title", element.getTitleElement(), false);
54538      }
54539      if (element.hasDescriptionElement()) {
54540        composeStringCore("description", element.getDescriptionElement(), false);
54541        composeStringExtras("description", element.getDescriptionElement(), false);
54542      }
54543      if (element.hasTextEquivalentElement()) {
54544        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
54545        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
54546      }
54547      if (element.hasPriorityElement()) {
54548        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
54549        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
54550      }
54551      if (element.hasCode()) {
54552        openArray("code");
54553        for (CodeableConcept e : element.getCode()) 
54554          composeCodeableConcept(null, e);
54555        closeArray();
54556      };
54557      if (element.hasDocumentation()) {
54558        openArray("documentation");
54559        for (RelatedArtifact e : element.getDocumentation()) 
54560          composeRelatedArtifact(null, e);
54561        closeArray();
54562      };
54563      if (element.hasCondition()) {
54564        openArray("condition");
54565        for (RequestGroup.RequestGroupActionConditionComponent e : element.getCondition()) 
54566          composeRequestGroupActionConditionComponent(null, e);
54567        closeArray();
54568      };
54569      if (element.hasRelatedAction()) {
54570        openArray("relatedAction");
54571        for (RequestGroup.RequestGroupActionRelatedActionComponent e : element.getRelatedAction()) 
54572          composeRequestGroupActionRelatedActionComponent(null, e);
54573        closeArray();
54574      };
54575      if (element.hasTiming()) {
54576        composeType("timing", element.getTiming());
54577      }
54578      if (element.hasParticipant()) {
54579        openArray("participant");
54580        for (Reference e : element.getParticipant()) 
54581          composeReference(null, e);
54582        closeArray();
54583      };
54584      if (element.hasType()) {
54585        composeCodeableConcept("type", element.getType());
54586      }
54587      if (element.hasGroupingBehaviorElement()) {
54588        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
54589        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory(), false);
54590      }
54591      if (element.hasSelectionBehaviorElement()) {
54592        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
54593        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory(), false);
54594      }
54595      if (element.hasRequiredBehaviorElement()) {
54596        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
54597        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory(), false);
54598      }
54599      if (element.hasPrecheckBehaviorElement()) {
54600        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
54601        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory(), false);
54602      }
54603      if (element.hasCardinalityBehaviorElement()) {
54604        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
54605        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory(), false);
54606      }
54607      if (element.hasResource()) {
54608        composeReference("resource", element.getResource());
54609      }
54610      if (element.hasAction()) {
54611        openArray("action");
54612        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
54613          composeRequestGroupActionComponent(null, e);
54614        closeArray();
54615      };
54616  }
54617
54618  protected void composeRequestGroupActionConditionComponent(String name, RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
54619    if (element != null) {
54620      open(name);
54621      composeRequestGroupActionConditionComponentProperties(element);
54622      close();
54623    }
54624  }
54625
54626  protected void composeRequestGroupActionConditionComponentProperties(RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
54627    composeBackboneElementProperties(element);
54628      if (element.hasKindElement()) {
54629        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
54630        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory(), false);
54631      }
54632      if (element.hasExpression()) {
54633        composeExpression("expression", element.getExpression());
54634      }
54635  }
54636
54637  protected void composeRequestGroupActionRelatedActionComponent(String name, RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
54638    if (element != null) {
54639      open(name);
54640      composeRequestGroupActionRelatedActionComponentProperties(element);
54641      close();
54642    }
54643  }
54644
54645  protected void composeRequestGroupActionRelatedActionComponentProperties(RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
54646    composeBackboneElementProperties(element);
54647      if (element.hasActionIdElement()) {
54648        composeIdCore("actionId", element.getActionIdElement(), false);
54649        composeIdExtras("actionId", element.getActionIdElement(), false);
54650      }
54651      if (element.hasRelationshipElement()) {
54652        composeEnumerationCore("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
54653        composeEnumerationExtras("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory(), false);
54654      }
54655      if (element.hasOffset()) {
54656        composeType("offset", element.getOffset());
54657      }
54658  }
54659
54660  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
54661    if (element != null) {
54662      prop("resourceType", name);
54663      composeResearchStudyProperties(element);
54664    }
54665  }
54666
54667  protected void composeResearchStudyProperties(ResearchStudy element) throws IOException {
54668    composeDomainResourceProperties(element);
54669      if (element.hasIdentifier()) {
54670        openArray("identifier");
54671        for (Identifier e : element.getIdentifier()) 
54672          composeIdentifier(null, e);
54673        closeArray();
54674      };
54675      if (element.hasTitleElement()) {
54676        composeStringCore("title", element.getTitleElement(), false);
54677        composeStringExtras("title", element.getTitleElement(), false);
54678      }
54679      if (element.hasProtocol()) {
54680        openArray("protocol");
54681        for (Reference e : element.getProtocol()) 
54682          composeReference(null, e);
54683        closeArray();
54684      };
54685      if (element.hasPartOf()) {
54686        openArray("partOf");
54687        for (Reference e : element.getPartOf()) 
54688          composeReference(null, e);
54689        closeArray();
54690      };
54691      if (element.hasStatusElement()) {
54692        composeEnumerationCore("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
54693        composeEnumerationExtras("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
54694      }
54695      if (element.hasPrimaryPurposeType()) {
54696        composeCodeableConcept("primaryPurposeType", element.getPrimaryPurposeType());
54697      }
54698      if (element.hasPhase()) {
54699        composeCodeableConcept("phase", element.getPhase());
54700      }
54701      if (element.hasCategory()) {
54702        openArray("category");
54703        for (CodeableConcept e : element.getCategory()) 
54704          composeCodeableConcept(null, e);
54705        closeArray();
54706      };
54707      if (element.hasFocus()) {
54708        openArray("focus");
54709        for (CodeableConcept e : element.getFocus()) 
54710          composeCodeableConcept(null, e);
54711        closeArray();
54712      };
54713      if (element.hasCondition()) {
54714        openArray("condition");
54715        for (CodeableConcept e : element.getCondition()) 
54716          composeCodeableConcept(null, e);
54717        closeArray();
54718      };
54719      if (element.hasContact()) {
54720        openArray("contact");
54721        for (ContactDetail e : element.getContact()) 
54722          composeContactDetail(null, e);
54723        closeArray();
54724      };
54725      if (element.hasRelatedArtifact()) {
54726        openArray("relatedArtifact");
54727        for (RelatedArtifact e : element.getRelatedArtifact()) 
54728          composeRelatedArtifact(null, e);
54729        closeArray();
54730      };
54731      if (element.hasKeyword()) {
54732        openArray("keyword");
54733        for (CodeableConcept e : element.getKeyword()) 
54734          composeCodeableConcept(null, e);
54735        closeArray();
54736      };
54737      if (element.hasLocation()) {
54738        openArray("location");
54739        for (CodeableConcept e : element.getLocation()) 
54740          composeCodeableConcept(null, e);
54741        closeArray();
54742      };
54743      if (element.hasDescriptionElement()) {
54744        composeMarkdownCore("description", element.getDescriptionElement(), false);
54745        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54746      }
54747      if (element.hasEnrollment()) {
54748        openArray("enrollment");
54749        for (Reference e : element.getEnrollment()) 
54750          composeReference(null, e);
54751        closeArray();
54752      };
54753      if (element.hasPeriod()) {
54754        composePeriod("period", element.getPeriod());
54755      }
54756      if (element.hasSponsor()) {
54757        composeReference("sponsor", element.getSponsor());
54758      }
54759      if (element.hasPrincipalInvestigator()) {
54760        composeReference("principalInvestigator", element.getPrincipalInvestigator());
54761      }
54762      if (element.hasSite()) {
54763        openArray("site");
54764        for (Reference e : element.getSite()) 
54765          composeReference(null, e);
54766        closeArray();
54767      };
54768      if (element.hasReasonStopped()) {
54769        composeCodeableConcept("reasonStopped", element.getReasonStopped());
54770      }
54771      if (element.hasNote()) {
54772        openArray("note");
54773        for (Annotation e : element.getNote()) 
54774          composeAnnotation(null, e);
54775        closeArray();
54776      };
54777      if (element.hasArm()) {
54778        openArray("arm");
54779        for (ResearchStudy.ResearchStudyArmComponent e : element.getArm()) 
54780          composeResearchStudyArmComponent(null, e);
54781        closeArray();
54782      };
54783      if (element.hasObjective()) {
54784        openArray("objective");
54785        for (ResearchStudy.ResearchStudyObjectiveComponent e : element.getObjective()) 
54786          composeResearchStudyObjectiveComponent(null, e);
54787        closeArray();
54788      };
54789  }
54790
54791  protected void composeResearchStudyArmComponent(String name, ResearchStudy.ResearchStudyArmComponent element) throws IOException {
54792    if (element != null) {
54793      open(name);
54794      composeResearchStudyArmComponentProperties(element);
54795      close();
54796    }
54797  }
54798
54799  protected void composeResearchStudyArmComponentProperties(ResearchStudy.ResearchStudyArmComponent element) throws IOException {
54800    composeBackboneElementProperties(element);
54801      if (element.hasNameElement()) {
54802        composeStringCore("name", element.getNameElement(), false);
54803        composeStringExtras("name", element.getNameElement(), false);
54804      }
54805      if (element.hasType()) {
54806        composeCodeableConcept("type", element.getType());
54807      }
54808      if (element.hasDescriptionElement()) {
54809        composeStringCore("description", element.getDescriptionElement(), false);
54810        composeStringExtras("description", element.getDescriptionElement(), false);
54811      }
54812  }
54813
54814  protected void composeResearchStudyObjectiveComponent(String name, ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
54815    if (element != null) {
54816      open(name);
54817      composeResearchStudyObjectiveComponentProperties(element);
54818      close();
54819    }
54820  }
54821
54822  protected void composeResearchStudyObjectiveComponentProperties(ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
54823    composeBackboneElementProperties(element);
54824      if (element.hasNameElement()) {
54825        composeStringCore("name", element.getNameElement(), false);
54826        composeStringExtras("name", element.getNameElement(), false);
54827      }
54828      if (element.hasType()) {
54829        composeCodeableConcept("type", element.getType());
54830      }
54831  }
54832
54833  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
54834    if (element != null) {
54835      prop("resourceType", name);
54836      composeResearchSubjectProperties(element);
54837    }
54838  }
54839
54840  protected void composeResearchSubjectProperties(ResearchSubject element) throws IOException {
54841    composeDomainResourceProperties(element);
54842      if (element.hasIdentifier()) {
54843        openArray("identifier");
54844        for (Identifier e : element.getIdentifier()) 
54845          composeIdentifier(null, e);
54846        closeArray();
54847      };
54848      if (element.hasStatusElement()) {
54849        composeEnumerationCore("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
54850        composeEnumerationExtras("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
54851      }
54852      if (element.hasProgress()) {
54853        openArray("progress");
54854        for (ResearchSubject.ResearchSubjectProgressComponent e : element.getProgress()) 
54855          composeResearchSubjectProgressComponent(null, e);
54856        closeArray();
54857      };
54858      if (element.hasPeriod()) {
54859        composePeriod("period", element.getPeriod());
54860      }
54861      if (element.hasStudy()) {
54862        composeReference("study", element.getStudy());
54863      }
54864      if (element.hasIndividual()) {
54865        composeReference("individual", element.getIndividual());
54866      }
54867      if (element.hasAssignedArmElement()) {
54868        composeStringCore("assignedArm", element.getAssignedArmElement(), false);
54869        composeStringExtras("assignedArm", element.getAssignedArmElement(), false);
54870      }
54871      if (element.hasActualArmElement()) {
54872        composeStringCore("actualArm", element.getActualArmElement(), false);
54873        composeStringExtras("actualArm", element.getActualArmElement(), false);
54874      }
54875      if (element.hasConsent()) {
54876        composeReference("consent", element.getConsent());
54877      }
54878  }
54879
54880  protected void composeResearchSubjectProgressComponent(String name, ResearchSubject.ResearchSubjectProgressComponent element) throws IOException {
54881    if (element != null) {
54882      open(name);
54883      composeResearchSubjectProgressComponentProperties(element);
54884      close();
54885    }
54886  }
54887
54888  protected void composeResearchSubjectProgressComponentProperties(ResearchSubject.ResearchSubjectProgressComponent element) throws IOException {
54889    composeBackboneElementProperties(element);
54890      if (element.hasType()) {
54891        composeCodeableConcept("type", element.getType());
54892      }
54893      if (element.hasState()) {
54894        composeCodeableConcept("state", element.getState());
54895      }
54896      if (element.hasMilestone()) {
54897        composeCodeableConcept("milestone", element.getMilestone());
54898      }
54899      if (element.hasReason()) {
54900        composeCodeableConcept("reason", element.getReason());
54901      }
54902      if (element.hasStartDateElement()) {
54903        composeDateTimeCore("startDate", element.getStartDateElement(), false);
54904        composeDateTimeExtras("startDate", element.getStartDateElement(), false);
54905      }
54906  }
54907
54908  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
54909    if (element != null) {
54910      prop("resourceType", name);
54911      composeRiskAssessmentProperties(element);
54912    }
54913  }
54914
54915  protected void composeRiskAssessmentProperties(RiskAssessment element) throws IOException {
54916    composeDomainResourceProperties(element);
54917      if (element.hasIdentifier()) {
54918        openArray("identifier");
54919        for (Identifier e : element.getIdentifier()) 
54920          composeIdentifier(null, e);
54921        closeArray();
54922      };
54923      if (element.hasBasedOn()) {
54924        composeReference("basedOn", element.getBasedOn());
54925      }
54926      if (element.hasParent()) {
54927        composeReference("parent", element.getParent());
54928      }
54929      if (element.hasStatusElement()) {
54930        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
54931        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.ObservationStatusEnumFactory(), false);
54932      }
54933      if (element.hasMethod()) {
54934        composeCodeableConcept("method", element.getMethod());
54935      }
54936      if (element.hasCode()) {
54937        composeCodeableConcept("code", element.getCode());
54938      }
54939      if (element.hasSubject()) {
54940        composeReference("subject", element.getSubject());
54941      }
54942      if (element.hasEncounter()) {
54943        composeReference("encounter", element.getEncounter());
54944      }
54945      if (element.hasOccurrence()) {
54946        composeType("occurrence", element.getOccurrence());
54947      }
54948      if (element.hasCondition()) {
54949        composeReference("condition", element.getCondition());
54950      }
54951      if (element.hasPerformer()) {
54952        composeReference("performer", element.getPerformer());
54953      }
54954      if (element.hasReason()) {
54955        openArray("reason");
54956        for (CodeableReference e : element.getReason()) 
54957          composeCodeableReference(null, e);
54958        closeArray();
54959      };
54960      if (element.hasBasis()) {
54961        openArray("basis");
54962        for (Reference e : element.getBasis()) 
54963          composeReference(null, e);
54964        closeArray();
54965      };
54966      if (element.hasPrediction()) {
54967        openArray("prediction");
54968        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
54969          composeRiskAssessmentPredictionComponent(null, e);
54970        closeArray();
54971      };
54972      if (element.hasMitigationElement()) {
54973        composeStringCore("mitigation", element.getMitigationElement(), false);
54974        composeStringExtras("mitigation", element.getMitigationElement(), false);
54975      }
54976      if (element.hasNote()) {
54977        openArray("note");
54978        for (Annotation e : element.getNote()) 
54979          composeAnnotation(null, e);
54980        closeArray();
54981      };
54982  }
54983
54984  protected void composeRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
54985    if (element != null) {
54986      open(name);
54987      composeRiskAssessmentPredictionComponentProperties(element);
54988      close();
54989    }
54990  }
54991
54992  protected void composeRiskAssessmentPredictionComponentProperties(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
54993    composeBackboneElementProperties(element);
54994      if (element.hasOutcome()) {
54995        composeCodeableConcept("outcome", element.getOutcome());
54996      }
54997      if (element.hasProbability()) {
54998        composeType("probability", element.getProbability());
54999      }
55000      if (element.hasQualitativeRisk()) {
55001        composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
55002      }
55003      if (element.hasRelativeRiskElement()) {
55004        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
55005        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
55006      }
55007      if (element.hasWhen()) {
55008        composeType("when", element.getWhen());
55009      }
55010      if (element.hasRationaleElement()) {
55011        composeStringCore("rationale", element.getRationaleElement(), false);
55012        composeStringExtras("rationale", element.getRationaleElement(), false);
55013      }
55014  }
55015
55016  protected void composeSchedule(String name, Schedule element) throws IOException {
55017    if (element != null) {
55018      prop("resourceType", name);
55019      composeScheduleProperties(element);
55020    }
55021  }
55022
55023  protected void composeScheduleProperties(Schedule element) throws IOException {
55024    composeDomainResourceProperties(element);
55025      if (element.hasIdentifier()) {
55026        openArray("identifier");
55027        for (Identifier e : element.getIdentifier()) 
55028          composeIdentifier(null, e);
55029        closeArray();
55030      };
55031      if (element.hasActiveElement()) {
55032        composeBooleanCore("active", element.getActiveElement(), false);
55033        composeBooleanExtras("active", element.getActiveElement(), false);
55034      }
55035      if (element.hasServiceCategory()) {
55036        openArray("serviceCategory");
55037        for (CodeableConcept e : element.getServiceCategory()) 
55038          composeCodeableConcept(null, e);
55039        closeArray();
55040      };
55041      if (element.hasServiceType()) {
55042        openArray("serviceType");
55043        for (CodeableConcept e : element.getServiceType()) 
55044          composeCodeableConcept(null, e);
55045        closeArray();
55046      };
55047      if (element.hasSpecialty()) {
55048        openArray("specialty");
55049        for (CodeableConcept e : element.getSpecialty()) 
55050          composeCodeableConcept(null, e);
55051        closeArray();
55052      };
55053      if (element.hasActor()) {
55054        openArray("actor");
55055        for (Reference e : element.getActor()) 
55056          composeReference(null, e);
55057        closeArray();
55058      };
55059      if (element.hasPlanningHorizon()) {
55060        composePeriod("planningHorizon", element.getPlanningHorizon());
55061      }
55062      if (element.hasCommentElement()) {
55063        composeStringCore("comment", element.getCommentElement(), false);
55064        composeStringExtras("comment", element.getCommentElement(), false);
55065      }
55066  }
55067
55068  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
55069    if (element != null) {
55070      prop("resourceType", name);
55071      composeSearchParameterProperties(element);
55072    }
55073  }
55074
55075  protected void composeSearchParameterProperties(SearchParameter element) throws IOException {
55076    composeCanonicalResourceProperties(element);
55077      if (element.hasUrlElement()) {
55078        composeUriCore("url", element.getUrlElement(), false);
55079        composeUriExtras("url", element.getUrlElement(), false);
55080      }
55081      if (element.hasVersionElement()) {
55082        composeStringCore("version", element.getVersionElement(), false);
55083        composeStringExtras("version", element.getVersionElement(), false);
55084      }
55085      if (element.hasNameElement()) {
55086        composeStringCore("name", element.getNameElement(), false);
55087        composeStringExtras("name", element.getNameElement(), false);
55088      }
55089      if (element.hasDerivedFromElement()) {
55090        composeCanonicalCore("derivedFrom", element.getDerivedFromElement(), false);
55091        composeCanonicalExtras("derivedFrom", element.getDerivedFromElement(), false);
55092      }
55093      if (element.hasStatusElement()) {
55094        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55095        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55096      }
55097      if (element.hasExperimentalElement()) {
55098        composeBooleanCore("experimental", element.getExperimentalElement(), false);
55099        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
55100      }
55101      if (element.hasDateElement()) {
55102        composeDateTimeCore("date", element.getDateElement(), false);
55103        composeDateTimeExtras("date", element.getDateElement(), false);
55104      }
55105      if (element.hasPublisherElement()) {
55106        composeStringCore("publisher", element.getPublisherElement(), false);
55107        composeStringExtras("publisher", element.getPublisherElement(), false);
55108      }
55109      if (element.hasContact()) {
55110        openArray("contact");
55111        for (ContactDetail e : element.getContact()) 
55112          composeContactDetail(null, e);
55113        closeArray();
55114      };
55115      if (element.hasDescriptionElement()) {
55116        composeMarkdownCore("description", element.getDescriptionElement(), false);
55117        composeMarkdownExtras("description", element.getDescriptionElement(), false);
55118      }
55119      if (element.hasUseContext()) {
55120        openArray("useContext");
55121        for (UsageContext e : element.getUseContext()) 
55122          composeUsageContext(null, e);
55123        closeArray();
55124      };
55125      if (element.hasJurisdiction()) {
55126        openArray("jurisdiction");
55127        for (CodeableConcept e : element.getJurisdiction()) 
55128          composeCodeableConcept(null, e);
55129        closeArray();
55130      };
55131      if (element.hasPurposeElement()) {
55132        composeMarkdownCore("purpose", element.getPurposeElement(), false);
55133        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
55134      }
55135      if (element.hasCodeElement()) {
55136        composeCodeCore("code", element.getCodeElement(), false);
55137        composeCodeExtras("code", element.getCodeElement(), false);
55138      }
55139      if (element.hasBase()) {
55140        openArray("base");
55141        for (CodeType e : element.getBase()) 
55142          composeCodeCore(null, e, true);
55143        closeArray();
55144        if (anyHasExtras(element.getBase())) {
55145          openArray("_base");
55146          for (CodeType e : element.getBase()) 
55147            composeCodeExtras(null, e, true);
55148          closeArray();
55149        }
55150      };
55151      if (element.hasTypeElement()) {
55152        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
55153        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
55154      }
55155      if (element.hasExpressionElement()) {
55156        composeStringCore("expression", element.getExpressionElement(), false);
55157        composeStringExtras("expression", element.getExpressionElement(), false);
55158      }
55159      if (element.hasXpathElement()) {
55160        composeStringCore("xpath", element.getXpathElement(), false);
55161        composeStringExtras("xpath", element.getXpathElement(), false);
55162      }
55163      if (element.hasXpathUsageElement()) {
55164        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
55165        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
55166      }
55167      if (element.hasTarget()) {
55168        openArray("target");
55169        for (CodeType e : element.getTarget()) 
55170          composeCodeCore(null, e, true);
55171        closeArray();
55172        if (anyHasExtras(element.getTarget())) {
55173          openArray("_target");
55174          for (CodeType e : element.getTarget()) 
55175            composeCodeExtras(null, e, true);
55176          closeArray();
55177        }
55178      };
55179      if (element.hasMultipleOrElement()) {
55180        composeBooleanCore("multipleOr", element.getMultipleOrElement(), false);
55181        composeBooleanExtras("multipleOr", element.getMultipleOrElement(), false);
55182      }
55183      if (element.hasMultipleAndElement()) {
55184        composeBooleanCore("multipleAnd", element.getMultipleAndElement(), false);
55185        composeBooleanExtras("multipleAnd", element.getMultipleAndElement(), false);
55186      }
55187      if (element.hasComparator()) {
55188        openArray("comparator");
55189        for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
55190          composeEnumerationCore(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
55191        closeArray();
55192        if (anyHasExtras(element.getComparator())) {
55193          openArray("_comparator");
55194          for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
55195            composeEnumerationExtras(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
55196          closeArray();
55197        }
55198      };
55199      if (element.hasModifier()) {
55200        openArray("modifier");
55201        for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
55202          composeEnumerationCore(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
55203        closeArray();
55204        if (anyHasExtras(element.getModifier())) {
55205          openArray("_modifier");
55206          for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
55207            composeEnumerationExtras(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
55208          closeArray();
55209        }
55210      };
55211      if (element.hasChain()) {
55212        openArray("chain");
55213        for (StringType e : element.getChain()) 
55214          composeStringCore(null, e, true);
55215        closeArray();
55216        if (anyHasExtras(element.getChain())) {
55217          openArray("_chain");
55218          for (StringType e : element.getChain()) 
55219            composeStringExtras(null, e, true);
55220          closeArray();
55221        }
55222      };
55223      if (element.hasComponent()) {
55224        openArray("component");
55225        for (SearchParameter.SearchParameterComponentComponent e : element.getComponent()) 
55226          composeSearchParameterComponentComponent(null, e);
55227        closeArray();
55228      };
55229  }
55230
55231  protected void composeSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
55232    if (element != null) {
55233      open(name);
55234      composeSearchParameterComponentComponentProperties(element);
55235      close();
55236    }
55237  }
55238
55239  protected void composeSearchParameterComponentComponentProperties(SearchParameter.SearchParameterComponentComponent element) throws IOException {
55240    composeBackboneElementProperties(element);
55241      if (element.hasDefinitionElement()) {
55242        composeCanonicalCore("definition", element.getDefinitionElement(), false);
55243        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
55244      }
55245      if (element.hasExpressionElement()) {
55246        composeStringCore("expression", element.getExpressionElement(), false);
55247        composeStringExtras("expression", element.getExpressionElement(), false);
55248      }
55249  }
55250
55251  protected void composeServiceRequest(String name, ServiceRequest element) throws IOException {
55252    if (element != null) {
55253      prop("resourceType", name);
55254      composeServiceRequestProperties(element);
55255    }
55256  }
55257
55258  protected void composeServiceRequestProperties(ServiceRequest element) throws IOException {
55259    composeDomainResourceProperties(element);
55260      if (element.hasIdentifier()) {
55261        openArray("identifier");
55262        for (Identifier e : element.getIdentifier()) 
55263          composeIdentifier(null, e);
55264        closeArray();
55265      };
55266      if (element.hasInstantiatesCanonical()) {
55267        openArray("instantiatesCanonical");
55268        for (CanonicalType e : element.getInstantiatesCanonical()) 
55269          composeCanonicalCore(null, e, true);
55270        closeArray();
55271        if (anyHasExtras(element.getInstantiatesCanonical())) {
55272          openArray("_instantiatesCanonical");
55273          for (CanonicalType e : element.getInstantiatesCanonical()) 
55274            composeCanonicalExtras(null, e, true);
55275          closeArray();
55276        }
55277      };
55278      if (element.hasInstantiatesUri()) {
55279        openArray("instantiatesUri");
55280        for (UriType e : element.getInstantiatesUri()) 
55281          composeUriCore(null, e, true);
55282        closeArray();
55283        if (anyHasExtras(element.getInstantiatesUri())) {
55284          openArray("_instantiatesUri");
55285          for (UriType e : element.getInstantiatesUri()) 
55286            composeUriExtras(null, e, true);
55287          closeArray();
55288        }
55289      };
55290      if (element.hasBasedOn()) {
55291        openArray("basedOn");
55292        for (Reference e : element.getBasedOn()) 
55293          composeReference(null, e);
55294        closeArray();
55295      };
55296      if (element.hasReplaces()) {
55297        openArray("replaces");
55298        for (Reference e : element.getReplaces()) 
55299          composeReference(null, e);
55300        closeArray();
55301      };
55302      if (element.hasRequisition()) {
55303        composeIdentifier("requisition", element.getRequisition());
55304      }
55305      if (element.hasStatusElement()) {
55306        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
55307        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.RequestStatusEnumFactory(), false);
55308      }
55309      if (element.hasIntentElement()) {
55310        composeEnumerationCore("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
55311        composeEnumerationExtras("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory(), false);
55312      }
55313      if (element.hasCategory()) {
55314        openArray("category");
55315        for (CodeableConcept e : element.getCategory()) 
55316          composeCodeableConcept(null, e);
55317        closeArray();
55318      };
55319      if (element.hasPriorityElement()) {
55320        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
55321        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
55322      }
55323      if (element.hasDoNotPerformElement()) {
55324        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
55325        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
55326      }
55327      if (element.hasCode()) {
55328        composeCodeableConcept("code", element.getCode());
55329      }
55330      if (element.hasOrderDetail()) {
55331        openArray("orderDetail");
55332        for (CodeableConcept e : element.getOrderDetail()) 
55333          composeCodeableConcept(null, e);
55334        closeArray();
55335      };
55336      if (element.hasQuantity()) {
55337        composeType("quantity", element.getQuantity());
55338      }
55339      if (element.hasSubject()) {
55340        composeReference("subject", element.getSubject());
55341      }
55342      if (element.hasEncounter()) {
55343        composeReference("encounter", element.getEncounter());
55344      }
55345      if (element.hasOccurrence()) {
55346        composeType("occurrence", element.getOccurrence());
55347      }
55348      if (element.hasAsNeeded()) {
55349        composeType("asNeeded", element.getAsNeeded());
55350      }
55351      if (element.hasAuthoredOnElement()) {
55352        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
55353        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
55354      }
55355      if (element.hasRequester()) {
55356        composeReference("requester", element.getRequester());
55357      }
55358      if (element.hasPerformerType()) {
55359        composeCodeableConcept("performerType", element.getPerformerType());
55360      }
55361      if (element.hasPerformer()) {
55362        openArray("performer");
55363        for (Reference e : element.getPerformer()) 
55364          composeReference(null, e);
55365        closeArray();
55366      };
55367      if (element.hasLocation()) {
55368        openArray("location");
55369        for (CodeableReference e : element.getLocation()) 
55370          composeCodeableReference(null, e);
55371        closeArray();
55372      };
55373      if (element.hasReason()) {
55374        openArray("reason");
55375        for (CodeableReference e : element.getReason()) 
55376          composeCodeableReference(null, e);
55377        closeArray();
55378      };
55379      if (element.hasInsurance()) {
55380        openArray("insurance");
55381        for (Reference e : element.getInsurance()) 
55382          composeReference(null, e);
55383        closeArray();
55384      };
55385      if (element.hasSupportingInfo()) {
55386        openArray("supportingInfo");
55387        for (Reference e : element.getSupportingInfo()) 
55388          composeReference(null, e);
55389        closeArray();
55390      };
55391      if (element.hasSpecimen()) {
55392        openArray("specimen");
55393        for (Reference e : element.getSpecimen()) 
55394          composeReference(null, e);
55395        closeArray();
55396      };
55397      if (element.hasBodySite()) {
55398        openArray("bodySite");
55399        for (CodeableConcept e : element.getBodySite()) 
55400          composeCodeableConcept(null, e);
55401        closeArray();
55402      };
55403      if (element.hasNote()) {
55404        openArray("note");
55405        for (Annotation e : element.getNote()) 
55406          composeAnnotation(null, e);
55407        closeArray();
55408      };
55409      if (element.hasPatientInstructionElement()) {
55410        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
55411        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
55412      }
55413      if (element.hasRelevantHistory()) {
55414        openArray("relevantHistory");
55415        for (Reference e : element.getRelevantHistory()) 
55416          composeReference(null, e);
55417        closeArray();
55418      };
55419  }
55420
55421  protected void composeSlot(String name, Slot element) throws IOException {
55422    if (element != null) {
55423      prop("resourceType", name);
55424      composeSlotProperties(element);
55425    }
55426  }
55427
55428  protected void composeSlotProperties(Slot element) throws IOException {
55429    composeDomainResourceProperties(element);
55430      if (element.hasIdentifier()) {
55431        openArray("identifier");
55432        for (Identifier e : element.getIdentifier()) 
55433          composeIdentifier(null, e);
55434        closeArray();
55435      };
55436      if (element.hasServiceCategory()) {
55437        openArray("serviceCategory");
55438        for (CodeableConcept e : element.getServiceCategory()) 
55439          composeCodeableConcept(null, e);
55440        closeArray();
55441      };
55442      if (element.hasServiceType()) {
55443        openArray("serviceType");
55444        for (CodeableConcept e : element.getServiceType()) 
55445          composeCodeableConcept(null, e);
55446        closeArray();
55447      };
55448      if (element.hasSpecialty()) {
55449        openArray("specialty");
55450        for (CodeableConcept e : element.getSpecialty()) 
55451          composeCodeableConcept(null, e);
55452        closeArray();
55453      };
55454      if (element.hasAppointmentType()) {
55455        composeCodeableConcept("appointmentType", element.getAppointmentType());
55456      }
55457      if (element.hasSchedule()) {
55458        composeReference("schedule", element.getSchedule());
55459      }
55460      if (element.hasStatusElement()) {
55461        composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
55462        composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
55463      }
55464      if (element.hasStartElement()) {
55465        composeInstantCore("start", element.getStartElement(), false);
55466        composeInstantExtras("start", element.getStartElement(), false);
55467      }
55468      if (element.hasEndElement()) {
55469        composeInstantCore("end", element.getEndElement(), false);
55470        composeInstantExtras("end", element.getEndElement(), false);
55471      }
55472      if (element.hasOverbookedElement()) {
55473        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
55474        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
55475      }
55476      if (element.hasCommentElement()) {
55477        composeStringCore("comment", element.getCommentElement(), false);
55478        composeStringExtras("comment", element.getCommentElement(), false);
55479      }
55480  }
55481
55482  protected void composeSpecimen(String name, Specimen element) throws IOException {
55483    if (element != null) {
55484      prop("resourceType", name);
55485      composeSpecimenProperties(element);
55486    }
55487  }
55488
55489  protected void composeSpecimenProperties(Specimen element) throws IOException {
55490    composeDomainResourceProperties(element);
55491      if (element.hasIdentifier()) {
55492        openArray("identifier");
55493        for (Identifier e : element.getIdentifier()) 
55494          composeIdentifier(null, e);
55495        closeArray();
55496      };
55497      if (element.hasAccessionIdentifier()) {
55498        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
55499      }
55500      if (element.hasStatusElement()) {
55501        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
55502        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
55503      }
55504      if (element.hasType()) {
55505        composeCodeableConcept("type", element.getType());
55506      }
55507      if (element.hasSubject()) {
55508        composeReference("subject", element.getSubject());
55509      }
55510      if (element.hasReceivedTimeElement()) {
55511        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
55512        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
55513      }
55514      if (element.hasParent()) {
55515        openArray("parent");
55516        for (Reference e : element.getParent()) 
55517          composeReference(null, e);
55518        closeArray();
55519      };
55520      if (element.hasRequest()) {
55521        openArray("request");
55522        for (Reference e : element.getRequest()) 
55523          composeReference(null, e);
55524        closeArray();
55525      };
55526      if (element.hasCollection()) {
55527        composeSpecimenCollectionComponent("collection", element.getCollection());
55528      }
55529      if (element.hasProcessing()) {
55530        openArray("processing");
55531        for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
55532          composeSpecimenProcessingComponent(null, e);
55533        closeArray();
55534      };
55535      if (element.hasContainer()) {
55536        openArray("container");
55537        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
55538          composeSpecimenContainerComponent(null, e);
55539        closeArray();
55540      };
55541      if (element.hasCondition()) {
55542        openArray("condition");
55543        for (CodeableConcept e : element.getCondition()) 
55544          composeCodeableConcept(null, e);
55545        closeArray();
55546      };
55547      if (element.hasNote()) {
55548        openArray("note");
55549        for (Annotation e : element.getNote()) 
55550          composeAnnotation(null, e);
55551        closeArray();
55552      };
55553  }
55554
55555  protected void composeSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
55556    if (element != null) {
55557      open(name);
55558      composeSpecimenCollectionComponentProperties(element);
55559      close();
55560    }
55561  }
55562
55563  protected void composeSpecimenCollectionComponentProperties(Specimen.SpecimenCollectionComponent element) throws IOException {
55564    composeBackboneElementProperties(element);
55565      if (element.hasCollector()) {
55566        composeReference("collector", element.getCollector());
55567      }
55568      if (element.hasCollected()) {
55569        composeType("collected", element.getCollected());
55570      }
55571      if (element.hasDuration()) {
55572        composeDuration("duration", element.getDuration());
55573      }
55574      if (element.hasQuantity()) {
55575        composeQuantity("quantity", element.getQuantity());
55576      }
55577      if (element.hasMethod()) {
55578        composeCodeableConcept("method", element.getMethod());
55579      }
55580      if (element.hasBodySite()) {
55581        composeCodeableConcept("bodySite", element.getBodySite());
55582      }
55583      if (element.hasFastingStatus()) {
55584        composeType("fastingStatus", element.getFastingStatus());
55585      }
55586  }
55587
55588  protected void composeSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
55589    if (element != null) {
55590      open(name);
55591      composeSpecimenProcessingComponentProperties(element);
55592      close();
55593    }
55594  }
55595
55596  protected void composeSpecimenProcessingComponentProperties(Specimen.SpecimenProcessingComponent element) throws IOException {
55597    composeBackboneElementProperties(element);
55598      if (element.hasDescriptionElement()) {
55599        composeStringCore("description", element.getDescriptionElement(), false);
55600        composeStringExtras("description", element.getDescriptionElement(), false);
55601      }
55602      if (element.hasProcedure()) {
55603        composeCodeableConcept("procedure", element.getProcedure());
55604      }
55605      if (element.hasAdditive()) {
55606        openArray("additive");
55607        for (Reference e : element.getAdditive()) 
55608          composeReference(null, e);
55609        closeArray();
55610      };
55611      if (element.hasTime()) {
55612        composeType("time", element.getTime());
55613      }
55614  }
55615
55616  protected void composeSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
55617    if (element != null) {
55618      open(name);
55619      composeSpecimenContainerComponentProperties(element);
55620      close();
55621    }
55622  }
55623
55624  protected void composeSpecimenContainerComponentProperties(Specimen.SpecimenContainerComponent element) throws IOException {
55625    composeBackboneElementProperties(element);
55626      if (element.hasIdentifier()) {
55627        openArray("identifier");
55628        for (Identifier e : element.getIdentifier()) 
55629          composeIdentifier(null, e);
55630        closeArray();
55631      };
55632      if (element.hasDescriptionElement()) {
55633        composeStringCore("description", element.getDescriptionElement(), false);
55634        composeStringExtras("description", element.getDescriptionElement(), false);
55635      }
55636      if (element.hasType()) {
55637        composeCodeableConcept("type", element.getType());
55638      }
55639      if (element.hasCapacity()) {
55640        composeQuantity("capacity", element.getCapacity());
55641      }
55642      if (element.hasSpecimenQuantity()) {
55643        composeQuantity("specimenQuantity", element.getSpecimenQuantity());
55644      }
55645      if (element.hasAdditive()) {
55646        composeType("additive", element.getAdditive());
55647      }
55648  }
55649
55650  protected void composeSpecimenDefinition(String name, SpecimenDefinition element) throws IOException {
55651    if (element != null) {
55652      prop("resourceType", name);
55653      composeSpecimenDefinitionProperties(element);
55654    }
55655  }
55656
55657  protected void composeSpecimenDefinitionProperties(SpecimenDefinition element) throws IOException {
55658    composeDomainResourceProperties(element);
55659      if (element.hasUrlElement()) {
55660        composeUriCore("url", element.getUrlElement(), false);
55661        composeUriExtras("url", element.getUrlElement(), false);
55662      }
55663      if (element.hasIdentifier()) {
55664        composeIdentifier("identifier", element.getIdentifier());
55665      }
55666      if (element.hasVersionElement()) {
55667        composeStringCore("version", element.getVersionElement(), false);
55668        composeStringExtras("version", element.getVersionElement(), false);
55669      }
55670      if (element.hasTitleElement()) {
55671        composeStringCore("title", element.getTitleElement(), false);
55672        composeStringExtras("title", element.getTitleElement(), false);
55673      }
55674      if (element.hasDerivedFromCanonical()) {
55675        openArray("derivedFromCanonical");
55676        for (CanonicalType e : element.getDerivedFromCanonical()) 
55677          composeCanonicalCore(null, e, true);
55678        closeArray();
55679        if (anyHasExtras(element.getDerivedFromCanonical())) {
55680          openArray("_derivedFromCanonical");
55681          for (CanonicalType e : element.getDerivedFromCanonical()) 
55682            composeCanonicalExtras(null, e, true);
55683          closeArray();
55684        }
55685      };
55686      if (element.hasDerivedFromUri()) {
55687        openArray("derivedFromUri");
55688        for (UriType e : element.getDerivedFromUri()) 
55689          composeUriCore(null, e, true);
55690        closeArray();
55691        if (anyHasExtras(element.getDerivedFromUri())) {
55692          openArray("_derivedFromUri");
55693          for (UriType e : element.getDerivedFromUri()) 
55694            composeUriExtras(null, e, true);
55695          closeArray();
55696        }
55697      };
55698      if (element.hasStatusElement()) {
55699        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55700        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55701      }
55702      if (element.hasExperimentalElement()) {
55703        composeBooleanCore("experimental", element.getExperimentalElement(), false);
55704        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
55705      }
55706      if (element.hasSubject()) {
55707        composeType("subject", element.getSubject());
55708      }
55709      if (element.hasDateElement()) {
55710        composeDateTimeCore("date", element.getDateElement(), false);
55711        composeDateTimeExtras("date", element.getDateElement(), false);
55712      }
55713      if (element.hasPublisher()) {
55714        composeReference("publisher", element.getPublisher());
55715      }
55716      if (element.hasContact()) {
55717        openArray("contact");
55718        for (ContactDetail e : element.getContact()) 
55719          composeContactDetail(null, e);
55720        closeArray();
55721      };
55722      if (element.hasDescriptionElement()) {
55723        composeMarkdownCore("description", element.getDescriptionElement(), false);
55724        composeMarkdownExtras("description", element.getDescriptionElement(), false);
55725      }
55726      if (element.hasUseContext()) {
55727        openArray("useContext");
55728        for (UsageContext e : element.getUseContext()) 
55729          composeUsageContext(null, e);
55730        closeArray();
55731      };
55732      if (element.hasJurisdiction()) {
55733        openArray("jurisdiction");
55734        for (CodeableConcept e : element.getJurisdiction()) 
55735          composeCodeableConcept(null, e);
55736        closeArray();
55737      };
55738      if (element.hasPurposeElement()) {
55739        composeMarkdownCore("purpose", element.getPurposeElement(), false);
55740        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
55741      }
55742      if (element.hasCopyrightElement()) {
55743        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
55744        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
55745      }
55746      if (element.hasApprovalDateElement()) {
55747        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
55748        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
55749      }
55750      if (element.hasLastReviewDateElement()) {
55751        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
55752        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
55753      }
55754      if (element.hasEffectivePeriod()) {
55755        composePeriod("effectivePeriod", element.getEffectivePeriod());
55756      }
55757      if (element.hasTypeCollected()) {
55758        composeCodeableConcept("typeCollected", element.getTypeCollected());
55759      }
55760      if (element.hasPatientPreparation()) {
55761        openArray("patientPreparation");
55762        for (CodeableConcept e : element.getPatientPreparation()) 
55763          composeCodeableConcept(null, e);
55764        closeArray();
55765      };
55766      if (element.hasTimeAspectElement()) {
55767        composeStringCore("timeAspect", element.getTimeAspectElement(), false);
55768        composeStringExtras("timeAspect", element.getTimeAspectElement(), false);
55769      }
55770      if (element.hasCollection()) {
55771        openArray("collection");
55772        for (CodeableConcept e : element.getCollection()) 
55773          composeCodeableConcept(null, e);
55774        closeArray();
55775      };
55776      if (element.hasTypeTested()) {
55777        openArray("typeTested");
55778        for (SpecimenDefinition.SpecimenDefinitionTypeTestedComponent e : element.getTypeTested()) 
55779          composeSpecimenDefinitionTypeTestedComponent(null, e);
55780        closeArray();
55781      };
55782  }
55783
55784  protected void composeSpecimenDefinitionTypeTestedComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
55785    if (element != null) {
55786      open(name);
55787      composeSpecimenDefinitionTypeTestedComponentProperties(element);
55788      close();
55789    }
55790  }
55791
55792  protected void composeSpecimenDefinitionTypeTestedComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
55793    composeBackboneElementProperties(element);
55794      if (element.hasIsDerivedElement()) {
55795        composeBooleanCore("isDerived", element.getIsDerivedElement(), false);
55796        composeBooleanExtras("isDerived", element.getIsDerivedElement(), false);
55797      }
55798      if (element.hasType()) {
55799        composeCodeableConcept("type", element.getType());
55800      }
55801      if (element.hasPreferenceElement()) {
55802        composeEnumerationCore("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
55803        composeEnumerationExtras("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
55804      }
55805      if (element.hasContainer()) {
55806        composeSpecimenDefinitionTypeTestedContainerComponent("container", element.getContainer());
55807      }
55808      if (element.hasRequirementElement()) {
55809        composeStringCore("requirement", element.getRequirementElement(), false);
55810        composeStringExtras("requirement", element.getRequirementElement(), false);
55811      }
55812      if (element.hasRetentionTime()) {
55813        composeDuration("retentionTime", element.getRetentionTime());
55814      }
55815      if (element.hasSingleUseElement()) {
55816        composeBooleanCore("singleUse", element.getSingleUseElement(), false);
55817        composeBooleanExtras("singleUse", element.getSingleUseElement(), false);
55818      }
55819      if (element.hasRejectionCriterion()) {
55820        openArray("rejectionCriterion");
55821        for (CodeableConcept e : element.getRejectionCriterion()) 
55822          composeCodeableConcept(null, e);
55823        closeArray();
55824      };
55825      if (element.hasHandling()) {
55826        openArray("handling");
55827        for (SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent e : element.getHandling()) 
55828          composeSpecimenDefinitionTypeTestedHandlingComponent(null, e);
55829        closeArray();
55830      };
55831      if (element.hasTestingDestination()) {
55832        openArray("testingDestination");
55833        for (CodeableConcept e : element.getTestingDestination()) 
55834          composeCodeableConcept(null, e);
55835        closeArray();
55836      };
55837  }
55838
55839  protected void composeSpecimenDefinitionTypeTestedContainerComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
55840    if (element != null) {
55841      open(name);
55842      composeSpecimenDefinitionTypeTestedContainerComponentProperties(element);
55843      close();
55844    }
55845  }
55846
55847  protected void composeSpecimenDefinitionTypeTestedContainerComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
55848    composeBackboneElementProperties(element);
55849      if (element.hasMaterial()) {
55850        composeCodeableConcept("material", element.getMaterial());
55851      }
55852      if (element.hasType()) {
55853        composeCodeableConcept("type", element.getType());
55854      }
55855      if (element.hasCap()) {
55856        composeCodeableConcept("cap", element.getCap());
55857      }
55858      if (element.hasDescriptionElement()) {
55859        composeStringCore("description", element.getDescriptionElement(), false);
55860        composeStringExtras("description", element.getDescriptionElement(), false);
55861      }
55862      if (element.hasCapacity()) {
55863        composeQuantity("capacity", element.getCapacity());
55864      }
55865      if (element.hasMinimumVolume()) {
55866        composeType("minimumVolume", element.getMinimumVolume());
55867      }
55868      if (element.hasAdditive()) {
55869        openArray("additive");
55870        for (SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent e : element.getAdditive()) 
55871          composeSpecimenDefinitionTypeTestedContainerAdditiveComponent(null, e);
55872        closeArray();
55873      };
55874      if (element.hasPreparationElement()) {
55875        composeStringCore("preparation", element.getPreparationElement(), false);
55876        composeStringExtras("preparation", element.getPreparationElement(), false);
55877      }
55878  }
55879
55880  protected void composeSpecimenDefinitionTypeTestedContainerAdditiveComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
55881    if (element != null) {
55882      open(name);
55883      composeSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(element);
55884      close();
55885    }
55886  }
55887
55888  protected void composeSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
55889    composeBackboneElementProperties(element);
55890      if (element.hasAdditive()) {
55891        composeType("additive", element.getAdditive());
55892      }
55893  }
55894
55895  protected void composeSpecimenDefinitionTypeTestedHandlingComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
55896    if (element != null) {
55897      open(name);
55898      composeSpecimenDefinitionTypeTestedHandlingComponentProperties(element);
55899      close();
55900    }
55901  }
55902
55903  protected void composeSpecimenDefinitionTypeTestedHandlingComponentProperties(SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
55904    composeBackboneElementProperties(element);
55905      if (element.hasTemperatureQualifier()) {
55906        composeCodeableConcept("temperatureQualifier", element.getTemperatureQualifier());
55907      }
55908      if (element.hasTemperatureRange()) {
55909        composeRange("temperatureRange", element.getTemperatureRange());
55910      }
55911      if (element.hasMaxDuration()) {
55912        composeDuration("maxDuration", element.getMaxDuration());
55913      }
55914      if (element.hasInstructionElement()) {
55915        composeStringCore("instruction", element.getInstructionElement(), false);
55916        composeStringExtras("instruction", element.getInstructionElement(), false);
55917      }
55918  }
55919
55920  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
55921    if (element != null) {
55922      prop("resourceType", name);
55923      composeStructureDefinitionProperties(element);
55924    }
55925  }
55926
55927  protected void composeStructureDefinitionProperties(StructureDefinition element) throws IOException {
55928    composeCanonicalResourceProperties(element);
55929      if (element.hasUrlElement()) {
55930        composeUriCore("url", element.getUrlElement(), false);
55931        composeUriExtras("url", element.getUrlElement(), false);
55932      }
55933      if (element.hasIdentifier()) {
55934        openArray("identifier");
55935        for (Identifier e : element.getIdentifier()) 
55936          composeIdentifier(null, e);
55937        closeArray();
55938      };
55939      if (element.hasVersionElement()) {
55940        composeStringCore("version", element.getVersionElement(), false);
55941        composeStringExtras("version", element.getVersionElement(), false);
55942      }
55943      if (element.hasNameElement()) {
55944        composeStringCore("name", element.getNameElement(), false);
55945        composeStringExtras("name", element.getNameElement(), false);
55946      }
55947      if (element.hasTitleElement()) {
55948        composeStringCore("title", element.getTitleElement(), false);
55949        composeStringExtras("title", element.getTitleElement(), false);
55950      }
55951      if (element.hasStatusElement()) {
55952        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55953        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
55954      }
55955      if (element.hasExperimentalElement()) {
55956        composeBooleanCore("experimental", element.getExperimentalElement(), false);
55957        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
55958      }
55959      if (element.hasDateElement()) {
55960        composeDateTimeCore("date", element.getDateElement(), false);
55961        composeDateTimeExtras("date", element.getDateElement(), false);
55962      }
55963      if (element.hasPublisherElement()) {
55964        composeStringCore("publisher", element.getPublisherElement(), false);
55965        composeStringExtras("publisher", element.getPublisherElement(), false);
55966      }
55967      if (element.hasContact()) {
55968        openArray("contact");
55969        for (ContactDetail e : element.getContact()) 
55970          composeContactDetail(null, e);
55971        closeArray();
55972      };
55973      if (element.hasDescriptionElement()) {
55974        composeMarkdownCore("description", element.getDescriptionElement(), false);
55975        composeMarkdownExtras("description", element.getDescriptionElement(), false);
55976      }
55977      if (element.hasUseContext()) {
55978        openArray("useContext");
55979        for (UsageContext e : element.getUseContext()) 
55980          composeUsageContext(null, e);
55981        closeArray();
55982      };
55983      if (element.hasJurisdiction()) {
55984        openArray("jurisdiction");
55985        for (CodeableConcept e : element.getJurisdiction()) 
55986          composeCodeableConcept(null, e);
55987        closeArray();
55988      };
55989      if (element.hasPurposeElement()) {
55990        composeMarkdownCore("purpose", element.getPurposeElement(), false);
55991        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
55992      }
55993      if (element.hasCopyrightElement()) {
55994        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
55995        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
55996      }
55997      if (element.hasKeyword()) {
55998        openArray("keyword");
55999        for (Coding e : element.getKeyword()) 
56000          composeCoding(null, e);
56001        closeArray();
56002      };
56003      if (element.hasFhirVersionElement()) {
56004        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
56005        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
56006      }
56007      if (element.hasMapping()) {
56008        openArray("mapping");
56009        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
56010          composeStructureDefinitionMappingComponent(null, e);
56011        closeArray();
56012      };
56013      if (element.hasKindElement()) {
56014        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
56015        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
56016      }
56017      if (element.hasAbstractElement()) {
56018        composeBooleanCore("abstract", element.getAbstractElement(), false);
56019        composeBooleanExtras("abstract", element.getAbstractElement(), false);
56020      }
56021      if (element.hasContext()) {
56022        openArray("context");
56023        for (StructureDefinition.StructureDefinitionContextComponent e : element.getContext()) 
56024          composeStructureDefinitionContextComponent(null, e);
56025        closeArray();
56026      };
56027      if (element.hasContextInvariant()) {
56028        openArray("contextInvariant");
56029        for (StringType e : element.getContextInvariant()) 
56030          composeStringCore(null, e, true);
56031        closeArray();
56032        if (anyHasExtras(element.getContextInvariant())) {
56033          openArray("_contextInvariant");
56034          for (StringType e : element.getContextInvariant()) 
56035            composeStringExtras(null, e, true);
56036          closeArray();
56037        }
56038      };
56039      if (element.hasTypeElement()) {
56040        composeUriCore("type", element.getTypeElement(), false);
56041        composeUriExtras("type", element.getTypeElement(), false);
56042      }
56043      if (element.hasBaseDefinitionElement()) {
56044        composeCanonicalCore("baseDefinition", element.getBaseDefinitionElement(), false);
56045        composeCanonicalExtras("baseDefinition", element.getBaseDefinitionElement(), false);
56046      }
56047      if (element.hasDerivationElement()) {
56048        composeEnumerationCore("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
56049        composeEnumerationExtras("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
56050      }
56051      if (element.hasSnapshot()) {
56052        composeStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
56053      }
56054      if (element.hasDifferential()) {
56055        composeStructureDefinitionDifferentialComponent("differential", element.getDifferential());
56056      }
56057  }
56058
56059  protected void composeStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
56060    if (element != null) {
56061      open(name);
56062      composeStructureDefinitionMappingComponentProperties(element);
56063      close();
56064    }
56065  }
56066
56067  protected void composeStructureDefinitionMappingComponentProperties(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
56068    composeBackboneElementProperties(element);
56069      if (element.hasIdentityElement()) {
56070        composeIdCore("identity", element.getIdentityElement(), false);
56071        composeIdExtras("identity", element.getIdentityElement(), false);
56072      }
56073      if (element.hasUriElement()) {
56074        composeUriCore("uri", element.getUriElement(), false);
56075        composeUriExtras("uri", element.getUriElement(), false);
56076      }
56077      if (element.hasNameElement()) {
56078        composeStringCore("name", element.getNameElement(), false);
56079        composeStringExtras("name", element.getNameElement(), false);
56080      }
56081      if (element.hasCommentElement()) {
56082        composeStringCore("comment", element.getCommentElement(), false);
56083        composeStringExtras("comment", element.getCommentElement(), false);
56084      }
56085  }
56086
56087  protected void composeStructureDefinitionContextComponent(String name, StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
56088    if (element != null) {
56089      open(name);
56090      composeStructureDefinitionContextComponentProperties(element);
56091      close();
56092    }
56093  }
56094
56095  protected void composeStructureDefinitionContextComponentProperties(StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
56096    composeBackboneElementProperties(element);
56097      if (element.hasTypeElement()) {
56098        composeEnumerationCore("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
56099        composeEnumerationExtras("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
56100      }
56101      if (element.hasExpressionElement()) {
56102        composeStringCore("expression", element.getExpressionElement(), false);
56103        composeStringExtras("expression", element.getExpressionElement(), false);
56104      }
56105  }
56106
56107  protected void composeStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
56108    if (element != null) {
56109      open(name);
56110      composeStructureDefinitionSnapshotComponentProperties(element);
56111      close();
56112    }
56113  }
56114
56115  protected void composeStructureDefinitionSnapshotComponentProperties(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
56116    composeBackboneElementProperties(element);
56117      if (element.hasElement()) {
56118        openArray("element");
56119        for (ElementDefinition e : element.getElement()) 
56120          composeElementDefinition(null, e);
56121        closeArray();
56122      };
56123  }
56124
56125  protected void composeStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
56126    if (element != null) {
56127      open(name);
56128      composeStructureDefinitionDifferentialComponentProperties(element);
56129      close();
56130    }
56131  }
56132
56133  protected void composeStructureDefinitionDifferentialComponentProperties(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
56134    composeBackboneElementProperties(element);
56135      if (element.hasElement()) {
56136        openArray("element");
56137        for (ElementDefinition e : element.getElement()) 
56138          composeElementDefinition(null, e);
56139        closeArray();
56140      };
56141  }
56142
56143  protected void composeStructureMap(String name, StructureMap element) throws IOException {
56144    if (element != null) {
56145      prop("resourceType", name);
56146      composeStructureMapProperties(element);
56147    }
56148  }
56149
56150  protected void composeStructureMapProperties(StructureMap element) throws IOException {
56151    composeCanonicalResourceProperties(element);
56152      if (element.hasUrlElement()) {
56153        composeUriCore("url", element.getUrlElement(), false);
56154        composeUriExtras("url", element.getUrlElement(), false);
56155      }
56156      if (element.hasIdentifier()) {
56157        openArray("identifier");
56158        for (Identifier e : element.getIdentifier()) 
56159          composeIdentifier(null, e);
56160        closeArray();
56161      };
56162      if (element.hasVersionElement()) {
56163        composeStringCore("version", element.getVersionElement(), false);
56164        composeStringExtras("version", element.getVersionElement(), false);
56165      }
56166      if (element.hasNameElement()) {
56167        composeStringCore("name", element.getNameElement(), false);
56168        composeStringExtras("name", element.getNameElement(), false);
56169      }
56170      if (element.hasTitleElement()) {
56171        composeStringCore("title", element.getTitleElement(), false);
56172        composeStringExtras("title", element.getTitleElement(), false);
56173      }
56174      if (element.hasStatusElement()) {
56175        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56176        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56177      }
56178      if (element.hasExperimentalElement()) {
56179        composeBooleanCore("experimental", element.getExperimentalElement(), false);
56180        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
56181      }
56182      if (element.hasDateElement()) {
56183        composeDateTimeCore("date", element.getDateElement(), false);
56184        composeDateTimeExtras("date", element.getDateElement(), false);
56185      }
56186      if (element.hasPublisherElement()) {
56187        composeStringCore("publisher", element.getPublisherElement(), false);
56188        composeStringExtras("publisher", element.getPublisherElement(), false);
56189      }
56190      if (element.hasContact()) {
56191        openArray("contact");
56192        for (ContactDetail e : element.getContact()) 
56193          composeContactDetail(null, e);
56194        closeArray();
56195      };
56196      if (element.hasDescriptionElement()) {
56197        composeMarkdownCore("description", element.getDescriptionElement(), false);
56198        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56199      }
56200      if (element.hasUseContext()) {
56201        openArray("useContext");
56202        for (UsageContext e : element.getUseContext()) 
56203          composeUsageContext(null, e);
56204        closeArray();
56205      };
56206      if (element.hasJurisdiction()) {
56207        openArray("jurisdiction");
56208        for (CodeableConcept e : element.getJurisdiction()) 
56209          composeCodeableConcept(null, e);
56210        closeArray();
56211      };
56212      if (element.hasPurposeElement()) {
56213        composeMarkdownCore("purpose", element.getPurposeElement(), false);
56214        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
56215      }
56216      if (element.hasCopyrightElement()) {
56217        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
56218        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
56219      }
56220      if (element.hasStructure()) {
56221        openArray("structure");
56222        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
56223          composeStructureMapStructureComponent(null, e);
56224        closeArray();
56225      };
56226      if (element.hasImport()) {
56227        openArray("import");
56228        for (CanonicalType e : element.getImport()) 
56229          composeCanonicalCore(null, e, true);
56230        closeArray();
56231        if (anyHasExtras(element.getImport())) {
56232          openArray("_import");
56233          for (CanonicalType e : element.getImport()) 
56234            composeCanonicalExtras(null, e, true);
56235          closeArray();
56236        }
56237      };
56238      if (element.hasGroup()) {
56239        openArray("group");
56240        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
56241          composeStructureMapGroupComponent(null, e);
56242        closeArray();
56243      };
56244  }
56245
56246  protected void composeStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
56247    if (element != null) {
56248      open(name);
56249      composeStructureMapStructureComponentProperties(element);
56250      close();
56251    }
56252  }
56253
56254  protected void composeStructureMapStructureComponentProperties(StructureMap.StructureMapStructureComponent element) throws IOException {
56255    composeBackboneElementProperties(element);
56256      if (element.hasUrlElement()) {
56257        composeCanonicalCore("url", element.getUrlElement(), false);
56258        composeCanonicalExtras("url", element.getUrlElement(), false);
56259      }
56260      if (element.hasModeElement()) {
56261        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
56262        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
56263      }
56264      if (element.hasAliasElement()) {
56265        composeStringCore("alias", element.getAliasElement(), false);
56266        composeStringExtras("alias", element.getAliasElement(), false);
56267      }
56268      if (element.hasDocumentationElement()) {
56269        composeStringCore("documentation", element.getDocumentationElement(), false);
56270        composeStringExtras("documentation", element.getDocumentationElement(), false);
56271      }
56272  }
56273
56274  protected void composeStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
56275    if (element != null) {
56276      open(name);
56277      composeStructureMapGroupComponentProperties(element);
56278      close();
56279    }
56280  }
56281
56282  protected void composeStructureMapGroupComponentProperties(StructureMap.StructureMapGroupComponent element) throws IOException {
56283    composeBackboneElementProperties(element);
56284      if (element.hasNameElement()) {
56285        composeIdCore("name", element.getNameElement(), false);
56286        composeIdExtras("name", element.getNameElement(), false);
56287      }
56288      if (element.hasExtendsElement()) {
56289        composeIdCore("extends", element.getExtendsElement(), false);
56290        composeIdExtras("extends", element.getExtendsElement(), false);
56291      }
56292      if (element.hasTypeModeElement()) {
56293        composeEnumerationCore("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
56294        composeEnumerationExtras("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
56295      }
56296      if (element.hasDocumentationElement()) {
56297        composeStringCore("documentation", element.getDocumentationElement(), false);
56298        composeStringExtras("documentation", element.getDocumentationElement(), false);
56299      }
56300      if (element.hasInput()) {
56301        openArray("input");
56302        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
56303          composeStructureMapGroupInputComponent(null, e);
56304        closeArray();
56305      };
56306      if (element.hasRule()) {
56307        openArray("rule");
56308        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
56309          composeStructureMapGroupRuleComponent(null, e);
56310        closeArray();
56311      };
56312  }
56313
56314  protected void composeStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
56315    if (element != null) {
56316      open(name);
56317      composeStructureMapGroupInputComponentProperties(element);
56318      close();
56319    }
56320  }
56321
56322  protected void composeStructureMapGroupInputComponentProperties(StructureMap.StructureMapGroupInputComponent element) throws IOException {
56323    composeBackboneElementProperties(element);
56324      if (element.hasNameElement()) {
56325        composeIdCore("name", element.getNameElement(), false);
56326        composeIdExtras("name", element.getNameElement(), false);
56327      }
56328      if (element.hasTypeElement()) {
56329        composeStringCore("type", element.getTypeElement(), false);
56330        composeStringExtras("type", element.getTypeElement(), false);
56331      }
56332      if (element.hasModeElement()) {
56333        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
56334        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
56335      }
56336      if (element.hasDocumentationElement()) {
56337        composeStringCore("documentation", element.getDocumentationElement(), false);
56338        composeStringExtras("documentation", element.getDocumentationElement(), false);
56339      }
56340  }
56341
56342  protected void composeStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
56343    if (element != null) {
56344      open(name);
56345      composeStructureMapGroupRuleComponentProperties(element);
56346      close();
56347    }
56348  }
56349
56350  protected void composeStructureMapGroupRuleComponentProperties(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
56351    composeBackboneElementProperties(element);
56352      if (element.hasNameElement()) {
56353        composeIdCore("name", element.getNameElement(), false);
56354        composeIdExtras("name", element.getNameElement(), false);
56355      }
56356      if (element.hasSource()) {
56357        openArray("source");
56358        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
56359          composeStructureMapGroupRuleSourceComponent(null, e);
56360        closeArray();
56361      };
56362      if (element.hasTarget()) {
56363        openArray("target");
56364        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
56365          composeStructureMapGroupRuleTargetComponent(null, e);
56366        closeArray();
56367      };
56368      if (element.hasRule()) {
56369        openArray("rule");
56370        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
56371          composeStructureMapGroupRuleComponent(null, e);
56372        closeArray();
56373      };
56374      if (element.hasDependent()) {
56375        openArray("dependent");
56376        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
56377          composeStructureMapGroupRuleDependentComponent(null, e);
56378        closeArray();
56379      };
56380      if (element.hasDocumentationElement()) {
56381        composeStringCore("documentation", element.getDocumentationElement(), false);
56382        composeStringExtras("documentation", element.getDocumentationElement(), false);
56383      }
56384  }
56385
56386  protected void composeStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
56387    if (element != null) {
56388      open(name);
56389      composeStructureMapGroupRuleSourceComponentProperties(element);
56390      close();
56391    }
56392  }
56393
56394  protected void composeStructureMapGroupRuleSourceComponentProperties(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
56395    composeBackboneElementProperties(element);
56396      if (element.hasContextElement()) {
56397        composeIdCore("context", element.getContextElement(), false);
56398        composeIdExtras("context", element.getContextElement(), false);
56399      }
56400      if (element.hasMinElement()) {
56401        composeIntegerCore("min", element.getMinElement(), false);
56402        composeIntegerExtras("min", element.getMinElement(), false);
56403      }
56404      if (element.hasMaxElement()) {
56405        composeStringCore("max", element.getMaxElement(), false);
56406        composeStringExtras("max", element.getMaxElement(), false);
56407      }
56408      if (element.hasTypeElement()) {
56409        composeStringCore("type", element.getTypeElement(), false);
56410        composeStringExtras("type", element.getTypeElement(), false);
56411      }
56412      if (element.hasDefaultValue()) {
56413        composeType("defaultValue", element.getDefaultValue());
56414      }
56415      if (element.hasElementElement()) {
56416        composeStringCore("element", element.getElementElement(), false);
56417        composeStringExtras("element", element.getElementElement(), false);
56418      }
56419      if (element.hasListModeElement()) {
56420        composeEnumerationCore("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
56421        composeEnumerationExtras("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
56422      }
56423      if (element.hasVariableElement()) {
56424        composeIdCore("variable", element.getVariableElement(), false);
56425        composeIdExtras("variable", element.getVariableElement(), false);
56426      }
56427      if (element.hasConditionElement()) {
56428        composeStringCore("condition", element.getConditionElement(), false);
56429        composeStringExtras("condition", element.getConditionElement(), false);
56430      }
56431      if (element.hasCheckElement()) {
56432        composeStringCore("check", element.getCheckElement(), false);
56433        composeStringExtras("check", element.getCheckElement(), false);
56434      }
56435      if (element.hasLogMessageElement()) {
56436        composeStringCore("logMessage", element.getLogMessageElement(), false);
56437        composeStringExtras("logMessage", element.getLogMessageElement(), false);
56438      }
56439  }
56440
56441  protected void composeStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
56442    if (element != null) {
56443      open(name);
56444      composeStructureMapGroupRuleTargetComponentProperties(element);
56445      close();
56446    }
56447  }
56448
56449  protected void composeStructureMapGroupRuleTargetComponentProperties(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
56450    composeBackboneElementProperties(element);
56451      if (element.hasContextElement()) {
56452        composeIdCore("context", element.getContextElement(), false);
56453        composeIdExtras("context", element.getContextElement(), false);
56454      }
56455      if (element.hasContextTypeElement()) {
56456        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
56457        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
56458      }
56459      if (element.hasElementElement()) {
56460        composeStringCore("element", element.getElementElement(), false);
56461        composeStringExtras("element", element.getElementElement(), false);
56462      }
56463      if (element.hasVariableElement()) {
56464        composeIdCore("variable", element.getVariableElement(), false);
56465        composeIdExtras("variable", element.getVariableElement(), false);
56466      }
56467      if (element.hasListMode()) {
56468        openArray("listMode");
56469        for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
56470          composeEnumerationCore(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
56471        closeArray();
56472        if (anyHasExtras(element.getListMode())) {
56473          openArray("_listMode");
56474          for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
56475            composeEnumerationExtras(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
56476          closeArray();
56477        }
56478      };
56479      if (element.hasListRuleIdElement()) {
56480        composeIdCore("listRuleId", element.getListRuleIdElement(), false);
56481        composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
56482      }
56483      if (element.hasTransformElement()) {
56484        composeEnumerationCore("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
56485        composeEnumerationExtras("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
56486      }
56487      if (element.hasParameter()) {
56488        openArray("parameter");
56489        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
56490          composeStructureMapGroupRuleTargetParameterComponent(null, e);
56491        closeArray();
56492      };
56493  }
56494
56495  protected void composeStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
56496    if (element != null) {
56497      open(name);
56498      composeStructureMapGroupRuleTargetParameterComponentProperties(element);
56499      close();
56500    }
56501  }
56502
56503  protected void composeStructureMapGroupRuleTargetParameterComponentProperties(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
56504    composeBackboneElementProperties(element);
56505      if (element.hasValue()) {
56506        composeType("value", element.getValue());
56507      }
56508  }
56509
56510  protected void composeStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
56511    if (element != null) {
56512      open(name);
56513      composeStructureMapGroupRuleDependentComponentProperties(element);
56514      close();
56515    }
56516  }
56517
56518  protected void composeStructureMapGroupRuleDependentComponentProperties(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
56519    composeBackboneElementProperties(element);
56520      if (element.hasNameElement()) {
56521        composeIdCore("name", element.getNameElement(), false);
56522        composeIdExtras("name", element.getNameElement(), false);
56523      }
56524      if (element.hasVariable()) {
56525        openArray("variable");
56526        for (StringType e : element.getVariable()) 
56527          composeStringCore(null, e, true);
56528        closeArray();
56529        if (anyHasExtras(element.getVariable())) {
56530          openArray("_variable");
56531          for (StringType e : element.getVariable()) 
56532            composeStringExtras(null, e, true);
56533          closeArray();
56534        }
56535      };
56536  }
56537
56538  protected void composeSubscription(String name, Subscription element) throws IOException {
56539    if (element != null) {
56540      prop("resourceType", name);
56541      composeSubscriptionProperties(element);
56542    }
56543  }
56544
56545  protected void composeSubscriptionProperties(Subscription element) throws IOException {
56546    composeDomainResourceProperties(element);
56547      if (element.hasIdentifier()) {
56548        openArray("identifier");
56549        for (Identifier e : element.getIdentifier()) 
56550          composeIdentifier(null, e);
56551        closeArray();
56552      };
56553      if (element.hasNameElement()) {
56554        composeStringCore("name", element.getNameElement(), false);
56555        composeStringExtras("name", element.getNameElement(), false);
56556      }
56557      if (element.hasStatusElement()) {
56558        composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
56559        composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
56560      }
56561      if (element.hasTopic()) {
56562        composeReference("topic", element.getTopic());
56563      }
56564      if (element.hasContact()) {
56565        openArray("contact");
56566        for (ContactPoint e : element.getContact()) 
56567          composeContactPoint(null, e);
56568        closeArray();
56569      };
56570      if (element.hasEndElement()) {
56571        composeInstantCore("end", element.getEndElement(), false);
56572        composeInstantExtras("end", element.getEndElement(), false);
56573      }
56574      if (element.hasReasonElement()) {
56575        composeStringCore("reason", element.getReasonElement(), false);
56576        composeStringExtras("reason", element.getReasonElement(), false);
56577      }
56578      if (element.hasFilterBy()) {
56579        openArray("filterBy");
56580        for (Subscription.SubscriptionFilterByComponent e : element.getFilterBy()) 
56581          composeSubscriptionFilterByComponent(null, e);
56582        closeArray();
56583      };
56584      if (element.hasError()) {
56585        openArray("error");
56586        for (CodeableConcept e : element.getError()) 
56587          composeCodeableConcept(null, e);
56588        closeArray();
56589      };
56590      if (element.hasEventCountElement()) {
56591        composeUnsignedIntCore("eventCount", element.getEventCountElement(), false);
56592        composeUnsignedIntExtras("eventCount", element.getEventCountElement(), false);
56593      }
56594      if (element.hasChannel()) {
56595        composeSubscriptionChannelComponent("channel", element.getChannel());
56596      }
56597  }
56598
56599  protected void composeSubscriptionFilterByComponent(String name, Subscription.SubscriptionFilterByComponent element) throws IOException {
56600    if (element != null) {
56601      open(name);
56602      composeSubscriptionFilterByComponentProperties(element);
56603      close();
56604    }
56605  }
56606
56607  protected void composeSubscriptionFilterByComponentProperties(Subscription.SubscriptionFilterByComponent element) throws IOException {
56608    composeBackboneElementProperties(element);
56609      if (element.hasNameElement()) {
56610        composeStringCore("name", element.getNameElement(), false);
56611        composeStringExtras("name", element.getNameElement(), false);
56612      }
56613      if (element.hasMatchTypeElement()) {
56614        composeEnumerationCore("matchType", element.getMatchTypeElement(), new Subscription.SubscriptionFilterByMatchTypeEnumFactory(), false);
56615        composeEnumerationExtras("matchType", element.getMatchTypeElement(), new Subscription.SubscriptionFilterByMatchTypeEnumFactory(), false);
56616      }
56617      if (element.hasValueElement()) {
56618        composeStringCore("value", element.getValueElement(), false);
56619        composeStringExtras("value", element.getValueElement(), false);
56620      }
56621  }
56622
56623  protected void composeSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
56624    if (element != null) {
56625      open(name);
56626      composeSubscriptionChannelComponentProperties(element);
56627      close();
56628    }
56629  }
56630
56631  protected void composeSubscriptionChannelComponentProperties(Subscription.SubscriptionChannelComponent element) throws IOException {
56632    composeBackboneElementProperties(element);
56633      if (element.hasType()) {
56634        composeCodeableConcept("type", element.getType());
56635      }
56636      if (element.hasEndpointElement()) {
56637        composeUrlCore("endpoint", element.getEndpointElement(), false);
56638        composeUrlExtras("endpoint", element.getEndpointElement(), false);
56639      }
56640      if (element.hasHeader()) {
56641        openArray("header");
56642        for (StringType e : element.getHeader()) 
56643          composeStringCore(null, e, true);
56644        closeArray();
56645        if (anyHasExtras(element.getHeader())) {
56646          openArray("_header");
56647          for (StringType e : element.getHeader()) 
56648            composeStringExtras(null, e, true);
56649          closeArray();
56650        }
56651      };
56652      if (element.hasHeartbeatPeriodElement()) {
56653        composeUnsignedIntCore("heartbeatPeriod", element.getHeartbeatPeriodElement(), false);
56654        composeUnsignedIntExtras("heartbeatPeriod", element.getHeartbeatPeriodElement(), false);
56655      }
56656      if (element.hasPayload()) {
56657        composeSubscriptionChannelPayloadComponent("payload", element.getPayload());
56658      }
56659  }
56660
56661  protected void composeSubscriptionChannelPayloadComponent(String name, Subscription.SubscriptionChannelPayloadComponent element) throws IOException {
56662    if (element != null) {
56663      open(name);
56664      composeSubscriptionChannelPayloadComponentProperties(element);
56665      close();
56666    }
56667  }
56668
56669  protected void composeSubscriptionChannelPayloadComponentProperties(Subscription.SubscriptionChannelPayloadComponent element) throws IOException {
56670    composeBackboneElementProperties(element);
56671      if (element.hasContentTypeElement()) {
56672        composeCodeCore("contentType", element.getContentTypeElement(), false);
56673        composeCodeExtras("contentType", element.getContentTypeElement(), false);
56674      }
56675      if (element.hasContentElement()) {
56676        composeEnumerationCore("content", element.getContentElement(), new Subscription.SubscriptionPayloadContentEnumFactory(), false);
56677        composeEnumerationExtras("content", element.getContentElement(), new Subscription.SubscriptionPayloadContentEnumFactory(), false);
56678      }
56679  }
56680
56681  protected void composeSubstance(String name, Substance element) throws IOException {
56682    if (element != null) {
56683      prop("resourceType", name);
56684      composeSubstanceProperties(element);
56685    }
56686  }
56687
56688  protected void composeSubstanceProperties(Substance element) throws IOException {
56689    composeDomainResourceProperties(element);
56690      if (element.hasIdentifier()) {
56691        openArray("identifier");
56692        for (Identifier e : element.getIdentifier()) 
56693          composeIdentifier(null, e);
56694        closeArray();
56695      };
56696      if (element.hasStatusElement()) {
56697        composeEnumerationCore("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
56698        composeEnumerationExtras("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
56699      }
56700      if (element.hasCategory()) {
56701        openArray("category");
56702        for (CodeableConcept e : element.getCategory()) 
56703          composeCodeableConcept(null, e);
56704        closeArray();
56705      };
56706      if (element.hasCode()) {
56707        composeCodeableConcept("code", element.getCode());
56708      }
56709      if (element.hasDescriptionElement()) {
56710        composeStringCore("description", element.getDescriptionElement(), false);
56711        composeStringExtras("description", element.getDescriptionElement(), false);
56712      }
56713      if (element.hasInstance()) {
56714        openArray("instance");
56715        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
56716          composeSubstanceInstanceComponent(null, e);
56717        closeArray();
56718      };
56719      if (element.hasIngredient()) {
56720        openArray("ingredient");
56721        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
56722          composeSubstanceIngredientComponent(null, e);
56723        closeArray();
56724      };
56725  }
56726
56727  protected void composeSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
56728    if (element != null) {
56729      open(name);
56730      composeSubstanceInstanceComponentProperties(element);
56731      close();
56732    }
56733  }
56734
56735  protected void composeSubstanceInstanceComponentProperties(Substance.SubstanceInstanceComponent element) throws IOException {
56736    composeBackboneElementProperties(element);
56737      if (element.hasIdentifier()) {
56738        composeIdentifier("identifier", element.getIdentifier());
56739      }
56740      if (element.hasExpiryElement()) {
56741        composeDateTimeCore("expiry", element.getExpiryElement(), false);
56742        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
56743      }
56744      if (element.hasQuantity()) {
56745        composeQuantity("quantity", element.getQuantity());
56746      }
56747  }
56748
56749  protected void composeSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
56750    if (element != null) {
56751      open(name);
56752      composeSubstanceIngredientComponentProperties(element);
56753      close();
56754    }
56755  }
56756
56757  protected void composeSubstanceIngredientComponentProperties(Substance.SubstanceIngredientComponent element) throws IOException {
56758    composeBackboneElementProperties(element);
56759      if (element.hasQuantity()) {
56760        composeRatio("quantity", element.getQuantity());
56761      }
56762      if (element.hasSubstance()) {
56763        composeType("substance", element.getSubstance());
56764      }
56765  }
56766
56767  protected void composeSubstanceDefinition(String name, SubstanceDefinition element) throws IOException {
56768    if (element != null) {
56769      prop("resourceType", name);
56770      composeSubstanceDefinitionProperties(element);
56771    }
56772  }
56773
56774  protected void composeSubstanceDefinitionProperties(SubstanceDefinition element) throws IOException {
56775    composeDomainResourceProperties(element);
56776      if (element.hasIdentifier()) {
56777        composeIdentifier("identifier", element.getIdentifier());
56778      }
56779      if (element.hasVersionElement()) {
56780        composeStringCore("version", element.getVersionElement(), false);
56781        composeStringExtras("version", element.getVersionElement(), false);
56782      }
56783      if (element.hasStatus()) {
56784        composeCodeableConcept("status", element.getStatus());
56785      }
56786      if (element.hasCategory()) {
56787        composeCodeableConcept("category", element.getCategory());
56788      }
56789      if (element.hasDomain()) {
56790        composeCodeableConcept("domain", element.getDomain());
56791      }
56792      if (element.hasDescriptionElement()) {
56793        composeMarkdownCore("description", element.getDescriptionElement(), false);
56794        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56795      }
56796      if (element.hasSource()) {
56797        openArray("source");
56798        for (Reference e : element.getSource()) 
56799          composeReference(null, e);
56800        closeArray();
56801      };
56802      if (element.hasNote()) {
56803        openArray("note");
56804        for (Annotation e : element.getNote()) 
56805          composeAnnotation(null, e);
56806        closeArray();
56807      };
56808      if (element.hasManufacturer()) {
56809        openArray("manufacturer");
56810        for (Reference e : element.getManufacturer()) 
56811          composeReference(null, e);
56812        closeArray();
56813      };
56814      if (element.hasSupplier()) {
56815        openArray("supplier");
56816        for (Reference e : element.getSupplier()) 
56817          composeReference(null, e);
56818        closeArray();
56819      };
56820      if (element.hasMoiety()) {
56821        openArray("moiety");
56822        for (SubstanceDefinition.SubstanceDefinitionMoietyComponent e : element.getMoiety()) 
56823          composeSubstanceDefinitionMoietyComponent(null, e);
56824        closeArray();
56825      };
56826      if (element.hasProperty()) {
56827        openArray("property");
56828        for (SubstanceDefinition.SubstanceDefinitionPropertyComponent e : element.getProperty()) 
56829          composeSubstanceDefinitionPropertyComponent(null, e);
56830        closeArray();
56831      };
56832      if (element.hasReferenceInformation()) {
56833        composeReference("referenceInformation", element.getReferenceInformation());
56834      }
56835      if (element.hasStructure()) {
56836        composeSubstanceDefinitionStructureComponent("structure", element.getStructure());
56837      }
56838      if (element.hasCode()) {
56839        openArray("code");
56840        for (SubstanceDefinition.SubstanceDefinitionCodeComponent e : element.getCode()) 
56841          composeSubstanceDefinitionCodeComponent(null, e);
56842        closeArray();
56843      };
56844      if (element.hasName()) {
56845        openArray("name");
56846        for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getName()) 
56847          composeSubstanceDefinitionNameComponent(null, e);
56848        closeArray();
56849      };
56850      if (element.hasMolecularWeight()) {
56851        openArray("molecularWeight");
56852        for (SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent e : element.getMolecularWeight()) 
56853          composeSubstanceDefinitionStructureIsotopeMolecularWeightComponent(null, e);
56854        closeArray();
56855      };
56856      if (element.hasRelationship()) {
56857        openArray("relationship");
56858        for (SubstanceDefinition.SubstanceDefinitionRelationshipComponent e : element.getRelationship()) 
56859          composeSubstanceDefinitionRelationshipComponent(null, e);
56860        closeArray();
56861      };
56862      if (element.hasNucleicAcid()) {
56863        composeReference("nucleicAcid", element.getNucleicAcid());
56864      }
56865      if (element.hasPolymer()) {
56866        composeReference("polymer", element.getPolymer());
56867      }
56868      if (element.hasProtein()) {
56869        composeReference("protein", element.getProtein());
56870      }
56871      if (element.hasSourceMaterial()) {
56872        composeReference("sourceMaterial", element.getSourceMaterial());
56873      }
56874  }
56875
56876  protected void composeSubstanceDefinitionMoietyComponent(String name, SubstanceDefinition.SubstanceDefinitionMoietyComponent element) throws IOException {
56877    if (element != null) {
56878      open(name);
56879      composeSubstanceDefinitionMoietyComponentProperties(element);
56880      close();
56881    }
56882  }
56883
56884  protected void composeSubstanceDefinitionMoietyComponentProperties(SubstanceDefinition.SubstanceDefinitionMoietyComponent element) throws IOException {
56885    composeBackboneElementProperties(element);
56886      if (element.hasRole()) {
56887        composeCodeableConcept("role", element.getRole());
56888      }
56889      if (element.hasIdentifier()) {
56890        composeIdentifier("identifier", element.getIdentifier());
56891      }
56892      if (element.hasNameElement()) {
56893        composeStringCore("name", element.getNameElement(), false);
56894        composeStringExtras("name", element.getNameElement(), false);
56895      }
56896      if (element.hasStereochemistry()) {
56897        composeCodeableConcept("stereochemistry", element.getStereochemistry());
56898      }
56899      if (element.hasOpticalActivity()) {
56900        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
56901      }
56902      if (element.hasMolecularFormulaElement()) {
56903        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
56904        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
56905      }
56906      if (element.hasAmount()) {
56907        composeType("amount", element.getAmount());
56908      }
56909      if (element.hasAmountType()) {
56910        composeCodeableConcept("amountType", element.getAmountType());
56911      }
56912  }
56913
56914  protected void composeSubstanceDefinitionPropertyComponent(String name, SubstanceDefinition.SubstanceDefinitionPropertyComponent element) throws IOException {
56915    if (element != null) {
56916      open(name);
56917      composeSubstanceDefinitionPropertyComponentProperties(element);
56918      close();
56919    }
56920  }
56921
56922  protected void composeSubstanceDefinitionPropertyComponentProperties(SubstanceDefinition.SubstanceDefinitionPropertyComponent element) throws IOException {
56923    composeBackboneElementProperties(element);
56924      if (element.hasCategory()) {
56925        composeCodeableConcept("category", element.getCategory());
56926      }
56927      if (element.hasCode()) {
56928        composeCodeableConcept("code", element.getCode());
56929      }
56930      if (element.hasParametersElement()) {
56931        composeStringCore("parameters", element.getParametersElement(), false);
56932        composeStringExtras("parameters", element.getParametersElement(), false);
56933      }
56934      if (element.hasDefiningSubstance()) {
56935        composeType("definingSubstance", element.getDefiningSubstance());
56936      }
56937      if (element.hasAmount()) {
56938        composeType("amount", element.getAmount());
56939      }
56940      if (element.hasReferenceRange()) {
56941        composeRange("referenceRange", element.getReferenceRange());
56942      }
56943      if (element.hasSource()) {
56944        openArray("source");
56945        for (Reference e : element.getSource()) 
56946          composeReference(null, e);
56947        closeArray();
56948      };
56949  }
56950
56951  protected void composeSubstanceDefinitionStructureComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureComponent element) throws IOException {
56952    if (element != null) {
56953      open(name);
56954      composeSubstanceDefinitionStructureComponentProperties(element);
56955      close();
56956    }
56957  }
56958
56959  protected void composeSubstanceDefinitionStructureComponentProperties(SubstanceDefinition.SubstanceDefinitionStructureComponent element) throws IOException {
56960    composeBackboneElementProperties(element);
56961      if (element.hasStereochemistry()) {
56962        composeCodeableConcept("stereochemistry", element.getStereochemistry());
56963      }
56964      if (element.hasOpticalActivity()) {
56965        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
56966      }
56967      if (element.hasMolecularFormulaElement()) {
56968        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
56969        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
56970      }
56971      if (element.hasMolecularFormulaByMoietyElement()) {
56972        composeStringCore("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
56973        composeStringExtras("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
56974      }
56975      if (element.hasIsotope()) {
56976        openArray("isotope");
56977        for (SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent e : element.getIsotope()) 
56978          composeSubstanceDefinitionStructureIsotopeComponent(null, e);
56979        closeArray();
56980      };
56981      if (element.hasMolecularWeight()) {
56982        composeSubstanceDefinitionStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
56983      }
56984      if (element.hasSourceCoding()) {
56985        openArray("sourceCoding");
56986        for (Coding e : element.getSourceCoding()) 
56987          composeCoding(null, e);
56988        closeArray();
56989      };
56990      if (element.hasSourceDocument()) {
56991        openArray("sourceDocument");
56992        for (Reference e : element.getSourceDocument()) 
56993          composeReference(null, e);
56994        closeArray();
56995      };
56996      if (element.hasRepresentation()) {
56997        openArray("representation");
56998        for (SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent e : element.getRepresentation()) 
56999          composeSubstanceDefinitionStructureRepresentationComponent(null, e);
57000        closeArray();
57001      };
57002  }
57003
57004  protected void composeSubstanceDefinitionStructureIsotopeComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent element) throws IOException {
57005    if (element != null) {
57006      open(name);
57007      composeSubstanceDefinitionStructureIsotopeComponentProperties(element);
57008      close();
57009    }
57010  }
57011
57012  protected void composeSubstanceDefinitionStructureIsotopeComponentProperties(SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent element) throws IOException {
57013    composeBackboneElementProperties(element);
57014      if (element.hasIdentifier()) {
57015        composeIdentifier("identifier", element.getIdentifier());
57016      }
57017      if (element.hasName()) {
57018        composeCodeableConcept("name", element.getName());
57019      }
57020      if (element.hasSubstitution()) {
57021        composeCodeableConcept("substitution", element.getSubstitution());
57022      }
57023      if (element.hasHalfLife()) {
57024        composeQuantity("halfLife", element.getHalfLife());
57025      }
57026      if (element.hasMolecularWeight()) {
57027        composeSubstanceDefinitionStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
57028      }
57029  }
57030
57031  protected void composeSubstanceDefinitionStructureIsotopeMolecularWeightComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent element) throws IOException {
57032    if (element != null) {
57033      open(name);
57034      composeSubstanceDefinitionStructureIsotopeMolecularWeightComponentProperties(element);
57035      close();
57036    }
57037  }
57038
57039  protected void composeSubstanceDefinitionStructureIsotopeMolecularWeightComponentProperties(SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent element) throws IOException {
57040    composeBackboneElementProperties(element);
57041      if (element.hasMethod()) {
57042        composeCodeableConcept("method", element.getMethod());
57043      }
57044      if (element.hasType()) {
57045        composeCodeableConcept("type", element.getType());
57046      }
57047      if (element.hasAmount()) {
57048        composeQuantity("amount", element.getAmount());
57049      }
57050  }
57051
57052  protected void composeSubstanceDefinitionStructureRepresentationComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent element) throws IOException {
57053    if (element != null) {
57054      open(name);
57055      composeSubstanceDefinitionStructureRepresentationComponentProperties(element);
57056      close();
57057    }
57058  }
57059
57060  protected void composeSubstanceDefinitionStructureRepresentationComponentProperties(SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent element) throws IOException {
57061    composeBackboneElementProperties(element);
57062      if (element.hasType()) {
57063        composeCodeableConcept("type", element.getType());
57064      }
57065      if (element.hasRepresentationElement()) {
57066        composeStringCore("representation", element.getRepresentationElement(), false);
57067        composeStringExtras("representation", element.getRepresentationElement(), false);
57068      }
57069      if (element.hasAttachment()) {
57070        composeAttachment("attachment", element.getAttachment());
57071      }
57072  }
57073
57074  protected void composeSubstanceDefinitionCodeComponent(String name, SubstanceDefinition.SubstanceDefinitionCodeComponent element) throws IOException {
57075    if (element != null) {
57076      open(name);
57077      composeSubstanceDefinitionCodeComponentProperties(element);
57078      close();
57079    }
57080  }
57081
57082  protected void composeSubstanceDefinitionCodeComponentProperties(SubstanceDefinition.SubstanceDefinitionCodeComponent element) throws IOException {
57083    composeBackboneElementProperties(element);
57084      if (element.hasCode()) {
57085        composeCodeableConcept("code", element.getCode());
57086      }
57087      if (element.hasStatus()) {
57088        composeCodeableConcept("status", element.getStatus());
57089      }
57090      if (element.hasStatusDateElement()) {
57091        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
57092        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
57093      }
57094      if (element.hasNote()) {
57095        openArray("note");
57096        for (Annotation e : element.getNote()) 
57097          composeAnnotation(null, e);
57098        closeArray();
57099      };
57100      if (element.hasSource()) {
57101        openArray("source");
57102        for (Reference e : element.getSource()) 
57103          composeReference(null, e);
57104        closeArray();
57105      };
57106  }
57107
57108  protected void composeSubstanceDefinitionNameComponent(String name, SubstanceDefinition.SubstanceDefinitionNameComponent element) throws IOException {
57109    if (element != null) {
57110      open(name);
57111      composeSubstanceDefinitionNameComponentProperties(element);
57112      close();
57113    }
57114  }
57115
57116  protected void composeSubstanceDefinitionNameComponentProperties(SubstanceDefinition.SubstanceDefinitionNameComponent element) throws IOException {
57117    composeBackboneElementProperties(element);
57118      if (element.hasNameElement()) {
57119        composeStringCore("name", element.getNameElement(), false);
57120        composeStringExtras("name", element.getNameElement(), false);
57121      }
57122      if (element.hasType()) {
57123        composeCodeableConcept("type", element.getType());
57124      }
57125      if (element.hasStatus()) {
57126        composeCodeableConcept("status", element.getStatus());
57127      }
57128      if (element.hasPreferredElement()) {
57129        composeBooleanCore("preferred", element.getPreferredElement(), false);
57130        composeBooleanExtras("preferred", element.getPreferredElement(), false);
57131      }
57132      if (element.hasLanguage()) {
57133        openArray("language");
57134        for (CodeableConcept e : element.getLanguage()) 
57135          composeCodeableConcept(null, e);
57136        closeArray();
57137      };
57138      if (element.hasDomain()) {
57139        openArray("domain");
57140        for (CodeableConcept e : element.getDomain()) 
57141          composeCodeableConcept(null, e);
57142        closeArray();
57143      };
57144      if (element.hasJurisdiction()) {
57145        openArray("jurisdiction");
57146        for (CodeableConcept e : element.getJurisdiction()) 
57147          composeCodeableConcept(null, e);
57148        closeArray();
57149      };
57150      if (element.hasSynonym()) {
57151        openArray("synonym");
57152        for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getSynonym()) 
57153          composeSubstanceDefinitionNameComponent(null, e);
57154        closeArray();
57155      };
57156      if (element.hasTranslation()) {
57157        openArray("translation");
57158        for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getTranslation()) 
57159          composeSubstanceDefinitionNameComponent(null, e);
57160        closeArray();
57161      };
57162      if (element.hasOfficial()) {
57163        openArray("official");
57164        for (SubstanceDefinition.SubstanceDefinitionNameOfficialComponent e : element.getOfficial()) 
57165          composeSubstanceDefinitionNameOfficialComponent(null, e);
57166        closeArray();
57167      };
57168      if (element.hasSource()) {
57169        openArray("source");
57170        for (Reference e : element.getSource()) 
57171          composeReference(null, e);
57172        closeArray();
57173      };
57174  }
57175
57176  protected void composeSubstanceDefinitionNameOfficialComponent(String name, SubstanceDefinition.SubstanceDefinitionNameOfficialComponent element) throws IOException {
57177    if (element != null) {
57178      open(name);
57179      composeSubstanceDefinitionNameOfficialComponentProperties(element);
57180      close();
57181    }
57182  }
57183
57184  protected void composeSubstanceDefinitionNameOfficialComponentProperties(SubstanceDefinition.SubstanceDefinitionNameOfficialComponent element) throws IOException {
57185    composeBackboneElementProperties(element);
57186      if (element.hasAuthority()) {
57187        composeCodeableConcept("authority", element.getAuthority());
57188      }
57189      if (element.hasStatus()) {
57190        composeCodeableConcept("status", element.getStatus());
57191      }
57192      if (element.hasDateElement()) {
57193        composeDateTimeCore("date", element.getDateElement(), false);
57194        composeDateTimeExtras("date", element.getDateElement(), false);
57195      }
57196  }
57197
57198  protected void composeSubstanceDefinitionRelationshipComponent(String name, SubstanceDefinition.SubstanceDefinitionRelationshipComponent element) throws IOException {
57199    if (element != null) {
57200      open(name);
57201      composeSubstanceDefinitionRelationshipComponentProperties(element);
57202      close();
57203    }
57204  }
57205
57206  protected void composeSubstanceDefinitionRelationshipComponentProperties(SubstanceDefinition.SubstanceDefinitionRelationshipComponent element) throws IOException {
57207    composeBackboneElementProperties(element);
57208      if (element.hasSubstanceDefinition()) {
57209        composeType("substanceDefinition", element.getSubstanceDefinition());
57210      }
57211      if (element.hasType()) {
57212        composeCodeableConcept("type", element.getType());
57213      }
57214      if (element.hasIsDefiningElement()) {
57215        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
57216        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
57217      }
57218      if (element.hasAmount()) {
57219        composeType("amount", element.getAmount());
57220      }
57221      if (element.hasAmountRatioHighLimit()) {
57222        composeRatio("amountRatioHighLimit", element.getAmountRatioHighLimit());
57223      }
57224      if (element.hasAmountType()) {
57225        composeCodeableConcept("amountType", element.getAmountType());
57226      }
57227      if (element.hasSource()) {
57228        openArray("source");
57229        for (Reference e : element.getSource()) 
57230          composeReference(null, e);
57231        closeArray();
57232      };
57233  }
57234
57235  protected void composeSubstanceNucleicAcid(String name, SubstanceNucleicAcid element) throws IOException {
57236    if (element != null) {
57237      prop("resourceType", name);
57238      composeSubstanceNucleicAcidProperties(element);
57239    }
57240  }
57241
57242  protected void composeSubstanceNucleicAcidProperties(SubstanceNucleicAcid element) throws IOException {
57243    composeDomainResourceProperties(element);
57244      if (element.hasSequenceType()) {
57245        composeCodeableConcept("sequenceType", element.getSequenceType());
57246      }
57247      if (element.hasNumberOfSubunitsElement()) {
57248        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
57249        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
57250      }
57251      if (element.hasAreaOfHybridisationElement()) {
57252        composeStringCore("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
57253        composeStringExtras("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
57254      }
57255      if (element.hasOligoNucleotideType()) {
57256        composeCodeableConcept("oligoNucleotideType", element.getOligoNucleotideType());
57257      }
57258      if (element.hasSubunit()) {
57259        openArray("subunit");
57260        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent e : element.getSubunit()) 
57261          composeSubstanceNucleicAcidSubunitComponent(null, e);
57262        closeArray();
57263      };
57264  }
57265
57266  protected void composeSubstanceNucleicAcidSubunitComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
57267    if (element != null) {
57268      open(name);
57269      composeSubstanceNucleicAcidSubunitComponentProperties(element);
57270      close();
57271    }
57272  }
57273
57274  protected void composeSubstanceNucleicAcidSubunitComponentProperties(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
57275    composeBackboneElementProperties(element);
57276      if (element.hasSubunitElement()) {
57277        composeIntegerCore("subunit", element.getSubunitElement(), false);
57278        composeIntegerExtras("subunit", element.getSubunitElement(), false);
57279      }
57280      if (element.hasSequenceElement()) {
57281        composeStringCore("sequence", element.getSequenceElement(), false);
57282        composeStringExtras("sequence", element.getSequenceElement(), false);
57283      }
57284      if (element.hasLengthElement()) {
57285        composeIntegerCore("length", element.getLengthElement(), false);
57286        composeIntegerExtras("length", element.getLengthElement(), false);
57287      }
57288      if (element.hasSequenceAttachment()) {
57289        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
57290      }
57291      if (element.hasFivePrime()) {
57292        composeCodeableConcept("fivePrime", element.getFivePrime());
57293      }
57294      if (element.hasThreePrime()) {
57295        composeCodeableConcept("threePrime", element.getThreePrime());
57296      }
57297      if (element.hasLinkage()) {
57298        openArray("linkage");
57299        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent e : element.getLinkage()) 
57300          composeSubstanceNucleicAcidSubunitLinkageComponent(null, e);
57301        closeArray();
57302      };
57303      if (element.hasSugar()) {
57304        openArray("sugar");
57305        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent e : element.getSugar()) 
57306          composeSubstanceNucleicAcidSubunitSugarComponent(null, e);
57307        closeArray();
57308      };
57309  }
57310
57311  protected void composeSubstanceNucleicAcidSubunitLinkageComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
57312    if (element != null) {
57313      open(name);
57314      composeSubstanceNucleicAcidSubunitLinkageComponentProperties(element);
57315      close();
57316    }
57317  }
57318
57319  protected void composeSubstanceNucleicAcidSubunitLinkageComponentProperties(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
57320    composeBackboneElementProperties(element);
57321      if (element.hasConnectivityElement()) {
57322        composeStringCore("connectivity", element.getConnectivityElement(), false);
57323        composeStringExtras("connectivity", element.getConnectivityElement(), false);
57324      }
57325      if (element.hasIdentifier()) {
57326        composeIdentifier("identifier", element.getIdentifier());
57327      }
57328      if (element.hasNameElement()) {
57329        composeStringCore("name", element.getNameElement(), false);
57330        composeStringExtras("name", element.getNameElement(), false);
57331      }
57332      if (element.hasResidueSiteElement()) {
57333        composeStringCore("residueSite", element.getResidueSiteElement(), false);
57334        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
57335      }
57336  }
57337
57338  protected void composeSubstanceNucleicAcidSubunitSugarComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
57339    if (element != null) {
57340      open(name);
57341      composeSubstanceNucleicAcidSubunitSugarComponentProperties(element);
57342      close();
57343    }
57344  }
57345
57346  protected void composeSubstanceNucleicAcidSubunitSugarComponentProperties(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
57347    composeBackboneElementProperties(element);
57348      if (element.hasIdentifier()) {
57349        composeIdentifier("identifier", element.getIdentifier());
57350      }
57351      if (element.hasNameElement()) {
57352        composeStringCore("name", element.getNameElement(), false);
57353        composeStringExtras("name", element.getNameElement(), false);
57354      }
57355      if (element.hasResidueSiteElement()) {
57356        composeStringCore("residueSite", element.getResidueSiteElement(), false);
57357        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
57358      }
57359  }
57360
57361  protected void composeSubstancePolymer(String name, SubstancePolymer element) throws IOException {
57362    if (element != null) {
57363      prop("resourceType", name);
57364      composeSubstancePolymerProperties(element);
57365    }
57366  }
57367
57368  protected void composeSubstancePolymerProperties(SubstancePolymer element) throws IOException {
57369    composeDomainResourceProperties(element);
57370      if (element.hasClass_()) {
57371        composeCodeableConcept("class", element.getClass_());
57372      }
57373      if (element.hasGeometry()) {
57374        composeCodeableConcept("geometry", element.getGeometry());
57375      }
57376      if (element.hasCopolymerConnectivity()) {
57377        openArray("copolymerConnectivity");
57378        for (CodeableConcept e : element.getCopolymerConnectivity()) 
57379          composeCodeableConcept(null, e);
57380        closeArray();
57381      };
57382      if (element.hasModification()) {
57383        openArray("modification");
57384        for (StringType e : element.getModification()) 
57385          composeStringCore(null, e, true);
57386        closeArray();
57387        if (anyHasExtras(element.getModification())) {
57388          openArray("_modification");
57389          for (StringType e : element.getModification()) 
57390            composeStringExtras(null, e, true);
57391          closeArray();
57392        }
57393      };
57394      if (element.hasMonomerSet()) {
57395        openArray("monomerSet");
57396        for (SubstancePolymer.SubstancePolymerMonomerSetComponent e : element.getMonomerSet()) 
57397          composeSubstancePolymerMonomerSetComponent(null, e);
57398        closeArray();
57399      };
57400      if (element.hasRepeat()) {
57401        openArray("repeat");
57402        for (SubstancePolymer.SubstancePolymerRepeatComponent e : element.getRepeat()) 
57403          composeSubstancePolymerRepeatComponent(null, e);
57404        closeArray();
57405      };
57406  }
57407
57408  protected void composeSubstancePolymerMonomerSetComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
57409    if (element != null) {
57410      open(name);
57411      composeSubstancePolymerMonomerSetComponentProperties(element);
57412      close();
57413    }
57414  }
57415
57416  protected void composeSubstancePolymerMonomerSetComponentProperties(SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
57417    composeBackboneElementProperties(element);
57418      if (element.hasRatioType()) {
57419        composeCodeableConcept("ratioType", element.getRatioType());
57420      }
57421      if (element.hasStartingMaterial()) {
57422        openArray("startingMaterial");
57423        for (SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent e : element.getStartingMaterial()) 
57424          composeSubstancePolymerMonomerSetStartingMaterialComponent(null, e);
57425        closeArray();
57426      };
57427  }
57428
57429  protected void composeSubstancePolymerMonomerSetStartingMaterialComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
57430    if (element != null) {
57431      open(name);
57432      composeSubstancePolymerMonomerSetStartingMaterialComponentProperties(element);
57433      close();
57434    }
57435  }
57436
57437  protected void composeSubstancePolymerMonomerSetStartingMaterialComponentProperties(SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
57438    composeBackboneElementProperties(element);
57439      if (element.hasMaterial()) {
57440        composeCodeableConcept("material", element.getMaterial());
57441      }
57442      if (element.hasType()) {
57443        composeCodeableConcept("type", element.getType());
57444      }
57445      if (element.hasIsDefiningElement()) {
57446        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
57447        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
57448      }
57449      if (element.hasAmount()) {
57450        composeSubstanceAmount("amount", element.getAmount());
57451      }
57452  }
57453
57454  protected void composeSubstancePolymerRepeatComponent(String name, SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
57455    if (element != null) {
57456      open(name);
57457      composeSubstancePolymerRepeatComponentProperties(element);
57458      close();
57459    }
57460  }
57461
57462  protected void composeSubstancePolymerRepeatComponentProperties(SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
57463    composeBackboneElementProperties(element);
57464      if (element.hasNumberOfUnitsElement()) {
57465        composeIntegerCore("numberOfUnits", element.getNumberOfUnitsElement(), false);
57466        composeIntegerExtras("numberOfUnits", element.getNumberOfUnitsElement(), false);
57467      }
57468      if (element.hasAverageMolecularFormulaElement()) {
57469        composeStringCore("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
57470        composeStringExtras("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
57471      }
57472      if (element.hasRepeatUnitAmountType()) {
57473        composeCodeableConcept("repeatUnitAmountType", element.getRepeatUnitAmountType());
57474      }
57475      if (element.hasRepeatUnit()) {
57476        openArray("repeatUnit");
57477        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent e : element.getRepeatUnit()) 
57478          composeSubstancePolymerRepeatRepeatUnitComponent(null, e);
57479        closeArray();
57480      };
57481  }
57482
57483  protected void composeSubstancePolymerRepeatRepeatUnitComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
57484    if (element != null) {
57485      open(name);
57486      composeSubstancePolymerRepeatRepeatUnitComponentProperties(element);
57487      close();
57488    }
57489  }
57490
57491  protected void composeSubstancePolymerRepeatRepeatUnitComponentProperties(SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
57492    composeBackboneElementProperties(element);
57493      if (element.hasOrientationOfPolymerisation()) {
57494        composeCodeableConcept("orientationOfPolymerisation", element.getOrientationOfPolymerisation());
57495      }
57496      if (element.hasRepeatUnitElement()) {
57497        composeStringCore("repeatUnit", element.getRepeatUnitElement(), false);
57498        composeStringExtras("repeatUnit", element.getRepeatUnitElement(), false);
57499      }
57500      if (element.hasAmount()) {
57501        composeSubstanceAmount("amount", element.getAmount());
57502      }
57503      if (element.hasDegreeOfPolymerisation()) {
57504        openArray("degreeOfPolymerisation");
57505        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent e : element.getDegreeOfPolymerisation()) 
57506          composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(null, e);
57507        closeArray();
57508      };
57509      if (element.hasStructuralRepresentation()) {
57510        openArray("structuralRepresentation");
57511        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent e : element.getStructuralRepresentation()) 
57512          composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(null, e);
57513        closeArray();
57514      };
57515  }
57516
57517  protected void composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
57518    if (element != null) {
57519      open(name);
57520      composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(element);
57521      close();
57522    }
57523  }
57524
57525  protected void composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
57526    composeBackboneElementProperties(element);
57527      if (element.hasDegree()) {
57528        composeCodeableConcept("degree", element.getDegree());
57529      }
57530      if (element.hasAmount()) {
57531        composeSubstanceAmount("amount", element.getAmount());
57532      }
57533  }
57534
57535  protected void composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
57536    if (element != null) {
57537      open(name);
57538      composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(element);
57539      close();
57540    }
57541  }
57542
57543  protected void composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
57544    composeBackboneElementProperties(element);
57545      if (element.hasType()) {
57546        composeCodeableConcept("type", element.getType());
57547      }
57548      if (element.hasRepresentationElement()) {
57549        composeStringCore("representation", element.getRepresentationElement(), false);
57550        composeStringExtras("representation", element.getRepresentationElement(), false);
57551      }
57552      if (element.hasAttachment()) {
57553        composeAttachment("attachment", element.getAttachment());
57554      }
57555  }
57556
57557  protected void composeSubstanceProtein(String name, SubstanceProtein element) throws IOException {
57558    if (element != null) {
57559      prop("resourceType", name);
57560      composeSubstanceProteinProperties(element);
57561    }
57562  }
57563
57564  protected void composeSubstanceProteinProperties(SubstanceProtein element) throws IOException {
57565    composeDomainResourceProperties(element);
57566      if (element.hasSequenceType()) {
57567        composeCodeableConcept("sequenceType", element.getSequenceType());
57568      }
57569      if (element.hasNumberOfSubunitsElement()) {
57570        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
57571        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
57572      }
57573      if (element.hasDisulfideLinkage()) {
57574        openArray("disulfideLinkage");
57575        for (StringType e : element.getDisulfideLinkage()) 
57576          composeStringCore(null, e, true);
57577        closeArray();
57578        if (anyHasExtras(element.getDisulfideLinkage())) {
57579          openArray("_disulfideLinkage");
57580          for (StringType e : element.getDisulfideLinkage()) 
57581            composeStringExtras(null, e, true);
57582          closeArray();
57583        }
57584      };
57585      if (element.hasSubunit()) {
57586        openArray("subunit");
57587        for (SubstanceProtein.SubstanceProteinSubunitComponent e : element.getSubunit()) 
57588          composeSubstanceProteinSubunitComponent(null, e);
57589        closeArray();
57590      };
57591  }
57592
57593  protected void composeSubstanceProteinSubunitComponent(String name, SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
57594    if (element != null) {
57595      open(name);
57596      composeSubstanceProteinSubunitComponentProperties(element);
57597      close();
57598    }
57599  }
57600
57601  protected void composeSubstanceProteinSubunitComponentProperties(SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
57602    composeBackboneElementProperties(element);
57603      if (element.hasSubunitElement()) {
57604        composeIntegerCore("subunit", element.getSubunitElement(), false);
57605        composeIntegerExtras("subunit", element.getSubunitElement(), false);
57606      }
57607      if (element.hasSequenceElement()) {
57608        composeStringCore("sequence", element.getSequenceElement(), false);
57609        composeStringExtras("sequence", element.getSequenceElement(), false);
57610      }
57611      if (element.hasLengthElement()) {
57612        composeIntegerCore("length", element.getLengthElement(), false);
57613        composeIntegerExtras("length", element.getLengthElement(), false);
57614      }
57615      if (element.hasSequenceAttachment()) {
57616        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
57617      }
57618      if (element.hasNTerminalModificationId()) {
57619        composeIdentifier("nTerminalModificationId", element.getNTerminalModificationId());
57620      }
57621      if (element.hasNTerminalModificationElement()) {
57622        composeStringCore("nTerminalModification", element.getNTerminalModificationElement(), false);
57623        composeStringExtras("nTerminalModification", element.getNTerminalModificationElement(), false);
57624      }
57625      if (element.hasCTerminalModificationId()) {
57626        composeIdentifier("cTerminalModificationId", element.getCTerminalModificationId());
57627      }
57628      if (element.hasCTerminalModificationElement()) {
57629        composeStringCore("cTerminalModification", element.getCTerminalModificationElement(), false);
57630        composeStringExtras("cTerminalModification", element.getCTerminalModificationElement(), false);
57631      }
57632  }
57633
57634  protected void composeSubstanceReferenceInformation(String name, SubstanceReferenceInformation element) throws IOException {
57635    if (element != null) {
57636      prop("resourceType", name);
57637      composeSubstanceReferenceInformationProperties(element);
57638    }
57639  }
57640
57641  protected void composeSubstanceReferenceInformationProperties(SubstanceReferenceInformation element) throws IOException {
57642    composeDomainResourceProperties(element);
57643      if (element.hasCommentElement()) {
57644        composeStringCore("comment", element.getCommentElement(), false);
57645        composeStringExtras("comment", element.getCommentElement(), false);
57646      }
57647      if (element.hasGene()) {
57648        openArray("gene");
57649        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent e : element.getGene()) 
57650          composeSubstanceReferenceInformationGeneComponent(null, e);
57651        closeArray();
57652      };
57653      if (element.hasGeneElement()) {
57654        openArray("geneElement");
57655        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent e : element.getGeneElement()) 
57656          composeSubstanceReferenceInformationGeneElementComponent(null, e);
57657        closeArray();
57658      };
57659      if (element.hasClassification()) {
57660        openArray("classification");
57661        for (SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent e : element.getClassification()) 
57662          composeSubstanceReferenceInformationClassificationComponent(null, e);
57663        closeArray();
57664      };
57665      if (element.hasTarget()) {
57666        openArray("target");
57667        for (SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent e : element.getTarget()) 
57668          composeSubstanceReferenceInformationTargetComponent(null, e);
57669        closeArray();
57670      };
57671  }
57672
57673  protected void composeSubstanceReferenceInformationGeneComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
57674    if (element != null) {
57675      open(name);
57676      composeSubstanceReferenceInformationGeneComponentProperties(element);
57677      close();
57678    }
57679  }
57680
57681  protected void composeSubstanceReferenceInformationGeneComponentProperties(SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
57682    composeBackboneElementProperties(element);
57683      if (element.hasGeneSequenceOrigin()) {
57684        composeCodeableConcept("geneSequenceOrigin", element.getGeneSequenceOrigin());
57685      }
57686      if (element.hasGene()) {
57687        composeCodeableConcept("gene", element.getGene());
57688      }
57689      if (element.hasSource()) {
57690        openArray("source");
57691        for (Reference e : element.getSource()) 
57692          composeReference(null, e);
57693        closeArray();
57694      };
57695  }
57696
57697  protected void composeSubstanceReferenceInformationGeneElementComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
57698    if (element != null) {
57699      open(name);
57700      composeSubstanceReferenceInformationGeneElementComponentProperties(element);
57701      close();
57702    }
57703  }
57704
57705  protected void composeSubstanceReferenceInformationGeneElementComponentProperties(SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
57706    composeBackboneElementProperties(element);
57707      if (element.hasType()) {
57708        composeCodeableConcept("type", element.getType());
57709      }
57710      if (element.hasElement()) {
57711        composeIdentifier("element", element.getElement());
57712      }
57713      if (element.hasSource()) {
57714        openArray("source");
57715        for (Reference e : element.getSource()) 
57716          composeReference(null, e);
57717        closeArray();
57718      };
57719  }
57720
57721  protected void composeSubstanceReferenceInformationClassificationComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
57722    if (element != null) {
57723      open(name);
57724      composeSubstanceReferenceInformationClassificationComponentProperties(element);
57725      close();
57726    }
57727  }
57728
57729  protected void composeSubstanceReferenceInformationClassificationComponentProperties(SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
57730    composeBackboneElementProperties(element);
57731      if (element.hasDomain()) {
57732        composeCodeableConcept("domain", element.getDomain());
57733      }
57734      if (element.hasClassification()) {
57735        composeCodeableConcept("classification", element.getClassification());
57736      }
57737      if (element.hasSubtype()) {
57738        openArray("subtype");
57739        for (CodeableConcept e : element.getSubtype()) 
57740          composeCodeableConcept(null, e);
57741        closeArray();
57742      };
57743      if (element.hasSource()) {
57744        openArray("source");
57745        for (Reference e : element.getSource()) 
57746          composeReference(null, e);
57747        closeArray();
57748      };
57749  }
57750
57751  protected void composeSubstanceReferenceInformationTargetComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
57752    if (element != null) {
57753      open(name);
57754      composeSubstanceReferenceInformationTargetComponentProperties(element);
57755      close();
57756    }
57757  }
57758
57759  protected void composeSubstanceReferenceInformationTargetComponentProperties(SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
57760    composeBackboneElementProperties(element);
57761      if (element.hasTarget()) {
57762        composeIdentifier("target", element.getTarget());
57763      }
57764      if (element.hasType()) {
57765        composeCodeableConcept("type", element.getType());
57766      }
57767      if (element.hasInteraction()) {
57768        composeCodeableConcept("interaction", element.getInteraction());
57769      }
57770      if (element.hasOrganism()) {
57771        composeCodeableConcept("organism", element.getOrganism());
57772      }
57773      if (element.hasOrganismType()) {
57774        composeCodeableConcept("organismType", element.getOrganismType());
57775      }
57776      if (element.hasAmount()) {
57777        composeType("amount", element.getAmount());
57778      }
57779      if (element.hasAmountType()) {
57780        composeCodeableConcept("amountType", element.getAmountType());
57781      }
57782      if (element.hasSource()) {
57783        openArray("source");
57784        for (Reference e : element.getSource()) 
57785          composeReference(null, e);
57786        closeArray();
57787      };
57788  }
57789
57790  protected void composeSubstanceSourceMaterial(String name, SubstanceSourceMaterial element) throws IOException {
57791    if (element != null) {
57792      prop("resourceType", name);
57793      composeSubstanceSourceMaterialProperties(element);
57794    }
57795  }
57796
57797  protected void composeSubstanceSourceMaterialProperties(SubstanceSourceMaterial element) throws IOException {
57798    composeDomainResourceProperties(element);
57799      if (element.hasSourceMaterialClass()) {
57800        composeCodeableConcept("sourceMaterialClass", element.getSourceMaterialClass());
57801      }
57802      if (element.hasSourceMaterialType()) {
57803        composeCodeableConcept("sourceMaterialType", element.getSourceMaterialType());
57804      }
57805      if (element.hasSourceMaterialState()) {
57806        composeCodeableConcept("sourceMaterialState", element.getSourceMaterialState());
57807      }
57808      if (element.hasOrganismId()) {
57809        composeIdentifier("organismId", element.getOrganismId());
57810      }
57811      if (element.hasOrganismNameElement()) {
57812        composeStringCore("organismName", element.getOrganismNameElement(), false);
57813        composeStringExtras("organismName", element.getOrganismNameElement(), false);
57814      }
57815      if (element.hasParentSubstanceId()) {
57816        openArray("parentSubstanceId");
57817        for (Identifier e : element.getParentSubstanceId()) 
57818          composeIdentifier(null, e);
57819        closeArray();
57820      };
57821      if (element.hasParentSubstanceName()) {
57822        openArray("parentSubstanceName");
57823        for (StringType e : element.getParentSubstanceName()) 
57824          composeStringCore(null, e, true);
57825        closeArray();
57826        if (anyHasExtras(element.getParentSubstanceName())) {
57827          openArray("_parentSubstanceName");
57828          for (StringType e : element.getParentSubstanceName()) 
57829            composeStringExtras(null, e, true);
57830          closeArray();
57831        }
57832      };
57833      if (element.hasCountryOfOrigin()) {
57834        openArray("countryOfOrigin");
57835        for (CodeableConcept e : element.getCountryOfOrigin()) 
57836          composeCodeableConcept(null, e);
57837        closeArray();
57838      };
57839      if (element.hasGeographicalLocation()) {
57840        openArray("geographicalLocation");
57841        for (StringType e : element.getGeographicalLocation()) 
57842          composeStringCore(null, e, true);
57843        closeArray();
57844        if (anyHasExtras(element.getGeographicalLocation())) {
57845          openArray("_geographicalLocation");
57846          for (StringType e : element.getGeographicalLocation()) 
57847            composeStringExtras(null, e, true);
57848          closeArray();
57849        }
57850      };
57851      if (element.hasDevelopmentStage()) {
57852        composeCodeableConcept("developmentStage", element.getDevelopmentStage());
57853      }
57854      if (element.hasFractionDescription()) {
57855        openArray("fractionDescription");
57856        for (SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent e : element.getFractionDescription()) 
57857          composeSubstanceSourceMaterialFractionDescriptionComponent(null, e);
57858        closeArray();
57859      };
57860      if (element.hasOrganism()) {
57861        composeSubstanceSourceMaterialOrganismComponent("organism", element.getOrganism());
57862      }
57863      if (element.hasPartDescription()) {
57864        openArray("partDescription");
57865        for (SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent e : element.getPartDescription()) 
57866          composeSubstanceSourceMaterialPartDescriptionComponent(null, e);
57867        closeArray();
57868      };
57869  }
57870
57871  protected void composeSubstanceSourceMaterialFractionDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
57872    if (element != null) {
57873      open(name);
57874      composeSubstanceSourceMaterialFractionDescriptionComponentProperties(element);
57875      close();
57876    }
57877  }
57878
57879  protected void composeSubstanceSourceMaterialFractionDescriptionComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
57880    composeBackboneElementProperties(element);
57881      if (element.hasFractionElement()) {
57882        composeStringCore("fraction", element.getFractionElement(), false);
57883        composeStringExtras("fraction", element.getFractionElement(), false);
57884      }
57885      if (element.hasMaterialType()) {
57886        composeCodeableConcept("materialType", element.getMaterialType());
57887      }
57888  }
57889
57890  protected void composeSubstanceSourceMaterialOrganismComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
57891    if (element != null) {
57892      open(name);
57893      composeSubstanceSourceMaterialOrganismComponentProperties(element);
57894      close();
57895    }
57896  }
57897
57898  protected void composeSubstanceSourceMaterialOrganismComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
57899    composeBackboneElementProperties(element);
57900      if (element.hasFamily()) {
57901        composeCodeableConcept("family", element.getFamily());
57902      }
57903      if (element.hasGenus()) {
57904        composeCodeableConcept("genus", element.getGenus());
57905      }
57906      if (element.hasSpecies()) {
57907        composeCodeableConcept("species", element.getSpecies());
57908      }
57909      if (element.hasIntraspecificType()) {
57910        composeCodeableConcept("intraspecificType", element.getIntraspecificType());
57911      }
57912      if (element.hasIntraspecificDescriptionElement()) {
57913        composeStringCore("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
57914        composeStringExtras("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
57915      }
57916      if (element.hasAuthor()) {
57917        openArray("author");
57918        for (SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent e : element.getAuthor()) 
57919          composeSubstanceSourceMaterialOrganismAuthorComponent(null, e);
57920        closeArray();
57921      };
57922      if (element.hasHybrid()) {
57923        composeSubstanceSourceMaterialOrganismHybridComponent("hybrid", element.getHybrid());
57924      }
57925      if (element.hasOrganismGeneral()) {
57926        composeSubstanceSourceMaterialOrganismOrganismGeneralComponent("organismGeneral", element.getOrganismGeneral());
57927      }
57928  }
57929
57930  protected void composeSubstanceSourceMaterialOrganismAuthorComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
57931    if (element != null) {
57932      open(name);
57933      composeSubstanceSourceMaterialOrganismAuthorComponentProperties(element);
57934      close();
57935    }
57936  }
57937
57938  protected void composeSubstanceSourceMaterialOrganismAuthorComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
57939    composeBackboneElementProperties(element);
57940      if (element.hasAuthorType()) {
57941        composeCodeableConcept("authorType", element.getAuthorType());
57942      }
57943      if (element.hasAuthorDescriptionElement()) {
57944        composeStringCore("authorDescription", element.getAuthorDescriptionElement(), false);
57945        composeStringExtras("authorDescription", element.getAuthorDescriptionElement(), false);
57946      }
57947  }
57948
57949  protected void composeSubstanceSourceMaterialOrganismHybridComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
57950    if (element != null) {
57951      open(name);
57952      composeSubstanceSourceMaterialOrganismHybridComponentProperties(element);
57953      close();
57954    }
57955  }
57956
57957  protected void composeSubstanceSourceMaterialOrganismHybridComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
57958    composeBackboneElementProperties(element);
57959      if (element.hasMaternalOrganismIdElement()) {
57960        composeStringCore("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
57961        composeStringExtras("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
57962      }
57963      if (element.hasMaternalOrganismNameElement()) {
57964        composeStringCore("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
57965        composeStringExtras("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
57966      }
57967      if (element.hasPaternalOrganismIdElement()) {
57968        composeStringCore("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
57969        composeStringExtras("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
57970      }
57971      if (element.hasPaternalOrganismNameElement()) {
57972        composeStringCore("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
57973        composeStringExtras("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
57974      }
57975      if (element.hasHybridType()) {
57976        composeCodeableConcept("hybridType", element.getHybridType());
57977      }
57978  }
57979
57980  protected void composeSubstanceSourceMaterialOrganismOrganismGeneralComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
57981    if (element != null) {
57982      open(name);
57983      composeSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(element);
57984      close();
57985    }
57986  }
57987
57988  protected void composeSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
57989    composeBackboneElementProperties(element);
57990      if (element.hasKingdom()) {
57991        composeCodeableConcept("kingdom", element.getKingdom());
57992      }
57993      if (element.hasPhylum()) {
57994        composeCodeableConcept("phylum", element.getPhylum());
57995      }
57996      if (element.hasClass_()) {
57997        composeCodeableConcept("class", element.getClass_());
57998      }
57999      if (element.hasOrder()) {
58000        composeCodeableConcept("order", element.getOrder());
58001      }
58002  }
58003
58004  protected void composeSubstanceSourceMaterialPartDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
58005    if (element != null) {
58006      open(name);
58007      composeSubstanceSourceMaterialPartDescriptionComponentProperties(element);
58008      close();
58009    }
58010  }
58011
58012  protected void composeSubstanceSourceMaterialPartDescriptionComponentProperties(SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
58013    composeBackboneElementProperties(element);
58014      if (element.hasPart()) {
58015        composeCodeableConcept("part", element.getPart());
58016      }
58017      if (element.hasPartLocation()) {
58018        composeCodeableConcept("partLocation", element.getPartLocation());
58019      }
58020  }
58021
58022  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
58023    if (element != null) {
58024      prop("resourceType", name);
58025      composeSupplyDeliveryProperties(element);
58026    }
58027  }
58028
58029  protected void composeSupplyDeliveryProperties(SupplyDelivery element) throws IOException {
58030    composeDomainResourceProperties(element);
58031      if (element.hasIdentifier()) {
58032        openArray("identifier");
58033        for (Identifier e : element.getIdentifier()) 
58034          composeIdentifier(null, e);
58035        closeArray();
58036      };
58037      if (element.hasBasedOn()) {
58038        openArray("basedOn");
58039        for (Reference e : element.getBasedOn()) 
58040          composeReference(null, e);
58041        closeArray();
58042      };
58043      if (element.hasPartOf()) {
58044        openArray("partOf");
58045        for (Reference e : element.getPartOf()) 
58046          composeReference(null, e);
58047        closeArray();
58048      };
58049      if (element.hasStatusElement()) {
58050        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
58051        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
58052      }
58053      if (element.hasPatient()) {
58054        composeReference("patient", element.getPatient());
58055      }
58056      if (element.hasType()) {
58057        composeCodeableConcept("type", element.getType());
58058      }
58059      if (element.hasSuppliedItem()) {
58060        composeSupplyDeliverySuppliedItemComponent("suppliedItem", element.getSuppliedItem());
58061      }
58062      if (element.hasOccurrence()) {
58063        composeType("occurrence", element.getOccurrence());
58064      }
58065      if (element.hasSupplier()) {
58066        composeReference("supplier", element.getSupplier());
58067      }
58068      if (element.hasDestination()) {
58069        composeReference("destination", element.getDestination());
58070      }
58071      if (element.hasReceiver()) {
58072        openArray("receiver");
58073        for (Reference e : element.getReceiver()) 
58074          composeReference(null, e);
58075        closeArray();
58076      };
58077  }
58078
58079  protected void composeSupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
58080    if (element != null) {
58081      open(name);
58082      composeSupplyDeliverySuppliedItemComponentProperties(element);
58083      close();
58084    }
58085  }
58086
58087  protected void composeSupplyDeliverySuppliedItemComponentProperties(SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
58088    composeBackboneElementProperties(element);
58089      if (element.hasQuantity()) {
58090        composeQuantity("quantity", element.getQuantity());
58091      }
58092      if (element.hasItem()) {
58093        composeType("item", element.getItem());
58094      }
58095  }
58096
58097  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
58098    if (element != null) {
58099      prop("resourceType", name);
58100      composeSupplyRequestProperties(element);
58101    }
58102  }
58103
58104  protected void composeSupplyRequestProperties(SupplyRequest element) throws IOException {
58105    composeDomainResourceProperties(element);
58106      if (element.hasIdentifier()) {
58107        openArray("identifier");
58108        for (Identifier e : element.getIdentifier()) 
58109          composeIdentifier(null, e);
58110        closeArray();
58111      };
58112      if (element.hasStatusElement()) {
58113        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
58114        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
58115      }
58116      if (element.hasCategory()) {
58117        composeCodeableConcept("category", element.getCategory());
58118      }
58119      if (element.hasPriorityElement()) {
58120        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
58121        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
58122      }
58123      if (element.hasItem()) {
58124        composeType("item", element.getItem());
58125      }
58126      if (element.hasQuantity()) {
58127        composeQuantity("quantity", element.getQuantity());
58128      }
58129      if (element.hasParameter()) {
58130        openArray("parameter");
58131        for (SupplyRequest.SupplyRequestParameterComponent e : element.getParameter()) 
58132          composeSupplyRequestParameterComponent(null, e);
58133        closeArray();
58134      };
58135      if (element.hasOccurrence()) {
58136        composeType("occurrence", element.getOccurrence());
58137      }
58138      if (element.hasAuthoredOnElement()) {
58139        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
58140        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
58141      }
58142      if (element.hasRequester()) {
58143        composeReference("requester", element.getRequester());
58144      }
58145      if (element.hasSupplier()) {
58146        openArray("supplier");
58147        for (Reference e : element.getSupplier()) 
58148          composeReference(null, e);
58149        closeArray();
58150      };
58151      if (element.hasReason()) {
58152        openArray("reason");
58153        for (CodeableReference e : element.getReason()) 
58154          composeCodeableReference(null, e);
58155        closeArray();
58156      };
58157      if (element.hasDeliverFrom()) {
58158        composeReference("deliverFrom", element.getDeliverFrom());
58159      }
58160      if (element.hasDeliverTo()) {
58161        composeReference("deliverTo", element.getDeliverTo());
58162      }
58163  }
58164
58165  protected void composeSupplyRequestParameterComponent(String name, SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
58166    if (element != null) {
58167      open(name);
58168      composeSupplyRequestParameterComponentProperties(element);
58169      close();
58170    }
58171  }
58172
58173  protected void composeSupplyRequestParameterComponentProperties(SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
58174    composeBackboneElementProperties(element);
58175      if (element.hasCode()) {
58176        composeCodeableConcept("code", element.getCode());
58177      }
58178      if (element.hasValue()) {
58179        composeType("value", element.getValue());
58180      }
58181  }
58182
58183  protected void composeTask(String name, Task element) throws IOException {
58184    if (element != null) {
58185      prop("resourceType", name);
58186      composeTaskProperties(element);
58187    }
58188  }
58189
58190  protected void composeTaskProperties(Task element) throws IOException {
58191    composeDomainResourceProperties(element);
58192      if (element.hasIdentifier()) {
58193        openArray("identifier");
58194        for (Identifier e : element.getIdentifier()) 
58195          composeIdentifier(null, e);
58196        closeArray();
58197      };
58198      if (element.hasInstantiatesCanonicalElement()) {
58199        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
58200        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
58201      }
58202      if (element.hasInstantiatesUriElement()) {
58203        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
58204        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
58205      }
58206      if (element.hasBasedOn()) {
58207        openArray("basedOn");
58208        for (Reference e : element.getBasedOn()) 
58209          composeReference(null, e);
58210        closeArray();
58211      };
58212      if (element.hasGroupIdentifier()) {
58213        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
58214      }
58215      if (element.hasPartOf()) {
58216        openArray("partOf");
58217        for (Reference e : element.getPartOf()) 
58218          composeReference(null, e);
58219        closeArray();
58220      };
58221      if (element.hasStatusElement()) {
58222        composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
58223        composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
58224      }
58225      if (element.hasStatusReason()) {
58226        composeCodeableConcept("statusReason", element.getStatusReason());
58227      }
58228      if (element.hasBusinessStatus()) {
58229        composeCodeableConcept("businessStatus", element.getBusinessStatus());
58230      }
58231      if (element.hasIntentElement()) {
58232        composeEnumerationCore("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
58233        composeEnumerationExtras("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
58234      }
58235      if (element.hasPriorityElement()) {
58236        composeEnumerationCore("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
58237        composeEnumerationExtras("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory(), false);
58238      }
58239      if (element.hasCode()) {
58240        composeCodeableConcept("code", element.getCode());
58241      }
58242      if (element.hasDescriptionElement()) {
58243        composeStringCore("description", element.getDescriptionElement(), false);
58244        composeStringExtras("description", element.getDescriptionElement(), false);
58245      }
58246      if (element.hasFocus()) {
58247        composeReference("focus", element.getFocus());
58248      }
58249      if (element.hasFor()) {
58250        composeReference("for", element.getFor());
58251      }
58252      if (element.hasEncounter()) {
58253        composeReference("encounter", element.getEncounter());
58254      }
58255      if (element.hasExecutionPeriod()) {
58256        composePeriod("executionPeriod", element.getExecutionPeriod());
58257      }
58258      if (element.hasAuthoredOnElement()) {
58259        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
58260        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
58261      }
58262      if (element.hasLastModifiedElement()) {
58263        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
58264        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
58265      }
58266      if (element.hasRequester()) {
58267        composeReference("requester", element.getRequester());
58268      }
58269      if (element.hasPerformerType()) {
58270        openArray("performerType");
58271        for (CodeableConcept e : element.getPerformerType()) 
58272          composeCodeableConcept(null, e);
58273        closeArray();
58274      };
58275      if (element.hasOwner()) {
58276        composeReference("owner", element.getOwner());
58277      }
58278      if (element.hasLocation()) {
58279        composeReference("location", element.getLocation());
58280      }
58281      if (element.hasReasonCode()) {
58282        composeCodeableConcept("reasonCode", element.getReasonCode());
58283      }
58284      if (element.hasReasonReference()) {
58285        composeReference("reasonReference", element.getReasonReference());
58286      }
58287      if (element.hasInsurance()) {
58288        openArray("insurance");
58289        for (Reference e : element.getInsurance()) 
58290          composeReference(null, e);
58291        closeArray();
58292      };
58293      if (element.hasNote()) {
58294        openArray("note");
58295        for (Annotation e : element.getNote()) 
58296          composeAnnotation(null, e);
58297        closeArray();
58298      };
58299      if (element.hasRelevantHistory()) {
58300        openArray("relevantHistory");
58301        for (Reference e : element.getRelevantHistory()) 
58302          composeReference(null, e);
58303        closeArray();
58304      };
58305      if (element.hasRestriction()) {
58306        composeTaskRestrictionComponent("restriction", element.getRestriction());
58307      }
58308      if (element.hasInput()) {
58309        openArray("input");
58310        for (Task.ParameterComponent e : element.getInput()) 
58311          composeParameterComponent(null, e);
58312        closeArray();
58313      };
58314      if (element.hasOutput()) {
58315        openArray("output");
58316        for (Task.TaskOutputComponent e : element.getOutput()) 
58317          composeTaskOutputComponent(null, e);
58318        closeArray();
58319      };
58320  }
58321
58322  protected void composeTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
58323    if (element != null) {
58324      open(name);
58325      composeTaskRestrictionComponentProperties(element);
58326      close();
58327    }
58328  }
58329
58330  protected void composeTaskRestrictionComponentProperties(Task.TaskRestrictionComponent element) throws IOException {
58331    composeBackboneElementProperties(element);
58332      if (element.hasRepetitionsElement()) {
58333        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
58334        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
58335      }
58336      if (element.hasPeriod()) {
58337        composePeriod("period", element.getPeriod());
58338      }
58339      if (element.hasRecipient()) {
58340        openArray("recipient");
58341        for (Reference e : element.getRecipient()) 
58342          composeReference(null, e);
58343        closeArray();
58344      };
58345  }
58346
58347  protected void composeParameterComponent(String name, Task.ParameterComponent element) throws IOException {
58348    if (element != null) {
58349      open(name);
58350      composeParameterComponentProperties(element);
58351      close();
58352    }
58353  }
58354
58355  protected void composeParameterComponentProperties(Task.ParameterComponent element) throws IOException {
58356    composeBackboneElementProperties(element);
58357      if (element.hasType()) {
58358        composeCodeableConcept("type", element.getType());
58359      }
58360      if (element.hasValue()) {
58361        composeType("value", element.getValue());
58362      }
58363  }
58364
58365  protected void composeTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
58366    if (element != null) {
58367      open(name);
58368      composeTaskOutputComponentProperties(element);
58369      close();
58370    }
58371  }
58372
58373  protected void composeTaskOutputComponentProperties(Task.TaskOutputComponent element) throws IOException {
58374    composeBackboneElementProperties(element);
58375      if (element.hasType()) {
58376        composeCodeableConcept("type", element.getType());
58377      }
58378      if (element.hasValue()) {
58379        composeType("value", element.getValue());
58380      }
58381  }
58382
58383  protected void composeTerminologyCapabilities(String name, TerminologyCapabilities element) throws IOException {
58384    if (element != null) {
58385      prop("resourceType", name);
58386      composeTerminologyCapabilitiesProperties(element);
58387    }
58388  }
58389
58390  protected void composeTerminologyCapabilitiesProperties(TerminologyCapabilities element) throws IOException {
58391    composeCanonicalResourceProperties(element);
58392      if (element.hasUrlElement()) {
58393        composeUriCore("url", element.getUrlElement(), false);
58394        composeUriExtras("url", element.getUrlElement(), false);
58395      }
58396      if (element.hasVersionElement()) {
58397        composeStringCore("version", element.getVersionElement(), false);
58398        composeStringExtras("version", element.getVersionElement(), false);
58399      }
58400      if (element.hasNameElement()) {
58401        composeStringCore("name", element.getNameElement(), false);
58402        composeStringExtras("name", element.getNameElement(), false);
58403      }
58404      if (element.hasTitleElement()) {
58405        composeStringCore("title", element.getTitleElement(), false);
58406        composeStringExtras("title", element.getTitleElement(), false);
58407      }
58408      if (element.hasStatusElement()) {
58409        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58410        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58411      }
58412      if (element.hasExperimentalElement()) {
58413        composeBooleanCore("experimental", element.getExperimentalElement(), false);
58414        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
58415      }
58416      if (element.hasDateElement()) {
58417        composeDateTimeCore("date", element.getDateElement(), false);
58418        composeDateTimeExtras("date", element.getDateElement(), false);
58419      }
58420      if (element.hasPublisherElement()) {
58421        composeStringCore("publisher", element.getPublisherElement(), false);
58422        composeStringExtras("publisher", element.getPublisherElement(), false);
58423      }
58424      if (element.hasContact()) {
58425        openArray("contact");
58426        for (ContactDetail e : element.getContact()) 
58427          composeContactDetail(null, e);
58428        closeArray();
58429      };
58430      if (element.hasDescriptionElement()) {
58431        composeMarkdownCore("description", element.getDescriptionElement(), false);
58432        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58433      }
58434      if (element.hasUseContext()) {
58435        openArray("useContext");
58436        for (UsageContext e : element.getUseContext()) 
58437          composeUsageContext(null, e);
58438        closeArray();
58439      };
58440      if (element.hasJurisdiction()) {
58441        openArray("jurisdiction");
58442        for (CodeableConcept e : element.getJurisdiction()) 
58443          composeCodeableConcept(null, e);
58444        closeArray();
58445      };
58446      if (element.hasPurposeElement()) {
58447        composeMarkdownCore("purpose", element.getPurposeElement(), false);
58448        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
58449      }
58450      if (element.hasCopyrightElement()) {
58451        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
58452        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
58453      }
58454      if (element.hasKindElement()) {
58455        composeEnumerationCore("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
58456        composeEnumerationExtras("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory(), false);
58457      }
58458      if (element.hasSoftware()) {
58459        composeTerminologyCapabilitiesSoftwareComponent("software", element.getSoftware());
58460      }
58461      if (element.hasImplementation()) {
58462        composeTerminologyCapabilitiesImplementationComponent("implementation", element.getImplementation());
58463      }
58464      if (element.hasLockedDateElement()) {
58465        composeBooleanCore("lockedDate", element.getLockedDateElement(), false);
58466        composeBooleanExtras("lockedDate", element.getLockedDateElement(), false);
58467      }
58468      if (element.hasCodeSystem()) {
58469        openArray("codeSystem");
58470        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent e : element.getCodeSystem()) 
58471          composeTerminologyCapabilitiesCodeSystemComponent(null, e);
58472        closeArray();
58473      };
58474      if (element.hasExpansion()) {
58475        composeTerminologyCapabilitiesExpansionComponent("expansion", element.getExpansion());
58476      }
58477      if (element.hasCodeSearchElement()) {
58478        composeEnumerationCore("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
58479        composeEnumerationExtras("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
58480      }
58481      if (element.hasValidateCode()) {
58482        composeTerminologyCapabilitiesValidateCodeComponent("validateCode", element.getValidateCode());
58483      }
58484      if (element.hasTranslation()) {
58485        composeTerminologyCapabilitiesTranslationComponent("translation", element.getTranslation());
58486      }
58487      if (element.hasClosure()) {
58488        composeTerminologyCapabilitiesClosureComponent("closure", element.getClosure());
58489      }
58490  }
58491
58492  protected void composeTerminologyCapabilitiesSoftwareComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
58493    if (element != null) {
58494      open(name);
58495      composeTerminologyCapabilitiesSoftwareComponentProperties(element);
58496      close();
58497    }
58498  }
58499
58500  protected void composeTerminologyCapabilitiesSoftwareComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
58501    composeBackboneElementProperties(element);
58502      if (element.hasNameElement()) {
58503        composeStringCore("name", element.getNameElement(), false);
58504        composeStringExtras("name", element.getNameElement(), false);
58505      }
58506      if (element.hasVersionElement()) {
58507        composeStringCore("version", element.getVersionElement(), false);
58508        composeStringExtras("version", element.getVersionElement(), false);
58509      }
58510  }
58511
58512  protected void composeTerminologyCapabilitiesImplementationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
58513    if (element != null) {
58514      open(name);
58515      composeTerminologyCapabilitiesImplementationComponentProperties(element);
58516      close();
58517    }
58518  }
58519
58520  protected void composeTerminologyCapabilitiesImplementationComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
58521    composeBackboneElementProperties(element);
58522      if (element.hasDescriptionElement()) {
58523        composeStringCore("description", element.getDescriptionElement(), false);
58524        composeStringExtras("description", element.getDescriptionElement(), false);
58525      }
58526      if (element.hasUrlElement()) {
58527        composeUrlCore("url", element.getUrlElement(), false);
58528        composeUrlExtras("url", element.getUrlElement(), false);
58529      }
58530  }
58531
58532  protected void composeTerminologyCapabilitiesCodeSystemComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
58533    if (element != null) {
58534      open(name);
58535      composeTerminologyCapabilitiesCodeSystemComponentProperties(element);
58536      close();
58537    }
58538  }
58539
58540  protected void composeTerminologyCapabilitiesCodeSystemComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
58541    composeBackboneElementProperties(element);
58542      if (element.hasUriElement()) {
58543        composeCanonicalCore("uri", element.getUriElement(), false);
58544        composeCanonicalExtras("uri", element.getUriElement(), false);
58545      }
58546      if (element.hasVersion()) {
58547        openArray("version");
58548        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent e : element.getVersion()) 
58549          composeTerminologyCapabilitiesCodeSystemVersionComponent(null, e);
58550        closeArray();
58551      };
58552      if (element.hasSubsumptionElement()) {
58553        composeBooleanCore("subsumption", element.getSubsumptionElement(), false);
58554        composeBooleanExtras("subsumption", element.getSubsumptionElement(), false);
58555      }
58556  }
58557
58558  protected void composeTerminologyCapabilitiesCodeSystemVersionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
58559    if (element != null) {
58560      open(name);
58561      composeTerminologyCapabilitiesCodeSystemVersionComponentProperties(element);
58562      close();
58563    }
58564  }
58565
58566  protected void composeTerminologyCapabilitiesCodeSystemVersionComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
58567    composeBackboneElementProperties(element);
58568      if (element.hasCodeElement()) {
58569        composeStringCore("code", element.getCodeElement(), false);
58570        composeStringExtras("code", element.getCodeElement(), false);
58571      }
58572      if (element.hasIsDefaultElement()) {
58573        composeBooleanCore("isDefault", element.getIsDefaultElement(), false);
58574        composeBooleanExtras("isDefault", element.getIsDefaultElement(), false);
58575      }
58576      if (element.hasCompositionalElement()) {
58577        composeBooleanCore("compositional", element.getCompositionalElement(), false);
58578        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
58579      }
58580      if (element.hasLanguage()) {
58581        openArray("language");
58582        for (CodeType e : element.getLanguage()) 
58583          composeCodeCore(null, e, true);
58584        closeArray();
58585        if (anyHasExtras(element.getLanguage())) {
58586          openArray("_language");
58587          for (CodeType e : element.getLanguage()) 
58588            composeCodeExtras(null, e, true);
58589          closeArray();
58590        }
58591      };
58592      if (element.hasFilter()) {
58593        openArray("filter");
58594        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent e : element.getFilter()) 
58595          composeTerminologyCapabilitiesCodeSystemVersionFilterComponent(null, e);
58596        closeArray();
58597      };
58598      if (element.hasProperty()) {
58599        openArray("property");
58600        for (CodeType e : element.getProperty()) 
58601          composeCodeCore(null, e, true);
58602        closeArray();
58603        if (anyHasExtras(element.getProperty())) {
58604          openArray("_property");
58605          for (CodeType e : element.getProperty()) 
58606            composeCodeExtras(null, e, true);
58607          closeArray();
58608        }
58609      };
58610  }
58611
58612  protected void composeTerminologyCapabilitiesCodeSystemVersionFilterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
58613    if (element != null) {
58614      open(name);
58615      composeTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(element);
58616      close();
58617    }
58618  }
58619
58620  protected void composeTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
58621    composeBackboneElementProperties(element);
58622      if (element.hasCodeElement()) {
58623        composeCodeCore("code", element.getCodeElement(), false);
58624        composeCodeExtras("code", element.getCodeElement(), false);
58625      }
58626      if (element.hasOp()) {
58627        openArray("op");
58628        for (CodeType e : element.getOp()) 
58629          composeCodeCore(null, e, true);
58630        closeArray();
58631        if (anyHasExtras(element.getOp())) {
58632          openArray("_op");
58633          for (CodeType e : element.getOp()) 
58634            composeCodeExtras(null, e, true);
58635          closeArray();
58636        }
58637      };
58638  }
58639
58640  protected void composeTerminologyCapabilitiesExpansionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
58641    if (element != null) {
58642      open(name);
58643      composeTerminologyCapabilitiesExpansionComponentProperties(element);
58644      close();
58645    }
58646  }
58647
58648  protected void composeTerminologyCapabilitiesExpansionComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
58649    composeBackboneElementProperties(element);
58650      if (element.hasHierarchicalElement()) {
58651        composeBooleanCore("hierarchical", element.getHierarchicalElement(), false);
58652        composeBooleanExtras("hierarchical", element.getHierarchicalElement(), false);
58653      }
58654      if (element.hasPagingElement()) {
58655        composeBooleanCore("paging", element.getPagingElement(), false);
58656        composeBooleanExtras("paging", element.getPagingElement(), false);
58657      }
58658      if (element.hasIncompleteElement()) {
58659        composeBooleanCore("incomplete", element.getIncompleteElement(), false);
58660        composeBooleanExtras("incomplete", element.getIncompleteElement(), false);
58661      }
58662      if (element.hasParameter()) {
58663        openArray("parameter");
58664        for (TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent e : element.getParameter()) 
58665          composeTerminologyCapabilitiesExpansionParameterComponent(null, e);
58666        closeArray();
58667      };
58668      if (element.hasTextFilterElement()) {
58669        composeMarkdownCore("textFilter", element.getTextFilterElement(), false);
58670        composeMarkdownExtras("textFilter", element.getTextFilterElement(), false);
58671      }
58672  }
58673
58674  protected void composeTerminologyCapabilitiesExpansionParameterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
58675    if (element != null) {
58676      open(name);
58677      composeTerminologyCapabilitiesExpansionParameterComponentProperties(element);
58678      close();
58679    }
58680  }
58681
58682  protected void composeTerminologyCapabilitiesExpansionParameterComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
58683    composeBackboneElementProperties(element);
58684      if (element.hasNameElement()) {
58685        composeCodeCore("name", element.getNameElement(), false);
58686        composeCodeExtras("name", element.getNameElement(), false);
58687      }
58688      if (element.hasDocumentationElement()) {
58689        composeStringCore("documentation", element.getDocumentationElement(), false);
58690        composeStringExtras("documentation", element.getDocumentationElement(), false);
58691      }
58692  }
58693
58694  protected void composeTerminologyCapabilitiesValidateCodeComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
58695    if (element != null) {
58696      open(name);
58697      composeTerminologyCapabilitiesValidateCodeComponentProperties(element);
58698      close();
58699    }
58700  }
58701
58702  protected void composeTerminologyCapabilitiesValidateCodeComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
58703    composeBackboneElementProperties(element);
58704      if (element.hasTranslationsElement()) {
58705        composeBooleanCore("translations", element.getTranslationsElement(), false);
58706        composeBooleanExtras("translations", element.getTranslationsElement(), false);
58707      }
58708  }
58709
58710  protected void composeTerminologyCapabilitiesTranslationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
58711    if (element != null) {
58712      open(name);
58713      composeTerminologyCapabilitiesTranslationComponentProperties(element);
58714      close();
58715    }
58716  }
58717
58718  protected void composeTerminologyCapabilitiesTranslationComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
58719    composeBackboneElementProperties(element);
58720      if (element.hasNeedsMapElement()) {
58721        composeBooleanCore("needsMap", element.getNeedsMapElement(), false);
58722        composeBooleanExtras("needsMap", element.getNeedsMapElement(), false);
58723      }
58724  }
58725
58726  protected void composeTerminologyCapabilitiesClosureComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
58727    if (element != null) {
58728      open(name);
58729      composeTerminologyCapabilitiesClosureComponentProperties(element);
58730      close();
58731    }
58732  }
58733
58734  protected void composeTerminologyCapabilitiesClosureComponentProperties(TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
58735    composeBackboneElementProperties(element);
58736      if (element.hasTranslationElement()) {
58737        composeBooleanCore("translation", element.getTranslationElement(), false);
58738        composeBooleanExtras("translation", element.getTranslationElement(), false);
58739      }
58740  }
58741
58742  protected void composeTestReport(String name, TestReport element) throws IOException {
58743    if (element != null) {
58744      prop("resourceType", name);
58745      composeTestReportProperties(element);
58746    }
58747  }
58748
58749  protected void composeTestReportProperties(TestReport element) throws IOException {
58750    composeDomainResourceProperties(element);
58751      if (element.hasIdentifier()) {
58752        composeIdentifier("identifier", element.getIdentifier());
58753      }
58754      if (element.hasNameElement()) {
58755        composeStringCore("name", element.getNameElement(), false);
58756        composeStringExtras("name", element.getNameElement(), false);
58757      }
58758      if (element.hasStatusElement()) {
58759        composeEnumerationCore("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
58760        composeEnumerationExtras("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
58761      }
58762      if (element.hasTestScript()) {
58763        composeReference("testScript", element.getTestScript());
58764      }
58765      if (element.hasResultElement()) {
58766        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
58767        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
58768      }
58769      if (element.hasScoreElement()) {
58770        composeDecimalCore("score", element.getScoreElement(), false);
58771        composeDecimalExtras("score", element.getScoreElement(), false);
58772      }
58773      if (element.hasTesterElement()) {
58774        composeStringCore("tester", element.getTesterElement(), false);
58775        composeStringExtras("tester", element.getTesterElement(), false);
58776      }
58777      if (element.hasIssuedElement()) {
58778        composeDateTimeCore("issued", element.getIssuedElement(), false);
58779        composeDateTimeExtras("issued", element.getIssuedElement(), false);
58780      }
58781      if (element.hasParticipant()) {
58782        openArray("participant");
58783        for (TestReport.TestReportParticipantComponent e : element.getParticipant()) 
58784          composeTestReportParticipantComponent(null, e);
58785        closeArray();
58786      };
58787      if (element.hasSetup()) {
58788        composeTestReportSetupComponent("setup", element.getSetup());
58789      }
58790      if (element.hasTest()) {
58791        openArray("test");
58792        for (TestReport.TestReportTestComponent e : element.getTest()) 
58793          composeTestReportTestComponent(null, e);
58794        closeArray();
58795      };
58796      if (element.hasTeardown()) {
58797        composeTestReportTeardownComponent("teardown", element.getTeardown());
58798      }
58799  }
58800
58801  protected void composeTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
58802    if (element != null) {
58803      open(name);
58804      composeTestReportParticipantComponentProperties(element);
58805      close();
58806    }
58807  }
58808
58809  protected void composeTestReportParticipantComponentProperties(TestReport.TestReportParticipantComponent element) throws IOException {
58810    composeBackboneElementProperties(element);
58811      if (element.hasTypeElement()) {
58812        composeEnumerationCore("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
58813        composeEnumerationExtras("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
58814      }
58815      if (element.hasUriElement()) {
58816        composeUriCore("uri", element.getUriElement(), false);
58817        composeUriExtras("uri", element.getUriElement(), false);
58818      }
58819      if (element.hasDisplayElement()) {
58820        composeStringCore("display", element.getDisplayElement(), false);
58821        composeStringExtras("display", element.getDisplayElement(), false);
58822      }
58823  }
58824
58825  protected void composeTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
58826    if (element != null) {
58827      open(name);
58828      composeTestReportSetupComponentProperties(element);
58829      close();
58830    }
58831  }
58832
58833  protected void composeTestReportSetupComponentProperties(TestReport.TestReportSetupComponent element) throws IOException {
58834    composeBackboneElementProperties(element);
58835      if (element.hasAction()) {
58836        openArray("action");
58837        for (TestReport.SetupActionComponent e : element.getAction()) 
58838          composeSetupActionComponent(null, e);
58839        closeArray();
58840      };
58841  }
58842
58843  protected void composeSetupActionComponent(String name, TestReport.SetupActionComponent element) throws IOException {
58844    if (element != null) {
58845      open(name);
58846      composeSetupActionComponentProperties(element);
58847      close();
58848    }
58849  }
58850
58851  protected void composeSetupActionComponentProperties(TestReport.SetupActionComponent element) throws IOException {
58852    composeBackboneElementProperties(element);
58853      if (element.hasOperation()) {
58854        composeSetupActionOperationComponent("operation", element.getOperation());
58855      }
58856      if (element.hasAssert()) {
58857        composeSetupActionAssertComponent("assert", element.getAssert());
58858      }
58859  }
58860
58861  protected void composeSetupActionOperationComponent(String name, TestReport.SetupActionOperationComponent element) throws IOException {
58862    if (element != null) {
58863      open(name);
58864      composeSetupActionOperationComponentProperties(element);
58865      close();
58866    }
58867  }
58868
58869  protected void composeSetupActionOperationComponentProperties(TestReport.SetupActionOperationComponent element) throws IOException {
58870    composeBackboneElementProperties(element);
58871      if (element.hasResultElement()) {
58872        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
58873        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
58874      }
58875      if (element.hasMessageElement()) {
58876        composeMarkdownCore("message", element.getMessageElement(), false);
58877        composeMarkdownExtras("message", element.getMessageElement(), false);
58878      }
58879      if (element.hasDetailElement()) {
58880        composeUriCore("detail", element.getDetailElement(), false);
58881        composeUriExtras("detail", element.getDetailElement(), false);
58882      }
58883  }
58884
58885  protected void composeSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element) throws IOException {
58886    if (element != null) {
58887      open(name);
58888      composeSetupActionAssertComponentProperties(element);
58889      close();
58890    }
58891  }
58892
58893  protected void composeSetupActionAssertComponentProperties(TestReport.SetupActionAssertComponent element) throws IOException {
58894    composeBackboneElementProperties(element);
58895      if (element.hasResultElement()) {
58896        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
58897        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
58898      }
58899      if (element.hasMessageElement()) {
58900        composeMarkdownCore("message", element.getMessageElement(), false);
58901        composeMarkdownExtras("message", element.getMessageElement(), false);
58902      }
58903      if (element.hasDetailElement()) {
58904        composeStringCore("detail", element.getDetailElement(), false);
58905        composeStringExtras("detail", element.getDetailElement(), false);
58906      }
58907  }
58908
58909  protected void composeTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
58910    if (element != null) {
58911      open(name);
58912      composeTestReportTestComponentProperties(element);
58913      close();
58914    }
58915  }
58916
58917  protected void composeTestReportTestComponentProperties(TestReport.TestReportTestComponent element) throws IOException {
58918    composeBackboneElementProperties(element);
58919      if (element.hasNameElement()) {
58920        composeStringCore("name", element.getNameElement(), false);
58921        composeStringExtras("name", element.getNameElement(), false);
58922      }
58923      if (element.hasDescriptionElement()) {
58924        composeStringCore("description", element.getDescriptionElement(), false);
58925        composeStringExtras("description", element.getDescriptionElement(), false);
58926      }
58927      if (element.hasAction()) {
58928        openArray("action");
58929        for (TestReport.TestActionComponent e : element.getAction()) 
58930          composeTestActionComponent(null, e);
58931        closeArray();
58932      };
58933  }
58934
58935  protected void composeTestActionComponent(String name, TestReport.TestActionComponent element) throws IOException {
58936    if (element != null) {
58937      open(name);
58938      composeTestActionComponentProperties(element);
58939      close();
58940    }
58941  }
58942
58943  protected void composeTestActionComponentProperties(TestReport.TestActionComponent element) throws IOException {
58944    composeBackboneElementProperties(element);
58945      if (element.hasOperation()) {
58946        composeSetupActionOperationComponent("operation", element.getOperation());
58947      }
58948      if (element.hasAssert()) {
58949        composeSetupActionAssertComponent("assert", element.getAssert());
58950      }
58951  }
58952
58953  protected void composeTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
58954    if (element != null) {
58955      open(name);
58956      composeTestReportTeardownComponentProperties(element);
58957      close();
58958    }
58959  }
58960
58961  protected void composeTestReportTeardownComponentProperties(TestReport.TestReportTeardownComponent element) throws IOException {
58962    composeBackboneElementProperties(element);
58963      if (element.hasAction()) {
58964        openArray("action");
58965        for (TestReport.TeardownActionComponent e : element.getAction()) 
58966          composeTeardownActionComponent(null, e);
58967        closeArray();
58968      };
58969  }
58970
58971  protected void composeTeardownActionComponent(String name, TestReport.TeardownActionComponent element) throws IOException {
58972    if (element != null) {
58973      open(name);
58974      composeTeardownActionComponentProperties(element);
58975      close();
58976    }
58977  }
58978
58979  protected void composeTeardownActionComponentProperties(TestReport.TeardownActionComponent element) throws IOException {
58980    composeBackboneElementProperties(element);
58981      if (element.hasOperation()) {
58982        composeSetupActionOperationComponent("operation", element.getOperation());
58983      }
58984  }
58985
58986  protected void composeTestScript(String name, TestScript element) throws IOException {
58987    if (element != null) {
58988      prop("resourceType", name);
58989      composeTestScriptProperties(element);
58990    }
58991  }
58992
58993  protected void composeTestScriptProperties(TestScript element) throws IOException {
58994    composeCanonicalResourceProperties(element);
58995      if (element.hasUrlElement()) {
58996        composeUriCore("url", element.getUrlElement(), false);
58997        composeUriExtras("url", element.getUrlElement(), false);
58998      }
58999      if (element.hasIdentifier()) {
59000        composeIdentifier("identifier", element.getIdentifierFirstRep());
59001      }
59002      if (element.hasVersionElement()) {
59003        composeStringCore("version", element.getVersionElement(), false);
59004        composeStringExtras("version", element.getVersionElement(), false);
59005      }
59006      if (element.hasNameElement()) {
59007        composeStringCore("name", element.getNameElement(), false);
59008        composeStringExtras("name", element.getNameElement(), false);
59009      }
59010      if (element.hasTitleElement()) {
59011        composeStringCore("title", element.getTitleElement(), false);
59012        composeStringExtras("title", element.getTitleElement(), false);
59013      }
59014      if (element.hasStatusElement()) {
59015        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
59016        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
59017      }
59018      if (element.hasExperimentalElement()) {
59019        composeBooleanCore("experimental", element.getExperimentalElement(), false);
59020        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
59021      }
59022      if (element.hasDateElement()) {
59023        composeDateTimeCore("date", element.getDateElement(), false);
59024        composeDateTimeExtras("date", element.getDateElement(), false);
59025      }
59026      if (element.hasPublisherElement()) {
59027        composeStringCore("publisher", element.getPublisherElement(), false);
59028        composeStringExtras("publisher", element.getPublisherElement(), false);
59029      }
59030      if (element.hasContact()) {
59031        openArray("contact");
59032        for (ContactDetail e : element.getContact()) 
59033          composeContactDetail(null, e);
59034        closeArray();
59035      };
59036      if (element.hasDescriptionElement()) {
59037        composeMarkdownCore("description", element.getDescriptionElement(), false);
59038        composeMarkdownExtras("description", element.getDescriptionElement(), false);
59039      }
59040      if (element.hasUseContext()) {
59041        openArray("useContext");
59042        for (UsageContext e : element.getUseContext()) 
59043          composeUsageContext(null, e);
59044        closeArray();
59045      };
59046      if (element.hasJurisdiction()) {
59047        openArray("jurisdiction");
59048        for (CodeableConcept e : element.getJurisdiction()) 
59049          composeCodeableConcept(null, e);
59050        closeArray();
59051      };
59052      if (element.hasPurposeElement()) {
59053        composeMarkdownCore("purpose", element.getPurposeElement(), false);
59054        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
59055      }
59056      if (element.hasCopyrightElement()) {
59057        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
59058        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
59059      }
59060      if (element.hasOrigin()) {
59061        openArray("origin");
59062        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
59063          composeTestScriptOriginComponent(null, e);
59064        closeArray();
59065      };
59066      if (element.hasDestination()) {
59067        openArray("destination");
59068        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
59069          composeTestScriptDestinationComponent(null, e);
59070        closeArray();
59071      };
59072      if (element.hasMetadata()) {
59073        composeTestScriptMetadataComponent("metadata", element.getMetadata());
59074      }
59075      if (element.hasFixture()) {
59076        openArray("fixture");
59077        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
59078          composeTestScriptFixtureComponent(null, e);
59079        closeArray();
59080      };
59081      if (element.hasProfile()) {
59082        openArray("profile");
59083        for (Reference e : element.getProfile()) 
59084          composeReference(null, e);
59085        closeArray();
59086      };
59087      if (element.hasVariable()) {
59088        openArray("variable");
59089        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
59090          composeTestScriptVariableComponent(null, e);
59091        closeArray();
59092      };
59093      if (element.hasSetup()) {
59094        composeTestScriptSetupComponent("setup", element.getSetup());
59095      }
59096      if (element.hasTest()) {
59097        openArray("test");
59098        for (TestScript.TestScriptTestComponent e : element.getTest()) 
59099          composeTestScriptTestComponent(null, e);
59100        closeArray();
59101      };
59102      if (element.hasTeardown()) {
59103        composeTestScriptTeardownComponent("teardown", element.getTeardown());
59104      }
59105  }
59106
59107  protected void composeTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
59108    if (element != null) {
59109      open(name);
59110      composeTestScriptOriginComponentProperties(element);
59111      close();
59112    }
59113  }
59114
59115  protected void composeTestScriptOriginComponentProperties(TestScript.TestScriptOriginComponent element) throws IOException {
59116    composeBackboneElementProperties(element);
59117      if (element.hasIndexElement()) {
59118        composeIntegerCore("index", element.getIndexElement(), false);
59119        composeIntegerExtras("index", element.getIndexElement(), false);
59120      }
59121      if (element.hasProfile()) {
59122        composeCoding("profile", element.getProfile());
59123      }
59124  }
59125
59126  protected void composeTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
59127    if (element != null) {
59128      open(name);
59129      composeTestScriptDestinationComponentProperties(element);
59130      close();
59131    }
59132  }
59133
59134  protected void composeTestScriptDestinationComponentProperties(TestScript.TestScriptDestinationComponent element) throws IOException {
59135    composeBackboneElementProperties(element);
59136      if (element.hasIndexElement()) {
59137        composeIntegerCore("index", element.getIndexElement(), false);
59138        composeIntegerExtras("index", element.getIndexElement(), false);
59139      }
59140      if (element.hasProfile()) {
59141        composeCoding("profile", element.getProfile());
59142      }
59143  }
59144
59145  protected void composeTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
59146    if (element != null) {
59147      open(name);
59148      composeTestScriptMetadataComponentProperties(element);
59149      close();
59150    }
59151  }
59152
59153  protected void composeTestScriptMetadataComponentProperties(TestScript.TestScriptMetadataComponent element) throws IOException {
59154    composeBackboneElementProperties(element);
59155      if (element.hasLink()) {
59156        openArray("link");
59157        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
59158          composeTestScriptMetadataLinkComponent(null, e);
59159        closeArray();
59160      };
59161      if (element.hasCapability()) {
59162        openArray("capability");
59163        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
59164          composeTestScriptMetadataCapabilityComponent(null, e);
59165        closeArray();
59166      };
59167  }
59168
59169  protected void composeTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
59170    if (element != null) {
59171      open(name);
59172      composeTestScriptMetadataLinkComponentProperties(element);
59173      close();
59174    }
59175  }
59176
59177  protected void composeTestScriptMetadataLinkComponentProperties(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
59178    composeBackboneElementProperties(element);
59179      if (element.hasUrlElement()) {
59180        composeUriCore("url", element.getUrlElement(), false);
59181        composeUriExtras("url", element.getUrlElement(), false);
59182      }
59183      if (element.hasDescriptionElement()) {
59184        composeStringCore("description", element.getDescriptionElement(), false);
59185        composeStringExtras("description", element.getDescriptionElement(), false);
59186      }
59187  }
59188
59189  protected void composeTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
59190    if (element != null) {
59191      open(name);
59192      composeTestScriptMetadataCapabilityComponentProperties(element);
59193      close();
59194    }
59195  }
59196
59197  protected void composeTestScriptMetadataCapabilityComponentProperties(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
59198    composeBackboneElementProperties(element);
59199      if (element.hasRequiredElement()) {
59200        composeBooleanCore("required", element.getRequiredElement(), false);
59201        composeBooleanExtras("required", element.getRequiredElement(), false);
59202      }
59203      if (element.hasValidatedElement()) {
59204        composeBooleanCore("validated", element.getValidatedElement(), false);
59205        composeBooleanExtras("validated", element.getValidatedElement(), false);
59206      }
59207      if (element.hasDescriptionElement()) {
59208        composeStringCore("description", element.getDescriptionElement(), false);
59209        composeStringExtras("description", element.getDescriptionElement(), false);
59210      }
59211      if (element.hasOrigin()) {
59212        openArray("origin");
59213        for (IntegerType e : element.getOrigin()) 
59214          composeIntegerCore(null, e, true);
59215        closeArray();
59216        if (anyHasExtras(element.getOrigin())) {
59217          openArray("_origin");
59218          for (IntegerType e : element.getOrigin()) 
59219            composeIntegerExtras(null, e, true);
59220          closeArray();
59221        }
59222      };
59223      if (element.hasDestinationElement()) {
59224        composeIntegerCore("destination", element.getDestinationElement(), false);
59225        composeIntegerExtras("destination", element.getDestinationElement(), false);
59226      }
59227      if (element.hasLink()) {
59228        openArray("link");
59229        for (UriType e : element.getLink()) 
59230          composeUriCore(null, e, true);
59231        closeArray();
59232        if (anyHasExtras(element.getLink())) {
59233          openArray("_link");
59234          for (UriType e : element.getLink()) 
59235            composeUriExtras(null, e, true);
59236          closeArray();
59237        }
59238      };
59239      if (element.hasCapabilitiesElement()) {
59240        composeCanonicalCore("capabilities", element.getCapabilitiesElement(), false);
59241        composeCanonicalExtras("capabilities", element.getCapabilitiesElement(), false);
59242      }
59243  }
59244
59245  protected void composeTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
59246    if (element != null) {
59247      open(name);
59248      composeTestScriptFixtureComponentProperties(element);
59249      close();
59250    }
59251  }
59252
59253  protected void composeTestScriptFixtureComponentProperties(TestScript.TestScriptFixtureComponent element) throws IOException {
59254    composeBackboneElementProperties(element);
59255      if (element.hasAutocreateElement()) {
59256        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
59257        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
59258      }
59259      if (element.hasAutodeleteElement()) {
59260        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
59261        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
59262      }
59263      if (element.hasResource()) {
59264        composeReference("resource", element.getResource());
59265      }
59266  }
59267
59268  protected void composeTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
59269    if (element != null) {
59270      open(name);
59271      composeTestScriptVariableComponentProperties(element);
59272      close();
59273    }
59274  }
59275
59276  protected void composeTestScriptVariableComponentProperties(TestScript.TestScriptVariableComponent element) throws IOException {
59277    composeBackboneElementProperties(element);
59278      if (element.hasNameElement()) {
59279        composeStringCore("name", element.getNameElement(), false);
59280        composeStringExtras("name", element.getNameElement(), false);
59281      }
59282      if (element.hasDefaultValueElement()) {
59283        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
59284        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
59285      }
59286      if (element.hasDescriptionElement()) {
59287        composeStringCore("description", element.getDescriptionElement(), false);
59288        composeStringExtras("description", element.getDescriptionElement(), false);
59289      }
59290      if (element.hasExpressionElement()) {
59291        composeStringCore("expression", element.getExpressionElement(), false);
59292        composeStringExtras("expression", element.getExpressionElement(), false);
59293      }
59294      if (element.hasHeaderFieldElement()) {
59295        composeStringCore("headerField", element.getHeaderFieldElement(), false);
59296        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
59297      }
59298      if (element.hasHintElement()) {
59299        composeStringCore("hint", element.getHintElement(), false);
59300        composeStringExtras("hint", element.getHintElement(), false);
59301      }
59302      if (element.hasPathElement()) {
59303        composeStringCore("path", element.getPathElement(), false);
59304        composeStringExtras("path", element.getPathElement(), false);
59305      }
59306      if (element.hasSourceIdElement()) {
59307        composeIdCore("sourceId", element.getSourceIdElement(), false);
59308        composeIdExtras("sourceId", element.getSourceIdElement(), false);
59309      }
59310  }
59311
59312  protected void composeTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
59313    if (element != null) {
59314      open(name);
59315      composeTestScriptSetupComponentProperties(element);
59316      close();
59317    }
59318  }
59319
59320  protected void composeTestScriptSetupComponentProperties(TestScript.TestScriptSetupComponent element) throws IOException {
59321    composeBackboneElementProperties(element);
59322      if (element.hasAction()) {
59323        openArray("action");
59324        for (TestScript.SetupActionComponent e : element.getAction()) 
59325          composeSetupActionComponent(null, e);
59326        closeArray();
59327      };
59328  }
59329
59330  protected void composeSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
59331    if (element != null) {
59332      open(name);
59333      composeSetupActionComponentProperties(element);
59334      close();
59335    }
59336  }
59337
59338  protected void composeSetupActionComponentProperties(TestScript.SetupActionComponent element) throws IOException {
59339    composeBackboneElementProperties(element);
59340      if (element.hasOperation()) {
59341        composeSetupActionOperationComponent("operation", element.getOperation());
59342      }
59343      if (element.hasAssert()) {
59344        composeSetupActionAssertComponent("assert", element.getAssert());
59345      }
59346  }
59347
59348  protected void composeSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
59349    if (element != null) {
59350      open(name);
59351      composeSetupActionOperationComponentProperties(element);
59352      close();
59353    }
59354  }
59355
59356  protected void composeSetupActionOperationComponentProperties(TestScript.SetupActionOperationComponent element) throws IOException {
59357    composeBackboneElementProperties(element);
59358      if (element.hasType()) {
59359        composeCoding("type", element.getType());
59360      }
59361      if (element.hasResourceElement()) {
59362        composeEnumerationCore("resource", element.getResourceElement(), new TestScript.FHIRDefinedTypeEnumFactory(), false);
59363        composeEnumerationExtras("resource", element.getResourceElement(), new TestScript.FHIRDefinedTypeEnumFactory(), false);
59364      }
59365      if (element.hasLabelElement()) {
59366        composeStringCore("label", element.getLabelElement(), false);
59367        composeStringExtras("label", element.getLabelElement(), false);
59368      }
59369      if (element.hasDescriptionElement()) {
59370        composeStringCore("description", element.getDescriptionElement(), false);
59371        composeStringExtras("description", element.getDescriptionElement(), false);
59372      }
59373      if (element.hasAcceptElement()) {
59374        composeCodeCore("accept", element.getAcceptElement(), false);
59375        composeCodeExtras("accept", element.getAcceptElement(), false);
59376      }
59377      if (element.hasContentTypeElement()) {
59378        composeCodeCore("contentType", element.getContentTypeElement(), false);
59379        composeCodeExtras("contentType", element.getContentTypeElement(), false);
59380      }
59381      if (element.hasDestinationElement()) {
59382        composeIntegerCore("destination", element.getDestinationElement(), false);
59383        composeIntegerExtras("destination", element.getDestinationElement(), false);
59384      }
59385      if (element.hasEncodeRequestUrlElement()) {
59386        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
59387        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
59388      }
59389      if (element.hasMethodElement()) {
59390        composeEnumerationCore("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
59391        composeEnumerationExtras("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
59392      }
59393      if (element.hasOriginElement()) {
59394        composeIntegerCore("origin", element.getOriginElement(), false);
59395        composeIntegerExtras("origin", element.getOriginElement(), false);
59396      }
59397      if (element.hasParamsElement()) {
59398        composeStringCore("params", element.getParamsElement(), false);
59399        composeStringExtras("params", element.getParamsElement(), false);
59400      }
59401      if (element.hasRequestHeader()) {
59402        openArray("requestHeader");
59403        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
59404          composeSetupActionOperationRequestHeaderComponent(null, e);
59405        closeArray();
59406      };
59407      if (element.hasRequestIdElement()) {
59408        composeIdCore("requestId", element.getRequestIdElement(), false);
59409        composeIdExtras("requestId", element.getRequestIdElement(), false);
59410      }
59411      if (element.hasResponseIdElement()) {
59412        composeIdCore("responseId", element.getResponseIdElement(), false);
59413        composeIdExtras("responseId", element.getResponseIdElement(), false);
59414      }
59415      if (element.hasSourceIdElement()) {
59416        composeIdCore("sourceId", element.getSourceIdElement(), false);
59417        composeIdExtras("sourceId", element.getSourceIdElement(), false);
59418      }
59419      if (element.hasTargetIdElement()) {
59420        composeIdCore("targetId", element.getTargetIdElement(), false);
59421        composeIdExtras("targetId", element.getTargetIdElement(), false);
59422      }
59423      if (element.hasUrlElement()) {
59424        composeStringCore("url", element.getUrlElement(), false);
59425        composeStringExtras("url", element.getUrlElement(), false);
59426      }
59427  }
59428
59429  protected void composeSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
59430    if (element != null) {
59431      open(name);
59432      composeSetupActionOperationRequestHeaderComponentProperties(element);
59433      close();
59434    }
59435  }
59436
59437  protected void composeSetupActionOperationRequestHeaderComponentProperties(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
59438    composeBackboneElementProperties(element);
59439      if (element.hasFieldElement()) {
59440        composeStringCore("field", element.getFieldElement(), false);
59441        composeStringExtras("field", element.getFieldElement(), false);
59442      }
59443      if (element.hasValueElement()) {
59444        composeStringCore("value", element.getValueElement(), false);
59445        composeStringExtras("value", element.getValueElement(), false);
59446      }
59447  }
59448
59449  protected void composeSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
59450    if (element != null) {
59451      open(name);
59452      composeSetupActionAssertComponentProperties(element);
59453      close();
59454    }
59455  }
59456
59457  protected void composeSetupActionAssertComponentProperties(TestScript.SetupActionAssertComponent element) throws IOException {
59458    composeBackboneElementProperties(element);
59459      if (element.hasLabelElement()) {
59460        composeStringCore("label", element.getLabelElement(), false);
59461        composeStringExtras("label", element.getLabelElement(), false);
59462      }
59463      if (element.hasDescriptionElement()) {
59464        composeStringCore("description", element.getDescriptionElement(), false);
59465        composeStringExtras("description", element.getDescriptionElement(), false);
59466      }
59467      if (element.hasDirectionElement()) {
59468        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
59469        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
59470      }
59471      if (element.hasCompareToSourceIdElement()) {
59472        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
59473        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
59474      }
59475      if (element.hasCompareToSourceExpressionElement()) {
59476        composeStringCore("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
59477        composeStringExtras("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
59478      }
59479      if (element.hasCompareToSourcePathElement()) {
59480        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
59481        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
59482      }
59483      if (element.hasContentTypeElement()) {
59484        composeCodeCore("contentType", element.getContentTypeElement(), false);
59485        composeCodeExtras("contentType", element.getContentTypeElement(), false);
59486      }
59487      if (element.hasExpressionElement()) {
59488        composeStringCore("expression", element.getExpressionElement(), false);
59489        composeStringExtras("expression", element.getExpressionElement(), false);
59490      }
59491      if (element.hasHeaderFieldElement()) {
59492        composeStringCore("headerField", element.getHeaderFieldElement(), false);
59493        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
59494      }
59495      if (element.hasMinimumIdElement()) {
59496        composeStringCore("minimumId", element.getMinimumIdElement(), false);
59497        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
59498      }
59499      if (element.hasNavigationLinksElement()) {
59500        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
59501        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
59502      }
59503      if (element.hasOperatorElement()) {
59504        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
59505        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
59506      }
59507      if (element.hasPathElement()) {
59508        composeStringCore("path", element.getPathElement(), false);
59509        composeStringExtras("path", element.getPathElement(), false);
59510      }
59511      if (element.hasRequestMethodElement()) {
59512        composeEnumerationCore("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
59513        composeEnumerationExtras("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
59514      }
59515      if (element.hasRequestURLElement()) {
59516        composeStringCore("requestURL", element.getRequestURLElement(), false);
59517        composeStringExtras("requestURL", element.getRequestURLElement(), false);
59518      }
59519      if (element.hasResourceElement()) {
59520        composeEnumerationCore("resource", element.getResourceElement(), new TestScript.FHIRDefinedTypeEnumFactory(), false);
59521        composeEnumerationExtras("resource", element.getResourceElement(), new TestScript.FHIRDefinedTypeEnumFactory(), false);
59522      }
59523      if (element.hasResponseElement()) {
59524        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
59525        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
59526      }
59527      if (element.hasResponseCodeElement()) {
59528        composeStringCore("responseCode", element.getResponseCodeElement(), false);
59529        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
59530      }
59531      if (element.hasSourceIdElement()) {
59532        composeIdCore("sourceId", element.getSourceIdElement(), false);
59533        composeIdExtras("sourceId", element.getSourceIdElement(), false);
59534      }
59535      if (element.hasValidateProfileIdElement()) {
59536        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
59537        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
59538      }
59539      if (element.hasValueElement()) {
59540        composeStringCore("value", element.getValueElement(), false);
59541        composeStringExtras("value", element.getValueElement(), false);
59542      }
59543      if (element.hasWarningOnlyElement()) {
59544        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
59545        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
59546      }
59547  }
59548
59549  protected void composeTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
59550    if (element != null) {
59551      open(name);
59552      composeTestScriptTestComponentProperties(element);
59553      close();
59554    }
59555  }
59556
59557  protected void composeTestScriptTestComponentProperties(TestScript.TestScriptTestComponent element) throws IOException {
59558    composeBackboneElementProperties(element);
59559      if (element.hasNameElement()) {
59560        composeStringCore("name", element.getNameElement(), false);
59561        composeStringExtras("name", element.getNameElement(), false);
59562      }
59563      if (element.hasDescriptionElement()) {
59564        composeStringCore("description", element.getDescriptionElement(), false);
59565        composeStringExtras("description", element.getDescriptionElement(), false);
59566      }
59567      if (element.hasAction()) {
59568        openArray("action");
59569        for (TestScript.TestActionComponent e : element.getAction()) 
59570          composeTestActionComponent(null, e);
59571        closeArray();
59572      };
59573  }
59574
59575  protected void composeTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
59576    if (element != null) {
59577      open(name);
59578      composeTestActionComponentProperties(element);
59579      close();
59580    }
59581  }
59582
59583  protected void composeTestActionComponentProperties(TestScript.TestActionComponent element) throws IOException {
59584    composeBackboneElementProperties(element);
59585      if (element.hasOperation()) {
59586        composeSetupActionOperationComponent("operation", element.getOperation());
59587      }
59588      if (element.hasAssert()) {
59589        composeSetupActionAssertComponent("assert", element.getAssert());
59590      }
59591  }
59592
59593  protected void composeTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
59594    if (element != null) {
59595      open(name);
59596      composeTestScriptTeardownComponentProperties(element);
59597      close();
59598    }
59599  }
59600
59601  protected void composeTestScriptTeardownComponentProperties(TestScript.TestScriptTeardownComponent element) throws IOException {
59602    composeBackboneElementProperties(element);
59603      if (element.hasAction()) {
59604        openArray("action");
59605        for (TestScript.TeardownActionComponent e : element.getAction()) 
59606          composeTeardownActionComponent(null, e);
59607        closeArray();
59608      };
59609  }
59610
59611  protected void composeTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
59612    if (element != null) {
59613      open(name);
59614      composeTeardownActionComponentProperties(element);
59615      close();
59616    }
59617  }
59618
59619  protected void composeTeardownActionComponentProperties(TestScript.TeardownActionComponent element) throws IOException {
59620    composeBackboneElementProperties(element);
59621      if (element.hasOperation()) {
59622        composeSetupActionOperationComponent("operation", element.getOperation());
59623      }
59624  }
59625
59626  protected void composeTopic(String name, Topic element) throws IOException {
59627    if (element != null) {
59628      prop("resourceType", name);
59629      composeTopicProperties(element);
59630    }
59631  }
59632
59633  protected void composeTopicProperties(Topic element) throws IOException {
59634    composeDomainResourceProperties(element);
59635      if (element.hasUrlElement()) {
59636        composeUriCore("url", element.getUrlElement(), false);
59637        composeUriExtras("url", element.getUrlElement(), false);
59638      }
59639      if (element.hasIdentifier()) {
59640        openArray("identifier");
59641        for (Identifier e : element.getIdentifier()) 
59642          composeIdentifier(null, e);
59643        closeArray();
59644      };
59645      if (element.hasVersionElement()) {
59646        composeStringCore("version", element.getVersionElement(), false);
59647        composeStringExtras("version", element.getVersionElement(), false);
59648      }
59649      if (element.hasTitleElement()) {
59650        composeStringCore("title", element.getTitleElement(), false);
59651        composeStringExtras("title", element.getTitleElement(), false);
59652      }
59653      if (element.hasDerivedFromCanonical()) {
59654        openArray("derivedFromCanonical");
59655        for (CanonicalType e : element.getDerivedFromCanonical()) 
59656          composeCanonicalCore(null, e, true);
59657        closeArray();
59658        if (anyHasExtras(element.getDerivedFromCanonical())) {
59659          openArray("_derivedFromCanonical");
59660          for (CanonicalType e : element.getDerivedFromCanonical()) 
59661            composeCanonicalExtras(null, e, true);
59662          closeArray();
59663        }
59664      };
59665      if (element.hasDerivedFromUri()) {
59666        openArray("derivedFromUri");
59667        for (UriType e : element.getDerivedFromUri()) 
59668          composeUriCore(null, e, true);
59669        closeArray();
59670        if (anyHasExtras(element.getDerivedFromUri())) {
59671          openArray("_derivedFromUri");
59672          for (UriType e : element.getDerivedFromUri()) 
59673            composeUriExtras(null, e, true);
59674          closeArray();
59675        }
59676      };
59677      if (element.hasStatusElement()) {
59678        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
59679        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
59680      }
59681      if (element.hasExperimentalElement()) {
59682        composeBooleanCore("experimental", element.getExperimentalElement(), false);
59683        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
59684      }
59685      if (element.hasDateElement()) {
59686        composeDateTimeCore("date", element.getDateElement(), false);
59687        composeDateTimeExtras("date", element.getDateElement(), false);
59688      }
59689      if (element.hasPublisher()) {
59690        composeReference("publisher", element.getPublisher());
59691      }
59692      if (element.hasContact()) {
59693        openArray("contact");
59694        for (ContactDetail e : element.getContact()) 
59695          composeContactDetail(null, e);
59696        closeArray();
59697      };
59698      if (element.hasDescriptionElement()) {
59699        composeMarkdownCore("description", element.getDescriptionElement(), false);
59700        composeMarkdownExtras("description", element.getDescriptionElement(), false);
59701      }
59702      if (element.hasUseContext()) {
59703        openArray("useContext");
59704        for (UsageContext e : element.getUseContext()) 
59705          composeUsageContext(null, e);
59706        closeArray();
59707      };
59708      if (element.hasJurisdiction()) {
59709        openArray("jurisdiction");
59710        for (CodeableConcept e : element.getJurisdiction()) 
59711          composeCodeableConcept(null, e);
59712        closeArray();
59713      };
59714      if (element.hasPurposeElement()) {
59715        composeMarkdownCore("purpose", element.getPurposeElement(), false);
59716        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
59717      }
59718      if (element.hasCopyrightElement()) {
59719        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
59720        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
59721      }
59722      if (element.hasApprovalDateElement()) {
59723        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
59724        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
59725      }
59726      if (element.hasLastReviewDateElement()) {
59727        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
59728        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
59729      }
59730      if (element.hasEffectivePeriod()) {
59731        composePeriod("effectivePeriod", element.getEffectivePeriod());
59732      }
59733      if (element.hasResourceTrigger()) {
59734        composeTopicResourceTriggerComponent("resourceTrigger", element.getResourceTrigger());
59735      }
59736      if (element.hasCanFilterBy()) {
59737        openArray("canFilterBy");
59738        for (Topic.TopicCanFilterByComponent e : element.getCanFilterBy()) 
59739          composeTopicCanFilterByComponent(null, e);
59740        closeArray();
59741      };
59742  }
59743
59744  protected void composeTopicResourceTriggerComponent(String name, Topic.TopicResourceTriggerComponent element) throws IOException {
59745    if (element != null) {
59746      open(name);
59747      composeTopicResourceTriggerComponentProperties(element);
59748      close();
59749    }
59750  }
59751
59752  protected void composeTopicResourceTriggerComponentProperties(Topic.TopicResourceTriggerComponent element) throws IOException {
59753    composeBackboneElementProperties(element);
59754      if (element.hasDescriptionElement()) {
59755        composeStringCore("description", element.getDescriptionElement(), false);
59756        composeStringExtras("description", element.getDescriptionElement(), false);
59757      }
59758      if (element.hasResourceType()) {
59759        openArray("resourceType");
59760        for (CodeType e : element.getResourceType()) 
59761          composeCodeCore(null, e, true);
59762        closeArray();
59763        if (anyHasExtras(element.getResourceType())) {
59764          openArray("_resourceType");
59765          for (CodeType e : element.getResourceType()) 
59766            composeCodeExtras(null, e, true);
59767          closeArray();
59768        }
59769      };
59770      if (element.hasMethodCriteria()) {
59771        openArray("methodCriteria");
59772        for (Enumeration<Topic.InteractionTrigger> e : element.getMethodCriteria()) 
59773          composeEnumerationCore(null, e, new Topic.InteractionTriggerEnumFactory(), true);
59774        closeArray();
59775        if (anyHasExtras(element.getMethodCriteria())) {
59776          openArray("_methodCriteria");
59777          for (Enumeration<Topic.InteractionTrigger> e : element.getMethodCriteria()) 
59778            composeEnumerationExtras(null, e, new Topic.InteractionTriggerEnumFactory(), true);
59779          closeArray();
59780        }
59781      };
59782      if (element.hasQueryCriteria()) {
59783        composeTopicResourceTriggerQueryCriteriaComponent("queryCriteria", element.getQueryCriteria());
59784      }
59785      if (element.hasFhirPathCriteriaElement()) {
59786        composeStringCore("fhirPathCriteria", element.getFhirPathCriteriaElement(), false);
59787        composeStringExtras("fhirPathCriteria", element.getFhirPathCriteriaElement(), false);
59788      }
59789  }
59790
59791  protected void composeTopicResourceTriggerQueryCriteriaComponent(String name, Topic.TopicResourceTriggerQueryCriteriaComponent element) throws IOException {
59792    if (element != null) {
59793      open(name);
59794      composeTopicResourceTriggerQueryCriteriaComponentProperties(element);
59795      close();
59796    }
59797  }
59798
59799  protected void composeTopicResourceTriggerQueryCriteriaComponentProperties(Topic.TopicResourceTriggerQueryCriteriaComponent element) throws IOException {
59800    composeBackboneElementProperties(element);
59801      if (element.hasPreviousElement()) {
59802        composeStringCore("previous", element.getPreviousElement(), false);
59803        composeStringExtras("previous", element.getPreviousElement(), false);
59804      }
59805      if (element.hasCurrentElement()) {
59806        composeStringCore("current", element.getCurrentElement(), false);
59807        composeStringExtras("current", element.getCurrentElement(), false);
59808      }
59809      if (element.hasRequireBothElement()) {
59810        composeBooleanCore("requireBoth", element.getRequireBothElement(), false);
59811        composeBooleanExtras("requireBoth", element.getRequireBothElement(), false);
59812      }
59813  }
59814
59815  protected void composeTopicCanFilterByComponent(String name, Topic.TopicCanFilterByComponent element) throws IOException {
59816    if (element != null) {
59817      open(name);
59818      composeTopicCanFilterByComponentProperties(element);
59819      close();
59820    }
59821  }
59822
59823  protected void composeTopicCanFilterByComponentProperties(Topic.TopicCanFilterByComponent element) throws IOException {
59824    composeBackboneElementProperties(element);
59825      if (element.hasNameElement()) {
59826        composeStringCore("name", element.getNameElement(), false);
59827        composeStringExtras("name", element.getNameElement(), false);
59828      }
59829      if (element.hasMatchType()) {
59830        openArray("matchType");
59831        for (Enumeration<Topic.TopicFilterByMatchType> e : element.getMatchType()) 
59832          composeEnumerationCore(null, e, new Topic.TopicFilterByMatchTypeEnumFactory(), true);
59833        closeArray();
59834        if (anyHasExtras(element.getMatchType())) {
59835          openArray("_matchType");
59836          for (Enumeration<Topic.TopicFilterByMatchType> e : element.getMatchType()) 
59837            composeEnumerationExtras(null, e, new Topic.TopicFilterByMatchTypeEnumFactory(), true);
59838          closeArray();
59839        }
59840      };
59841      if (element.hasDocumentationElement()) {
59842        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
59843        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
59844      }
59845  }
59846
59847  protected void composeValueSet(String name, ValueSet element) throws IOException {
59848    if (element != null) {
59849      prop("resourceType", name);
59850      composeValueSetProperties(element);
59851    }
59852  }
59853
59854  protected void composeValueSetProperties(ValueSet element) throws IOException {
59855    composeCanonicalResourceProperties(element);
59856      if (element.hasUrlElement()) {
59857        composeUriCore("url", element.getUrlElement(), false);
59858        composeUriExtras("url", element.getUrlElement(), false);
59859      }
59860      if (element.hasIdentifier()) {
59861        openArray("identifier");
59862        for (Identifier e : element.getIdentifier()) 
59863          composeIdentifier(null, e);
59864        closeArray();
59865      };
59866      if (element.hasVersionElement()) {
59867        composeStringCore("version", element.getVersionElement(), false);
59868        composeStringExtras("version", element.getVersionElement(), false);
59869      }
59870      if (element.hasNameElement()) {
59871        composeStringCore("name", element.getNameElement(), false);
59872        composeStringExtras("name", element.getNameElement(), false);
59873      }
59874      if (element.hasTitleElement()) {
59875        composeStringCore("title", element.getTitleElement(), false);
59876        composeStringExtras("title", element.getTitleElement(), false);
59877      }
59878      if (element.hasStatusElement()) {
59879        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
59880        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
59881      }
59882      if (element.hasExperimentalElement()) {
59883        composeBooleanCore("experimental", element.getExperimentalElement(), false);
59884        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
59885      }
59886      if (element.hasDateElement()) {
59887        composeDateTimeCore("date", element.getDateElement(), false);
59888        composeDateTimeExtras("date", element.getDateElement(), false);
59889      }
59890      if (element.hasPublisherElement()) {
59891        composeStringCore("publisher", element.getPublisherElement(), false);
59892        composeStringExtras("publisher", element.getPublisherElement(), false);
59893      }
59894      if (element.hasContact()) {
59895        openArray("contact");
59896        for (ContactDetail e : element.getContact()) 
59897          composeContactDetail(null, e);
59898        closeArray();
59899      };
59900      if (element.hasDescriptionElement()) {
59901        composeMarkdownCore("description", element.getDescriptionElement(), false);
59902        composeMarkdownExtras("description", element.getDescriptionElement(), false);
59903      }
59904      if (element.hasUseContext()) {
59905        openArray("useContext");
59906        for (UsageContext e : element.getUseContext()) 
59907          composeUsageContext(null, e);
59908        closeArray();
59909      };
59910      if (element.hasJurisdiction()) {
59911        openArray("jurisdiction");
59912        for (CodeableConcept e : element.getJurisdiction()) 
59913          composeCodeableConcept(null, e);
59914        closeArray();
59915      };
59916      if (element.hasImmutableElement()) {
59917        composeBooleanCore("immutable", element.getImmutableElement(), false);
59918        composeBooleanExtras("immutable", element.getImmutableElement(), false);
59919      }
59920      if (element.hasPurposeElement()) {
59921        composeMarkdownCore("purpose", element.getPurposeElement(), false);
59922        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
59923      }
59924      if (element.hasCopyrightElement()) {
59925        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
59926        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
59927      }
59928      if (element.hasCompose()) {
59929        composeValueSetComposeComponent("compose", element.getCompose());
59930      }
59931      if (element.hasExpansion()) {
59932        composeValueSetExpansionComponent("expansion", element.getExpansion());
59933      }
59934  }
59935
59936  protected void composeValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
59937    if (element != null) {
59938      open(name);
59939      composeValueSetComposeComponentProperties(element);
59940      close();
59941    }
59942  }
59943
59944  protected void composeValueSetComposeComponentProperties(ValueSet.ValueSetComposeComponent element) throws IOException {
59945    composeBackboneElementProperties(element);
59946      if (element.hasLockedDateElement()) {
59947        composeDateCore("lockedDate", element.getLockedDateElement(), false);
59948        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
59949      }
59950      if (element.hasInactiveElement()) {
59951        composeBooleanCore("inactive", element.getInactiveElement(), false);
59952        composeBooleanExtras("inactive", element.getInactiveElement(), false);
59953      }
59954      if (element.hasInclude()) {
59955        openArray("include");
59956        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
59957          composeConceptSetComponent(null, e);
59958        closeArray();
59959      };
59960      if (element.hasExclude()) {
59961        openArray("exclude");
59962        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
59963          composeConceptSetComponent(null, e);
59964        closeArray();
59965      };
59966      if (element.hasProperty()) {
59967        openArray("property");
59968        for (StringType e : element.getProperty()) 
59969          composeStringCore(null, e, true);
59970        closeArray();
59971        if (anyHasExtras(element.getProperty())) {
59972          openArray("_property");
59973          for (StringType e : element.getProperty()) 
59974            composeStringExtras(null, e, true);
59975          closeArray();
59976        }
59977      };
59978  }
59979
59980  protected void composeConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
59981    if (element != null) {
59982      open(name);
59983      composeConceptSetComponentProperties(element);
59984      close();
59985    }
59986  }
59987
59988  protected void composeConceptSetComponentProperties(ValueSet.ConceptSetComponent element) throws IOException {
59989    composeBackboneElementProperties(element);
59990      if (element.hasSystemElement()) {
59991        composeUriCore("system", element.getSystemElement(), false);
59992        composeUriExtras("system", element.getSystemElement(), false);
59993      }
59994      if (element.hasVersionElement()) {
59995        composeStringCore("version", element.getVersionElement(), false);
59996        composeStringExtras("version", element.getVersionElement(), false);
59997      }
59998      if (element.hasConcept()) {
59999        openArray("concept");
60000        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
60001          composeConceptReferenceComponent(null, e);
60002        closeArray();
60003      };
60004      if (element.hasFilter()) {
60005        openArray("filter");
60006        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
60007          composeConceptSetFilterComponent(null, e);
60008        closeArray();
60009      };
60010      if (element.hasValueSet()) {
60011        openArray("valueSet");
60012        for (CanonicalType e : element.getValueSet()) 
60013          composeCanonicalCore(null, e, true);
60014        closeArray();
60015        if (anyHasExtras(element.getValueSet())) {
60016          openArray("_valueSet");
60017          for (CanonicalType e : element.getValueSet()) 
60018            composeCanonicalExtras(null, e, true);
60019          closeArray();
60020        }
60021      };
60022  }
60023
60024  protected void composeConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
60025    if (element != null) {
60026      open(name);
60027      composeConceptReferenceComponentProperties(element);
60028      close();
60029    }
60030  }
60031
60032  protected void composeConceptReferenceComponentProperties(ValueSet.ConceptReferenceComponent element) throws IOException {
60033    composeBackboneElementProperties(element);
60034      if (element.hasCodeElement()) {
60035        composeCodeCore("code", element.getCodeElement(), false);
60036        composeCodeExtras("code", element.getCodeElement(), false);
60037      }
60038      if (element.hasDisplayElement()) {
60039        composeStringCore("display", element.getDisplayElement(), false);
60040        composeStringExtras("display", element.getDisplayElement(), false);
60041      }
60042      if (element.hasDesignation()) {
60043        openArray("designation");
60044        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
60045          composeConceptReferenceDesignationComponent(null, e);
60046        closeArray();
60047      };
60048  }
60049
60050  protected void composeConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
60051    if (element != null) {
60052      open(name);
60053      composeConceptReferenceDesignationComponentProperties(element);
60054      close();
60055    }
60056  }
60057
60058  protected void composeConceptReferenceDesignationComponentProperties(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
60059    composeBackboneElementProperties(element);
60060      if (element.hasLanguageElement()) {
60061        composeCodeCore("language", element.getLanguageElement(), false);
60062        composeCodeExtras("language", element.getLanguageElement(), false);
60063      }
60064      if (element.hasUse()) {
60065        composeCoding("use", element.getUse());
60066      }
60067      if (element.hasValueElement()) {
60068        composeStringCore("value", element.getValueElement(), false);
60069        composeStringExtras("value", element.getValueElement(), false);
60070      }
60071  }
60072
60073  protected void composeConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
60074    if (element != null) {
60075      open(name);
60076      composeConceptSetFilterComponentProperties(element);
60077      close();
60078    }
60079  }
60080
60081  protected void composeConceptSetFilterComponentProperties(ValueSet.ConceptSetFilterComponent element) throws IOException {
60082    composeBackboneElementProperties(element);
60083      if (element.hasPropertyElement()) {
60084        composeCodeCore("property", element.getPropertyElement(), false);
60085        composeCodeExtras("property", element.getPropertyElement(), false);
60086      }
60087      if (element.hasOpElement()) {
60088        composeEnumerationCore("op", element.getOpElement(), new Enumerations.FilterOperatorEnumFactory(), false);
60089        composeEnumerationExtras("op", element.getOpElement(), new Enumerations.FilterOperatorEnumFactory(), false);
60090      }
60091      if (element.hasValueElement()) {
60092        composeStringCore("value", element.getValueElement(), false);
60093        composeStringExtras("value", element.getValueElement(), false);
60094      }
60095  }
60096
60097  protected void composeValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
60098    if (element != null) {
60099      open(name);
60100      composeValueSetExpansionComponentProperties(element);
60101      close();
60102    }
60103  }
60104
60105  protected void composeValueSetExpansionComponentProperties(ValueSet.ValueSetExpansionComponent element) throws IOException {
60106    composeBackboneElementProperties(element);
60107      if (element.hasIdentifierElement()) {
60108        composeUriCore("identifier", element.getIdentifierElement(), false);
60109        composeUriExtras("identifier", element.getIdentifierElement(), false);
60110      }
60111      if (element.hasTimestampElement()) {
60112        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
60113        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
60114      }
60115      if (element.hasTotalElement()) {
60116        composeIntegerCore("total", element.getTotalElement(), false);
60117        composeIntegerExtras("total", element.getTotalElement(), false);
60118      }
60119      if (element.hasOffsetElement()) {
60120        composeIntegerCore("offset", element.getOffsetElement(), false);
60121        composeIntegerExtras("offset", element.getOffsetElement(), false);
60122      }
60123      if (element.hasParameter()) {
60124        openArray("parameter");
60125        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
60126          composeValueSetExpansionParameterComponent(null, e);
60127        closeArray();
60128      };
60129      if (element.hasProperty()) {
60130        openArray("property");
60131        for (ValueSet.ValueSetExpansionPropertyComponent e : element.getProperty()) 
60132          composeValueSetExpansionPropertyComponent(null, e);
60133        closeArray();
60134      };
60135      if (element.hasContains()) {
60136        openArray("contains");
60137        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
60138          composeValueSetExpansionContainsComponent(null, e);
60139        closeArray();
60140      };
60141  }
60142
60143  protected void composeValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
60144    if (element != null) {
60145      open(name);
60146      composeValueSetExpansionParameterComponentProperties(element);
60147      close();
60148    }
60149  }
60150
60151  protected void composeValueSetExpansionParameterComponentProperties(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
60152    composeBackboneElementProperties(element);
60153      if (element.hasNameElement()) {
60154        composeStringCore("name", element.getNameElement(), false);
60155        composeStringExtras("name", element.getNameElement(), false);
60156      }
60157      if (element.hasValue()) {
60158        composeType("value", element.getValue());
60159      }
60160  }
60161
60162  protected void composeValueSetExpansionPropertyComponent(String name, ValueSet.ValueSetExpansionPropertyComponent element) throws IOException {
60163    if (element != null) {
60164      open(name);
60165      composeValueSetExpansionPropertyComponentProperties(element);
60166      close();
60167    }
60168  }
60169
60170  protected void composeValueSetExpansionPropertyComponentProperties(ValueSet.ValueSetExpansionPropertyComponent element) throws IOException {
60171    composeBackboneElementProperties(element);
60172      if (element.hasCodeElement()) {
60173        composeCodeCore("code", element.getCodeElement(), false);
60174        composeCodeExtras("code", element.getCodeElement(), false);
60175      }
60176      if (element.hasUriElement()) {
60177        composeUriCore("uri", element.getUriElement(), false);
60178        composeUriExtras("uri", element.getUriElement(), false);
60179      }
60180  }
60181
60182  protected void composeValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
60183    if (element != null) {
60184      open(name);
60185      composeValueSetExpansionContainsComponentProperties(element);
60186      close();
60187    }
60188  }
60189
60190  protected void composeValueSetExpansionContainsComponentProperties(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
60191    composeBackboneElementProperties(element);
60192      if (element.hasSystemElement()) {
60193        composeUriCore("system", element.getSystemElement(), false);
60194        composeUriExtras("system", element.getSystemElement(), false);
60195      }
60196      if (element.hasAbstractElement()) {
60197        composeBooleanCore("abstract", element.getAbstractElement(), false);
60198        composeBooleanExtras("abstract", element.getAbstractElement(), false);
60199      }
60200      if (element.hasInactiveElement()) {
60201        composeBooleanCore("inactive", element.getInactiveElement(), false);
60202        composeBooleanExtras("inactive", element.getInactiveElement(), false);
60203      }
60204      if (element.hasVersionElement()) {
60205        composeStringCore("version", element.getVersionElement(), false);
60206        composeStringExtras("version", element.getVersionElement(), false);
60207      }
60208      if (element.hasCodeElement()) {
60209        composeCodeCore("code", element.getCodeElement(), false);
60210        composeCodeExtras("code", element.getCodeElement(), false);
60211      }
60212      if (element.hasDisplayElement()) {
60213        composeStringCore("display", element.getDisplayElement(), false);
60214        composeStringExtras("display", element.getDisplayElement(), false);
60215      }
60216      if (element.hasDesignation()) {
60217        openArray("designation");
60218        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
60219          composeConceptReferenceDesignationComponent(null, e);
60220        closeArray();
60221      };
60222      if (element.hasProperty()) {
60223        openArray("property");
60224        for (ValueSet.ConceptPropertyComponent e : element.getProperty()) 
60225          composeConceptPropertyComponent(null, e);
60226        closeArray();
60227      };
60228      if (element.hasContains()) {
60229        openArray("contains");
60230        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
60231          composeValueSetExpansionContainsComponent(null, e);
60232        closeArray();
60233      };
60234  }
60235
60236  protected void composeConceptPropertyComponent(String name, ValueSet.ConceptPropertyComponent element) throws IOException {
60237    if (element != null) {
60238      open(name);
60239      composeConceptPropertyComponentProperties(element);
60240      close();
60241    }
60242  }
60243
60244  protected void composeConceptPropertyComponentProperties(ValueSet.ConceptPropertyComponent element) throws IOException {
60245    composeBackboneElementProperties(element);
60246      if (element.hasCodeElement()) {
60247        composeCodeCore("code", element.getCodeElement(), false);
60248        composeCodeExtras("code", element.getCodeElement(), false);
60249      }
60250      if (element.hasValue()) {
60251        composeType("value", element.getValue());
60252      }
60253  }
60254
60255  protected void composeVerificationResult(String name, VerificationResult element) throws IOException {
60256    if (element != null) {
60257      prop("resourceType", name);
60258      composeVerificationResultProperties(element);
60259    }
60260  }
60261
60262  protected void composeVerificationResultProperties(VerificationResult element) throws IOException {
60263    composeDomainResourceProperties(element);
60264      if (element.hasTarget()) {
60265        openArray("target");
60266        for (Reference e : element.getTarget()) 
60267          composeReference(null, e);
60268        closeArray();
60269      };
60270      if (element.hasTargetLocation()) {
60271        openArray("targetLocation");
60272        for (StringType e : element.getTargetLocation()) 
60273          composeStringCore(null, e, true);
60274        closeArray();
60275        if (anyHasExtras(element.getTargetLocation())) {
60276          openArray("_targetLocation");
60277          for (StringType e : element.getTargetLocation()) 
60278            composeStringExtras(null, e, true);
60279          closeArray();
60280        }
60281      };
60282      if (element.hasNeed()) {
60283        composeCodeableConcept("need", element.getNeed());
60284      }
60285      if (element.hasStatusElement()) {
60286        composeEnumerationCore("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
60287        composeEnumerationExtras("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
60288      }
60289      if (element.hasStatusDateElement()) {
60290        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
60291        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
60292      }
60293      if (element.hasValidationType()) {
60294        composeCodeableConcept("validationType", element.getValidationType());
60295      }
60296      if (element.hasValidationProcess()) {
60297        openArray("validationProcess");
60298        for (CodeableConcept e : element.getValidationProcess()) 
60299          composeCodeableConcept(null, e);
60300        closeArray();
60301      };
60302      if (element.hasFrequency()) {
60303        composeTiming("frequency", element.getFrequency());
60304      }
60305      if (element.hasLastPerformedElement()) {
60306        composeDateTimeCore("lastPerformed", element.getLastPerformedElement(), false);
60307        composeDateTimeExtras("lastPerformed", element.getLastPerformedElement(), false);
60308      }
60309      if (element.hasNextScheduledElement()) {
60310        composeDateCore("nextScheduled", element.getNextScheduledElement(), false);
60311        composeDateExtras("nextScheduled", element.getNextScheduledElement(), false);
60312      }
60313      if (element.hasFailureAction()) {
60314        composeCodeableConcept("failureAction", element.getFailureAction());
60315      }
60316      if (element.hasPrimarySource()) {
60317        openArray("primarySource");
60318        for (VerificationResult.VerificationResultPrimarySourceComponent e : element.getPrimarySource()) 
60319          composeVerificationResultPrimarySourceComponent(null, e);
60320        closeArray();
60321      };
60322      if (element.hasAttestation()) {
60323        composeVerificationResultAttestationComponent("attestation", element.getAttestation());
60324      }
60325      if (element.hasValidator()) {
60326        openArray("validator");
60327        for (VerificationResult.VerificationResultValidatorComponent e : element.getValidator()) 
60328          composeVerificationResultValidatorComponent(null, e);
60329        closeArray();
60330      };
60331  }
60332
60333  protected void composeVerificationResultPrimarySourceComponent(String name, VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
60334    if (element != null) {
60335      open(name);
60336      composeVerificationResultPrimarySourceComponentProperties(element);
60337      close();
60338    }
60339  }
60340
60341  protected void composeVerificationResultPrimarySourceComponentProperties(VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
60342    composeBackboneElementProperties(element);
60343      if (element.hasWho()) {
60344        composeReference("who", element.getWho());
60345      }
60346      if (element.hasType()) {
60347        openArray("type");
60348        for (CodeableConcept e : element.getType()) 
60349          composeCodeableConcept(null, e);
60350        closeArray();
60351      };
60352      if (element.hasCommunicationMethod()) {
60353        openArray("communicationMethod");
60354        for (CodeableConcept e : element.getCommunicationMethod()) 
60355          composeCodeableConcept(null, e);
60356        closeArray();
60357      };
60358      if (element.hasValidationStatus()) {
60359        composeCodeableConcept("validationStatus", element.getValidationStatus());
60360      }
60361      if (element.hasValidationDateElement()) {
60362        composeDateTimeCore("validationDate", element.getValidationDateElement(), false);
60363        composeDateTimeExtras("validationDate", element.getValidationDateElement(), false);
60364      }
60365      if (element.hasCanPushUpdates()) {
60366        composeCodeableConcept("canPushUpdates", element.getCanPushUpdates());
60367      }
60368      if (element.hasPushTypeAvailable()) {
60369        openArray("pushTypeAvailable");
60370        for (CodeableConcept e : element.getPushTypeAvailable()) 
60371          composeCodeableConcept(null, e);
60372        closeArray();
60373      };
60374  }
60375
60376  protected void composeVerificationResultAttestationComponent(String name, VerificationResult.VerificationResultAttestationComponent element) throws IOException {
60377    if (element != null) {
60378      open(name);
60379      composeVerificationResultAttestationComponentProperties(element);
60380      close();
60381    }
60382  }
60383
60384  protected void composeVerificationResultAttestationComponentProperties(VerificationResult.VerificationResultAttestationComponent element) throws IOException {
60385    composeBackboneElementProperties(element);
60386      if (element.hasWho()) {
60387        composeReference("who", element.getWho());
60388      }
60389      if (element.hasOnBehalfOf()) {
60390        composeReference("onBehalfOf", element.getOnBehalfOf());
60391      }
60392      if (element.hasCommunicationMethod()) {
60393        composeCodeableConcept("communicationMethod", element.getCommunicationMethod());
60394      }
60395      if (element.hasDateElement()) {
60396        composeDateCore("date", element.getDateElement(), false);
60397        composeDateExtras("date", element.getDateElement(), false);
60398      }
60399      if (element.hasSourceIdentityCertificateElement()) {
60400        composeStringCore("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
60401        composeStringExtras("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
60402      }
60403      if (element.hasProxyIdentityCertificateElement()) {
60404        composeStringCore("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
60405        composeStringExtras("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
60406      }
60407      if (element.hasProxySignature()) {
60408        composeSignature("proxySignature", element.getProxySignature());
60409      }
60410      if (element.hasSourceSignature()) {
60411        composeSignature("sourceSignature", element.getSourceSignature());
60412      }
60413  }
60414
60415  protected void composeVerificationResultValidatorComponent(String name, VerificationResult.VerificationResultValidatorComponent element) throws IOException {
60416    if (element != null) {
60417      open(name);
60418      composeVerificationResultValidatorComponentProperties(element);
60419      close();
60420    }
60421  }
60422
60423  protected void composeVerificationResultValidatorComponentProperties(VerificationResult.VerificationResultValidatorComponent element) throws IOException {
60424    composeBackboneElementProperties(element);
60425      if (element.hasOrganization()) {
60426        composeReference("organization", element.getOrganization());
60427      }
60428      if (element.hasIdentityCertificateElement()) {
60429        composeStringCore("identityCertificate", element.getIdentityCertificateElement(), false);
60430        composeStringExtras("identityCertificate", element.getIdentityCertificateElement(), false);
60431      }
60432      if (element.hasAttestationSignature()) {
60433        composeSignature("attestationSignature", element.getAttestationSignature());
60434      }
60435  }
60436
60437  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
60438    if (element != null) {
60439      prop("resourceType", name);
60440      composeVisionPrescriptionProperties(element);
60441    }
60442  }
60443
60444  protected void composeVisionPrescriptionProperties(VisionPrescription element) throws IOException {
60445    composeDomainResourceProperties(element);
60446      if (element.hasIdentifier()) {
60447        openArray("identifier");
60448        for (Identifier e : element.getIdentifier()) 
60449          composeIdentifier(null, e);
60450        closeArray();
60451      };
60452      if (element.hasStatusElement()) {
60453        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
60454        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.FinancialResourceStatusCodesEnumFactory(), false);
60455      }
60456      if (element.hasCreatedElement()) {
60457        composeDateTimeCore("created", element.getCreatedElement(), false);
60458        composeDateTimeExtras("created", element.getCreatedElement(), false);
60459      }
60460      if (element.hasPatient()) {
60461        composeReference("patient", element.getPatient());
60462      }
60463      if (element.hasEncounter()) {
60464        composeReference("encounter", element.getEncounter());
60465      }
60466      if (element.hasDateWrittenElement()) {
60467        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
60468        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
60469      }
60470      if (element.hasPrescriber()) {
60471        composeReference("prescriber", element.getPrescriber());
60472      }
60473      if (element.hasLensSpecification()) {
60474        openArray("lensSpecification");
60475        for (VisionPrescription.VisionPrescriptionLensSpecificationComponent e : element.getLensSpecification()) 
60476          composeVisionPrescriptionLensSpecificationComponent(null, e);
60477        closeArray();
60478      };
60479  }
60480
60481  protected void composeVisionPrescriptionLensSpecificationComponent(String name, VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
60482    if (element != null) {
60483      open(name);
60484      composeVisionPrescriptionLensSpecificationComponentProperties(element);
60485      close();
60486    }
60487  }
60488
60489  protected void composeVisionPrescriptionLensSpecificationComponentProperties(VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
60490    composeBackboneElementProperties(element);
60491      if (element.hasProduct()) {
60492        composeCodeableConcept("product", element.getProduct());
60493      }
60494      if (element.hasEyeElement()) {
60495        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
60496        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
60497      }
60498      if (element.hasSphereElement()) {
60499        composeDecimalCore("sphere", element.getSphereElement(), false);
60500        composeDecimalExtras("sphere", element.getSphereElement(), false);
60501      }
60502      if (element.hasCylinderElement()) {
60503        composeDecimalCore("cylinder", element.getCylinderElement(), false);
60504        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
60505      }
60506      if (element.hasAxisElement()) {
60507        composeIntegerCore("axis", element.getAxisElement(), false);
60508        composeIntegerExtras("axis", element.getAxisElement(), false);
60509      }
60510      if (element.hasPrism()) {
60511        openArray("prism");
60512        for (VisionPrescription.PrismComponent e : element.getPrism()) 
60513          composePrismComponent(null, e);
60514        closeArray();
60515      };
60516      if (element.hasAddElement()) {
60517        composeDecimalCore("add", element.getAddElement(), false);
60518        composeDecimalExtras("add", element.getAddElement(), false);
60519      }
60520      if (element.hasPowerElement()) {
60521        composeDecimalCore("power", element.getPowerElement(), false);
60522        composeDecimalExtras("power", element.getPowerElement(), false);
60523      }
60524      if (element.hasBackCurveElement()) {
60525        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
60526        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
60527      }
60528      if (element.hasDiameterElement()) {
60529        composeDecimalCore("diameter", element.getDiameterElement(), false);
60530        composeDecimalExtras("diameter", element.getDiameterElement(), false);
60531      }
60532      if (element.hasDuration()) {
60533        composeQuantity("duration", element.getDuration());
60534      }
60535      if (element.hasColorElement()) {
60536        composeStringCore("color", element.getColorElement(), false);
60537        composeStringExtras("color", element.getColorElement(), false);
60538      }
60539      if (element.hasBrandElement()) {
60540        composeStringCore("brand", element.getBrandElement(), false);
60541        composeStringExtras("brand", element.getBrandElement(), false);
60542      }
60543      if (element.hasNote()) {
60544        openArray("note");
60545        for (Annotation e : element.getNote()) 
60546          composeAnnotation(null, e);
60547        closeArray();
60548      };
60549  }
60550
60551  protected void composePrismComponent(String name, VisionPrescription.PrismComponent element) throws IOException {
60552    if (element != null) {
60553      open(name);
60554      composePrismComponentProperties(element);
60555      close();
60556    }
60557  }
60558
60559  protected void composePrismComponentProperties(VisionPrescription.PrismComponent element) throws IOException {
60560    composeBackboneElementProperties(element);
60561      if (element.hasAmountElement()) {
60562        composeDecimalCore("amount", element.getAmountElement(), false);
60563        composeDecimalExtras("amount", element.getAmountElement(), false);
60564      }
60565      if (element.hasBaseElement()) {
60566        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
60567        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
60568      }
60569  }
60570
60571
60572
60573  @Override
60574  protected void composeResource(Resource resource) throws IOException {
60575    if (resource == null) {
60576      throw new Error("Unhandled resource type "+resource.getClass().getName());
60577    } else if (resource instanceof Account) {
60578      composeAccount("Account", (Account)resource);
60579    } else if (resource instanceof ActivityDefinition) {
60580      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
60581    } else if (resource instanceof AdministrableProductDefinition) {
60582      composeAdministrableProductDefinition("AdministrableProductDefinition", (AdministrableProductDefinition)resource);
60583    } else if (resource instanceof AdverseEvent) {
60584      composeAdverseEvent("AdverseEvent", (AdverseEvent)resource);
60585    } else if (resource instanceof AllergyIntolerance) {
60586      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
60587    } else if (resource instanceof Appointment) {
60588      composeAppointment("Appointment", (Appointment)resource);
60589    } else if (resource instanceof AppointmentResponse) {
60590      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
60591    } else if (resource instanceof AuditEvent) {
60592      composeAuditEvent("AuditEvent", (AuditEvent)resource);
60593    } else if (resource instanceof Basic) {
60594      composeBasic("Basic", (Basic)resource);
60595    } else if (resource instanceof Binary) {
60596      composeBinary("Binary", (Binary)resource);
60597    } else if (resource instanceof BiologicallyDerivedProduct) {
60598      composeBiologicallyDerivedProduct("BiologicallyDerivedProduct", (BiologicallyDerivedProduct)resource);
60599    } else if (resource instanceof BodyStructure) {
60600      composeBodyStructure("BodyStructure", (BodyStructure)resource);
60601    } else if (resource instanceof Bundle) {
60602      composeBundle("Bundle", (Bundle)resource);
60603    } else if (resource instanceof CapabilityStatement) {
60604      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement)resource);
60605    } else if (resource instanceof CapabilityStatement2) {
60606      composeCapabilityStatement2("CapabilityStatement2", (CapabilityStatement2)resource);
60607    } else if (resource instanceof CarePlan) {
60608      composeCarePlan("CarePlan", (CarePlan)resource);
60609    } else if (resource instanceof CareTeam) {
60610      composeCareTeam("CareTeam", (CareTeam)resource);
60611    } else if (resource instanceof CatalogEntry) {
60612      composeCatalogEntry("CatalogEntry", (CatalogEntry)resource);
60613    } else if (resource instanceof ChargeItem) {
60614      composeChargeItem("ChargeItem", (ChargeItem)resource);
60615    } else if (resource instanceof ChargeItemDefinition) {
60616      composeChargeItemDefinition("ChargeItemDefinition", (ChargeItemDefinition)resource);
60617    } else if (resource instanceof Claim) {
60618      composeClaim("Claim", (Claim)resource);
60619    } else if (resource instanceof ClaimResponse) {
60620      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
60621    } else if (resource instanceof ClinicalImpression) {
60622      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
60623    } else if (resource instanceof ClinicalUseIssue) {
60624      composeClinicalUseIssue("ClinicalUseIssue", (ClinicalUseIssue)resource);
60625    } else if (resource instanceof CodeSystem) {
60626      composeCodeSystem("CodeSystem", (CodeSystem)resource);
60627    } else if (resource instanceof Communication) {
60628      composeCommunication("Communication", (Communication)resource);
60629    } else if (resource instanceof CommunicationRequest) {
60630      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
60631    } else if (resource instanceof CompartmentDefinition) {
60632      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
60633    } else if (resource instanceof Composition) {
60634      composeComposition("Composition", (Composition)resource);
60635    } else if (resource instanceof ConceptMap) {
60636      composeConceptMap("ConceptMap", (ConceptMap)resource);
60637    } else if (resource instanceof Condition) {
60638      composeCondition("Condition", (Condition)resource);
60639    } else if (resource instanceof ConditionDefinition) {
60640      composeConditionDefinition("ConditionDefinition", (ConditionDefinition)resource);
60641    } else if (resource instanceof Consent) {
60642      composeConsent("Consent", (Consent)resource);
60643    } else if (resource instanceof Contract) {
60644      composeContract("Contract", (Contract)resource);
60645    } else if (resource instanceof Coverage) {
60646      composeCoverage("Coverage", (Coverage)resource);
60647    } else if (resource instanceof CoverageEligibilityRequest) {
60648      composeCoverageEligibilityRequest("CoverageEligibilityRequest", (CoverageEligibilityRequest)resource);
60649    } else if (resource instanceof CoverageEligibilityResponse) {
60650      composeCoverageEligibilityResponse("CoverageEligibilityResponse", (CoverageEligibilityResponse)resource);
60651    } else if (resource instanceof DetectedIssue) {
60652      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
60653    } else if (resource instanceof Device) {
60654      composeDevice("Device", (Device)resource);
60655    } else if (resource instanceof DeviceDefinition) {
60656      composeDeviceDefinition("DeviceDefinition", (DeviceDefinition)resource);
60657    } else if (resource instanceof DeviceMetric) {
60658      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
60659    } else if (resource instanceof DeviceRequest) {
60660      composeDeviceRequest("DeviceRequest", (DeviceRequest)resource);
60661    } else if (resource instanceof DeviceUseStatement) {
60662      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
60663    } else if (resource instanceof DiagnosticReport) {
60664      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
60665    } else if (resource instanceof DocumentManifest) {
60666      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
60667    } else if (resource instanceof DocumentReference) {
60668      composeDocumentReference("DocumentReference", (DocumentReference)resource);
60669    } else if (resource instanceof Encounter) {
60670      composeEncounter("Encounter", (Encounter)resource);
60671    } else if (resource instanceof Endpoint) {
60672      composeEndpoint("Endpoint", (Endpoint)resource);
60673    } else if (resource instanceof EnrollmentRequest) {
60674      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
60675    } else if (resource instanceof EnrollmentResponse) {
60676      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
60677    } else if (resource instanceof EpisodeOfCare) {
60678      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
60679    } else if (resource instanceof EventDefinition) {
60680      composeEventDefinition("EventDefinition", (EventDefinition)resource);
60681    } else if (resource instanceof Evidence) {
60682      composeEvidence("Evidence", (Evidence)resource);
60683    } else if (resource instanceof EvidenceVariable) {
60684      composeEvidenceVariable("EvidenceVariable", (EvidenceVariable)resource);
60685    } else if (resource instanceof ExampleScenario) {
60686      composeExampleScenario("ExampleScenario", (ExampleScenario)resource);
60687    } else if (resource instanceof ExplanationOfBenefit) {
60688      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
60689    } else if (resource instanceof FamilyMemberHistory) {
60690      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
60691    } else if (resource instanceof Flag) {
60692      composeFlag("Flag", (Flag)resource);
60693    } else if (resource instanceof Goal) {
60694      composeGoal("Goal", (Goal)resource);
60695    } else if (resource instanceof GraphDefinition) {
60696      composeGraphDefinition("GraphDefinition", (GraphDefinition)resource);
60697    } else if (resource instanceof Group) {
60698      composeGroup("Group", (Group)resource);
60699    } else if (resource instanceof GuidanceResponse) {
60700      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
60701    } else if (resource instanceof HealthcareService) {
60702      composeHealthcareService("HealthcareService", (HealthcareService)resource);
60703    } else if (resource instanceof ImagingStudy) {
60704      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
60705    } else if (resource instanceof Immunization) {
60706      composeImmunization("Immunization", (Immunization)resource);
60707    } else if (resource instanceof ImmunizationEvaluation) {
60708      composeImmunizationEvaluation("ImmunizationEvaluation", (ImmunizationEvaluation)resource);
60709    } else if (resource instanceof ImmunizationRecommendation) {
60710      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
60711    } else if (resource instanceof ImplementationGuide) {
60712      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
60713    } else if (resource instanceof Ingredient) {
60714      composeIngredient("Ingredient", (Ingredient)resource);
60715    } else if (resource instanceof InsurancePlan) {
60716      composeInsurancePlan("InsurancePlan", (InsurancePlan)resource);
60717    } else if (resource instanceof Invoice) {
60718      composeInvoice("Invoice", (Invoice)resource);
60719    } else if (resource instanceof Library) {
60720      composeLibrary("Library", (Library)resource);
60721    } else if (resource instanceof Linkage) {
60722      composeLinkage("Linkage", (Linkage)resource);
60723    } else if (resource instanceof ListResource) {
60724      composeListResource("List", (ListResource)resource);
60725    } else if (resource instanceof Location) {
60726      composeLocation("Location", (Location)resource);
60727    } else if (resource instanceof ManufacturedItemDefinition) {
60728      composeManufacturedItemDefinition("ManufacturedItemDefinition", (ManufacturedItemDefinition)resource);
60729    } else if (resource instanceof Measure) {
60730      composeMeasure("Measure", (Measure)resource);
60731    } else if (resource instanceof MeasureReport) {
60732      composeMeasureReport("MeasureReport", (MeasureReport)resource);
60733    } else if (resource instanceof Medication) {
60734      composeMedication("Medication", (Medication)resource);
60735    } else if (resource instanceof MedicationAdministration) {
60736      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
60737    } else if (resource instanceof MedicationDispense) {
60738      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
60739    } else if (resource instanceof MedicationKnowledge) {
60740      composeMedicationKnowledge("MedicationKnowledge", (MedicationKnowledge)resource);
60741    } else if (resource instanceof MedicationRequest) {
60742      composeMedicationRequest("MedicationRequest", (MedicationRequest)resource);
60743    } else if (resource instanceof MedicationUsage) {
60744      composeMedicationUsage("MedicationUsage", (MedicationUsage)resource);
60745    } else if (resource instanceof MedicinalProductDefinition) {
60746      composeMedicinalProductDefinition("MedicinalProductDefinition", (MedicinalProductDefinition)resource);
60747    } else if (resource instanceof MessageDefinition) {
60748      composeMessageDefinition("MessageDefinition", (MessageDefinition)resource);
60749    } else if (resource instanceof MessageHeader) {
60750      composeMessageHeader("MessageHeader", (MessageHeader)resource);
60751    } else if (resource instanceof MolecularSequence) {
60752      composeMolecularSequence("MolecularSequence", (MolecularSequence)resource);
60753    } else if (resource instanceof NamingSystem) {
60754      composeNamingSystem("NamingSystem", (NamingSystem)resource);
60755    } else if (resource instanceof NutritionIntake) {
60756      composeNutritionIntake("NutritionIntake", (NutritionIntake)resource);
60757    } else if (resource instanceof NutritionOrder) {
60758      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
60759    } else if (resource instanceof Observation) {
60760      composeObservation("Observation", (Observation)resource);
60761    } else if (resource instanceof ObservationDefinition) {
60762      composeObservationDefinition("ObservationDefinition", (ObservationDefinition)resource);
60763    } else if (resource instanceof OperationDefinition) {
60764      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
60765    } else if (resource instanceof OperationOutcome) {
60766      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
60767    } else if (resource instanceof Organization) {
60768      composeOrganization("Organization", (Organization)resource);
60769    } else if (resource instanceof OrganizationAffiliation) {
60770      composeOrganizationAffiliation("OrganizationAffiliation", (OrganizationAffiliation)resource);
60771    } else if (resource instanceof PackagedProductDefinition) {
60772      composePackagedProductDefinition("PackagedProductDefinition", (PackagedProductDefinition)resource);
60773    } else if (resource instanceof Parameters) {
60774      composeParameters("Parameters", (Parameters)resource);
60775    } else if (resource instanceof Patient) {
60776      composePatient("Patient", (Patient)resource);
60777    } else if (resource instanceof PaymentNotice) {
60778      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
60779    } else if (resource instanceof PaymentReconciliation) {
60780      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
60781    } else if (resource instanceof Person) {
60782      composePerson("Person", (Person)resource);
60783    } else if (resource instanceof PlanDefinition) {
60784      composePlanDefinition("PlanDefinition", (PlanDefinition)resource);
60785    } else if (resource instanceof Practitioner) {
60786      composePractitioner("Practitioner", (Practitioner)resource);
60787    } else if (resource instanceof PractitionerRole) {
60788      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
60789    } else if (resource instanceof Procedure) {
60790      composeProcedure("Procedure", (Procedure)resource);
60791    } else if (resource instanceof Provenance) {
60792      composeProvenance("Provenance", (Provenance)resource);
60793    } else if (resource instanceof Questionnaire) {
60794      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
60795    } else if (resource instanceof QuestionnaireResponse) {
60796      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
60797    } else if (resource instanceof RegulatedAuthorization) {
60798      composeRegulatedAuthorization("RegulatedAuthorization", (RegulatedAuthorization)resource);
60799    } else if (resource instanceof RelatedPerson) {
60800      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
60801    } else if (resource instanceof RequestGroup) {
60802      composeRequestGroup("RequestGroup", (RequestGroup)resource);
60803    } else if (resource instanceof ResearchStudy) {
60804      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
60805    } else if (resource instanceof ResearchSubject) {
60806      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
60807    } else if (resource instanceof RiskAssessment) {
60808      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
60809    } else if (resource instanceof Schedule) {
60810      composeSchedule("Schedule", (Schedule)resource);
60811    } else if (resource instanceof SearchParameter) {
60812      composeSearchParameter("SearchParameter", (SearchParameter)resource);
60813    } else if (resource instanceof ServiceRequest) {
60814      composeServiceRequest("ServiceRequest", (ServiceRequest)resource);
60815    } else if (resource instanceof Slot) {
60816      composeSlot("Slot", (Slot)resource);
60817    } else if (resource instanceof Specimen) {
60818      composeSpecimen("Specimen", (Specimen)resource);
60819    } else if (resource instanceof SpecimenDefinition) {
60820      composeSpecimenDefinition("SpecimenDefinition", (SpecimenDefinition)resource);
60821    } else if (resource instanceof StructureDefinition) {
60822      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
60823    } else if (resource instanceof StructureMap) {
60824      composeStructureMap("StructureMap", (StructureMap)resource);
60825    } else if (resource instanceof Subscription) {
60826      composeSubscription("Subscription", (Subscription)resource);
60827    } else if (resource instanceof Substance) {
60828      composeSubstance("Substance", (Substance)resource);
60829    } else if (resource instanceof SubstanceDefinition) {
60830      composeSubstanceDefinition("SubstanceDefinition", (SubstanceDefinition)resource);
60831    } else if (resource instanceof SubstanceNucleicAcid) {
60832      composeSubstanceNucleicAcid("SubstanceNucleicAcid", (SubstanceNucleicAcid)resource);
60833    } else if (resource instanceof SubstancePolymer) {
60834      composeSubstancePolymer("SubstancePolymer", (SubstancePolymer)resource);
60835    } else if (resource instanceof SubstanceProtein) {
60836      composeSubstanceProtein("SubstanceProtein", (SubstanceProtein)resource);
60837    } else if (resource instanceof SubstanceReferenceInformation) {
60838      composeSubstanceReferenceInformation("SubstanceReferenceInformation", (SubstanceReferenceInformation)resource);
60839    } else if (resource instanceof SubstanceSourceMaterial) {
60840      composeSubstanceSourceMaterial("SubstanceSourceMaterial", (SubstanceSourceMaterial)resource);
60841    } else if (resource instanceof SupplyDelivery) {
60842      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
60843    } else if (resource instanceof SupplyRequest) {
60844      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
60845    } else if (resource instanceof Task) {
60846      composeTask("Task", (Task)resource);
60847    } else if (resource instanceof TerminologyCapabilities) {
60848      composeTerminologyCapabilities("TerminologyCapabilities", (TerminologyCapabilities)resource);
60849    } else if (resource instanceof TestReport) {
60850      composeTestReport("TestReport", (TestReport)resource);
60851    } else if (resource instanceof TestScript) {
60852      composeTestScript("TestScript", (TestScript)resource);
60853    } else if (resource instanceof Topic) {
60854      composeTopic("Topic", (Topic)resource);
60855    } else if (resource instanceof ValueSet) {
60856      composeValueSet("ValueSet", (ValueSet)resource);
60857    } else if (resource instanceof VerificationResult) {
60858      composeVerificationResult("VerificationResult", (VerificationResult)resource);
60859    } else if (resource instanceof VisionPrescription) {
60860      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
60861 
60862    } else
60863      throw new Error("Unhandled resource type "+resource.getClass().getName());
60864  }
60865
60866  protected void composeNamedReference(String name, Resource resource) throws IOException {
60867    if (resource == null) {
60868      throw new Error("Unhandled resource type "+resource.getClass().getName());
60869    } else if (resource instanceof Account) {
60870      composeAccount(name, (Account)resource);
60871    } else if (resource instanceof ActivityDefinition) {
60872      composeActivityDefinition(name, (ActivityDefinition)resource);
60873    } else if (resource instanceof AdministrableProductDefinition) {
60874      composeAdministrableProductDefinition(name, (AdministrableProductDefinition)resource);
60875    } else if (resource instanceof AdverseEvent) {
60876      composeAdverseEvent(name, (AdverseEvent)resource);
60877    } else if (resource instanceof AllergyIntolerance) {
60878      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
60879    } else if (resource instanceof Appointment) {
60880      composeAppointment(name, (Appointment)resource);
60881    } else if (resource instanceof AppointmentResponse) {
60882      composeAppointmentResponse(name, (AppointmentResponse)resource);
60883    } else if (resource instanceof AuditEvent) {
60884      composeAuditEvent(name, (AuditEvent)resource);
60885    } else if (resource instanceof Basic) {
60886      composeBasic(name, (Basic)resource);
60887    } else if (resource instanceof Binary) {
60888      composeBinary(name, (Binary)resource);
60889    } else if (resource instanceof BiologicallyDerivedProduct) {
60890      composeBiologicallyDerivedProduct(name, (BiologicallyDerivedProduct)resource);
60891    } else if (resource instanceof BodyStructure) {
60892      composeBodyStructure(name, (BodyStructure)resource);
60893    } else if (resource instanceof Bundle) {
60894      composeBundle(name, (Bundle)resource);
60895    } else if (resource instanceof CapabilityStatement) {
60896      composeCapabilityStatement(name, (CapabilityStatement)resource);
60897    } else if (resource instanceof CapabilityStatement2) {
60898      composeCapabilityStatement2(name, (CapabilityStatement2)resource);
60899    } else if (resource instanceof CarePlan) {
60900      composeCarePlan(name, (CarePlan)resource);
60901    } else if (resource instanceof CareTeam) {
60902      composeCareTeam(name, (CareTeam)resource);
60903    } else if (resource instanceof CatalogEntry) {
60904      composeCatalogEntry(name, (CatalogEntry)resource);
60905    } else if (resource instanceof ChargeItem) {
60906      composeChargeItem(name, (ChargeItem)resource);
60907    } else if (resource instanceof ChargeItemDefinition) {
60908      composeChargeItemDefinition(name, (ChargeItemDefinition)resource);
60909    } else if (resource instanceof Claim) {
60910      composeClaim(name, (Claim)resource);
60911    } else if (resource instanceof ClaimResponse) {
60912      composeClaimResponse(name, (ClaimResponse)resource);
60913    } else if (resource instanceof ClinicalImpression) {
60914      composeClinicalImpression(name, (ClinicalImpression)resource);
60915    } else if (resource instanceof ClinicalUseIssue) {
60916      composeClinicalUseIssue(name, (ClinicalUseIssue)resource);
60917    } else if (resource instanceof CodeSystem) {
60918      composeCodeSystem(name, (CodeSystem)resource);
60919    } else if (resource instanceof Communication) {
60920      composeCommunication(name, (Communication)resource);
60921    } else if (resource instanceof CommunicationRequest) {
60922      composeCommunicationRequest(name, (CommunicationRequest)resource);
60923    } else if (resource instanceof CompartmentDefinition) {
60924      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
60925    } else if (resource instanceof Composition) {
60926      composeComposition(name, (Composition)resource);
60927    } else if (resource instanceof ConceptMap) {
60928      composeConceptMap(name, (ConceptMap)resource);
60929    } else if (resource instanceof Condition) {
60930      composeCondition(name, (Condition)resource);
60931    } else if (resource instanceof ConditionDefinition) {
60932      composeConditionDefinition(name, (ConditionDefinition)resource);
60933    } else if (resource instanceof Consent) {
60934      composeConsent(name, (Consent)resource);
60935    } else if (resource instanceof Contract) {
60936      composeContract(name, (Contract)resource);
60937    } else if (resource instanceof Coverage) {
60938      composeCoverage(name, (Coverage)resource);
60939    } else if (resource instanceof CoverageEligibilityRequest) {
60940      composeCoverageEligibilityRequest(name, (CoverageEligibilityRequest)resource);
60941    } else if (resource instanceof CoverageEligibilityResponse) {
60942      composeCoverageEligibilityResponse(name, (CoverageEligibilityResponse)resource);
60943    } else if (resource instanceof DetectedIssue) {
60944      composeDetectedIssue(name, (DetectedIssue)resource);
60945    } else if (resource instanceof Device) {
60946      composeDevice(name, (Device)resource);
60947    } else if (resource instanceof DeviceDefinition) {
60948      composeDeviceDefinition(name, (DeviceDefinition)resource);
60949    } else if (resource instanceof DeviceMetric) {
60950      composeDeviceMetric(name, (DeviceMetric)resource);
60951    } else if (resource instanceof DeviceRequest) {
60952      composeDeviceRequest(name, (DeviceRequest)resource);
60953    } else if (resource instanceof DeviceUseStatement) {
60954      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
60955    } else if (resource instanceof DiagnosticReport) {
60956      composeDiagnosticReport(name, (DiagnosticReport)resource);
60957    } else if (resource instanceof DocumentManifest) {
60958      composeDocumentManifest(name, (DocumentManifest)resource);
60959    } else if (resource instanceof DocumentReference) {
60960      composeDocumentReference(name, (DocumentReference)resource);
60961    } else if (resource instanceof Encounter) {
60962      composeEncounter(name, (Encounter)resource);
60963    } else if (resource instanceof Endpoint) {
60964      composeEndpoint(name, (Endpoint)resource);
60965    } else if (resource instanceof EnrollmentRequest) {
60966      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
60967    } else if (resource instanceof EnrollmentResponse) {
60968      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
60969    } else if (resource instanceof EpisodeOfCare) {
60970      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
60971    } else if (resource instanceof EventDefinition) {
60972      composeEventDefinition(name, (EventDefinition)resource);
60973    } else if (resource instanceof Evidence) {
60974      composeEvidence(name, (Evidence)resource);
60975    } else if (resource instanceof EvidenceVariable) {
60976      composeEvidenceVariable(name, (EvidenceVariable)resource);
60977    } else if (resource instanceof ExampleScenario) {
60978      composeExampleScenario(name, (ExampleScenario)resource);
60979    } else if (resource instanceof ExplanationOfBenefit) {
60980      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
60981    } else if (resource instanceof FamilyMemberHistory) {
60982      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
60983    } else if (resource instanceof Flag) {
60984      composeFlag(name, (Flag)resource);
60985    } else if (resource instanceof Goal) {
60986      composeGoal(name, (Goal)resource);
60987    } else if (resource instanceof GraphDefinition) {
60988      composeGraphDefinition(name, (GraphDefinition)resource);
60989    } else if (resource instanceof Group) {
60990      composeGroup(name, (Group)resource);
60991    } else if (resource instanceof GuidanceResponse) {
60992      composeGuidanceResponse(name, (GuidanceResponse)resource);
60993    } else if (resource instanceof HealthcareService) {
60994      composeHealthcareService(name, (HealthcareService)resource);
60995    } else if (resource instanceof ImagingStudy) {
60996      composeImagingStudy(name, (ImagingStudy)resource);
60997    } else if (resource instanceof Immunization) {
60998      composeImmunization(name, (Immunization)resource);
60999    } else if (resource instanceof ImmunizationEvaluation) {
61000      composeImmunizationEvaluation(name, (ImmunizationEvaluation)resource);
61001    } else if (resource instanceof ImmunizationRecommendation) {
61002      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
61003    } else if (resource instanceof ImplementationGuide) {
61004      composeImplementationGuide(name, (ImplementationGuide)resource);
61005    } else if (resource instanceof Ingredient) {
61006      composeIngredient(name, (Ingredient)resource);
61007    } else if (resource instanceof InsurancePlan) {
61008      composeInsurancePlan(name, (InsurancePlan)resource);
61009    } else if (resource instanceof Invoice) {
61010      composeInvoice(name, (Invoice)resource);
61011    } else if (resource instanceof Library) {
61012      composeLibrary(name, (Library)resource);
61013    } else if (resource instanceof Linkage) {
61014      composeLinkage(name, (Linkage)resource);
61015    } else if (resource instanceof ListResource) {
61016      composeListResource(name, (ListResource)resource);
61017    } else if (resource instanceof Location) {
61018      composeLocation(name, (Location)resource);
61019    } else if (resource instanceof ManufacturedItemDefinition) {
61020      composeManufacturedItemDefinition(name, (ManufacturedItemDefinition)resource);
61021    } else if (resource instanceof Measure) {
61022      composeMeasure(name, (Measure)resource);
61023    } else if (resource instanceof MeasureReport) {
61024      composeMeasureReport(name, (MeasureReport)resource);
61025    } else if (resource instanceof Medication) {
61026      composeMedication(name, (Medication)resource);
61027    } else if (resource instanceof MedicationAdministration) {
61028      composeMedicationAdministration(name, (MedicationAdministration)resource);
61029    } else if (resource instanceof MedicationDispense) {
61030      composeMedicationDispense(name, (MedicationDispense)resource);
61031    } else if (resource instanceof MedicationKnowledge) {
61032      composeMedicationKnowledge(name, (MedicationKnowledge)resource);
61033    } else if (resource instanceof MedicationRequest) {
61034      composeMedicationRequest(name, (MedicationRequest)resource);
61035    } else if (resource instanceof MedicationUsage) {
61036      composeMedicationUsage(name, (MedicationUsage)resource);
61037    } else if (resource instanceof MedicinalProductDefinition) {
61038      composeMedicinalProductDefinition(name, (MedicinalProductDefinition)resource);
61039    } else if (resource instanceof MessageDefinition) {
61040      composeMessageDefinition(name, (MessageDefinition)resource);
61041    } else if (resource instanceof MessageHeader) {
61042      composeMessageHeader(name, (MessageHeader)resource);
61043    } else if (resource instanceof MolecularSequence) {
61044      composeMolecularSequence(name, (MolecularSequence)resource);
61045    } else if (resource instanceof NamingSystem) {
61046      composeNamingSystem(name, (NamingSystem)resource);
61047    } else if (resource instanceof NutritionIntake) {
61048      composeNutritionIntake(name, (NutritionIntake)resource);
61049    } else if (resource instanceof NutritionOrder) {
61050      composeNutritionOrder(name, (NutritionOrder)resource);
61051    } else if (resource instanceof Observation) {
61052      composeObservation(name, (Observation)resource);
61053    } else if (resource instanceof ObservationDefinition) {
61054      composeObservationDefinition(name, (ObservationDefinition)resource);
61055    } else if (resource instanceof OperationDefinition) {
61056      composeOperationDefinition(name, (OperationDefinition)resource);
61057    } else if (resource instanceof OperationOutcome) {
61058      composeOperationOutcome(name, (OperationOutcome)resource);
61059    } else if (resource instanceof Organization) {
61060      composeOrganization(name, (Organization)resource);
61061    } else if (resource instanceof OrganizationAffiliation) {
61062      composeOrganizationAffiliation(name, (OrganizationAffiliation)resource);
61063    } else if (resource instanceof PackagedProductDefinition) {
61064      composePackagedProductDefinition(name, (PackagedProductDefinition)resource);
61065    } else if (resource instanceof Parameters) {
61066      composeParameters(name, (Parameters)resource);
61067    } else if (resource instanceof Patient) {
61068      composePatient(name, (Patient)resource);
61069    } else if (resource instanceof PaymentNotice) {
61070      composePaymentNotice(name, (PaymentNotice)resource);
61071    } else if (resource instanceof PaymentReconciliation) {
61072      composePaymentReconciliation(name, (PaymentReconciliation)resource);
61073    } else if (resource instanceof Person) {
61074      composePerson(name, (Person)resource);
61075    } else if (resource instanceof PlanDefinition) {
61076      composePlanDefinition(name, (PlanDefinition)resource);
61077    } else if (resource instanceof Practitioner) {
61078      composePractitioner(name, (Practitioner)resource);
61079    } else if (resource instanceof PractitionerRole) {
61080      composePractitionerRole(name, (PractitionerRole)resource);
61081    } else if (resource instanceof Procedure) {
61082      composeProcedure(name, (Procedure)resource);
61083    } else if (resource instanceof Provenance) {
61084      composeProvenance(name, (Provenance)resource);
61085    } else if (resource instanceof Questionnaire) {
61086      composeQuestionnaire(name, (Questionnaire)resource);
61087    } else if (resource instanceof QuestionnaireResponse) {
61088      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
61089    } else if (resource instanceof RegulatedAuthorization) {
61090      composeRegulatedAuthorization(name, (RegulatedAuthorization)resource);
61091    } else if (resource instanceof RelatedPerson) {
61092      composeRelatedPerson(name, (RelatedPerson)resource);
61093    } else if (resource instanceof RequestGroup) {
61094      composeRequestGroup(name, (RequestGroup)resource);
61095    } else if (resource instanceof ResearchStudy) {
61096      composeResearchStudy(name, (ResearchStudy)resource);
61097    } else if (resource instanceof ResearchSubject) {
61098      composeResearchSubject(name, (ResearchSubject)resource);
61099    } else if (resource instanceof RiskAssessment) {
61100      composeRiskAssessment(name, (RiskAssessment)resource);
61101    } else if (resource instanceof Schedule) {
61102      composeSchedule(name, (Schedule)resource);
61103    } else if (resource instanceof SearchParameter) {
61104      composeSearchParameter(name, (SearchParameter)resource);
61105    } else if (resource instanceof ServiceRequest) {
61106      composeServiceRequest(name, (ServiceRequest)resource);
61107    } else if (resource instanceof Slot) {
61108      composeSlot(name, (Slot)resource);
61109    } else if (resource instanceof Specimen) {
61110      composeSpecimen(name, (Specimen)resource);
61111    } else if (resource instanceof SpecimenDefinition) {
61112      composeSpecimenDefinition(name, (SpecimenDefinition)resource);
61113    } else if (resource instanceof StructureDefinition) {
61114      composeStructureDefinition(name, (StructureDefinition)resource);
61115    } else if (resource instanceof StructureMap) {
61116      composeStructureMap(name, (StructureMap)resource);
61117    } else if (resource instanceof Subscription) {
61118      composeSubscription(name, (Subscription)resource);
61119    } else if (resource instanceof Substance) {
61120      composeSubstance(name, (Substance)resource);
61121    } else if (resource instanceof SubstanceDefinition) {
61122      composeSubstanceDefinition(name, (SubstanceDefinition)resource);
61123    } else if (resource instanceof SubstanceNucleicAcid) {
61124      composeSubstanceNucleicAcid(name, (SubstanceNucleicAcid)resource);
61125    } else if (resource instanceof SubstancePolymer) {
61126      composeSubstancePolymer(name, (SubstancePolymer)resource);
61127    } else if (resource instanceof SubstanceProtein) {
61128      composeSubstanceProtein(name, (SubstanceProtein)resource);
61129    } else if (resource instanceof SubstanceReferenceInformation) {
61130      composeSubstanceReferenceInformation(name, (SubstanceReferenceInformation)resource);
61131    } else if (resource instanceof SubstanceSourceMaterial) {
61132      composeSubstanceSourceMaterial(name, (SubstanceSourceMaterial)resource);
61133    } else if (resource instanceof SupplyDelivery) {
61134      composeSupplyDelivery(name, (SupplyDelivery)resource);
61135    } else if (resource instanceof SupplyRequest) {
61136      composeSupplyRequest(name, (SupplyRequest)resource);
61137    } else if (resource instanceof Task) {
61138      composeTask(name, (Task)resource);
61139    } else if (resource instanceof TerminologyCapabilities) {
61140      composeTerminologyCapabilities(name, (TerminologyCapabilities)resource);
61141    } else if (resource instanceof TestReport) {
61142      composeTestReport(name, (TestReport)resource);
61143    } else if (resource instanceof TestScript) {
61144      composeTestScript(name, (TestScript)resource);
61145    } else if (resource instanceof Topic) {
61146      composeTopic(name, (Topic)resource);
61147    } else if (resource instanceof ValueSet) {
61148      composeValueSet(name, (ValueSet)resource);
61149    } else if (resource instanceof VerificationResult) {
61150      composeVerificationResult(name, (VerificationResult)resource);
61151    } else if (resource instanceof VisionPrescription) {
61152      composeVisionPrescription(name, (VisionPrescription)resource);
61153 
61154    } else
61155      throw new Error("Unhandled resource type "+resource.getClass().getName());
61156  }
61157
61158  protected void composeType(String prefix, DataType type) throws IOException {
61159    if (type == null) {
61160      ;
61161    } else if (type instanceof Address) {
61162       composeAddress(prefix+"Address", (Address) type);
61163    } else if (type instanceof Age) {
61164       composeAge(prefix+"Age", (Age) type);
61165    } else if (type instanceof Annotation) {
61166       composeAnnotation(prefix+"Annotation", (Annotation) type);
61167    } else if (type instanceof Attachment) {
61168       composeAttachment(prefix+"Attachment", (Attachment) type);
61169    } else if (type instanceof CodeableConcept) {
61170       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
61171    } else if (type instanceof CodeableReference) {
61172       composeCodeableReference(prefix+"CodeableReference", (CodeableReference) type);
61173    } else if (type instanceof Coding) {
61174       composeCoding(prefix+"Coding", (Coding) type);
61175    } else if (type instanceof ContactDetail) {
61176       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
61177    } else if (type instanceof ContactPoint) {
61178       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
61179    } else if (type instanceof Contributor) {
61180       composeContributor(prefix+"Contributor", (Contributor) type);
61181    } else if (type instanceof Count) {
61182       composeCount(prefix+"Count", (Count) type);
61183    } else if (type instanceof DataRequirement) {
61184       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
61185    } else if (type instanceof Distance) {
61186       composeDistance(prefix+"Distance", (Distance) type);
61187    } else if (type instanceof Dosage) {
61188       composeDosage(prefix+"Dosage", (Dosage) type);
61189    } else if (type instanceof Duration) {
61190       composeDuration(prefix+"Duration", (Duration) type);
61191    } else if (type instanceof ElementDefinition) {
61192       composeElementDefinition(prefix+"ElementDefinition", (ElementDefinition) type);
61193    } else if (type instanceof Expression) {
61194       composeExpression(prefix+"Expression", (Expression) type);
61195    } else if (type instanceof Extension) {
61196       composeExtension(prefix+"Extension", (Extension) type);
61197    } else if (type instanceof HumanName) {
61198       composeHumanName(prefix+"HumanName", (HumanName) type);
61199    } else if (type instanceof Identifier) {
61200       composeIdentifier(prefix+"Identifier", (Identifier) type);
61201    } else if (type instanceof MarketingStatus) {
61202       composeMarketingStatus(prefix+"MarketingStatus", (MarketingStatus) type);
61203    } else if (type instanceof Meta) {
61204       composeMeta(prefix+"Meta", (Meta) type);
61205    } else if (type instanceof Money) {
61206       composeMoney(prefix+"Money", (Money) type);
61207    } else if (type instanceof Narrative) {
61208       composeNarrative(prefix+"Narrative", (Narrative) type);
61209    } else if (type instanceof OrderedDistribution) {
61210       composeOrderedDistribution(prefix+"OrderedDistribution", (OrderedDistribution) type);
61211    } else if (type instanceof ParameterDefinition) {
61212       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
61213    } else if (type instanceof Period) {
61214       composePeriod(prefix+"Period", (Period) type);
61215    } else if (type instanceof Population) {
61216       composePopulation(prefix+"Population", (Population) type);
61217    } else if (type instanceof ProdCharacteristic) {
61218       composeProdCharacteristic(prefix+"ProdCharacteristic", (ProdCharacteristic) type);
61219    } else if (type instanceof ProductShelfLife) {
61220       composeProductShelfLife(prefix+"ProductShelfLife", (ProductShelfLife) type);
61221    } else if (type instanceof Quantity) {
61222       composeQuantity(prefix+"Quantity", (Quantity) type);
61223    } else if (type instanceof Range) {
61224       composeRange(prefix+"Range", (Range) type);
61225    } else if (type instanceof Ratio) {
61226       composeRatio(prefix+"Ratio", (Ratio) type);
61227    } else if (type instanceof Reference) {
61228       composeReference(prefix+"Reference", (Reference) type);
61229    } else if (type instanceof RelatedArtifact) {
61230       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
61231    } else if (type instanceof SampledData) {
61232       composeSampledData(prefix+"SampledData", (SampledData) type);
61233    } else if (type instanceof Signature) {
61234       composeSignature(prefix+"Signature", (Signature) type);
61235    } else if (type instanceof Statistic) {
61236       composeStatistic(prefix+"Statistic", (Statistic) type);
61237    } else if (type instanceof SubstanceAmount) {
61238       composeSubstanceAmount(prefix+"SubstanceAmount", (SubstanceAmount) type);
61239    } else if (type instanceof Timing) {
61240       composeTiming(prefix+"Timing", (Timing) type);
61241    } else if (type instanceof TriggerDefinition) {
61242       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
61243    } else if (type instanceof UsageContext) {
61244       composeUsageContext(prefix+"UsageContext", (UsageContext) type);
61245 
61246    } else if (type instanceof CodeType) {
61247      composeCodeCore(prefix+"Code", (CodeType) type, false);
61248      composeCodeExtras(prefix+"Code", (CodeType) type, false);
61249    }
61250    else if (type instanceof OidType) {
61251      composeOidCore(prefix+"Oid", (OidType) type, false);
61252      composeOidExtras(prefix+"Oid", (OidType) type, false);
61253    }
61254    else if (type instanceof CanonicalType) {
61255      composeCanonicalCore(prefix+"Canonical", (CanonicalType) type, false);
61256      composeCanonicalExtras(prefix+"Canonical", (CanonicalType) type, false);
61257    }
61258    else if (type instanceof UuidType) {
61259      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
61260      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
61261    }
61262    else if (type instanceof UrlType) {
61263      composeUrlCore(prefix+"Url", (UrlType) type, false);
61264      composeUrlExtras(prefix+"Url", (UrlType) type, false);
61265    }
61266    else if (type instanceof UnsignedIntType) {
61267      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
61268      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
61269    }
61270    else if (type instanceof MarkdownType) {
61271      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
61272      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
61273    }
61274    else if (type instanceof IdType) {
61275      composeIdCore(prefix+"Id", (IdType) type, false);
61276      composeIdExtras(prefix+"Id", (IdType) type, false);
61277    }
61278    else if (type instanceof PositiveIntType) {
61279      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
61280      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
61281    }
61282    else if (type instanceof DateType) {
61283      composeDateCore(prefix+"Date", (DateType) type, false);
61284      composeDateExtras(prefix+"Date", (DateType) type, false);
61285    }
61286    else if (type instanceof DateTimeType) {
61287      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
61288      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
61289    }
61290    else if (type instanceof StringType) {
61291      composeStringCore(prefix+"String", (StringType) type, false);
61292      composeStringExtras(prefix+"String", (StringType) type, false);
61293    }
61294    else if (type instanceof IntegerType) {
61295      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
61296      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
61297    }
61298    else if (type instanceof Integer64Type) {
61299      composeInteger64Core(prefix+"Integer64", (Integer64Type) type, false);
61300      composeInteger64Extras(prefix+"Integer64", (Integer64Type) type, false);
61301    }
61302    else if (type instanceof UriType) {
61303      composeUriCore(prefix+"Uri", (UriType) type, false);
61304      composeUriExtras(prefix+"Uri", (UriType) type, false);
61305    }
61306    else if (type instanceof InstantType) {
61307      composeInstantCore(prefix+"Instant", (InstantType) type, false);
61308      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
61309    }
61310    else if (type instanceof BooleanType) {
61311      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
61312      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
61313    }
61314    else if (type instanceof Base64BinaryType) {
61315      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
61316      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
61317    }
61318    else if (type instanceof TimeType) {
61319      composeTimeCore(prefix+"Time", (TimeType) type, false);
61320      composeTimeExtras(prefix+"Time", (TimeType) type, false);
61321    }
61322    else if (type instanceof DecimalType) {
61323      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
61324      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
61325    } else
61326      throw new Error("Unhandled type");
61327  }
61328
61329  protected void composeTypeInner(DataType type) throws IOException {
61330    if (type == null) {
61331      ;
61332    } else if (type instanceof Address) {
61333       composeAddressProperties((Address) type);
61334    } else if (type instanceof Age) {
61335       composeAgeProperties((Age) type);
61336    } else if (type instanceof Annotation) {
61337       composeAnnotationProperties((Annotation) type);
61338    } else if (type instanceof Attachment) {
61339       composeAttachmentProperties((Attachment) type);
61340    } else if (type instanceof CodeableConcept) {
61341       composeCodeableConceptProperties((CodeableConcept) type);
61342    } else if (type instanceof CodeableReference) {
61343       composeCodeableReferenceProperties((CodeableReference) type);
61344    } else if (type instanceof Coding) {
61345       composeCodingProperties((Coding) type);
61346    } else if (type instanceof ContactDetail) {
61347       composeContactDetailProperties((ContactDetail) type);
61348    } else if (type instanceof ContactPoint) {
61349       composeContactPointProperties((ContactPoint) type);
61350    } else if (type instanceof Contributor) {
61351       composeContributorProperties((Contributor) type);
61352    } else if (type instanceof Count) {
61353       composeCountProperties((Count) type);
61354    } else if (type instanceof DataRequirement) {
61355       composeDataRequirementProperties((DataRequirement) type);
61356    } else if (type instanceof Distance) {
61357       composeDistanceProperties((Distance) type);
61358    } else if (type instanceof Dosage) {
61359       composeDosageProperties((Dosage) type);
61360    } else if (type instanceof Duration) {
61361       composeDurationProperties((Duration) type);
61362    } else if (type instanceof ElementDefinition) {
61363       composeElementDefinitionProperties((ElementDefinition) type);
61364    } else if (type instanceof Expression) {
61365       composeExpressionProperties((Expression) type);
61366    } else if (type instanceof Extension) {
61367       composeExtensionProperties((Extension) type);
61368    } else if (type instanceof HumanName) {
61369       composeHumanNameProperties((HumanName) type);
61370    } else if (type instanceof Identifier) {
61371       composeIdentifierProperties((Identifier) type);
61372    } else if (type instanceof MarketingStatus) {
61373       composeMarketingStatusProperties((MarketingStatus) type);
61374    } else if (type instanceof Meta) {
61375       composeMetaProperties((Meta) type);
61376    } else if (type instanceof Money) {
61377       composeMoneyProperties((Money) type);
61378    } else if (type instanceof Narrative) {
61379       composeNarrativeProperties((Narrative) type);
61380    } else if (type instanceof OrderedDistribution) {
61381       composeOrderedDistributionProperties((OrderedDistribution) type);
61382    } else if (type instanceof ParameterDefinition) {
61383       composeParameterDefinitionProperties((ParameterDefinition) type);
61384    } else if (type instanceof Period) {
61385       composePeriodProperties((Period) type);
61386    } else if (type instanceof Population) {
61387       composePopulationProperties((Population) type);
61388    } else if (type instanceof ProdCharacteristic) {
61389       composeProdCharacteristicProperties((ProdCharacteristic) type);
61390    } else if (type instanceof ProductShelfLife) {
61391       composeProductShelfLifeProperties((ProductShelfLife) type);
61392    } else if (type instanceof Quantity) {
61393       composeQuantityProperties((Quantity) type);
61394    } else if (type instanceof Range) {
61395       composeRangeProperties((Range) type);
61396    } else if (type instanceof Ratio) {
61397       composeRatioProperties((Ratio) type);
61398    } else if (type instanceof Reference) {
61399       composeReferenceProperties((Reference) type);
61400    } else if (type instanceof RelatedArtifact) {
61401       composeRelatedArtifactProperties((RelatedArtifact) type);
61402    } else if (type instanceof SampledData) {
61403       composeSampledDataProperties((SampledData) type);
61404    } else if (type instanceof Signature) {
61405       composeSignatureProperties((Signature) type);
61406    } else if (type instanceof Statistic) {
61407       composeStatisticProperties((Statistic) type);
61408    } else if (type instanceof SubstanceAmount) {
61409       composeSubstanceAmountProperties((SubstanceAmount) type);
61410    } else if (type instanceof Timing) {
61411       composeTimingProperties((Timing) type);
61412    } else if (type instanceof TriggerDefinition) {
61413       composeTriggerDefinitionProperties((TriggerDefinition) type);
61414    } else if (type instanceof UsageContext) {
61415       composeUsageContextProperties((UsageContext) type);
61416 
61417    } else
61418      throw new Error("Unhandled type: "+type.fhirType());
61419  }
61420
61421}
61422